* sysdeps/mach/hurd/wait4.c (__wait4): When proc_wait returns EAGAIN,
return zero to indicate no children died yet (assuming WNOHANG).
-/* Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,95,96,97,98,99 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
err = __USEPORT (PROC, __proc_wait (port, pid, options,
stat_loc ?: &dummy, &sigcode,
usage ?: &ignored, &dead));
err = __USEPORT (PROC, __proc_wait (port, pid, options,
stat_loc ?: &dummy, &sigcode,
usage ?: &ignored, &dead));
-
- return err ? (pid_t) __hurd_fail (err) : dead;
+ switch (err)
+ {
+ case 0: /* Got a child. */
+ return dead;
+ case EAGAIN:
+ /* The RPC returns this error when the WNOHANG flag is set and no
+ selected children are dead (but some are living). In that
+ situation, our return value is zero. (The RPC can't return zero
+ for DEAD without also returning some garbage for the other out
+ parameters, so an error return is much more natural here. Hence
+ the difference between the RPC and the POSIX.1 interface. */
+ return (pid_t) 0;
+ default:
+ return (pid_t) __hurd_fail (err);
+ }
}
weak_alias (__wait4, wait4)
}
weak_alias (__wait4, wait4)