Skip to content

Commit b60cf1f

Browse files
poetteringbluca
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) (cherry picked from commit c98a24b)
1 parent e13981d commit b60cf1f

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
@@ -56,6 +56,7 @@
5656
#include "pretty-print.h"
5757
#include "proc-cmdline.h"
5858
#include "process-util.h"
59+
#include "rlimit-util.h"
5960
#include "selinux-util.h"
6061
#include "signal-util.h"
6162
#include "socket-util.h"
@@ -2051,6 +2052,9 @@ int run_udevd(int argc, char *argv[]) {
20512052
if (r < 0)
20522053
return r;
20532054

2055+
/* Make sure we can have plenty fds (for example for pidfds) */
2056+
(void) rlimit_nofile_bump(-1);
2057+
20542058
r = RET_NERRNO(mkdir("/run/udev", 0755));
20552059
if (r < 0 && r != -EEXIST)
20562060
return log_error_errno(r, "Failed to create /run/udev: %m");

0 commit comments

Comments
 (0)