summaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-27 00:58:17 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-27 01:01:57 +0100
commitb9fe5b6eadc913ead80531905aeafa51ed0d4ccd (patch)
tree92866f4a59fe8c852f9ab10611acc63e47e56fa9 /hurd
parentd7964b08211f5221e73400ed36093d44f9455fff (diff)
Add proc_waitid
proc_wait assumes that the caller always wants WEXITED, but waitid() does not. The new proc_waitid RPC requires the caller to specify at least one of WEXITED, WSTOPPED, or WCONTINUED. * hurd/process.defs (proc_waitid): New RPC. * hurd/process_reply.defs (proc_waitid): New RPC. * hurd/process_request.defs (proc_waitid): New RPC. * proc/proc.h (struct proc): Add p_continued field. * proc/wait.c (WCONTINUED, WEXITED): Define if not already defined. (S_proc_wait): Rename implementation to S_proc_waitid, and modify to stop assuming WEXITED. Add support for WCONTINUED. (S_proc_wait): Reimplement by just calling S_proc_waitid with an additional WEXITED. (proc_mark_stop): Clear p_continued. (proc_mark_cont): Set p_continued, clear p_waited, wake any waiting parent.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/process.defs17
-rw-r--r--hurd/process_reply.defs2
-rw-r--r--hurd/process_request.defs2
3 files changed, 21 insertions, 0 deletions
diff --git a/hurd/process.defs b/hurd/process.defs
index d515a46d..3b091290 100644
--- a/hurd/process.defs
+++ b/hurd/process.defs
@@ -434,3 +434,20 @@ routine proc_set_entry (
routine proc_get_entry (
process: process_t;
out entry: vm_address_t);
+
+/* Wait for a child process to exit. If pid is zero, it waits for any
+ child in the same pgrp as the parent. If pid is -1, it waits for
+ any child. Otherwise, if pid is negative, it waits for any process
+ in the specified process group. If pid is positive, it waits for
+ the specified process. The exit status and resource usage of the
+ process are returned in status and rusage respectively.
+ options must specify at least one of WEXITED, WSTOPPED, or WCONTINUED. */
+routine proc_waitid (
+ process: process_t;
+ sreplyport reply_port: sreply_port_t;
+ pid: pid_t;
+ options: int;
+ out status: int;
+ out sigcode: int;
+ out rusage: rusage_t;
+ out pid_status: pid_t);
diff --git a/hurd/process_reply.defs b/hurd/process_reply.defs
index 2eefcc37..4a79024c 100644
--- a/hurd/process_reply.defs
+++ b/hurd/process_reply.defs
@@ -200,3 +200,5 @@ skip; /* proc_get_exe */
skip; /* proc_set_entry */
skip; /* proc_get_entry */
+
+skip; /* proc_waitid */
diff --git a/hurd/process_request.defs b/hurd/process_request.defs
index fc9127ab..f200bf15 100644
--- a/hurd/process_request.defs
+++ b/hurd/process_request.defs
@@ -423,3 +423,5 @@ skip; /* proc_get_exe */
skip; /* proc_set_entry */
skip; /* proc_get_entry */
+
+skip; /* proc_waitid */