mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Better collection of zombie processes.
Note that there seems to be a deadlock if a process exits when there are zombies around. Init also doesn't handle zombie children correctly as there is sent no SIGCHLD signal yet.
This commit is contained in:
parent
07b3cc8e06
commit
c9eb1b2cb3
2 changed files with 6 additions and 1 deletions
|
@ -58,7 +58,9 @@ int runsystem()
|
|||
return status;
|
||||
}
|
||||
|
||||
return child();
|
||||
int ret = child();
|
||||
while ( 0 < waitpid(-1, NULL, WNOHANG) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
|
|
@ -79,6 +79,9 @@ int runcommandline(const char** tokens)
|
|||
bool internal;
|
||||
int internalresult;
|
||||
readcmd:
|
||||
// Collect any pending zombie processes.
|
||||
while ( 0 < waitpid(-1, NULL, WNOHANG) );
|
||||
|
||||
cmdstart = cmdnext;
|
||||
for ( cmdend = cmdstart; true; cmdend++ )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue