summaryrefslogtreecommitdiff
path: root/os2/waitpid.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2005-10-03 13:43:40 +0000
committer <>2014-09-25 11:25:48 +0000
commit10de491ef0bc43827ab8631a4c02860134e620a9 (patch)
tree22e734337cc9aa5d9b1d7c71261d160b6a60634d /os2/waitpid.c
downloadcvs-tarball-master.tar.gz
Imported from /home/lorry/working-area/delta_cvs-tarball/cvs-1.12.13.tar.bz2.HEADcvs-1.12.13master
Diffstat (limited to 'os2/waitpid.c')
-rw-r--r--os2/waitpid.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/os2/waitpid.c b/os2/waitpid.c
new file mode 100644
index 0000000..2b64f5d
--- /dev/null
+++ b/os2/waitpid.c
@@ -0,0 +1,36 @@
+/* waitpid.c --- waiting for process termination, under OS/2
+ Karl Fogel <kfogel@cyclic.com> --- November 1995 */
+
+#include <assert.h>
+#include <stdio.h>
+#include <process.h>
+#include <errno.h>
+
+#include "config.h"
+
+/* Wait for the process PID to exit. Put the return status in *statusp.
+ OPTIONS is not supported yet under OS/2. We hope it's always zero. */
+pid_t waitpid (pid, statusp, options)
+ pid_t pid;
+ int *statusp;
+ int options;
+{
+ pid_t rc;
+
+ /* We don't know how to deal with any options yet. */
+ assert (options == 0);
+
+ rc = _cwait (statusp, pid, WAIT_CHILD);
+
+ if (rc == -1)
+ {
+ if (errno == ECHILD)
+ return pid;
+ else
+ return -1;
+ }
+ else if (rc == pid)
+ return pid;
+ else
+ return -1;
+}