Repository navigation
bpo-31904: Add posix module support for VxWorks RTOS - #12118
Conversation
|
@pablogsal @izbyshev @nanjekyejoannah: Would you min to review this change? |
Have updated os.rst about this. |
|
@izbyshev @pablogsal I've fixed all the issues reviewed out. Could you help to review again when available? Thanks a lot. |
|
I've combined #12319 into this PR. |
vstinner
left a comment
There was a problem hiding this comment.
Your change seems reasonable, but I have a few comments.
| @@ -1419,9 +1419,20 @@ def test_urandom_failure(self): | |||
| import errno | |||
| import os | |||
| import resource | |||
There was a problem hiding this comment.
I dislike this code. If the limit is high (ex: larger than 1024), the test can take a lot of time.
I suggest to simply skip the test on VxWorks.
There was a problem hiding this comment.
Following your comments, skip this test on VxWorks. By default the RLIMIT_NOFILE on VxWorks is 8. But on other OS, perhaps there will be the issues you concerned.
| else: | ||
| pass | ||
| try: | ||
| os.urandom(16) |
There was a problem hiding this comment.
nitpick: please align the string to the start of hasattr.
| On VxWorks, if *mode* is :const:`P_NOWAIT`, this function returns the process id | ||
| of the new process; if *mode* is :const:`P_WAIT`, only returns the new process's | ||
| exit code if it exits normally. The process id will actually be the process | ||
| handle, so can be used with the :func:`waitpid` function. |
There was a problem hiding this comment.
This description seems to be redundant with the previous paragraph. I don't see how it's different from the previous paragraph. And it seems obvious to that the a process is can be passed to waitpid(), I don't see the point of saying it here.
There was a problem hiding this comment.
Really some confusion here. The difference we want to express here is in P_WAIT mode if the process is killed by others, VxWorks doesn't return "-signal" as unix-like OS does. VxWorks just returns -1 in this case.
| if ((rtpid != RTP_ID_ERROR) && (mode == _P_WAIT)) { | ||
| do { | ||
| res = waitpid((pid_t)rtpid, &status, 0); | ||
| } while (res < 0 && errno == EINTR); |
There was a problem hiding this comment.
You have to call PyErr_CheckSignals() on EINTR to respect the PEP 475. See how other functions implement that.
Thanks, I like that :-) |
vstinner
left a comment
There was a problem hiding this comment.
Your PR mostly LGTM, but I have a few more comments before being able to approve it.
| @@ -0,0 +1 @@ | |||
| Skip ExecTests and URandomFDTests in test_os.py for VxWorks. | |||
There was a problem hiding this comment.
Honestly, I don't think that this NEWS entry is really helpful to users. Can you please remove it?
| process. On Windows, the process id will actually be the process handle, so can | ||
| be used with the :func:`waitpid` function. | ||
|
|
||
| Note on VxWorks, this function desn't return ``-signal`` when the new process is |
There was a problem hiding this comment.
typo!
| Note on VxWorks, this function desn't return ``-signal`` when the new process is | |
| Note on VxWorks, this function doesn't return ``-signal`` when the new process is |
|
|
||
|
|
||
| @unittest.skipUnless(hasattr(os, 'execv'), | ||
| "No os.execv or os.execve function to test.") |
There was a problem hiding this comment.
nitpick: usually, we just say "need os.execv", no need to elaborate ;-)
|
LGTM except if the typo. Please fix the typo, so I can merge your PR ;-) |
|
Thanks @pxinwr! I know that this one was painful, but well, the os ("posix") module is where you can find most differences between operating systems. |
This is the successive PR after #11968. This PR enables posix module support for VxWorks RTOS. VxWorks doesn't support fork()/exec(). Instead, we use rtpSpawn() to spawn new processes.
More and full support on modules for VxWorks will continuously be added by the coming PRs.
VxWorks is a product developed and owned by Wind River. For VxWorks introduction or more details, go to https://www.windriver.com/products/vxworks/
Wind River will have a dedicated engineering team to contribute to the support as maintainers.
We already have a working buildbot worker internally, but has not bound to master. We will check the process for the buildbot, then add it.
https://bugs.python.org/issue31904