[Midnightbsd-cvs] src [7247] trunk/sys: add the kernel piece of wait6 system call
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Aug 14 10:20:10 EDT 2015
Revision: 7247
http://svnweb.midnightbsd.org/src/?rev=7247
Author: laffer1
Date: 2015-08-14 10:20:09 -0400 (Fri, 14 Aug 2015)
Log Message:
-----------
add the kernel piece of wait6 system call
Modified Paths:
--------------
trunk/UPDATING
trunk/sys/bsm/audit_kevents.h
trunk/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h
trunk/sys/compat/freebsd32/freebsd32.h
trunk/sys/compat/freebsd32/freebsd32_misc.c
trunk/sys/compat/freebsd32/freebsd32_proto.h
trunk/sys/compat/freebsd32/freebsd32_syscall.h
trunk/sys/compat/freebsd32/freebsd32_syscalls.c
trunk/sys/compat/freebsd32/freebsd32_sysent.c
trunk/sys/compat/freebsd32/freebsd32_systrace_args.c
trunk/sys/compat/freebsd32/syscalls.master
trunk/sys/kern/init_sysent.c
trunk/sys/kern/kern_exit.c
trunk/sys/kern/sys_procdesc.c
trunk/sys/kern/syscalls.c
trunk/sys/kern/syscalls.master
trunk/sys/kern/systrace_args.c
trunk/sys/sys/proc.h
trunk/sys/sys/resource.h
trunk/sys/sys/syscall.h
trunk/sys/sys/syscall.mk
trunk/sys/sys/syscallsubr.h
trunk/sys/sys/sysproto.h
trunk/sys/sys/types.h
trunk/sys/sys/wait.h
Property Changed:
----------------
trunk/sys/bsm/audit_kevents.h
trunk/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h
trunk/sys/compat/freebsd32/Makefile
trunk/sys/compat/freebsd32/freebsd32.h
trunk/sys/compat/freebsd32/freebsd32_ioctl.c
trunk/sys/compat/freebsd32/freebsd32_ioctl.h
trunk/sys/compat/freebsd32/freebsd32_ipc.h
trunk/sys/compat/freebsd32/freebsd32_misc.c
trunk/sys/compat/freebsd32/freebsd32_signal.h
trunk/sys/compat/freebsd32/freebsd32_util.h
Modified: trunk/UPDATING
===================================================================
--- trunk/UPDATING 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/UPDATING 2015-08-14 14:20:09 UTC (rev 7247)
@@ -1,5 +1,8 @@
Updating Information for MidnightBSD users.
+20160814:
+ wait6 system call added.
+
20160811:
ata(4) AMD Hudson2 SATA controller support.
Intel lynxpoint SATA.
Modified: trunk/sys/bsm/audit_kevents.h
===================================================================
--- trunk/sys/bsm/audit_kevents.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/bsm/audit_kevents.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/bsm/audit_kevents.h,v 1.5 2012/03/31 03:08:56 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*
* Copyright (c) 2005 Apple Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*
* P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_kevents.h#34
* $FreeBSD: src/sys/bsm/audit_kevents.h,v 1.12 2007/07/22 12:28:12 rwatson Exp $
- * $MidnightBSD: src/sys/bsm/audit_kevents.h,v 1.5 2012/03/31 03:08:56 laffer1 Exp $
+ * $MidnightBSD$
*/
#ifndef _BSM_AUDIT_KEVENTS_H_
@@ -604,6 +604,7 @@
#define AUE_PDKILL 43198 /* FreeBSD. */
#define AUE_PDGETPID 43199 /* FreeBSD. */
#define AUE_PDWAIT 43200 /* FreeBSD. */
+#define AUE_WAIT6 43201 /* FreeBSD. */
/*
* Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the
Property changes on: trunk/sys/bsm/audit_kevents.h
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.6
\ No newline at end of property
Modified: trunk/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h
===================================================================
--- trunk/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -51,6 +51,7 @@
#define P_INITUID 0
#define P_INITPGID 0
+#ifndef _IDTYPE_T_DECLARED
/*
* The following defines the values for an identifier type. It
@@ -81,7 +82,10 @@
P_PSETID /* Processor set identifier */
} idtype_t;
+#define _IDTYPE_T_DECLARED
+#endif
+
/*
* The following defines the operations which can be performed to
* combine two simple sets of processes to form another set of
Property changes on: trunk/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.3
\ No newline at end of property
Index: trunk/sys/compat/freebsd32/Makefile
===================================================================
--- trunk/sys/compat/freebsd32/Makefile 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/Makefile 2015-08-14 14:20:09 UTC (rev 7247)
Property changes on: trunk/sys/compat/freebsd32/Makefile
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.4
\ No newline at end of property
Modified: trunk/sys/compat/freebsd32/freebsd32.h
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/compat/freebsd32/freebsd32.h,v 1.4 2012/03/09 00:20:24 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 Doug Rabson
* All rights reserved.
@@ -80,6 +80,11 @@
int32_t ru_nivcsw;
};
+struct wrusage32 {
+ struct rusage32 wru_self;
+ struct rusage32 wru_children;
+};
+
struct itimerval32 {
struct timeval32 it_interval;
struct timeval32 it_value;
Property changes on: trunk/sys/compat/freebsd32/freebsd32.h
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.5
\ No newline at end of property
Index: trunk/sys/compat/freebsd32/freebsd32_ioctl.c
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_ioctl.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_ioctl.c 2015-08-14 14:20:09 UTC (rev 7247)
Property changes on: trunk/sys/compat/freebsd32/freebsd32_ioctl.c
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.2
\ No newline at end of property
Index: trunk/sys/compat/freebsd32/freebsd32_ioctl.h
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_ioctl.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_ioctl.h 2015-08-14 14:20:09 UTC (rev 7247)
Property changes on: trunk/sys/compat/freebsd32/freebsd32_ioctl.h
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.3
\ No newline at end of property
Index: trunk/sys/compat/freebsd32/freebsd32_ipc.h
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_ipc.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_ipc.h 2015-08-14 14:20:09 UTC (rev 7247)
Property changes on: trunk/sys/compat/freebsd32/freebsd32_ipc.h
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.4
\ No newline at end of property
Modified: trunk/sys/compat/freebsd32/freebsd32_misc.c
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_misc.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_misc.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.10 2012/03/09 00:20:24 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Doug Rabson
* All rights reserved.
@@ -175,6 +175,44 @@
return (error);
}
+int
+freebsd32_wait6(struct thread *td, struct freebsd32_wait6_args *uap)
+{
+ struct wrusage32 wru32;
+ struct __wrusage wru, *wrup;
+ struct siginfo32 si32;
+ struct __siginfo si, *sip;
+ int error, status;
+
+ if (uap->wrusage != NULL)
+ wrup = &wru;
+ else
+ wrup = NULL;
+
+ if (uap->info != NULL) {
+ sip = &si;
+ bzero(sip, sizeof(*sip));
+ } else
+ sip = NULL;
+
+ error = kern_wait6(td, uap->idtype, uap->id, &status, uap->options,
+ wrup, sip);
+ if (error != 0)
+ return (error);
+ if (uap->status != NULL)
+ error = copyout(&status, uap->status, sizeof(status));
+ if (uap->wrusage != NULL && error == 0) {
+ freebsd32_rusage_out(&wru.wru_self, &wru32.wru_self);
+ freebsd32_rusage_out(&wru.wru_children, &wru32.wru_children);
+ error = copyout(&wru32, uap->wrusage, sizeof(wru32));
+ }
+ if (uap->info != NULL && error == 0) {
+ siginfo_to_siginfo32 (&si, &si32);
+ error = copyout(&si32, uap->info, sizeof(si32));
+ }
+ return (error);
+}
+
#ifdef COMPAT_FREEBSD4
static void
copy_statfs(struct statfs *in, struct statfs32 *out)
Property changes on: trunk/sys/compat/freebsd32/freebsd32_misc.c
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.11
\ No newline at end of property
Modified: trunk/sys/compat/freebsd32/freebsd32_proto.h
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_proto.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_proto.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -588,6 +588,14 @@
char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)];
char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
};
+struct freebsd32_wait6_args {
+ char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)];
+ char id_l_[PADL_(int)]; int id; char id_r_[PADR_(int)];
+ char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];
+ char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
+ char wrusage_l_[PADL_(struct wrusage32 *)]; struct wrusage32 * wrusage; char wrusage_r_[PADR_(struct wrusage32 *)];
+ char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];
+};
#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
#define PAD64_REQUIRED
#endif
@@ -699,6 +707,7 @@
int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *);
int freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *);
int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *);
+int freebsd32_wait6(struct thread *, struct freebsd32_wait6_args *);
#ifdef COMPAT_43
@@ -1075,6 +1084,7 @@
#define FREEBSD32_SYS_AUE_freebsd32_pselect AUE_SELECT
#define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL
#define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_wait6 AUE_WAIT6
#undef PAD_
#undef PADL_
Index: trunk/sys/compat/freebsd32/freebsd32_signal.h
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_signal.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_signal.h 2015-08-14 14:20:09 UTC (rev 7247)
Property changes on: trunk/sys/compat/freebsd32/freebsd32_signal.h
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.3
\ No newline at end of property
Modified: trunk/sys/compat/freebsd32/freebsd32_syscall.h
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_syscall.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_syscall.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -425,4 +425,5 @@
#define FREEBSD32_SYS_rctl_remove_rule 529
#define FREEBSD32_SYS_freebsd32_posix_fallocate 530
#define FREEBSD32_SYS_freebsd32_posix_fadvise 531
-#define FREEBSD32_SYS_MAXSYSCALL 532
+#define FREEBSD32_SYS_freebsd32_wait6 532
+#define FREEBSD32_SYS_MAXSYSCALL 533
Modified: trunk/sys/compat/freebsd32/freebsd32_syscalls.c
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_syscalls.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_syscalls.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -555,4 +555,5 @@
"rctl_remove_rule", /* 529 = rctl_remove_rule */
"freebsd32_posix_fallocate", /* 530 = freebsd32_posix_fallocate */
"freebsd32_posix_fadvise", /* 531 = freebsd32_posix_fadvise */
+ "freebsd32_wait6", /* 532 = freebsd32_wait6 */
};
Modified: trunk/sys/compat/freebsd32/freebsd32_sysent.c
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_sysent.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_sysent.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -592,4 +592,5 @@
{ AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 529 = rctl_remove_rule */
{ AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = freebsd32_posix_fallocate */
{ AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = freebsd32_posix_fadvise */
+ { AS(freebsd32_wait6_args), (sy_call_t *)freebsd32_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 532 = freebsd32_wait6 */
};
Modified: trunk/sys/compat/freebsd32/freebsd32_systrace_args.c
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_systrace_args.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_systrace_args.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -3046,6 +3046,18 @@
*n_args = 6;
break;
}
+ /* freebsd32_wait6 */
+ case 532: {
+ struct freebsd32_wait6_args *p = params;
+ iarg[0] = p->idtype; /* int */
+ iarg[1] = p->id; /* int */
+ uarg[2] = (intptr_t) p->status; /* int * */
+ iarg[3] = p->options; /* int */
+ uarg[4] = (intptr_t) p->wrusage; /* struct wrusage32 * */
+ uarg[5] = (intptr_t) p->info; /* siginfo_t * */
+ *n_args = 6;
+ break;
+ }
default:
*n_args = 0;
break;
@@ -8130,6 +8142,31 @@
break;
};
break;
+ /* freebsd32_wait6 */
+ case 532:
+ switch(ndx) {
+ case 0:
+ p = "int";
+ break;
+ case 1:
+ p = "int";
+ break;
+ case 2:
+ p = "int *";
+ break;
+ case 3:
+ p = "int";
+ break;
+ case 4:
+ p = "struct wrusage32 *";
+ break;
+ case 5:
+ p = "siginfo_t *";
+ break;
+ default:
+ break;
+ };
+ break;
default:
break;
};
Index: trunk/sys/compat/freebsd32/freebsd32_util.h
===================================================================
--- trunk/sys/compat/freebsd32/freebsd32_util.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/freebsd32_util.h 2015-08-14 14:20:09 UTC (rev 7247)
Property changes on: trunk/sys/compat/freebsd32/freebsd32_util.h
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.4
\ No newline at end of property
Modified: trunk/sys/compat/freebsd32/syscalls.master
===================================================================
--- trunk/sys/compat/freebsd32/syscalls.master 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/compat/freebsd32/syscalls.master 2015-08-14 14:20:09 UTC (rev 7247)
@@ -995,3 +995,8 @@
uint32_t offset1, uint32_t offset2,\
uint32_t len1, uint32_t len2, \
int advice); }
+532 AUE_WAIT6 STD { int freebsd32_wait6(int idtype, int id, \
+ int *status, int options, \
+ struct wrusage32 *wrusage, \
+ siginfo_t *info); }
+
Modified: trunk/sys/kern/init_sysent.c
===================================================================
--- trunk/sys/kern/init_sysent.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/kern/init_sysent.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -41,7 +41,7 @@
{ AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = write */
{ AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = open */
{ AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 6 = close */
- { AS(wait_args), (sy_call_t *)sys_wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = wait4 */
+ { AS(wait4_args), (sy_call_t *)sys_wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = wait4 */
{ compat(AS(ocreat_args),creat), AUE_CREAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 8 = old creat */
{ AS(link_args), (sy_call_t *)sys_link, AUE_LINK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 9 = link */
{ AS(unlink_args), (sy_call_t *)sys_unlink, AUE_UNLINK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 10 = unlink */
@@ -566,4 +566,5 @@
{ AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 529 = rctl_remove_rule */
{ AS(posix_fallocate_args), (sy_call_t *)sys_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = posix_fallocate */
{ AS(posix_fadvise_args), (sy_call_t *)sys_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = posix_fadvise */
+ { AS(wait6_args), (sy_call_t *)sys_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 532 = wait6 */
};
Modified: trunk/sys/kern/kern_exit.c
===================================================================
--- trunk/sys/kern/kern_exit.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/kern/kern_exit.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -144,7 +144,7 @@
* XXX in case we're rebooting we just let init die in order to
* work around an unsolved stack overflow seen very late during
* shutdown on sparc64 when the gmirror worker process exists.
- */
+ */
if (p == initproc && rebooting == 0) {
printf("init died (signal %d, exit %d)\n",
WTERMSIG(rv), WEXITSTATUS(rv));
@@ -612,7 +612,7 @@
sbuf_clear(sb);
sbuf_printf(sb, "%s(pid %d uid %d) aborted: ",
p->p_comm, p->p_pid, td->td_ucred->cr_uid);
- /*
+ /*
* Since we can't return from abort2(), send SIGKILL in cases, where
* abort2() was called improperly
*/
@@ -684,7 +684,7 @@
* The dirty work is handled by kern_wait().
*/
int
-sys_wait4(struct thread *td, struct wait_args *uap)
+sys_wait4(struct thread *td, struct wait4_args *uap)
{
struct rusage ru, *rup;
int error, status;
@@ -701,6 +701,44 @@
return (error);
}
+int
+sys_wait6(struct thread *td, struct wait6_args *uap)
+{
+ struct __wrusage wru, *wrup;
+ siginfo_t si, *sip;
+ int error, status;
+ idtype_t idtype;
+ id_t id;
+
+ idtype = uap->idtype;
+ id = uap->id;
+
+ if (uap->wrusage != NULL)
+ wrup = &wru;
+ else
+ wrup = NULL;
+
+ if (uap->info != NULL) {
+ sip = &si;
+ bzero(sip, sizeof(*sip));
+ } else
+ sip = NULL;
+
+ /*
+ * We expect all callers of wait6() to know about WEXITED and
+ * WTRAPPED.
+ */
+ error = kern_wait6(td, idtype, id, &status, uap->options, wrup, sip);
+
+ if (uap->status != NULL && error == 0)
+ error = copyout(&status, uap->status, sizeof(status));
+ if (uap->wrusage != NULL && error == 0)
+ error = copyout(&wru, uap->wrusage, sizeof(wru));
+ if (uap->info != NULL && error == 0)
+ error = copyout(&si, uap->info, sizeof(si));
+ return (error);
+}
+
/*
* Reap the remains of a zombie process and optionally return status and
* rusage. Asserts and will release both the proctree_lock and the process
@@ -707,8 +745,7 @@
* lock as part of its work.
*/
void
-proc_reap(struct thread *td, struct proc *p, int *status, int options,
- struct rusage *rusage)
+proc_reap(struct thread *td, struct proc *p, int *status, int options)
{
struct proc *q, *t;
@@ -718,10 +755,7 @@
KASSERT(p->p_state == PRS_ZOMBIE, ("proc_reap: !PRS_ZOMBIE"));
q = td->td_proc;
- if (rusage) {
- *rusage = p->p_ru;
- calcru(p, &rusage->ru_utime, &rusage->ru_stime);
- }
+
PROC_SUNLOCK(p);
td->td_retval[0] = p->p_pid;
if (status)
@@ -834,24 +868,78 @@
}
static int
-proc_to_reap(struct thread *td, struct proc *p, pid_t pid, int *status,
- int options, struct rusage *rusage)
+proc_to_reap(struct thread *td, struct proc *p, idtype_t idtype, id_t id,
+ int *status, int options, struct __wrusage *wrusage, siginfo_t *siginfo)
{
struct proc *q;
+ struct rusage *rup;
sx_assert(&proctree_lock, SA_XLOCKED);
q = td->td_proc;
PROC_LOCK(p);
- if (pid != WAIT_ANY && p->p_pid != pid && p->p_pgid != -pid) {
+
+ switch (idtype) {
+ case P_ALL:
+ break;
+ case P_PID:
+ if (p->p_pid != (pid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_PGID:
+ if (p->p_pgid != (pid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_SID:
+ if (p->p_session->s_sid != (pid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_UID:
+ if (p->p_ucred->cr_uid != (uid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_GID:
+ if (p->p_ucred->cr_gid != (gid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_JAILID:
+ if (p->p_ucred->cr_prison == NULL ||
+ (p->p_ucred->cr_prison->pr_id != (int)id)) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ /*
+ * It seems that the thread structures get zeroed out
+ * at process exit. This makes it impossible to
+ * support P_SETID, P_CID or P_CPUID.
+ */
+ default:
PROC_UNLOCK(p);
return (0);
+ break;
}
+
if (p_canwait(td, p)) {
PROC_UNLOCK(p);
return (0);
}
+ if (((options & WEXITED) == 0) && (p->p_state == PRS_ZOMBIE)) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+
/*
* This special case handles a kthread spawned by linux_clone
* (see linux_misc.c). The linux_wait4 and linux_waitpid
@@ -867,8 +955,59 @@
}
PROC_SLOCK(p);
+
+ if (siginfo != NULL) {
+ bzero (siginfo, sizeof (*siginfo));
+ siginfo->si_errno = 0;
+
+ /*
+ * SUSv4 requires that the si_signo value is always
+ * SIGCHLD. Obey it despite the rfork(2) interface
+ * allows to request other signal for child exit
+ * notification.
+ */
+ siginfo->si_signo = SIGCHLD;
+
+ /*
+ * This is still a rough estimate. We will fix the
+ * cases TRAPPED, STOPPED, and CONTINUED later.
+ */
+ if (WCOREDUMP(p->p_xstat))
+ siginfo->si_code = CLD_DUMPED;
+ else if (WIFSIGNALED(p->p_xstat))
+ siginfo->si_code = CLD_KILLED;
+ else
+ siginfo->si_code = CLD_EXITED;
+
+ siginfo->si_pid = p->p_pid;
+ siginfo->si_uid = p->p_ucred->cr_uid;
+ siginfo->si_status = p->p_xstat;
+
+ /*
+ * The si_addr field would be useful additional
+ * detail, but apparently the PC value may be lost
+ * when we reach this point. bzero() above sets
+ * siginfo->si_addr to NULL.
+ */
+ }
+
+ /*
+ * There should be no reason to limit resources usage info to
+ * exited processes only. A snapshot about any resources used
+ * by a stopped process may be exactly what is needed.
+ */
+ if (wrusage != NULL) {
+ rup = &wrusage->wru_self;
+ *rup = p->p_ru;
+ calcru(p, &rup->ru_utime, &rup->ru_stime);
+
+ rup = &wrusage->wru_children;
+ *rup = p->p_stats->p_cru;
+ calccru(p, &rup->ru_utime, &rup->ru_stime);
+ }
+
if (p->p_state == PRS_ZOMBIE) {
- proc_reap(td, p, status, options, rusage);
+ proc_reap(td, p, status, options);
return (-1);
}
PROC_SUNLOCK(p);
@@ -880,21 +1019,71 @@
kern_wait(struct thread *td, pid_t pid, int *status, int options,
struct rusage *rusage)
{
+ struct __wrusage wru, *wrup;
+ idtype_t idtype;
+ id_t id;
+ int ret;
+
+ if (pid == WAIT_ANY) {
+ idtype = P_ALL;
+ id = 0;
+ }
+ else if (pid <= 0) {
+ idtype = P_PGID;
+ id = (id_t)-pid;
+ }
+ else {
+ idtype = P_PID;
+ id = (id_t)pid;
+ }
+ if (rusage != NULL)
+ wrup = &wru;
+ else
+ wrup = NULL;
+ /*
+ * For backward compatibility we implicitly add flags WEXITED
+ * and WTRAPPED here.
+ */
+ options |= WEXITED | WTRAPPED;
+ ret = kern_wait6(td, idtype, id, status, options, wrup, NULL);
+ if (rusage != NULL)
+ *rusage = wru.wru_self;
+ return (ret);
+}
+
+int
+kern_wait6(struct thread *td, idtype_t idtype, id_t id, int *status,
+ int options, struct __wrusage *wrusage, siginfo_t *siginfo)
+{
struct proc *p, *q;
int error, nfound, ret;
- AUDIT_ARG_PID(pid);
+ AUDIT_ARG_VALUE((int)idtype); /* XXX - This is likely wrong! */
+ AUDIT_ARG_PID((pid_t)id); /* XXX - This may be wrong! */
AUDIT_ARG_VALUE(options);
q = td->td_proc;
- if (pid == 0) {
- PROC_LOCK(q);
- pid = -q->p_pgid;
- PROC_UNLOCK(q);
+
+ if ((pid_t)id == WAIT_MYPGRP &&
+ (idtype == P_PID || idtype == P_PGID)) {
+ id = (id_t)q->p_pgid;
+ idtype = P_PGID;
}
+
/* If we don't know the option, just return. */
- if (options & ~(WUNTRACED|WNOHANG|WCONTINUED|WNOWAIT|WLINUXCLONE))
+ if ((options & ~(WUNTRACED | WNOHANG | WCONTINUED | WNOWAIT |
+ WEXITED | WTRAPPED | WLINUXCLONE)) != 0)
return (EINVAL);
+ if ((options & (WEXITED | WUNTRACED | WCONTINUED | WTRAPPED)) == 0) {
+ /*
+ * We will be unable to find any matching processes,
+ * because there are no known events to look for.
+ * Prefer to return error instead of blocking
+ * indefinitely.
+ */
+ return (EINVAL);
+ }
+
loop:
if (q->p_flag & P_STATCHILD) {
PROC_LOCK(q);
@@ -904,7 +1093,8 @@
nfound = 0;
sx_xlock(&proctree_lock);
LIST_FOREACH(p, &q->p_children, p_sibling) {
- ret = proc_to_reap(td, p, pid, status, options, rusage);
+ ret = proc_to_reap(td, p, idtype, id, status, options,
+ wrusage, siginfo);
if (ret == 0)
continue;
else if (ret == 1)
@@ -914,37 +1104,77 @@
PROC_LOCK(p);
PROC_SLOCK(p);
- if ((p->p_flag & P_STOPPED_SIG) &&
+
+ if ((options & WTRAPPED) != 0 &&
+ (p->p_flag & P_TRACED) != 0 &&
+ (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 &&
(p->p_suspcount == p->p_numthreads) &&
- (p->p_flag & P_WAITED) == 0 &&
- (p->p_flag & P_TRACED || options & WUNTRACED)) {
+ ((p->p_flag & P_WAITED) == 0)) {
PROC_SUNLOCK(p);
- p->p_flag |= P_WAITED;
+ if ((options & WNOWAIT) == 0)
+ p->p_flag |= P_WAITED;
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
- if (status)
+
+ if (status != NULL)
*status = W_STOPCODE(p->p_xstat);
+ if (siginfo != NULL) {
+ siginfo->si_status = p->p_xstat;
+ siginfo->si_code = CLD_TRAPPED;
+ }
+ if ((options & WNOWAIT) == 0) {
+ PROC_LOCK(q);
+ sigqueue_take(p->p_ksi);
+ PROC_UNLOCK(q);
+ }
- PROC_LOCK(q);
- sigqueue_take(p->p_ksi);
- PROC_UNLOCK(q);
PROC_UNLOCK(p);
+ return (0);
+ }
+ if ((options & WUNTRACED) != 0 &&
+ (p->p_flag & P_STOPPED_SIG) != 0 &&
+ (p->p_suspcount == p->p_numthreads) &&
+ ((p->p_flag & P_WAITED) == 0)) {
+ PROC_SUNLOCK(p);
+ if ((options & WNOWAIT) == 0)
+ p->p_flag |= P_WAITED;
+ sx_xunlock(&proctree_lock);
+ td->td_retval[0] = p->p_pid;
+ if (status != NULL)
+ *status = W_STOPCODE(p->p_xstat);
+ if (siginfo != NULL) {
+ siginfo->si_status = p->p_xstat;
+ siginfo->si_code = CLD_STOPPED;
+ }
+ if ((options & WNOWAIT) == 0) {
+ PROC_LOCK(q);
+ sigqueue_take(p->p_ksi);
+ PROC_UNLOCK(q);
+ }
+
+ PROC_UNLOCK(p);
return (0);
}
PROC_SUNLOCK(p);
- if (options & WCONTINUED && (p->p_flag & P_CONTINUED)) {
+ if ((options & WCONTINUED) != 0 &&
+ (p->p_flag & P_CONTINUED) != 0) {
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
- p->p_flag &= ~P_CONTINUED;
-
- PROC_LOCK(q);
- sigqueue_take(p->p_ksi);
- PROC_UNLOCK(q);
+ if ((options & WNOWAIT) == 0) {
+ p->p_flag &= ~P_CONTINUED;
+ PROC_LOCK(q);
+ sigqueue_take(p->p_ksi);
+ PROC_UNLOCK(q);
+ }
PROC_UNLOCK(p);
- if (status)
+ if (status != NULL)
*status = SIGCONT;
+ if (siginfo != NULL) {
+ siginfo->si_status = SIGCONT;
+ siginfo->si_code = CLD_CONTINUED;
+ }
return (0);
}
PROC_UNLOCK(p);
@@ -963,7 +1193,8 @@
* to successfully wait until the child becomes a zombie.
*/
LIST_FOREACH(p, &q->p_orphans, p_orphan) {
- ret = proc_to_reap(td, p, pid, status, options, rusage);
+ ret = proc_to_reap(td, p, idtype, id, status, options,
+ wrusage, siginfo);
if (ret == 0)
continue;
else if (ret == 1)
@@ -989,7 +1220,7 @@
error = msleep(q, &q->p_mtx, PWAIT | PCATCH, "wait", 0);
PROC_UNLOCK(q);
if (error)
- return (error);
+ return (error);
goto loop;
}
Modified: trunk/sys/kern/sys_procdesc.c
===================================================================
--- trunk/sys/kern/sys_procdesc.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/kern/sys_procdesc.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -367,7 +367,7 @@
* procdesc_reap().
*/
PROC_SLOCK(p);
- proc_reap(curthread, p, NULL, 0, NULL);
+ proc_reap(curthread, p, NULL, 0);
} else {
/*
* If the process is not yet dead, we need to kill it, but we
Modified: trunk/sys/kern/syscalls.c
===================================================================
--- trunk/sys/kern/syscalls.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/kern/syscalls.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -539,4 +539,5 @@
"rctl_remove_rule", /* 529 = rctl_remove_rule */
"posix_fallocate", /* 530 = posix_fallocate */
"posix_fadvise", /* 531 = posix_fadvise */
+ "wait6", /* 532 = wait6 */
};
Modified: trunk/sys/kern/syscalls.master
===================================================================
--- trunk/sys/kern/syscalls.master 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/kern/syscalls.master 2015-08-14 14:20:09 UTC (rev 7247)
@@ -71,8 +71,7 @@
; XXX man page says `mode_t mode'.
6 AUE_CLOSE STD { int close(int fd); }
7 AUE_WAIT4 STD { int wait4(int pid, int *status, \
- int options, struct rusage *rusage); } \
- wait4 wait_args int
+ int options, struct rusage *rusage); }
8 AUE_CREAT COMPAT { int creat(char *path, int mode); }
9 AUE_LINK STD { int link(char *path, char *link); }
10 AUE_UNLINK STD { int unlink(char *path); }
@@ -949,5 +948,9 @@
off_t offset, off_t len); }
531 AUE_NULL STD { int posix_fadvise(int fd, off_t offset, \
off_t len, int advice); }
+532 AUE_WAIT6 STD { int wait6(int idtype, int id, \
+ int *status, int options, \
+ struct __wrusage *wrusage, \
+ siginfo_t *info); }
; Please copy any additions and changes to the following compatability tables:
; sys/compat/freebsd32/syscalls.master
Modified: trunk/sys/kern/systrace_args.c
===================================================================
--- trunk/sys/kern/systrace_args.c 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/kern/systrace_args.c 2015-08-14 14:20:09 UTC (rev 7247)
@@ -64,7 +64,7 @@
}
/* wait4 */
case 7: {
- struct wait_args *p = params;
+ struct wait4_args *p = params;
iarg[0] = p->pid; /* int */
uarg[1] = (intptr_t) p->status; /* int * */
iarg[2] = p->options; /* int */
@@ -3244,6 +3244,18 @@
*n_args = 4;
break;
}
+ /* wait6 */
+ case 532: {
+ struct wait6_args *p = params;
+ iarg[0] = p->idtype; /* int */
+ iarg[1] = p->id; /* int */
+ uarg[2] = (intptr_t) p->status; /* int * */
+ iarg[3] = p->options; /* int */
+ uarg[4] = (intptr_t) p->wrusage; /* struct __wrusage * */
+ uarg[5] = (intptr_t) p->info; /* siginfo_t * */
+ *n_args = 6;
+ break;
+ }
default:
*n_args = 0;
break;
@@ -8632,6 +8644,31 @@
break;
};
break;
+ /* wait6 */
+ case 532:
+ switch(ndx) {
+ case 0:
+ p = "int";
+ break;
+ case 1:
+ p = "int";
+ break;
+ case 2:
+ p = "int *";
+ break;
+ case 3:
+ p = "int";
+ break;
+ case 4:
+ p = "struct __wrusage *";
+ break;
+ case 5:
+ p = "siginfo_t *";
+ break;
+ default:
+ break;
+ };
+ break;
default:
break;
};
Modified: trunk/sys/sys/proc.h
===================================================================
--- trunk/sys/sys/proc.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/sys/proc.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -879,8 +879,7 @@
void procinit(void);
void proc_linkup0(struct proc *p, struct thread *td);
void proc_linkup(struct proc *p, struct thread *td);
-void proc_reap(struct thread *td, struct proc *p, int *status, int options,
- struct rusage *rusage);
+void proc_reap(struct thread *td, struct proc *p, int *status, int options);
void proc_reparent(struct proc *child, struct proc *newparent);
struct pstats *pstats_alloc(void);
void pstats_fork(struct pstats *src, struct pstats *dst);
Modified: trunk/sys/sys/resource.h
===================================================================
--- trunk/sys/sys/resource.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/sys/resource.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -79,6 +79,13 @@
#define ru_last ru_nivcsw
};
+#if __BSD_VISIBLE
+struct __wrusage {
+ struct rusage wru_self;
+ struct rusage wru_children;
+};
+#endif
+
/*
* Resource limits
*/
Modified: trunk/sys/sys/syscall.h
===================================================================
--- trunk/sys/sys/syscall.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/sys/syscall.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -447,4 +447,5 @@
#define SYS_rctl_remove_rule 529
#define SYS_posix_fallocate 530
#define SYS_posix_fadvise 531
-#define SYS_MAXSYSCALL 532
+#define SYS_wait6 532
+#define SYS_MAXSYSCALL 533
Modified: trunk/sys/sys/syscall.mk
===================================================================
--- trunk/sys/sys/syscall.mk 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/sys/syscall.mk 2015-08-14 14:20:09 UTC (rev 7247)
@@ -395,4 +395,5 @@
rctl_add_rule.o \
rctl_remove_rule.o \
posix_fallocate.o \
- posix_fadvise.o
+ posix_fadvise.o \
+ wait6.o
Modified: trunk/sys/sys/syscallsubr.h
===================================================================
--- trunk/sys/sys/syscallsubr.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/sys/syscallsubr.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -43,6 +43,7 @@
struct msqid_ds;
struct rlimit;
struct rusage;
+struct __wrusage;
union semun;
struct sockaddr;
struct stat;
@@ -233,6 +234,8 @@
enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg);
int kern_wait(struct thread *td, pid_t pid, int *status, int options,
struct rusage *rup);
+int kern_wait6(struct thread *td, idtype_t idtype, id_t id, int *status,
+ int options, struct __wrusage *wrup, siginfo_t *sip);
int kern_writev(struct thread *td, int fd, struct uio *auio);
int kern_socketpair(struct thread *td, int domain, int type, int protocol,
int *rsv);
Modified: trunk/sys/sys/sysproto.h
===================================================================
--- trunk/sys/sys/sysproto.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/sys/sysproto.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -59,7 +59,7 @@
struct close_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
};
-struct wait_args {
+struct wait4_args {
char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];
char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];
char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
@@ -1739,6 +1739,14 @@
char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)];
char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
};
+struct wait6_args {
+ char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)];
+ char id_l_[PADL_(int)]; int id; char id_r_[PADR_(int)];
+ char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];
+ char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
+ char wrusage_l_[PADL_(struct __wrusage *)]; struct __wrusage * wrusage; char wrusage_r_[PADR_(struct __wrusage *)];
+ char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];
+};
int nosys(struct thread *, struct nosys_args *);
void sys_sys_exit(struct thread *, struct sys_exit_args *);
int sys_fork(struct thread *, struct fork_args *);
@@ -1746,7 +1754,7 @@
int sys_write(struct thread *, struct write_args *);
int sys_open(struct thread *, struct open_args *);
int sys_close(struct thread *, struct close_args *);
-int sys_wait4(struct thread *, struct wait_args *);
+int sys_wait4(struct thread *, struct wait4_args *);
int sys_link(struct thread *, struct link_args *);
int sys_unlink(struct thread *, struct unlink_args *);
int sys_chdir(struct thread *, struct chdir_args *);
@@ -2116,6 +2124,7 @@
int sys_rctl_remove_rule(struct thread *, struct rctl_remove_rule_args *);
int sys_posix_fallocate(struct thread *, struct posix_fallocate_args *);
int sys_posix_fadvise(struct thread *, struct posix_fadvise_args *);
+int sys_wait6(struct thread *, struct wait6_args *);
#ifdef COMPAT_43
@@ -2807,6 +2816,7 @@
#define SYS_AUE_rctl_remove_rule AUE_NULL
#define SYS_AUE_posix_fallocate AUE_NULL
#define SYS_AUE_posix_fadvise AUE_NULL
+#define SYS_AUE_wait6 AUE_WAIT6
#undef PAD_
#undef PADL_
Modified: trunk/sys/sys/types.h
===================================================================
--- trunk/sys/sys/types.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/sys/types.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -142,6 +142,46 @@
#define _ID_T_DECLARED
#endif
+#ifndef _IDTYPE_T_DECLARED
+
+typedef enum
+#if defined(__BSD_VISIBLE)
+ idtype /* pollutes XPG4.2 namespace */
+#endif
+ {
+ /*
+ * These names were mostly lifted from Solaris source code and
+ * still use Solaris style naming to avoid breaking any
+ * OpenSolaris code which has been ported to FreeBSD. There
+ * is no clear FreeBSD counterpart for all of the names, but
+ * some have a clear correspondence to FreeBSD entities.
+ */
+ P_PID, /* A process identifier. */
+ P_PPID, /* A parent process identifier. */
+ P_PGID, /* A process group identifier. */
+ P_SID, /* A session identifier. */
+ P_CID, /* A scheduling class identifier. */
+ P_UID, /* A user identifier. */
+ P_GID, /* A group identifier. */
+ P_ALL, /* All processes. */
+ P_LWPID, /* An LWP identifier. */
+ P_TASKID, /* A task identifier. */
+ P_PROJID, /* A project identifier. */
+ P_POOLID, /* A pool identifier. */
+ P_JAILID, /* A zone identifier. */
+ P_CTID, /* A (process) contract identifier. */
+ P_CPUID, /* CPU identifier. */
+ P_PSETID /* Processor set identifier */
+} idtype_t; /* The type of id_t we are using. */
+
+#if defined(__BSD_VISIBLE)
+#define P_ZONEID P_JAILID
+#endif
+
+#define _IDTYPE_T_DECLARED
+#endif
+
+
#ifndef _INO_T_DECLARED
typedef __ino_t ino_t; /* inode number */
#define _INO_T_DECLARED
Modified: trunk/sys/sys/wait.h
===================================================================
--- trunk/sys/sys/wait.h 2015-08-14 02:20:55 UTC (rev 7246)
+++ trunk/sys/sys/wait.h 2015-08-14 14:20:09 UTC (rev 7247)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/sys/wait.h,v 1.3 2008/12/03 00:11:23 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -81,6 +81,9 @@
#define WSTOPPED WUNTRACED /* SUS compatibility */
#define WCONTINUED 4 /* Report a job control continued process. */
#define WNOWAIT 8 /* Poll only. Don't delete the proc entry. */
+#define WEXITED 16 /* Wait for exited processes. */
+#define WTRAPPED 32 /* Wait for a process to hit a trap or
+ a breakpoint. */
#if __BSD_VISIBLE
#define WLINUXCLONE 0x80000000 /* Wait for kthread spawned from linux_clone. */
@@ -88,6 +91,8 @@
/*
* Tokens for special values of the "pid" parameter to wait4.
+ * Extended struct __wrusage to collect rusage for both the target
+ * process and its children within one wait6() call.
*/
#if __BSD_VISIBLE
#define WAIT_ANY (-1) /* any process */
@@ -98,12 +103,19 @@
#include <sys/types.h>
__BEGIN_DECLS
+struct __siginfo;
pid_t wait(int *);
pid_t waitpid(pid_t, int *, int);
+#if __POSIX_VISIBLE >= 200112
+int waitid(idtype_t, id_t, struct __siginfo *, int);
+#endif
#if __BSD_VISIBLE
struct rusage;
+struct __wrusage;
pid_t wait3(int *, int, struct rusage *);
pid_t wait4(pid_t, int *, int, struct rusage *);
+pid_t wait6(idtype_t, id_t, int *, int, struct __wrusage *,
+ struct __siginfo *);
#endif
__END_DECLS
#endif /* !_KERNEL */
More information about the Midnightbsd-cvs
mailing list