summaryrefslogtreecommitdiff
path: root/otherlibs/win32unix/winwait.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-09-04 14:17:43 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-09-04 14:17:43 +0000
commita0c8d7373311facda78d250751203371cc0487b2 (patch)
treecfb65b4d0bff35f71cede7ae09e647433845236f /otherlibs/win32unix/winwait.c
parentac9f8e8094ea19199a24fd5c67053718198ed172 (diff)
downloadocaml-a0c8d7373311facda78d250751203371cc0487b2.tar.gz
Merge du stage de Pascal Cuoq
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@952 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/winwait.c')
-rw-r--r--otherlibs/win32unix/winwait.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/otherlibs/win32unix/winwait.c b/otherlibs/win32unix/winwait.c
new file mode 100644
index 0000000000..ac1865cf05
--- /dev/null
+++ b/otherlibs/win32unix/winwait.c
@@ -0,0 +1,47 @@
+/***********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Pascal Cuoq, projet Cristal, INRIA Rocquencourt */
+/* */
+/* Copyright 1996 Institut National de Recherche en Informatique et */
+/* Automatique. Distributed only by permission. */
+/* */
+/***********************************************************************/
+
+/* $Id$ */
+
+#include <windows.h>
+#include <mlvalues.h>
+#include <alloc.h>
+#include <memory.h>
+#include <process.h>
+#include "unixsupport.h"
+#include <sys/types.h>
+
+static value alloc_process_status(pid, status)
+ int pid, status;
+{
+ value st, res;
+ Push_roots(r, 1);
+
+
+ st = alloc(1, 0);
+ Field(st, 0) = Val_int(status);
+
+ r[0] = st;
+ res = alloc_tuple(2);
+ Field(res, 0) = Val_int(pid);
+ Field(res, 1) = r[0];
+ Pop_roots();
+ return res;
+}
+
+value win_waitpid(flags, pid_req)
+ value flags, pid_req;
+{
+ int status;
+ if (_cwait(&status,Int_val(pid_req), 0/* ignored by win32 */) == -1)
+ uerror("waitpid", Nothing);
+ return alloc_process_status(pid_req, status);
+}