posix: Improve default posix_spawn implementation

System Internals / glibc - Adhemerval Zanella [linaro.org] - 29 June 2017 09:59 UTC

This patch improves the default posix implementation of posix_spawn{p} and align with Linux one. The main idea is to fix some issues already fixed in Linux code, and deprecated vfork internal usage (source of
various bug reports). In a short:

- It moves POSIX_SPAWN_USEVFORK usage and sets it a no-op. Since the process that actually spawn the new process do not share memory with parent (with vfork), it fixes BZ#14750 for this implementation.

- It uses a pipe to correctly obtain the return upon failure of execution (BZ#18433).

- It correctly enable/disable asynchronous cancellation (checked on ptl/tst-exec5.c).

- It correctly disable/enable signal handling.

Using this version instead of Linux shows only one regression, posix/tst-spawn3, because of pipe2 usage which increase total number of file descriptor.

- sysdeps/posix/spawni.c (__spawni_child): New function. (__spawni): Rename to __spawnix.

ccfb296 posix: Improve default posix_spawn implementation
ChangeLog | 5 +
sysdeps/posix/spawni.c | 362 ++++++++++++++++++++++++-------------------------
2 files changed, 184 insertions(+), 183 deletions(-)

Upstream: sourceware.org


  • Share