userland bits for wait6/waitid.diff -r1.262 -r1.263 src/lib/libc/shlib_version
(christos)
--- src/lib/libc/shlib_version 2016/01/14 20:42:29 1.262
+++ src/lib/libc/shlib_version 2016/04/03 00:19:42 1.263
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: shlib_version,v 1.262 2016/01/14 20:42:29 christos Exp $ | 1 | # $NetBSD: shlib_version,v 1.263 2016/04/03 00:19:42 christos Exp $ | |
2 | # Remember to update distrib/sets/lists/base/shl.* when changing | 2 | # Remember to update distrib/sets/lists/base/shl.* when changing | |
3 | # | 3 | # | |
4 | # things we wish to do on next major version bump: | 4 | # things we wish to do on next major version bump: | |
5 | # - remove code under BUILD_LEGACY | 5 | # - remove code under BUILD_LEGACY | |
6 | # - remove BCS code in citrus and replace it with use of the C locale | 6 | # - remove BCS code in citrus and replace it with use of the C locale | |
7 | # - libc/net/rcmd.c: make __ivaliduser() and __ivaliduser_sa() static | 7 | # - libc/net/rcmd.c: make __ivaliduser() and __ivaliduser_sa() static | |
8 | # - libc/net: resolver update to BIND8/9? | 8 | # - libc/net: resolver update to BIND8/9? | |
9 | # - md2, md4, md5, rmd160 & sha1 functions should take the same arguments AFAP | 9 | # - md2, md4, md5, rmd160 & sha1 functions should take the same arguments AFAP | |
10 | # - Crypto hashes have name overlap with libcrypto, rename them | 10 | # - Crypto hashes have name overlap with libcrypto, rename them | |
11 | # - libc/gen/assert.c: __{diag,}assert13() -> __{diag,}assert() | 11 | # - libc/gen/assert.c: __{diag,}assert13() -> __{diag,}assert() | |
12 | # - lib/libc/net/iso_addr.c: remove | 12 | # - lib/libc/net/iso_addr.c: remove | |
13 | # - libc/gen/times.c: remove; __times13() -> times() | 13 | # - libc/gen/times.c: remove; __times13() -> times() | |
14 | # - libc/gen/timezone.c: remove; __timezone13 -> timezone | 14 | # - libc/gen/timezone.c: remove; __timezone13 -> timezone | |
@@ -34,14 +34,14 @@ | @@ -34,14 +34,14 @@ | |||
34 | # - remove gets(); it is finally dead in c11. | 34 | # - remove gets(); it is finally dead in c11. | |
35 | # (note: maybe it still needs to be kept in a compat lib; but not in libc) | 35 | # (note: maybe it still needs to be kept in a compat lib; but not in libc) | |
36 | # - make __cerror (spelled CERROR) hidden again | 36 | # - make __cerror (spelled CERROR) hidden again | |
37 | # - remove ruserok() and friends to libcompat (or entirely) | 37 | # - remove ruserok() and friends to libcompat (or entirely) | |
38 | # - remove alloca fallback and expect compiler to provide a builtin version. | 38 | # - remove alloca fallback and expect compiler to provide a builtin version. | |
39 | # - switch to DT_INIT_ARRAY on all platforms | 39 | # - switch to DT_INIT_ARRAY on all platforms | |
40 | # - consolidate ownership with crt0.o and avoid common symbols | 40 | # - consolidate ownership with crt0.o and avoid common symbols | |
41 | # - redo stdin/stdout/stderr to not require copy relocations | 41 | # - redo stdin/stdout/stderr to not require copy relocations | |
42 | # - move gethostbyname to a compat library | 42 | # - move gethostbyname to a compat library | |
43 | # - remove arc4random(3) API | 43 | # - remove arc4random(3) API | |
44 | # - decide whether soft-float should support fenv.h, including thread-local contett | 44 | # - decide whether soft-float should support fenv.h, including thread-local contett | |
45 | # - stop all math functions from setting errno | 45 | # - stop all math functions from setting errno | |
46 | major=12 | 46 | major=12 | |
47 | minor=200 | 47 | minor=201 |
--- src/lib/libc/gen/Makefile.inc 2016/01/14 20:41:23 1.193
+++ src/lib/libc/gen/Makefile.inc 2016/04/03 00:19:42 1.194
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: Makefile.inc,v 1.193 2016/01/14 20:41:23 christos Exp $ | 1 | # $NetBSD: Makefile.inc,v 1.194 2016/04/03 00:19:42 christos Exp $ | |
2 | # from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95 | 2 | # from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95 | |
3 | 3 | |||
4 | # gen sources | 4 | # gen sources | |
5 | .PATH: ${ARCHDIR}/gen ${.CURDIR}/gen | 5 | .PATH: ${ARCHDIR}/gen ${.CURDIR}/gen | |
6 | 6 | |||
7 | .if ${RUMPRUN} != "yes" | 7 | .if ${RUMPRUN} != "yes" | |
8 | SRCS+= _errno.c daemon.c | 8 | SRCS+= _errno.c daemon.c | |
9 | .endif | 9 | .endif | |
10 | 10 | |||
11 | SRCS+= alarm.c alphasort.c arc4random.c assert.c asysctl.c \ | 11 | SRCS+= alarm.c alphasort.c arc4random.c assert.c asysctl.c \ | |
12 | basename.c clock.c closedir.c closefrom.c \ | 12 | basename.c clock.c closedir.c closefrom.c \ | |
13 | confstr.c ctermid.c ctype_.c \ | 13 | confstr.c ctermid.c ctype_.c \ | |
14 | dehumanize_number.c devname.c dirname.c disklabel.c err.c errx.c \ | 14 | dehumanize_number.c devname.c dirname.c disklabel.c err.c errx.c \ | |
@@ -25,28 +25,29 @@ SRCS+= alarm.c alphasort.c arc4random.c | @@ -25,28 +25,29 @@ SRCS+= alarm.c alphasort.c arc4random.c | |||
25 | nice.c nlist.c nlist_aout.c nlist_coff.c nlist_ecoff.c nlist_elf32.c \ | 25 | nice.c nlist.c nlist_aout.c nlist_coff.c nlist_ecoff.c nlist_elf32.c \ | |
26 | nlist_elf64.c opendir.c pause.c popen.c posix_spawn_sched.c \ | 26 | nlist_elf64.c opendir.c pause.c popen.c posix_spawn_sched.c \ | |
27 | posix_spawn_fileactions.c posix_spawnp.c psignal.c pthread_atfork.c \ | 27 | posix_spawn_fileactions.c posix_spawnp.c psignal.c pthread_atfork.c \ | |
28 | ptree.c pwcache.c pw_scan.c raise.c randomid.c rb.c readdir.c \ | 28 | ptree.c pwcache.c pw_scan.c raise.c randomid.c rb.c readdir.c \ | |
29 | rewinddir.c scandir.c seekdir.c setdomainname.c \ | 29 | rewinddir.c scandir.c seekdir.c setdomainname.c \ | |
30 | sethostname.c setjmperr.c setmode.c setproctitle.c setprogname.c \ | 30 | sethostname.c setjmperr.c setmode.c setproctitle.c setprogname.c \ | |
31 | shquote.c shquotev.c sighold.c sigignore.c siginterrupt.c \ | 31 | shquote.c shquotev.c sighold.c sigignore.c siginterrupt.c \ | |
32 | siglist.c signal.c signame.c sigrelse.c \ | 32 | siglist.c signal.c signame.c sigrelse.c \ | |
33 | sigset.c sigsetops.c sleep.c \ | 33 | sigset.c sigsetops.c sleep.c \ | |
34 | stringlist.c sysconf.c sysctl.c sysctlbyname.c sysctlgetmibinfo.c \ | 34 | stringlist.c sysconf.c sysctl.c sysctlbyname.c sysctlgetmibinfo.c \ | |
35 | sysctlnametomib.c syslog.c telldir.c time.c \ | 35 | sysctlnametomib.c syslog.c telldir.c time.c \ | |
36 | times.c toascii.c tolower_.c ttyname.c ttyslot.c toupper_.c ualarm.c \ | 36 | times.c toascii.c tolower_.c ttyname.c ttyslot.c toupper_.c ualarm.c \ | |
37 | ulimit.c uname.c unvis.c usleep.c utime.c utimens.c utmp.c \ | 37 | ulimit.c uname.c unvis.c usleep.c utime.c utimens.c utmp.c \ | |
38 | utmpx.c valloc.c vis.c wait.c wait3.c waitpid.c warn.c warnx.c \ | 38 | utmpx.c valloc.c vis.c wait.c wait3.c waitid.c waitpid.c warn.c \ | |
39 | warnc.c vwarn.c vwarnx.c vwarnc.c verr.c verrx.c verrc.c wordexp.c | 39 | warnx.c warnc.c vwarn.c vwarnx.c vwarnc.c verr.c verrx.c verrc.c \ | |
40 | wordexp.c | |||
40 | 41 | |||
41 | # uses alloca | 42 | # uses alloca | |
42 | COPTS.execvp.c = -Wno-stack-protector | 43 | COPTS.execvp.c = -Wno-stack-protector | |
43 | COPTS.execl.c = -Wno-stack-protector | 44 | COPTS.execl.c = -Wno-stack-protector | |
44 | COPTS.execle.c = -Wno-stack-protector | 45 | COPTS.execle.c = -Wno-stack-protector | |
45 | COPTS.execlp.c = -Wno-stack-protector | 46 | COPTS.execlp.c = -Wno-stack-protector | |
46 | COPTS.syslog.c = -Wno-format-nonliteral | 47 | COPTS.syslog.c = -Wno-format-nonliteral | |
47 | 48 | |||
48 | # machine-dependent gen sources | 49 | # machine-dependent gen sources | |
49 | # m-d Makefile.inc must include sources for: | 50 | # m-d Makefile.inc must include sources for: | |
50 | # _setjmp() bswap16() bswap32() bswap64() fabs() infinity | 51 | # _setjmp() bswap16() bswap32() bswap64() fabs() infinity | |
51 | # isinf() setjmp() sigsetjmp() | 52 | # isinf() setjmp() sigsetjmp() | |
52 | 53 |
/* $NetBSD: waitid.c,v 1.1 2016/04/03 00:19:42 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: waitid.c,v 1.1 2016/04/03 00:19:42 christos Exp $");
#include "namespace.h"
#include <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <string.h>
#include <signal.h>
#ifdef __weak_alias
__weak_alias(waitpid,_waitpid)
#endif
#ifdef __weak_alias
__weak_alias(waitid,_waitid)
#endif
int
waitid(idtype_t idtype, id_t id, siginfo_t *info, int flags)
{
int status;
pid_t rv;
rv = wait6(idtype, id, &status, flags, NULL, info);
if (rv < 0)
return rv;
if (rv == 0 && info != NULL)
memset(info, 0, sizeof(*info));
return 0;
}
--- src/lib/libc/include/namespace.h 2015/09/10 14:05:06 1.179
+++ src/lib/libc/include/namespace.h 2016/04/03 00:19:42 1.180
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: namespace.h,v 1.179 2015/09/10 14:05:06 christos Exp $ */ | 1 | /* $NetBSD: namespace.h,v 1.180 2016/04/03 00:19:42 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1997-2004 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1997-2004 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -749,26 +749,27 @@ | @@ -749,26 +749,27 @@ | |||
749 | #define vsprintf_l _vsprintf_l | 749 | #define vsprintf_l _vsprintf_l | |
750 | #define vswprintf_l _vswprintf_l | 750 | #define vswprintf_l _vswprintf_l | |
751 | #define vwprintf_l _vwprintf_l | 751 | #define vwprintf_l _vwprintf_l | |
752 | #define vwscanf_l _vwscanf_l | 752 | #define vwscanf_l _vwscanf_l | |
753 | #define vsyslog _vsyslog | 753 | #define vsyslog _vsyslog | |
754 | #define vsyslog_r _vsyslog_r | 754 | #define vsyslog_r _vsyslog_r | |
755 | #define vsyslog_ss _vsyslog_ss | 755 | #define vsyslog_ss _vsyslog_ss | |
756 | #define vsyslogp _vsyslogp | 756 | #define vsyslogp _vsyslogp | |
757 | #define vsyslogp_r _vsyslogp_r | 757 | #define vsyslogp_r _vsyslogp_r | |
758 | #define vsyslogp_ss _vsyslogp_ss | 758 | #define vsyslogp_ss _vsyslogp_ss | |
759 | #define wait _wait | 759 | #define wait _wait | |
760 | #define wait3 _wait3 | 760 | #define wait3 _wait3 | |
761 | #define wait4 _wait4 | 761 | #define wait4 _wait4 | |
762 | #define waitid _waitid | |||
762 | #define waitpid _waitpid | 763 | #define waitpid _waitpid | |
763 | #define wcscasecmp _wcscasecmp | 764 | #define wcscasecmp _wcscasecmp | |
764 | #define wcscasecmp_l _wcscasecmp_l | 765 | #define wcscasecmp_l _wcscasecmp_l | |
765 | #define wcsdup _wcsdup | 766 | #define wcsdup _wcsdup | |
766 | #define wcsftime_l _wcsftime_l | 767 | #define wcsftime_l _wcsftime_l | |
767 | #define wcsncasecmp _wcsncasecmp | 768 | #define wcsncasecmp _wcsncasecmp | |
768 | #define wcsncasecmp_l _wcsncasecmp_l | 769 | #define wcsncasecmp_l _wcsncasecmp_l | |
769 | #define wcstof _wcstof | 770 | #define wcstof _wcstof | |
770 | #define wcstof_l _wcstof_l | 771 | #define wcstof_l _wcstof_l | |
771 | #define wcstod _wcstod | 772 | #define wcstod _wcstod | |
772 | #define wcstod_l _wcstod_l | 773 | #define wcstod_l _wcstod_l | |
773 | #define wcstold _wcstold | 774 | #define wcstold _wcstold | |
774 | #define wcstold_l _wcstold_l | 775 | #define wcstold_l _wcstold_l |
--- src/lib/libc/sys/Makefile.inc 2015/11/29 06:10:01 1.228
+++ src/lib/libc/sys/Makefile.inc 2016/04/03 00:19:42 1.229
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: Makefile.inc,v 1.228 2015/11/29 06:10:01 pgoyette Exp $ | 1 | # $NetBSD: Makefile.inc,v 1.229 2016/04/03 00:19:42 christos Exp $ | |
2 | # @(#)Makefile.inc 8.3 (Berkeley) 10/24/94 | 2 | # @(#)Makefile.inc 8.3 (Berkeley) 10/24/94 | |
3 | 3 | |||
4 | # sys sources | 4 | # sys sources | |
5 | .PATH: ${ARCHDIR}/sys ${.CURDIR}/sys | 5 | .PATH: ${ARCHDIR}/sys ${.CURDIR}/sys | |
6 | 6 | |||
7 | # other sources shared with the kernel, used in syscalls | 7 | # other sources shared with the kernel, used in syscalls | |
8 | SRCS+= cpuset.c | 8 | SRCS+= cpuset.c | |
9 | # glue to offer userland wrappers for some syscalls | 9 | # glue to offer userland wrappers for some syscalls | |
10 | SRCS+= posix_fadvise.c posix_madvise.c sched.c sigqueue.c sigtimedwait.c \ | 10 | SRCS+= posix_fadvise.c posix_madvise.c sched.c sigqueue.c sigtimedwait.c \ | |
11 | sigwait.c sigwaitinfo.c statvfs.c swapon.c semctl.c | 11 | sigwait.c sigwaitinfo.c statvfs.c swapon.c semctl.c | |
12 | 12 | |||
13 | .if ${RUMPRUN} != "yes" | 13 | .if ${RUMPRUN} != "yes" | |
14 | # modules with non-default implementations on at least one architecture: | 14 | # modules with non-default implementations on at least one architecture: | |
@@ -122,28 +122,28 @@ ASM= access.S acct.S \ | @@ -122,28 +122,28 @@ ASM= access.S acct.S \ | |||
122 | _lwp_unpark_all.S _lwp_suspend.S _lwp_continue.S \ | 122 | _lwp_unpark_all.S _lwp_suspend.S _lwp_continue.S \ | |
123 | _lwp_wakeup.S _lwp_detach.S _lwp_setprivate.S \ | 123 | _lwp_wakeup.S _lwp_detach.S _lwp_setprivate.S \ | |
124 | _lwp_setname.S _lwp_getname.S _lwp_ctl.S \ | 124 | _lwp_setname.S _lwp_getname.S _lwp_ctl.S \ | |
125 | madvise.S mincore.S minherit.S mkdir.S mkdirat.S mkfifo.S mkfifoat.S \ | 125 | madvise.S mincore.S minherit.S mkdir.S mkdirat.S mkfifo.S mkfifoat.S \ | |
126 | __mknod50.S mlock.S mlockall.S modctl.S __mount50.S \ | 126 | __mknod50.S mlock.S mlockall.S modctl.S __mount50.S \ | |
127 | mprotect.S __msgctl50.S msgget.S munlock.S munlockall.S \ | 127 | mprotect.S __msgctl50.S msgget.S munlock.S munlockall.S \ | |
128 | munmap.S \ | 128 | munmap.S \ | |
129 | nfssvc.S __ntp_gettime50.S \ | 129 | nfssvc.S __ntp_gettime50.S \ | |
130 | openat.S \ | 130 | openat.S \ | |
131 | paccept.S pathconf.S pipe2.S pmc_get_info.S pmc_control.S \ | 131 | paccept.S pathconf.S pipe2.S pmc_get_info.S pmc_control.S \ | |
132 | __posix_chown.S __posix_fchown.S __posix_lchown.S \ | 132 | __posix_chown.S __posix_fchown.S __posix_lchown.S \ | |
133 | __posix_rename.S profil.S \ | 133 | __posix_rename.S profil.S \ | |
134 | __quotactl.S \ | 134 | __quotactl.S \ | |
135 | rasctl.S readlinkat.S reboot.S recvfrom.S recvmmsg.S recvmsg.S rename.S \ | 135 | rasctl.S readlinkat.S reboot.S recvfrom.S recvmmsg.S recvmsg.S \ | |
136 | renameat.S revoke.S rmdir.S \ | 136 | rename.S renameat.S revoke.S rmdir.S \ | |
137 | semconfig.S semget.S semop.S \ | 137 | semconfig.S semget.S semop.S \ | |
138 | sendmmsg.S sendmsg.S sendto.S setegid.S seteuid.S \ | 138 | sendmmsg.S sendmsg.S sendto.S setegid.S seteuid.S \ | |
139 | setgid.S setgroups.S __setitimer50.S __setlogin.S setpgid.S \ | 139 | setgid.S setgroups.S __setitimer50.S __setlogin.S setpgid.S \ | |
140 | setpriority.S \ | 140 | setpriority.S \ | |
141 | setregid.S setreuid.S setrlimit.S setsid.S setsockopt.S \ | 141 | setregid.S setreuid.S setrlimit.S setsid.S setsockopt.S \ | |
142 | setuid.S __shmctl50.S shmdt.S shmget.S shutdown.S \ | 142 | setuid.S __shmctl50.S shmdt.S shmget.S shutdown.S \ | |
143 | sigqueueinfo.S \ | 143 | sigqueueinfo.S \ | |
144 | __sigaltstack14.S __sigpending14.S __sigaction_sigtramp.S \ | 144 | __sigaltstack14.S __sigpending14.S __sigaction_sigtramp.S \ | |
145 | ____sigtimedwait50.S __socket30.S socketpair.S __stat50.S \ | 145 | ____sigtimedwait50.S __socket30.S socketpair.S __stat50.S \ | |
146 | statvfs1.S swapctl.S symlink.S symlinkat.S __sysctl.S \ | 146 | statvfs1.S swapctl.S symlink.S symlinkat.S __sysctl.S \ | |
147 | timer_create.S timer_delete.S __timer_gettime50.S timer_getoverrun.S \ | 147 | timer_create.S timer_delete.S __timer_gettime50.S timer_getoverrun.S \ | |
148 | ____semctl50.S __timer_settime50.S \ | 148 | ____semctl50.S __timer_settime50.S \ | |
149 | umask.S undelete.S unlink.S unlinkat.S unmount.S __utimes50.S \ | 149 | umask.S undelete.S unlink.S unlinkat.S unmount.S __utimes50.S \ | |
@@ -163,27 +163,27 @@ ASM_MD= _lwp_getprivate.S mremap.S | @@ -163,27 +163,27 @@ ASM_MD= _lwp_getprivate.S mremap.S | |||
163 | SRCS+= ${f} | 163 | SRCS+= ${f} | |
164 | . endif | 164 | . endif | |
165 | .endfor | 165 | .endfor | |
166 | 166 | |||
167 | WEAKASM= accept.S __aio_suspend50.S close.S connect.S execve.S \ | 167 | WEAKASM= accept.S __aio_suspend50.S close.S connect.S execve.S \ | |
168 | fcntl.S fdatasync.S fsync.S \ | 168 | fcntl.S fdatasync.S fsync.S \ | |
169 | fsync_range.S __kevent50.S \ | 169 | fsync_range.S __kevent50.S \ | |
170 | kill.S mq_receive.S mq_send.S __mq_timedreceive50.S __mq_timedsend50.S \ | 170 | kill.S mq_receive.S mq_send.S __mq_timedreceive50.S __mq_timedsend50.S \ | |
171 | msgrcv.S msgsnd.S __msync13.S __nanosleep50.S open.S poll.S \ | 171 | msgrcv.S msgsnd.S __msync13.S __nanosleep50.S open.S poll.S \ | |
172 | __pollts50.S __pselect50.S read.S readlink.S \ | 172 | __pollts50.S __pselect50.S read.S readlink.S \ | |
173 | readv.S _sched_setparam.S _sched_getparam.S _sched_setaffinity.S \ | 173 | readv.S _sched_setparam.S _sched_getparam.S _sched_setaffinity.S \ | |
174 | _sched_getaffinity.S sched_yield.S \ | 174 | _sched_getaffinity.S sched_yield.S \ | |
175 | __select50.S setcontext.S __sigprocmask14.S __sigsuspend14.S sysarch.S \ | 175 | __select50.S setcontext.S __sigprocmask14.S __sigsuspend14.S sysarch.S \ | |
176 | __wait450.S write.S writev.S | 176 | __wait450.S wait6.S write.S writev.S | |
177 | 177 | |||
178 | NOERR= getegid.S geteuid.S getgid.S getpid.S getppid.S getuid.S \ | 178 | NOERR= getegid.S geteuid.S getgid.S getpid.S getppid.S getuid.S \ | |
179 | issetugid.S posix_spawn.S sync.S __posix_fadvise50.S | 179 | issetugid.S posix_spawn.S sync.S __posix_fadvise50.S | |
180 | 180 | |||
181 | PSEUDONOERR= _exit.S | 181 | PSEUDONOERR= _exit.S | |
182 | 182 | |||
183 | _GENFILES= ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} \ | 183 | _GENFILES= ${ASM} ${WEAKASM} ${NOERR} ${PSEUDONOERR} \ | |
184 | ${ASM_GLUE} ${ASM_GLUENOERR} | 184 | ${ASM_GLUE} ${ASM_GLUENOERR} | |
185 | 185 | |||
186 | SRCS+= ${_GENFILES} | 186 | SRCS+= ${_GENFILES} | |
187 | CLEANFILES+= ${_GENFILES} | 187 | CLEANFILES+= ${_GENFILES} | |
188 | 188 | |||
189 | ASMDEPS= ${.CURDIR}/sys/Makefile.inc ${ARCHDIR}/SYS.h \ | 189 | ASMDEPS= ${.CURDIR}/sys/Makefile.inc ${ARCHDIR}/SYS.h \ | |
@@ -363,17 +363,18 @@ MLINKS+=sigqueue.2 sigqueueinfo.2 | @@ -363,17 +363,18 @@ MLINKS+=sigqueue.2 sigqueueinfo.2 | |||
363 | MLINKS+=sigtimedwait.2 sigwaitinfo.2 | 363 | MLINKS+=sigtimedwait.2 sigwaitinfo.2 | |
364 | MLINKS+=sigtimedwait.2 sigwait.2 | 364 | MLINKS+=sigtimedwait.2 sigwait.2 | |
365 | MLINKS+=stat.2 fstat.2 stat.2 lstat.2 | 365 | MLINKS+=stat.2 fstat.2 stat.2 lstat.2 | |
366 | MLINKS+=statvfs.2 fstatvfs.2 | 366 | MLINKS+=statvfs.2 fstatvfs.2 | |
367 | MLINKS+=statvfs.2 statvfs1.2 | 367 | MLINKS+=statvfs.2 statvfs1.2 | |
368 | MLINKS+=statvfs.2 fstatvfs1.2 | 368 | MLINKS+=statvfs.2 fstatvfs1.2 | |
369 | MLINKS+=syscall.2 __syscall.2 | 369 | MLINKS+=syscall.2 __syscall.2 | |
370 | MLINKS+=truncate.2 ftruncate.2 | 370 | MLINKS+=truncate.2 ftruncate.2 | |
371 | MLINKS+=unlink.2 unlinkat.2 | 371 | MLINKS+=unlink.2 unlinkat.2 | |
372 | MLINKS+=utimes.2 futimes.2 utimes.2 lutimes.2 | 372 | MLINKS+=utimes.2 futimes.2 utimes.2 lutimes.2 | |
373 | MLINKS+=utimes.2 utimens.2 utimes.2 futimens.2 utimes.2 lutimens.2 | 373 | MLINKS+=utimes.2 utimens.2 utimes.2 futimens.2 utimes.2 lutimens.2 | |
374 | MLINKS+=utimes.2 utimensat.2 | 374 | MLINKS+=utimes.2 utimensat.2 | |
375 | MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2 | 375 | MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2 | |
376 | MLINKS+=wait.2 wait6.2 wait.2 waitid.2 | |||
376 | MLINKS+=write.2 writev.2 write.2 pwrite.2 write.2 pwritev.2 | 377 | MLINKS+=write.2 writev.2 write.2 pwrite.2 write.2 pwritev.2 | |
377 | MLINKS+=pipe.2 pipe2.2 | 378 | MLINKS+=pipe.2 pipe2.2 | |
378 | MLINKS+=accept.2 paccept.2 | 379 | MLINKS+=accept.2 paccept.2 | |
379 | MLINKS+=nanosleep.2 clock_nanosleep.2 | 380 | MLINKS+=nanosleep.2 clock_nanosleep.2 |
--- src/lib/libc/sys/wait.2 2010/04/03 15:43:46 1.27
+++ src/lib/libc/sys/wait.2 2016/04/03 00:19:42 1.28
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | .\" $NetBSD: wait.2,v 1.27 2010/04/03 15:43:46 jruoho Exp $ | 1 | .\" $NetBSD: wait.2,v 1.28 2016/04/03 00:19:42 christos Exp $ | |
2 | .\" | 2 | .\" | |
3 | .\" Copyright (c) 1980, 1991, 1993, 1994 | 3 | .\" Copyright (c) 1980, 1991, 1993, 1994 | |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. | |
5 | .\" | 5 | .\" | |
6 | .\" Redistribution and use in source and binary forms, with or without | 6 | .\" Redistribution and use in source and binary forms, with or without | |
7 | .\" modification, are permitted provided that the following conditions | 7 | .\" modification, are permitted provided that the following conditions | |
8 | .\" are met: | 8 | .\" are met: | |
9 | .\" 1. Redistributions of source code must retain the above copyright | 9 | .\" 1. Redistributions of source code must retain the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer. | 10 | .\" notice, this list of conditions and the following disclaimer. | |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
12 | .\" notice, this list of conditions and the following disclaimer in the | 12 | .\" notice, this list of conditions and the following disclaimer in the | |
13 | .\" documentation and/or other materials provided with the distribution. | 13 | .\" documentation and/or other materials provided with the distribution. | |
14 | .\" 3. Neither the name of the University nor the names of its contributors | 14 | .\" 3. Neither the name of the University nor the names of its contributors | |
@@ -19,71 +19,81 @@ | @@ -19,71 +19,81 @@ | |||
19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
28 | .\" SUCH DAMAGE. | 28 | .\" SUCH DAMAGE. | |
29 | .\" | 29 | .\" | |
30 | .\" @(#)wait.2 8.2 (Berkeley) 4/19/94 | 30 | .\" @(#)wait.2 8.2 (Berkeley) 4/19/94 | |
31 | .\" | 31 | .\" | |
32 | .Dd April 3, 2010 | 32 | .Dd April 2, 2016 | |
33 | .Dt WAIT 2 | 33 | .Dt WAIT 2 | |
34 | .Os | 34 | .Os | |
35 | .Sh NAME | 35 | .Sh NAME | |
36 | .Nm wait , | 36 | .Nm wait , | |
37 | .Nm waitid , | |||
37 | .Nm waitpid , | 38 | .Nm waitpid , | |
39 | .Nm wait6 , | |||
38 | .Nm wait4 , | 40 | .Nm wait4 , | |
39 | .Nm wait3 | 41 | .Nm wait3 | |
40 | .Nd wait for process termination | 42 | .Nd wait for process termination | |
41 | .Sh LIBRARY | 43 | .Sh LIBRARY | |
42 | .Lb libc | 44 | .Lb libc | |
43 | .Sh SYNOPSIS | 45 | .Sh SYNOPSIS | |
44 | .In sys/wait.h | 46 | .In sys/wait.h | |
45 | .Ft pid_t | 47 | .Ft pid_t | |
46 | .Fn wait "int *status" | 48 | .Fn wait "int *status" | |
47 | .Ft pid_t | 49 | .Ft pid_t | |
48 | .Fn waitpid "pid_t wpid" "int *status" "int options" | 50 | .Fn waitpid "pid_t wpid" "int *status" "int options" | |
51 | .Ft int | |||
52 | .Fn waitid "idtype_t idtype" "id_t id" "siginfo_t *info" "int options" | |||
49 | .In sys/resource.h | 53 | .In sys/resource.h | |
50 | .Ft pid_t | 54 | .Ft pid_t | |
51 | .Fn wait3 "int *status" "int options" "struct rusage *rusage" | 55 | .Fn wait3 "int *status" "int options" "struct rusage *rusage" | |
52 | .Ft pid_t | 56 | .Ft pid_t | |
53 | .Fn wait4 "pid_t wpid" "int *status" "int options" "struct rusage *rusage" | 57 | .Fn wait4 "pid_t wpid" "int *status" "int options" "struct rusage *rusage" | |
58 | .Ft pid_t | |||
59 | .Fn wait6 "idtype_t idtype" "id_t id" "int *status" "int options" "struct __wrusage *wrusage" "siginfo_t *infop" | |||
54 | .Sh DESCRIPTION | 60 | .Sh DESCRIPTION | |
55 | The | 61 | The | |
56 | .Fn wait | 62 | .Fn wait | |
57 | function suspends execution of its calling process until | 63 | function suspends execution of its calling process until | |
58 | .Fa status | 64 | .Fa status | |
59 | information is available for a terminated child process, | 65 | information is available for a terminated child process, | |
60 | or a signal is received. | 66 | or a signal is received. | |
61 | On return from a successful | 67 | On return from a successful | |
62 | .Fn wait | 68 | .Fn wait | |
63 | call, | 69 | call, | |
64 | the | 70 | the | |
65 | .Fa status | 71 | .Fa status | |
66 | area contains termination information about the process that exited | 72 | area contains termination information about the process that exited | |
67 | as defined below. | 73 | as defined below. | |
68 | .Pp | 74 | .Pp | |
69 | The | 75 | The | |
70 | .Fn wait4 | 76 | .Fn wait4 | |
77 | and | |||
78 | .Fn wait6 | |||
71 | call provides a more general interface for programs | 79 | call provides a more general interface for programs | |
72 | that need to wait for certain child processes, | 80 | that need to wait for certain child processes, | |
73 | that need resource utilization statistics accumulated by child processes, | 81 | that need resource utilization statistics accumulated by child processes, | |
74 | or that require options. | 82 | or that require options. | |
75 | The other wait functions are implemented using | 83 | The other wait functions are implemented using | |
76 | .Fn wait4 . | 84 | .Fn wait4 . | |
85 | or | |||
86 | .Fn wait6 . | |||
77 | .Pp | 87 | .Pp | |
78 | The | 88 | The | |
79 | .Fa wpid | 89 | .Fa wpid | |
80 | parameter specifies the set of child processes for which to wait. | 90 | parameter specifies the set of child processes for which to wait. | |
81 | If | 91 | If | |
82 | .Fa wpid | 92 | .Fa wpid | |
83 | is \-1, the call waits for any child process. | 93 | is \-1, the call waits for any child process. | |
84 | If | 94 | If | |
85 | .Fa wpid | 95 | .Fa wpid | |
86 | is 0, | 96 | is 0, | |
87 | the call waits for any child process in the process group of the caller. | 97 | the call waits for any child process in the process group of the caller. | |
88 | If | 98 | If | |
89 | .Fa wpid | 99 | .Fa wpid | |
@@ -137,26 +147,325 @@ This is an alias for | @@ -137,26 +147,325 @@ This is an alias for | |||
137 | .Dv WALLSIG . | 147 | .Dv WALLSIG . | |
138 | It is provided for compatibility with the Linux | 148 | It is provided for compatibility with the Linux | |
139 | .Xr clone 2 | 149 | .Xr clone 2 | |
140 | API . | 150 | API . | |
141 | .El | 151 | .El | |
142 | .Pp | 152 | .Pp | |
143 | If | 153 | If | |
144 | .Fa rusage | 154 | .Fa rusage | |
145 | is non-zero, a summary of the resources used by the terminated | 155 | is non-zero, a summary of the resources used by the terminated | |
146 | process and all its | 156 | process and all its | |
147 | children is returned (this information is currently not available | 157 | children is returned (this information is currently not available | |
148 | for stopped processes). | 158 | for stopped processes). | |
149 | .Pp | 159 | .Pp | |
160 | The | |||
161 | .Fn wait6 | |||
162 | function is the most general function in this family and its distinct | |||
163 | features are: | |||
164 | .Pp | |||
165 | All of the desired process statuses to be waited on must be explicitly | |||
166 | specified in | |||
167 | .Fa options . | |||
168 | The | |||
169 | .Fn wait , | |||
170 | .Fn waitpid , | |||
171 | .Fn wait3 , | |||
172 | and | |||
173 | .Fn wait4 | |||
174 | functions all implicitly wait for exited and trapped processes, | |||
175 | but the | |||
176 | .Fn waitid | |||
177 | and | |||
178 | .Fn wait6 | |||
179 | functions require the corresponding | |||
180 | .Dv WEXITED | |||
181 | and | |||
182 | .Dv WTRAPPED | |||
183 | flags to be explicitly specified. | |||
184 | This allows waiting for processes which have experienced other | |||
185 | status changes without having to also handle the exit status from | |||
186 | terminated processes. | |||
187 | .Pp | |||
188 | The | |||
189 | .Fn wait6 | |||
190 | function accepts a | |||
191 | .Fa wrusage | |||
192 | argument which points to a structure defined as: | |||
193 | .Bd -literal | |||
194 | struct wrusage { | |||
195 | struct rusage wru_self; | |||
196 | struct rusage wru_children; | |||
197 | }; | |||
198 | .Ed | |||
199 | .Pp | |||
200 | This allows the calling process to collect resource usage statistics | |||
201 | from both its own child process as well as from its grand children. | |||
202 | When no resource usage statistics are needed this pointer can be | |||
203 | .Dv NULL . | |||
204 | .Pp | |||
205 | The last argument | |||
206 | .Fa infop | |||
207 | must be either | |||
208 | .Dv NULL | |||
209 | or a pointer to a | |||
210 | .Fa siginfo_t | |||
211 | structure. | |||
212 | If | |||
213 | .Pf non- Dv NULL , | |||
214 | the structure is filled with the same data as for a | |||
215 | .Dv SIGCHLD | |||
216 | signal delivered when the process changed state. | |||
217 | .Pp | |||
218 | The set of child processes to be queried is specified by the arguments | |||
219 | .Fa idtype | |||
220 | and | |||
221 | .Fa id . | |||
222 | The separate | |||
223 | .Fa idtype | |||
224 | and | |||
225 | .Fa id | |||
226 | arguments support many other types of | |||
227 | identifers in addition to process IDs and process group IDs. | |||
228 | .Bl -bullet -offset indent | |||
229 | .It | |||
230 | If | |||
231 | .Fa idtype | |||
232 | is | |||
233 | .Dv P_PID , | |||
234 | .Fn waitid | |||
235 | and | |||
236 | .Fn wait6 | |||
237 | wait for the child process with a process ID equal to | |||
238 | .Dv (pid_t)id . | |||
239 | .It | |||
240 | If | |||
241 | .Fa idtype | |||
242 | is | |||
243 | .Dv P_PGID , | |||
244 | .Fn waitid | |||
245 | and | |||
246 | .Fn wait6 | |||
247 | wait for the child process with a process group ID equal to | |||
248 | .Dv (pid_t)id . | |||
249 | .It | |||
250 | If | |||
251 | .Fa idtype | |||
252 | is | |||
253 | .Dv P_ALL , | |||
254 | .Fn waitid | |||
255 | and | |||
256 | .Fn wait6 | |||
257 | wait for any child process and the | |||
258 | .Dv id | |||
259 | is ignored. | |||
260 | .It | |||
261 | If | |||
262 | .Fa idtype | |||
263 | is | |||
264 | .Dv P_PID | |||
265 | or | |||
266 | .Dv P_PGID | |||
267 | and the | |||
268 | .Dv id | |||
269 | is zero, | |||
270 | .Fn waitid | |||
271 | and | |||
272 | .Fn wait6 | |||
273 | wait for any child process in the same process group as the caller. | |||
274 | .El | |||
275 | .Pp | |||
276 | Non-standard identifier types supported by this | |||
277 | implementation of | |||
278 | .Fn waitid | |||
279 | and | |||
280 | .Fn wait6 | |||
281 | are: | |||
282 | .Bl -tag -width P_JAILID | |||
283 | .It Dv P_UID | |||
284 | Wait for processes whose effective user ID is equal to | |||
285 | .Dv (uid_t) Fa id . | |||
286 | .It Dv P_GID | |||
287 | Wait for processes whose effective group ID is equal to | |||
288 | .Dv (gid_t) Fa id . | |||
289 | .It Dv P_SID | |||
290 | Wait for processes whose session ID is equal to | |||
291 | .Fa id . | |||
292 | .\" This is just how sessions work, not sure this needs to be documented here | |||
293 | If the child process started its own session, | |||
294 | its session ID will be the same as its process ID. | |||
295 | Otherwise the session ID of a child process will match the caller's session ID. | |||
296 | .\" .It Dv P_JAILID | |||
297 | .\" Waits for processes within a jail whose jail identifier is equal to | |||
298 | .\" .Fa id . | |||
299 | .El | |||
300 | .Pp | |||
301 | For the | |||
302 | .Fn waitpid | |||
303 | and | |||
304 | .Fn wait4 | |||
305 | functions, the single | |||
306 | .Fa wpid | |||
307 | argument specifies the set of child processes for which to wait. | |||
308 | .Bl -bullet -offset indent | |||
309 | .It | |||
310 | If | |||
311 | .Fa wpid | |||
312 | is -1, the call waits for any child process. | |||
313 | .It | |||
314 | If | |||
315 | .Fa wpid | |||
316 | is 0, | |||
317 | the call waits for any child process in the process group of the caller. | |||
318 | .It | |||
319 | If | |||
320 | .Fa wpid | |||
321 | is greater than zero, the call waits for the process with process ID | |||
322 | .Fa wpid . | |||
323 | .It | |||
324 | If | |||
325 | .Fa wpid | |||
326 | is less than -1, the call waits for any process whose process group ID | |||
327 | equals the absolute value of | |||
328 | .Fa wpid . | |||
329 | .El | |||
330 | .Pp | |||
331 | The | |||
332 | .Fa status | |||
333 | argument is defined below. | |||
334 | .Pp | |||
335 | The | |||
336 | .Fa options | |||
337 | argument contains the bitwise OR of any of the following options. | |||
338 | .Bl -tag -width WCONTINUED | |||
339 | .It Dv WCONTINUED | |||
340 | Report the status of selected processes that | |||
341 | have continued from a job control stop by receiving a | |||
342 | .Dv SIGCONT | |||
343 | signal. | |||
344 | .It Dv WNOHANG | |||
345 | Do not block when | |||
346 | there are no processes wishing to report status. | |||
347 | .It Dv WUNTRACED | |||
348 | Report the status of selected processes which are stopped due to a | |||
349 | .Dv SIGTTIN , SIGTTOU , SIGTSTP , | |||
350 | or | |||
351 | .Dv SIGSTOP | |||
352 | signal. | |||
353 | .It Dv WSTOPPED | |||
354 | An alias for | |||
355 | .Dv WUNTRACED . | |||
356 | .It Dv WTRAPPED | |||
357 | Report the status of selected processes which are being traced via | |||
358 | .Xr ptrace 2 | |||
359 | and have trapped or reached a breakpoint. | |||
360 | This flag is implicitly set for the functions | |||
361 | .Fn wait , | |||
362 | .Fn waitpid , | |||
363 | .Fn wait3 , | |||
364 | and | |||
365 | .Fn wait4 . | |||
366 | .br | |||
367 | For the | |||
368 | .Fn waitid | |||
369 | and | |||
370 | .Fn wait6 | |||
371 | functions, the flag has to be explicitly included in | |||
372 | .Fa options | |||
373 | if status reports from trapped processes are expected. | |||
374 | .It Dv WEXITED | |||
375 | Report the status of selected processes which have terminated. | |||
376 | This flag is implicitly set for the functions | |||
377 | .Fn wait , | |||
378 | .Fn waitpid , | |||
379 | .Fn wait3 , | |||
380 | and | |||
381 | .Fn wait4 . | |||
382 | .br | |||
383 | For the | |||
384 | .Fn waitid | |||
385 | and | |||
386 | .Fn wait6 | |||
387 | functions, the flag has to be explicitly included in | |||
388 | .Fa options | |||
389 | if status reports from terminated processes are expected. | |||
390 | .It Dv WNOWAIT | |||
391 | Keep the process whose status is returned in a waitable state. | |||
392 | The process may be waited for again after this call completes. | |||
393 | .El | |||
394 | .sp | |||
395 | For the | |||
396 | .Fn waitid | |||
397 | and | |||
398 | .Fn wait6 | |||
399 | functions, at least one of the options | |||
400 | .Dv WEXITED , | |||
401 | .Dv WUNTRACED , | |||
402 | .Dv WSTOPPED , | |||
403 | .Dv WTRAPPED , | |||
404 | or | |||
405 | .Dv WCONTINUED | |||
406 | must be specified. | |||
407 | Otherwise there will be no events for the call to report. | |||
408 | To avoid hanging indefinitely in such a case these functions | |||
409 | return -1 with | |||
410 | .Dv errno | |||
411 | set to | |||
412 | .Dv EINVAL . | |||
413 | .Pp | |||
414 | If | |||
415 | .Fa rusage | |||
416 | is non-NULL, a summary of the resources used by the terminated | |||
417 | process and all its children is returned. | |||
418 | .Pp | |||
419 | If | |||
420 | .Fa wrusage | |||
421 | is non-NULL, separate summaries are returned for the resources used | |||
422 | by the terminated process and the resources used by all its children. | |||
423 | .Pp | |||
424 | If | |||
425 | .Fa infop | |||
426 | is non-NULL, a | |||
427 | .Dv siginfo_t | |||
428 | structure is returned with the | |||
429 | .Fa si_signo | |||
430 | field set to | |||
431 | .Dv SIGCHLD | |||
432 | and the | |||
433 | .Fa si_pid | |||
434 | field set to the process ID of the process reporting status. | |||
435 | For the exited process, the | |||
436 | .Fa si_status | |||
437 | field of the | |||
438 | .Dv siginfo_t | |||
439 | structure contains the full 32 bit exit status passed to | |||
440 | .Xr _exit 2 ; | |||
441 | the | |||
442 | .Fa status | |||
443 | argument of other calls only returns 8 lowest bits of the exit status. | |||
444 | .Pp | |||
445 | When the | |||
446 | .Dv WNOHANG | |||
447 | option is specified and no processes | |||
448 | wish to report status, | |||
449 | .Fn waitid | |||
450 | sets the | |||
451 | .Fa si_signo | |||
452 | and | |||
453 | .Fa si_pid | |||
454 | fields in | |||
455 | .Fa infop | |||
456 | to zero. | |||
457 | Checking these fields is the only way to know if a status change was reported. | |||
458 | .Pp | |||
150 | When the | 459 | When the | |
151 | .Dv WNOHANG | 460 | .Dv WNOHANG | |
152 | option is specified and no processes | 461 | option is specified and no processes | |
153 | wish to report status, | 462 | wish to report status, | |
154 | .Fn wait4 | 463 | .Fn wait4 | |
155 | returns a | 464 | returns a | |
156 | process id | 465 | process id | |
157 | of 0. | 466 | of 0. | |
158 | .Pp | 467 | .Pp | |
159 | The | 468 | The | |
160 | .Fn waitpid | 469 | .Fn waitpid | |
161 | call is identical to | 470 | call is identical to | |
162 | .Fn wait4 | 471 | .Fn wait4 | |
@@ -245,88 +554,127 @@ see | @@ -245,88 +554,127 @@ see | |||
245 | .Xr intro 2 , | 554 | .Xr intro 2 , | |
246 | System call restart. | 555 | System call restart. | |
247 | .Sh RETURN VALUES | 556 | .Sh RETURN VALUES | |
248 | If | 557 | If | |
249 | .Fn wait | 558 | .Fn wait | |
250 | returns due to a stopped | 559 | returns due to a stopped | |
251 | or terminated child process, the process ID of the child | 560 | or terminated child process, the process ID of the child | |
252 | is returned to the calling process. | 561 | is returned to the calling process. | |
253 | Otherwise, a value of \-1 is returned and | 562 | Otherwise, a value of \-1 is returned and | |
254 | .Va errno | 563 | .Va errno | |
255 | is set to indicate the error. | 564 | is set to indicate the error. | |
256 | .Pp | 565 | .Pp | |
257 | If | 566 | If | |
567 | .Fn wait6 , | |||
258 | .Fn wait4 , | 568 | .Fn wait4 , | |
259 | .Fn wait3 | 569 | .Fn wait3 | |
260 | or | 570 | or | |
261 | .Fn waitpid | 571 | .Fn waitpid | |
262 | returns due to a stopped | 572 | returns due to a stopped | |
263 | or terminated child process, the process ID of the child | 573 | or terminated child process, the process ID of the child | |
264 | is returned to the calling process. | 574 | is returned to the calling process. | |
265 | If there are no children not previously awaited, | 575 | If there are no children not previously awaited, | |
266 | \-1 is returned with | 576 | \-1 is returned with | |
267 | .Va errno | 577 | .Va errno | |
268 | set to | 578 | set to | |
269 | .Bq Er ECHILD . | 579 | .Bq Er ECHILD . | |
270 | Otherwise, if | 580 | Otherwise, if | |
271 | .Dv WNOHANG | 581 | .Dv WNOHANG | |
272 | is specified and there are | 582 | is specified and there are | |
273 | no stopped or exited children, 0 is returned. | 583 | no stopped or exited children, 0 is returned. | |
274 | If an error is detected or a caught signal aborts the call, | 584 | If an error is detected or a caught signal aborts the call, | |
275 | a value of \-1 is returned and | 585 | a value of \-1 is returned and | |
276 | .Va errno | 586 | .Va errno | |
277 | is set to indicate the error. | 587 | is set to indicate the error. | |
588 | .Pp | |||
589 | If | |||
590 | .Fn waitid | |||
591 | returns because one or more processes have a state change to report, | |||
592 | 0 is returned. | |||
593 | If an error is detected, | |||
594 | a value of -1 | |||
595 | is returned and | |||
596 | .Va errno | |||
597 | is set to indicate the error. | |||
598 | If | |||
599 | .Dv WNOHANG | |||
600 | is specified and there are | |||
601 | no stopped, continued or exited children, | |||
602 | 0 is returned. | |||
603 | The | |||
604 | .Fa si_signo | |||
605 | and | |||
606 | .Fa si_pid | |||
607 | fields of | |||
608 | .Fa infop | |||
609 | must be checked against zero to determine if a process reported status. | |||
278 | .Sh ERRORS | 610 | .Sh ERRORS | |
279 | .Fn wait | 611 | .Fn wait | |
280 | will fail and return immediately if: | 612 | will fail and return immediately if: | |
281 | .Bl -tag -width Er | 613 | .Bl -tag -width Er | |
282 | .It Bq Er ECHILD | 614 | .It Bq Er ECHILD | |
283 | The calling process has no existing unwaited-for child processes. | 615 | The calling process has no existing unwaited-for child processes. | |
616 | .It Bq Er ECHILD | |||
617 | No status from the terminated child process is available | |||
618 | because the calling process has asked the system to discard | |||
619 | such status by ignoring the signal | |||
620 | .Dv SIGCHLD | |||
621 | or setting the flag | |||
622 | .Dv SA_NOCLDWAIT | |||
623 | for that signal. | |||
284 | .It Bq Er EFAULT | 624 | .It Bq Er EFAULT | |
285 | The | 625 | The | |
286 | .Fa status | 626 | .Fa status | |
287 | or | 627 | or | |
288 | .Fa rusage | 628 | .Fa rusage | |
289 | arguments point to an illegal address. | 629 | arguments point to an illegal address. | |
290 | (May not be detected before exit of a child process.) | 630 | (May not be detected before exit of a child process.) | |
291 | .It Bq Er EINTR | 631 | .It Bq Er EINTR | |
292 | The call was interrupted by a caught signal, | 632 | The call was interrupted by a caught signal, | |
293 | or the signal did not have the | 633 | or the signal did not have the | |
294 | .Dv SA_RESTART | 634 | .Dv SA_RESTART | |
295 | flag set. | 635 | flag set. | |
296 | .El | 636 | .El | |
297 | .Pp | 637 | .Pp | |
298 | In addition, | 638 | In addition, | |
639 | .Fn wait6 , | |||
299 | .Fn wait3 , | 640 | .Fn wait3 , | |
300 | .Fn wait4 , | 641 | .Fn wait4 , | |
642 | .Fn waitid , | |||
301 | and | 643 | and | |
302 | .Fn waitpid | 644 | .Fn waitpid | |
303 | will fail and return immediately if: | 645 | will fail and return immediately if: | |
304 | .Bl -tag -width Er | 646 | .Bl -tag -width Er | |
305 | .It Bq Er EINVAL | 647 | .It Bq Er EINVAL | |
306 | An invalid value was specified for | 648 | An invalid value was specified for | |
307 | .Fa options . | 649 | .Fa options . | |
308 | .El | 650 | .El | |
309 | .Sh SEE ALSO | 651 | .Sh SEE ALSO | |
310 | .Xr _exit 2 , | 652 | .Xr _exit 2 , | |
311 | .Xr sigaction 2 | 653 | .Xr ptrace 2 , | |
654 | .Xr sigaction 2 , | |||
655 | .Xr siginfo 2 | |||
312 | .Sh STANDARDS | 656 | .Sh STANDARDS | |
313 | The | 657 | The | |
314 | .Fn wait | 658 | .Fn wait | |
315 | and | 659 | and | |
316 | .Fn waitpid | 660 | .Fn waitpid | |
317 | functions conform to | 661 | functions conform to | |
318 | .St -p1003.1-90 ; | 662 | .St -p1003.1-90 ; | |
319 | the | 663 | the | |
664 | .Fn waitid | |||
665 | function conforms to | |||
666 | .St -p1003.1-2004 ; | |||
667 | the | |||
320 | .Fn wait3 | 668 | .Fn wait3 | |
321 | function conforms to | 669 | function conforms to | |
322 | .St -xpg4 ; | 670 | .St -xpg4 ; | |
323 | .Fn wait4 | 671 | .Fn wait4 | |
324 | is an extension. | 672 | is an extension. | |
325 | The | 673 | The | |
326 | .Fn WCOREDUMP | 674 | .Fn WCOREDUMP | |
327 | macro | 675 | macro | |
328 | and the ability to restart a pending | 676 | and the ability to restart a pending | |
329 | .Fn wait | 677 | .Fn wait | |
330 | call are extensions to the POSIX interface. | 678 | call are extensions to the POSIX interface. | |
331 | .Sh HISTORY | 679 | .Sh HISTORY | |
332 | A | 680 | A |