|
Added
Link Here
|
| 1 |
|
| 2 |
#include "namespace.h" |
| 3 |
#include <sys/types.h> |
| 4 |
#include <sys/wait.h> |
| 5 |
#include <stddef.h> |
| 6 |
#include <string.h> |
| 7 |
#include <signal.h> |
| 8 |
#include <errno.h> |
| 9 |
#include "un-namespace.h" |
| 10 |
|
| 11 |
int |
| 12 |
__waitid (idtype, id, info, flags) |
| 13 |
idtype_t idtype; |
| 14 |
id_t id; |
| 15 |
siginfo_t *info; |
| 16 |
int flags; |
| 17 |
{ |
| 18 |
int status; |
| 19 |
pid_t ret; |
| 20 |
|
| 21 |
/* |
| 22 |
* NOTICE! |
| 23 |
* The traditional PID/PGID == 0 to wait for |
| 24 |
* any process in the caller's own process group |
| 25 |
* still works when the idtype is set to either |
| 26 |
* P_PID or P_PGID. |
| 27 |
*/ |
| 28 |
|
| 29 |
if (info) { |
| 30 |
memset (info, '\0', sizeof (*info)); |
| 31 |
} |
| 32 |
|
| 33 |
/* |
| 34 |
* In case you wish to start waiting for any |
| 35 |
* processes |
| 36 |
* - running in a certain jail (zone), |
| 37 |
* - running on a certain cpu, or |
| 38 |
* - nailed to a certain CPU set, |
| 39 |
* - etc. |
| 40 |
* you will have to extend the kern_wait6() in |
| 41 |
* the kernel to support such idtype_t flavours. |
| 42 |
*/ |
| 43 |
|
| 44 |
ret = _wait6 (idtype, id, &status, flags, NULL, info); |
| 45 |
|
| 46 |
if (ret < 0) { |
| 47 |
ret = -1; |
| 48 |
} |
| 49 |
else { |
| 50 |
ret = 0; |
| 51 |
} |
| 52 |
|
| 53 |
return ((int) ret); |
| 54 |
} |
| 55 |
|
| 56 |
__weak_reference(__waitid, waitid); |
| 57 |
__weak_reference(__waitid, _waitid); |