diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-06-28 16:54:49 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-06-28 18:04:27 +0000 |
commit | 09effdc9b04a3a04d4f128fd9e1fa360a251ed81 (patch) | |
tree | 0ef789ae1f6e385a9664ca6cb5a9f85f7773bcff /sysdeps/mach/hurd/wait4.c | |
parent | d60fdd480d32a9b4bd781cae08e9a8dfb486c3bd (diff) | |
download | glibc-09effdc9b04a3a04d4f128fd9e1fa360a251ed81.tar.gz glibc-09effdc9b04a3a04d4f128fd9e1fa360a251ed81.tar.xz glibc-09effdc9b04a3a04d4f128fd9e1fa360a251ed81.zip |
hurd: make wait4 a cancellation point
and add _nocancel variant. * sysdeps/mach/hurd/Makefile [io] (sysdep_routines): Add wait4_nocancel. * sysdeps/mach/hurd/wait4.c: Include <sysdep-cancel.h> (__wait4): Surround __proc_wait with enabling async cancel, and use __USEPORT_CANCEL instead of __USEPORT. * sysdeps/mach/hurd/wait4_nocancel.c: New file, contains previous implementation of __wait4. * sysdeps/mach/hurd/not-cancel.h (__waitpid_nocancel): Replace macro with __wait4_nocancel declaration with hidden proto, and make __waitpid_nocancel call __wait4_nocancel.
Diffstat (limited to 'sysdeps/mach/hurd/wait4.c')
-rw-r--r-- | sysdeps/mach/hurd/wait4.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/wait4.c b/sysdeps/mach/hurd/wait4.c index 7cc969bf30..49c1b5d497 100644 --- a/sysdeps/mach/hurd/wait4.c +++ b/sysdeps/mach/hurd/wait4.c @@ -20,6 +20,7 @@ #include <errno.h> #include <hurd.h> #include <hurd/port.h> +#include <sysdep-cancel.h> pid_t __wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage) @@ -29,10 +30,13 @@ __wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage) struct rusage ignored; int sigcode; int dummy; + int cancel_oldtype; - err = __USEPORT (PROC, __proc_wait (port, pid, options, - stat_loc ?: &dummy, &sigcode, - usage ?: &ignored, &dead)); + cancel_oldtype = LIBC_CANCEL_ASYNC(); + err = __USEPORT_CANCEL (PROC, __proc_wait (port, pid, options, + stat_loc ?: &dummy, &sigcode, + usage ?: &ignored, &dead)); + LIBC_CANCEL_RESET (cancel_oldtype); switch (err) { case 0: /* Got a child. */ |