Hi!
It is currently impossible to wait for all children at same time. This
is esential for strace tracing mix of threads and processes.
[patch is against 42, but I checked it applies to 46]
Pavel
--- linux-2.3.42/kernel/exit.c.orig Sat Feb 5 02:08:19 2000
+++ linux-2.3.42/kernel/exit.c Sat Feb 5 02:09:32 2000
@@ -445,7 +445,7 @@
DECLARE_WAITQUEUE(wait, current);
struct task_struct *p;
- if (options & ~(WNOHANG|WUNTRACED|__WCLONE))
+ if (options & ~(WNOHANG|WUNTRACED|__WCLONE|__WALL))
return -EINVAL;
add_wait_queue(¤t->wait_chldexit,&wait);
@@ -464,8 +464,13 @@
if (p->pgrp != -pid)
continue;
}
- /* wait for cloned processes iff the __WCLONE flag is set */
- if ((p->exit_signal != SIGCHLD) ^ ((options & __WCLONE) != 0))
+ /* Wait for all children (clone and not) if __WALL is set;
+ * otherwise, wait for clone children *only* if __WCLONE is
+ * set; otherwise, wait for non-clone children *only*. (Note:
+ * A "clone" child here is one that reports to its parent
+ * using a signal other than SIGCHLD.) */
+ if (((p->exit_signal != SIGCHLD) ^ ((options & __WCLONE) != 0))
+ && !(options & __WALL))
continue;
flag = 1;
switch (p->state) {
--- linux-2.3.42/include/linux/wait.h.orig Mon Jan 10 20:29:12 2000
+++ linux-2.3.42/include/linux/wait.h Sat Feb 5 02:09:32 2000
@@ -4,6 +4,7 @@
#define WNOHANG 0x00000001
#define WUNTRACED 0x00000002
+#define __WALL 0x40000000
#define __WCLONE 0x80000000
#ifdef __KERNEL__
-- I'm pavel@ucw.cz. "In my country we have almost anarchy and I don't care." Panos Katsaloulis describing me w.r.t. patents me at discuss@linmodems.org- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:27 EST