Module Name:    src
Committed By:   christos
Date:           Sat Nov  5 23:49:59 UTC 2016

Modified Files:
        src/sys/sys: wait.h

Log Message:
Since the stopped bits set is a subset of the continued bits set, check
that we are not continued in WIFSTOPPED.
Make WIFSIGNALED more obvious, it being the remaining state of not exited,
not stopped and not continued.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/sys/wait.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/wait.h
diff -u src/sys/sys/wait.h:1.31 src/sys/sys/wait.h:1.32
--- src/sys/sys/wait.h:1.31	Thu Jul  7 02:55:44 2016
+++ src/sys/sys/wait.h	Sat Nov  5 19:49:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: wait.h,v 1.31 2016/07/07 06:55:44 msaitoh Exp $	*/
+/*	$NetBSD: wait.h,v 1.32 2016/11/05 23:49:59 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993, 1994
@@ -58,10 +58,10 @@
 #define	_WSTATUS(x)	(_W_INT(x) & 0177)
 #define	_WSTOPPED	0177		/* _WSTATUS if process is stopped */
 #define _WCONTINUED	0xffffU
-#define WIFSTOPPED(x)	(_WSTATUS(x) == _WSTOPPED)
+#define WIFSTOPPED(x)	(_WSTATUS(x) == _WSTOPPED && !WIFCONTINUED(x))
 #define WIFCONTINUED(x)	(_W_INT(x) == _WCONTINUED)
 #define WSTOPSIG(x)	((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)
-#define WIFSIGNALED(x)	(_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
+#define WIFSIGNALED(x)	(!WIFSTOPPED(x) && !WIFCONTINUED(x) && !WIFEXITED(x))
 #define WTERMSIG(x)	(_WSTATUS(x))
 #define WIFEXITED(x)	(_WSTATUS(x) == 0)
 #define WEXITSTATUS(x)	((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)

Reply via email to