summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/wait.c
diff options
context:
space:
mode:
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);