Skip to content
BSD syscall#194

svc · unix #194

getrlimit

Returns the soft and hard limits for a resource.

Prototype

int getrlimit(u_int which, struct rlimit *rlp);

Returns: int

Arguments

NameTypeDirDescription
whichu_int-
rlpstruct rlimit-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard194
xnu-1486.2.11194
xnu-1504.15.3194
xnu-1504.3.12194
xnu-1504.7.4194
xnu-1504.9.17194
xnu-1504.9.26194
xnu-1504.9.37194

Notes

Resources include RLIMIT_NOFILE, RLIMIT_STACK, RLIMIT_AS, RLIMIT_CPU, RLIMIT_CORE, and others. The hard limit caps what setrlimit() can raise to; on macOS the kernel cap on RLIMIT_NOFILE is OPEN_MAX (10240) by default, even though launchd often configures higher.

Related APIs

setrlimitgetrusageproc_rlimit_controlgetdtablesizegetpriority