summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/wait.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1997-06-13 15:52:43 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1997-06-13 15:52:43 +0000
commit6cc9c438667c56c0fb66e1b8d2366b6efb94805b (patch)
treecebcadbaa332f69410bf6438251c686168339687 /otherlibs/unix/wait.c
parentf7ccaf7b6c4365b7b1b640949de3b3e54356782c (diff)
Eradication des warnings de gcc.
Nettoyages divers. Suppression de ioctl. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1597 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix/wait.c')
-rw-r--r--otherlibs/unix/wait.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/otherlibs/unix/wait.c b/otherlibs/unix/wait.c
index fbc24a9d6..78ef7621e 100644
--- a/otherlibs/unix/wait.c
+++ b/otherlibs/unix/wait.c
@@ -22,28 +22,33 @@
#if !(defined(WIFEXITED) && defined(WEXITSTATUS) && defined(WIFSTOPPED) && \
defined(WSTOPSIG) && defined(WTERMSIG))
-#define WIFEXITED(status) ((status) & 0xFF == 0)
+/* Assume old-style V7 status word */
+#define WIFEXITED(status) (((status) & 0xFF) == 0)
#define WEXITSTATUS(status) (((status) >> 8) & 0xFF)
-#define WIFSTOPPED(status) ((status) & 0xFF == 0xFF)
+#define WIFSTOPPED(status) (((status) & 0xFF) == 0xFF)
#define WSTOPSIG(status) (((status) >> 8) & 0xFF)
#define WTERMSIG(status) ((status) & 0x3F)
#endif
+#define TAG_WEXITED 0
+#define TAG_WSIGNALED 1
+#define TAG_WSTOPPED 2
+
static value alloc_process_status(pid, status)
int pid, status;
{
value st, res;
if (WIFEXITED(status)) {
- st = alloc(1, 0);
+ st = alloc(1, TAG_WEXITED);
Field(st, 0) = Val_int(WEXITSTATUS(status));
}
else if (WIFSTOPPED(status)) {
- st = alloc(1, 2);
+ st = alloc(1, TAG_WSTOPPED);
Field(st, 0) = Val_int(WSTOPSIG(status));
}
else {
- st = alloc(1, 1);
+ st = alloc(1, TAG_WSIGNALED);
Field(st, 0) = Val_int(WTERMSIG(status));
}
Begin_root (st);