mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 23:07:34 +00:00
SystemServer: Reap dead processes. (#706)
SystemServer didn't reap its child processes. This commit adds sigchld_handler, which reaps children when appropriate.
This commit is contained in:
parent
b583f21e27
commit
6bd1879189
1 changed files with 13 additions and 1 deletions
|
@ -3,13 +3,23 @@
|
|||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
//#define SPAWN_MULTIPLE_VIRTUAL_CONSOLES
|
||||
|
||||
void sigchld_handler(int)
|
||||
{
|
||||
int status = 0;
|
||||
pid_t pid = waitpid(-1, &status, WNOHANG);
|
||||
if (pid)
|
||||
dbg() << "reaped pid " << pid;
|
||||
}
|
||||
|
||||
void start_process(const String& program, const Vector<String>& arguments, int prio, const char* tty = nullptr)
|
||||
{
|
||||
pid_t pid = 0;
|
||||
|
@ -100,6 +110,8 @@ int main(int, char**)
|
|||
setgid(100);
|
||||
setuid(100);
|
||||
|
||||
signal(SIGCHLD, sigchld_handler);
|
||||
|
||||
start_process("/bin/LookupServer", {}, lowest_prio);
|
||||
start_process("/bin/WindowServer", {}, highest_prio);
|
||||
start_process("/bin/AudioServer", {}, highest_prio);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue