Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Since the stopped bits set is a subset of the contin...



details:   https://anonhg.NetBSD.org/src/rev/0261400e2a66
branches:  trunk
changeset: 818901:0261400e2a66
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 05 23:49:59 2016 +0000

description:
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.

diffstat:

 sys/sys/wait.h |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (22 lines):

diff -r 2c118f19cd41 -r 0261400e2a66 sys/sys/wait.h
--- a/sys/sys/wait.h    Sat Nov 05 23:30:22 2016 +0000
+++ b/sys/sys/wait.h    Sat Nov 05 23:49:59 2016 +0000
@@ -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)



Home | Main Index | Thread Index | Old Index