diff options
author | dzwdz | 2021-08-18 17:36:16 +0200 |
---|---|---|
committer | dzwdz | 2021-08-18 17:36:16 +0200 |
commit | baa4c5e085d81b2021b25adaba61d32e3f835a56 (patch) | |
tree | 6c3b421591933df64a368e7f59537963e7139ed6 /src/init/main.c | |
parent | ab1f8ed9b9513de631193aaa024ddb86eb2a97b7 (diff) |
fork() now has a return value; you can tell the child and parent apart
Diffstat (limited to 'src/init/main.c')
-rw-r--r-- | src/init/main.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/init/main.c b/src/init/main.c index a59ce9c..c6d19a3 100644 --- a/src/init/main.c +++ b/src/init/main.c @@ -19,10 +19,13 @@ int main() { multipageify("I cross pages. "), sizeof("I cross pages. ") - 1); - _syscall_fork(); - - _syscall_debuglog("fork ", - sizeof("fork ") - 1); + if (_syscall_fork() > 0) { + _syscall_debuglog("parent ", + sizeof("parent ") - 1); + } else { + _syscall_debuglog("child ", + sizeof("child ") - 1); + } _syscall_exit("bye from init! ", sizeof("bye from init! ") - 1); |