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

View File

@ -7,7 +7,7 @@ _Begin_C_Header
#define WNOHANG 0x0001 #define WNOHANG 0x0001
#define WUNTRACED 0x0002 #define WUNTRACED 0x0002
#define WEXITED 0x0004 #define WSTOPPED 0x0004
#define WNOKERN 0x0010 #define WNOKERN 0x0010
/* This were taken from newlib, but they remain true */ /* 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; candidate = child;
break; break;
} }
if (!(options & WEXITED) && child->suspended) { if ((options & WSTOPPED) && child->suspended) {
candidate = child; candidate = child;
break; break;
} }