diff options
author | Kay Sievers <kay@vrfy.org> | 2012-06-04 18:10:50 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-06-04 18:10:50 +0200 |
commit | 145dae7eb3367933e0d0bfcde3a7a77bb549aa61 (patch) | |
tree | d56a92dc85f33b969f44703ef1d005592bcbb30e /src/udev/udevd.c | |
parent | 8600c525cb1420570e7670c963abd19c5696b683 (diff) |
udev: reset /proc/self/oom_score_adj in worker processes
Only the main daemon process should be excluded from OOM handling,
not the worker processes or their child processes.
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r-- | src/udev/udevd.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 8ad1eccac1..2ac9fde049 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -262,6 +262,9 @@ static void worker_new(struct event *event) /* request TERM signal if parent exits */ prctl(PR_SET_PDEATHSIG, SIGTERM); + /* reset OOM score, we only protect the main daemon */ + write_one_line_file("/proc/self/oom_score_adj", "0"); + for (;;) { struct udev_event *udev_event; struct worker_message msg; @@ -1230,7 +1233,6 @@ int main(int argc, char *argv[]) if (daemonize) { pid_t pid; - int fd; pid = fork(); switch (pid) { @@ -1247,11 +1249,7 @@ int main(int argc, char *argv[]) setsid(); - fd = open("/proc/self/oom_score_adj", O_RDWR|O_CLOEXEC); - if (fd >= 0) { - write(fd, "-1000", 5); - close(fd); - } + write_one_line_file("/proc/self/oom_score_adj", "-1000"); } else { sd_notify(1, "READY=1"); } |