A child process created via fork(2) inherits its parent's
resource limits. Resource limits are preserved across execve(2).
Resource limits are per-process attributes that are shared by all
of the threads in a process.
Lowering the soft limit for a resource below the process's
current consumption of that resource will succeed (but will
prevent the process from further increasing its consumption of
the resource).
One can set the resource limits of the shell using the built-in
ulimit command (limit in csh
(1)). The shell's resource limits
are inherited by the processes that it creates to execute
commands.
Since Linux 2.6.24, the resource limits of any process can be
inspected via /proc/[pid]/limits; see proc(5).
Ancient systems provided a vlimit
() function with a similar
purpose to setrlimit
(). For backward compatibility, glibc also
provides vlimit
(). All new applications should be written using
setrlimit
().
C library/kernel ABI differences
Since version 2.13, the glibc getrlimit
() and setrlimit
() wrapper
functions no longer invoke the corresponding system calls, but
instead employ prlimit
(), for the reasons described in BUGS.
The name of the glibc wrapper function is prlimit
(); the
underlying system call is prlimit64
().