Skip to content

Commit de448e0

Browse files
trenthuberMichael Tokarev
authored and
Michael Tokarev
committed
os-posix: Expand setrlimit() syscall compatibility
Darwin uses a subtly different version of the setrlimit() syscall as described in the COMPATIBILITY section of the macOS man page. The value of the rlim_cur member has been adjusted accordingly for Darwin-based systems. Signed-off-by: Trent Huber <[email protected]> Tested-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Daniel P. Berrangé <[email protected]> Reviewed-by: Michael Tokarev <[email protected]> Signed-off-by: Michael Tokarev <[email protected]>
1 parent 737308f commit de448e0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: os-posix.c

+4
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ void os_setup_limits(void)
270270
return;
271271
}
272272

273+
#ifdef CONFIG_DARWIN
274+
nofile.rlim_cur = OPEN_MAX < nofile.rlim_max ? OPEN_MAX : nofile.rlim_max;
275+
#else
273276
nofile.rlim_cur = nofile.rlim_max;
277+
#endif
274278

275279
if (setrlimit(RLIMIT_NOFILE, &nofile) < 0) {
276280
warn_report("unable to set NOFILE limit: %s", strerror(errno));

0 commit comments

Comments
 (0)