diff options
author | Christian Heimes <christian@python.org> | 2022-07-26 09:16:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 09:16:51 (GMT) |
commit | 0d35a59ce3242b7326890a8c8cc41b321192ec9a (patch) | |
tree | 0d165365dff1a2131594c209d16719aca25813eb /Modules/posixmodule.c | |
parent | e8f3e8f0ab8aa5d667229ce9694e6e1477e524fd (diff) | |
download | cpython-0d35a59ce3242b7326890a8c8cc41b321192ec9a.zip cpython-0d35a59ce3242b7326890a8c8cc41b321192ec9a.tar.gz cpython-0d35a59ce3242b7326890a8c8cc41b321192ec9a.tar.bz2 |
gh-95174: Handle missing dup() and constants in WASI (GH-95229)
- check for ``dup()`` libc function
- handle missing ``F_DUPFD`` in ``dup2()`` replacement function
- add workaround for WASI libc bug in MSG_TRUNC
- ESHUTDOWN is missing, use EPIPE instead
- POLLPRI is missing, define as 0 (no-op)
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 40229bc..2e89e2f 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -9316,7 +9316,9 @@ os_dup_impl(PyObject *module, int fd) return _Py_dup(fd); } - +// dup2() is either provided by libc or dup2.c with AC_REPLACE_FUNCS(). +// dup2.c provides working dup2() if and only if F_DUPFD is available. +#if (defined(HAVE_DUP3) || defined(F_DUPFD) || defined(MS_WINDOWS)) /*[clinic input] os.dup2 -> int fd: int @@ -9416,6 +9418,7 @@ os_dup2_impl(PyObject *module, int fd, int fd2, int inheritable) return res; } +#endif #ifdef HAVE_LOCKF |