Skip to content

Commit b45b570

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) (cherry picked from commit b60cf1f)
1 parent 7e5f462 commit b45b570

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
@@ -55,6 +55,7 @@
5555
#include "pretty-print.h"
5656
#include "proc-cmdline.h"
5757
#include "process-util.h"
58+
#include "rlimit-util.h"
5859
#include "selinux-util.h"
5960
#include "signal-util.h"
6061
#include "socket-util.h"
@@ -2040,6 +2041,9 @@ int run_udevd(int argc, char *argv[]) {
20402041
if (r < 0)
20412042
return r;
20422043

2044+
/* Make sure we can have plenty fds (for example for pidfds) */
2045+
(void) rlimit_nofile_bump(-1);
2046+
20432047
r = RET_NERRNO(mkdir("/run/udev", 0755));
20442048
if (r < 0 && r != -EEXIST)
20452049
return log_error_errno(r, "Failed to create /run/udev: %m");

0 commit comments

Comments
 (0)