waitpid should be able to ignore kernel processes

This commit is contained in:
K. Lange 2018-08-12 16:36:44 +09:00
parent 4dfa82543e
commit 4dbade5b5a
3 changed files with 9 additions and 4 deletions

View File

@ -2,8 +2,9 @@
#include <sys/types.h>
#define WNOHANG 1
#define WUNTRACED 2
#define WNOHANG 0x0001
#define WUNTRACED 0x0002
#define WNOKERN 0x0010
/* This were taken from newlib, but they remain true */
#define WIFEXITED(w) (((w) & 0xff) == 0)

View File

@ -1,3 +1,4 @@
#pragma once
int waitpid(int pid, int *status, int options);
int wait(int *status);

View File

@ -775,10 +775,13 @@ void reap_process(process_t * proc) {
}
static int wait_candidate(process_t * parent, int pid, int options, process_t * proc) {
(void)options; /* there is only one option that affects candidacy, and we don't support it yet */
if (!proc) return 0;
if (options & 0x10) {
/* Skip kernel processes */
if (proc->is_tasklet) return 0;
}
if (pid < -1) {
if (proc->group == -pid || proc->id == -pid) return 1;
} else if (pid == 0) {