standards/170346: Changes to support waitid() and related stuff
Jukka A. Ukkonen
jau at oxit.fi
Sat Aug 4 05:10:06 UTC 2012
The following reply was made to PR standards/170346; it has been noted by GNATS.
From: "Jukka A. Ukkonen" <jau at oxit.fi>
To: bug-followup at FreeBSD.org, jau at iki.fi
Cc:
Subject: Re: standards/170346: Changes to support waitid() and related stuff
Date: Sat, 04 Aug 2012 07:51:29 +0300
This is a multi-part message in MIME format.
--------------080906020500020008010404
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Oops! Sorry!
It seems I forgot the actual waitid() function from the patch.
Here is the missing part.
--jau
--------------080906020500020008010404
Content-Type: text/plain; charset=UTF-8;
name="waitid-wait6.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="waitid-wait6.patch"
--- /dev/null 2012-08-04 07:33:00.000000000 +0300
+++ lib/libc/gen/waitid.c 2012-07-30 12:43:59.000000000 +0300
@@ -0,0 +1,57 @@
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <stddef.h>
+#include <string.h>
+#include <signal.h>
+#include <errno.h>
+#include "un-namespace.h"
+
+int
+__waitid (idtype, id, info, flags)
+ idtype_t idtype;
+ id_t id;
+ siginfo_t *info;
+ int flags;
+{
+ int status;
+ pid_t ret;
+
+ /*
+ * NOTICE!
+ * The traditional PID/PGID == 0 to wait for
+ * any process in the caller's own process group
+ * still works when the idtype is set to either
+ * P_PID or P_PGID.
+ */
+
+ if (info) {
+ memset (info, '\0', sizeof (*info));
+ }
+
+ /*
+ * In case you wish to start waiting for any
+ * processes
+ * - running in a certain jail (zone),
+ * - running on a certain cpu, or
+ * - nailed to a certain CPU set,
+ * - etc.
+ * you will have to extend the kern_wait6() in
+ * the kernel to support such idtype_t flavours.
+ */
+
+ ret = _wait6 (idtype, id, &status, flags, NULL, info);
+
+ if (ret < 0) {
+ ret = -1;
+ }
+ else {
+ ret = 0;
+ }
+
+ return ((int) ret);
+}
+
+__weak_reference(__waitid, waitid);
+__weak_reference(__waitid, _waitid);
--------------080906020500020008010404--
More information about the freebsd-standards
mailing list