Re: [PATCH] waitid system call

Roland McGrath
2004-08-31T23:54:15Z

Andrew, please replace waitid-clear-fields.patch with this one.
The old log entry is still good.

Thanks,
Roland

--- linux-2.6.9-rc1-mm1/kernel/exit.c.~1~
+++ linux-2.6.9-rc1-mm1/kernel/exit.c
@@ -1369,8 +1369,19 @@ check_continued:
end:
current->state = TASK_RUNNING;
remove_wait_queue(&current->wait_chldexit,&wait);
- if (infop && retval > 0)
- retval = 0;
+ if (infop) {
+ if (retval > 0)
+ retval = 0;
+ else if (retval == 0) {
+ /*
+ * For a WNOHANG return, clear out all the fields
+ * we would set so the user can easily tell the
+ * difference.
+ */
+ if (clear_user(infop, sizeof *infop))
+ retval = -EFAULT;
+ }
+ }
return retval;
}