X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/aa8afd3a17a7433230b76a1910ab3ddb83bcd227..9d62069fd52fa2108b677ffadc7f6138c7641757:/lunaix-os/kernel/lxinit.c diff --git a/lunaix-os/kernel/lxinit.c b/lunaix-os/kernel/lxinit.c index 1485c34..2ac9342 100644 --- a/lunaix-os/kernel/lxinit.c +++ b/lunaix-os/kernel/lxinit.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -19,12 +18,6 @@ LOG_MODULE("INIT") #define WAIT_DEMO #define IN_USER_MODE -void __USER__ -sigchild_handler(int signum) -{ - kprintf(KINFO "SIGCHLD received\n"); -} - void __USER__ _lxinit_main() { @@ -38,8 +31,6 @@ _lxinit_main() } #endif - signal(_SIGCHLD, sigchild_handler); - int status; #ifdef WAIT_DEMO // 测试wait @@ -50,6 +41,7 @@ _lxinit_main() kprintf("I am child, I am about to terminated\n"); _exit(1); } + wait(&status); pid_t child = wait(&status); kprintf("I am parent, my child (%d) terminated normally with code: %d.\n", child, @@ -66,7 +58,7 @@ _lxinit_main() waitpid(-1, &status, WNOHANG); - for (size_t i = 0; i < 10; i++) { + for (size_t i = 0; i < 5; i++) { pid_t pid = 0; if (!(pid = fork())) { sleep(i);