about summary refs log tree commit diff
path: root/bits/waitstatus.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2004-09-28 01:42:49 +0000
committerRoland McGrath <roland@gnu.org>2004-09-28 01:42:49 +0000
commita044c713b054695326df96e7710dd5c8f80ad8c2 (patch)
treed1a0d23700e585670175a522246f43ed88fcca66 /bits/waitstatus.h
parentc5e2501b0b0fd773dc6f1037b5aabf862716b94d (diff)
downloadglibc-a044c713b054695326df96e7710dd5c8f80ad8c2.tar.gz
glibc-a044c713b054695326df96e7710dd5c8f80ad8c2.tar.xz
glibc-a044c713b054695326df96e7710dd5c8f80ad8c2.zip
* posix/tst-waitid.c (do_test): Add tests for waitpid with WCONTINUED.
	* posix/sys/wait.h [__WIFCONTINUED] (WIFCONTINUED): New macro.
	* stdlib/stdlib.h [__WIFCONTINUED] (WIFCONTINUED): New macro.
	* sysdeps/generic/bits/waitstatus.h (__W_CONTINUED): New macro.
	[WCONTINUED] (__WIFCONTINUED): New macro.
	(__WIFSIGNALED): Rewritten to exclude __W_CONTINUED value, and have no
	branches.
Diffstat (limited to 'bits/waitstatus.h')
-rw-r--r--bits/waitstatus.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/bits/waitstatus.h b/bits/waitstatus.h
index 982c9dbb28..98da41858e 100644
--- a/bits/waitstatus.h
+++ b/bits/waitstatus.h
@@ -1,5 +1,5 @@
 /* Definitions of status bits for `wait' et al.
-   Copyright (C) 1992, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,1994,1996,1997,2000,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -38,23 +38,25 @@
 #define	__WIFEXITED(status)	(__WTERMSIG(status) == 0)
 
 /* Nonzero if STATUS indicates termination by a signal.  */
-#ifdef	__GNUC__
-# define __WIFSIGNALED(status) \
-  (__extension__ ({ int __status = (status);				      \
-		    !__WIFSTOPPED(__status) && !__WIFEXITED(__status); }))
-#else	/* Not GCC.  */
-# define __WIFSIGNALED(status)	(!__WIFSTOPPED(status) && !__WIFEXITED(status))
-#endif	/* GCC.  */
+#define __WIFSIGNALED(status) \
+  (((signed char) ((((((status) + 1) & 0xffff) - 1) & 0x7f) + 1) >> 1) > 0)
 
 /* Nonzero if STATUS indicates the child is stopped.  */
 #define	__WIFSTOPPED(status)	(((status) & 0xff) == 0x7f)
 
+/* Nonzero if STATUS indicates the child continued after a stop.  We only
+   define this if <bits/waitflags.h> provides the WCONTINUED flag bit.  */
+#ifdef WCONTINUED
+# define __WIFCONTINUED(status)	((status) == __W_CONTINUED)
+#endif
+
 /* Nonzero if STATUS indicates the child dumped core.  */
 #define	__WCOREDUMP(status)	((status) & __WCOREFLAG)
 
 /* Macros for constructing status values.  */
 #define	__W_EXITCODE(ret, sig)	((ret) << 8 | (sig))
 #define	__W_STOPCODE(sig)	((sig) << 8 | 0x7f)
+#define __W_CONTINUED		0xffff
 #define	__WCOREFLAG		0x80