kernel: invert WEXITED to WSTOPPED

This commit is contained in:
K. Lange 2018-10-30 13:11:07 +09:00
parent 821eb55496
commit 36afa24d2f
3 changed files with 4 additions and 4 deletions

View File

@ -785,7 +785,7 @@ int wait_for_child(int pgid, char * name) {
int ret_code = 0;
do {
outpid = waitpid(waitee, &ret_code, 0);
outpid = waitpid(waitee, &ret_code, WSTOPPED);
if (WIFSTOPPED(ret_code)) {
suspended_pgid = pgid;
if (name) {
@ -1534,7 +1534,7 @@ int main(int argc, char ** argv) {
foreach(node, keys) {
int pid = (int)node->value;
int status = 0;
if (waitpid(-pid, &status, WNOHANG | WEXITED) > 0) {
if (waitpid(-pid, &status, WNOHANG) > 0) {
char * desc = "Done";
if (WTERMSIG(status) != 0) {
desc = _strsignal(WTERMSIG(status));

View File

@ -7,7 +7,7 @@ _Begin_C_Header
#define WNOHANG 0x0001
#define WUNTRACED 0x0002
#define WEXITED 0x0004
#define WSTOPPED 0x0004
#define WNOKERN 0x0010
/* This were taken from newlib, but they remain true */

View File

@ -845,7 +845,7 @@ int waitpid(int pid, int * status, int options) {
candidate = child;
break;
}
if (!(options & WEXITED) && child->suspended) {
if ((options & WSTOPPED) && child->suspended) {
candidate = child;
break;
}