Skip to content

Commit c98a24b

Browse files
poetteringkeszybz
authored andcommitted
udev: raise RLIMIT_NOFILE as high as we can
We might need a lot of fds on large systems, hence raise RLIMIT_NOFILE to what the service manager allows us, which is quite a lot these days. udev already sets FORK_RLIMIT_NOFILE_SAFE when forking of chilren, thus ensuring that forked off processes get their RLIMIT_NOFILE soft limit reset to 1K for compat with crappy old select(). Replaces: #29298 Fixes: #28583 (cherry picked from commit 1617424)
1 parent c0b3190 commit c98a24b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/udev/udevd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include "pretty-print.h"
5858
#include "proc-cmdline.h"
5959
#include "process-util.h"
60+
#include "rlimit-util.h"
6061
#include "selinux-util.h"
6162
#include "signal-util.h"
6263
#include "socket-util.h"
@@ -2022,6 +2023,9 @@ int run_udevd(int argc, char *argv[]) {
20222023
if (r < 0)
20232024
return r;
20242025

2026+
/* Make sure we can have plenty fds (for example for pidfds) */
2027+
(void) rlimit_nofile_bump(-1);
2028+
20252029
r = RET_NERRNO(mkdir("/run/udev", 0755));
20262030
if (r < 0 && r != -EEXIST)
20272031
return log_error_errno(r, "Failed to create /run/udev: %m");

0 commit comments

Comments
 (0)