Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-31904: Add posix module support for VxWorks RTOS#12118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
cce75baf548045b41b4d034629918de11347354c9f86686126f8e048961f43586091ad5ea075530e9049cf1a844728165f36e955f3716550c14d326a508f47201212dda73b91b380c497ada2adeb063a8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add posix module support for VxWorks. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -191,11 +191,13 @@ corresponding Unix manual entries for more information on calls."); | ||
| #define fsync _commit | ||
| #else | ||
| /* Unix functions that the configure script doesn't check for */ | ||
| #ifndef __VXWORKS__ | ||
| #define HAVE_EXECV 1 | ||
| #define HAVE_FORK 1 | ||
| #if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler */ | ||
| #define HAVE_FORK1 1 | ||
| #endif | ||
| #endif | ||
| #define HAVE_GETEGID 1 | ||
| #define HAVE_GETEUID 1 | ||
| #define HAVE_GETGID 1 | ||
| @@ -227,6 +229,18 @@ extern char *ctermid_r(char *); | ||
| #endif /* !_MSC_VER */ | ||
| #if defined(__VXWORKS__) | ||
| #include <vxCpuLib.h> | ||
| #include <rtpLib.h> | ||
| #include <wait.h> | ||
| #include <taskLib.h> | ||
| #ifndef _P_WAIT | ||
| #define _P_WAIT 0 | ||
| #define _P_NOWAIT 1 | ||
| #define _P_NOWAITO 1 | ||
pxinwr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| #endif | ||
| #endif /* __VXWORKS__ */ | ||
| #ifdef HAVE_POSIX_SPAWN | ||
| #include <spawn.h> | ||
| #endif | ||
| @@ -1353,7 +1367,7 @@ win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag) | ||
| */ | ||
| #include <crt_externs.h> | ||
| static char **environ; | ||
| #elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) ) | ||
| #elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) | ||
| extern char **environ; | ||
| #endif /* !_MSC_VER */ | ||
| @@ -4870,7 +4884,7 @@ os__exit_impl(PyObject *module, int status) | ||
| #define EXECV_CHAR char | ||
| #endif | ||
| #if defined(HAVE_EXECV) || defined(HAVE_SPAWNV) | ||
| #if defined(HAVE_EXECV) || defined(HAVE_SPAWNV) || defined(HAVE_RTPSPAWN) | ||
| static void | ||
| free_string_array(EXECV_CHAR **array, Py_ssize_t count) | ||
| { | ||
| @@ -4908,7 +4922,7 @@ fsconvert_strdup(PyObject *o, EXECV_CHAR **out) | ||
| } | ||
| #endif | ||
| #if defined(HAVE_EXECV) || defined (HAVE_FEXECVE) | ||
| #if defined(HAVE_EXECV) || defined (HAVE_FEXECVE) || defined(HAVE_RTPSPAWN) | ||
| static EXECV_CHAR** | ||
| parse_envlist(PyObject* env, Py_ssize_t *envc_ptr) | ||
| { | ||
| @@ -5632,8 +5646,41 @@ os_posix_spawnp_impl(PyObject *module, path_t *path, PyObject *argv, | ||
| } | ||
| #endif /* HAVE_POSIX_SPAWNP */ | ||
| #if defined(HAVE_SPAWNV) || defined(HAVE_WSPAWNV) | ||
| #ifdef HAVE_RTPSPAWN | ||
| static intptr_t | ||
| _rtp_spawn(int mode, const char *rtpFileName, const char *argv[], | ||
| const char *envp[]) | ||
| { | ||
| RTP_ID rtpid; | ||
| int status; | ||
| pid_t res; | ||
| int async_err = 0; | ||
| /* Set priority=100 and uStackSize=16 MiB (0x1000000) for new processes. | ||
| uStackSize=0 cannot be used, the default stack size is too small for | ||
| Python. */ | ||
| if (envp){ | ||
| rtpid = rtpSpawn(rtpFileName, argv, envp, | ||
| 100, 0x1000000, 0, VX_FP_TASK); | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| else{ | ||
| rtpid = rtpSpawn(rtpFileName, argv, (const char **)environ, | ||
| 100, 0x1000000, 0, VX_FP_TASK); | ||
| } | ||
| if ((rtpid != RTP_ID_ERROR) && (mode == _P_WAIT)){ | ||
| do{ | ||
| res = waitpid((pid_t)rtpid, &status, 0); | ||
| } while (res < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); | ||
| if (res < 0) | ||
| return RTP_ID_ERROR; | ||
| return ((intptr_t)status); | ||
pxinwr marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| return ((intptr_t)rtpid); | ||
| } | ||
| #endif | ||
| #if defined(HAVE_SPAWNV) || defined(HAVE_WSPAWNV) || defined(HAVE_RTPSPAWN) | ||
| /*[clinic input] | ||
| os.spawnv | ||
| @@ -5703,13 +5750,17 @@ os_spawnv_impl(PyObject *module, int mode, path_t *path, PyObject *argv) | ||
| } | ||
| argvlist[argc] = NULL; | ||
| #if !defined(HAVE_RTPSPAWN) | ||
| if (mode == _OLD_P_OVERLAY) | ||
| mode = _P_OVERLAY; | ||
| #endif | ||
| Py_BEGIN_ALLOW_THREADS | ||
| _Py_BEGIN_SUPPRESS_IPH | ||
| #ifdef HAVE_WSPAWNV | ||
| spawnval = _wspawnv(mode, path->wide, argvlist); | ||
| #elif defined(HAVE_RTPSPAWN) | ||
| spawnval = _rtp_spawn(mode, path->narrow, (const char **)argvlist, NULL); | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| #else | ||
| spawnval = _spawnv(mode, path->narrow, argvlist); | ||
| #endif | ||
| @@ -5808,13 +5859,18 @@ os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv, | ||
| if (envlist == NULL) | ||
| goto fail_1; | ||
| #if !defined(HAVE_RTPSPAWN) | ||
| if (mode == _OLD_P_OVERLAY) | ||
| mode = _P_OVERLAY; | ||
| #endif | ||
| Py_BEGIN_ALLOW_THREADS | ||
| _Py_BEGIN_SUPPRESS_IPH | ||
| #ifdef HAVE_WSPAWNV | ||
| spawnval = _wspawnve(mode, path->wide, argvlist, envlist); | ||
| #elif defined(HAVE_RTPSPAWN) | ||
| spawnval = _rtp_spawn(mode, path->narrow, (const char **)argvlist, | ||
| (const char **)envlist); | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| #else | ||
| spawnval = _spawnve(mode, path->narrow, argvlist, envlist); | ||
| #endif | ||
| @@ -13844,11 +13900,13 @@ all_ins(PyObject *m) | ||
| if (PyModule_AddIntConstant(m, "POSIX_SPAWN_DUP2", POSIX_SPAWN_DUP2)) return -1; | ||
| #endif | ||
| #ifdef HAVE_SPAWNV | ||
| #if defined(HAVE_SPAWNV) || defined (HAVE_RTPSPAWN) | ||
| if (PyModule_AddIntConstant(m, "P_WAIT", _P_WAIT)) return -1; | ||
| if (PyModule_AddIntConstant(m, "P_NOWAIT", _P_NOWAIT)) return -1; | ||
| if (PyModule_AddIntConstant(m, "P_OVERLAY", _OLD_P_OVERLAY)) return -1; | ||
| if (PyModule_AddIntConstant(m, "P_NOWAITO", _P_NOWAITO)) return -1; | ||
| #endif | ||
| #ifdef HAVE_SPAWNV | ||
| if (PyModule_AddIntConstant(m, "P_OVERLAY", _OLD_P_OVERLAY)) return -1; | ||
| if (PyModule_AddIntConstant(m, "P_DETACH", _P_DETACH)) return -1; | ||
| #endif | ||
Uh oh!
There was an error while loading. Please reload this page.