NetBSD-Bugs archive

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

standards/51603: WIFCONTINUED()==true always implies WIFSTOPPED()==true in the current implementation



>Number:         51603
>Category:       standards
>Synopsis:       WIFCONTINUED()==true always implies WIFSTOPPED()==true in the current implementation
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 05 20:55:00 +0000 2016
>Originator:     Kamil Rytarowski
>Release:        NetBSD 7.99.42 amd64
>Organization:
TNF
>Environment:
NetBSD chieftec 7.99.42 NetBSD 7.99.42 (GENERIC) #0: Sat Nov  5 15:49:14 CET 2016  root@chieftec:/tmp/netbsd-tmp/sys/arch/amd64/compile/GENERIC amd64
>Description:
Current implementation of <sys/wait.h> implies that a status of wait(2)-like functions for WIFCONTINED()==true implies always true.

In the current code of <sys/wait.h>:

#if !( defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) ) || defined(_KERNEL)
#define _W_INT(i)       (i)
#else
#define _W_INT(w)       (*(int *)(void *)&(w))  /* convert union wait to int */
#endif

#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 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 WTERMSIG(x)     (_WSTATUS(x))
#define WIFEXITED(x)    (_WSTATUS(x) == 0)
#define WEXITSTATUS(x)  ((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)


WIFSTOPPED() checks a bit submask of WIFCONTINUED()
>How-To-Repeat:
The code triggering this issue will be committed to tests/lib/libc/sys/t_wait.c once ID number will be assigned to this PR.

atf-run t_wait | atf-report
>Fix:
TBD

WIFCONTINUED() was added in April 2016 and is not widely used, therefore I'm fine with changing the code with breaking backwards compatibility.



Home | Main Index | Thread Index | Old Index