Index: lib/libc/sys/getrlimit.2 =================================================================== --- lib/libc/sys/getrlimit.2 +++ lib/libc/sys/getrlimit.2 @@ -28,7 +28,7 @@ .\" @(#)getrlimit.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd August 20, 2008 +.Dd August 19, 2015 .Dt GETRLIMIT 2 .Os .Sh NAME @@ -74,6 +74,8 @@ function. .It Dv RLIMIT_FSIZE The largest size (in bytes) file that may be created. +.It Dv RLIMIT_KQUEUES +The maximum number of kqueues created by this user id. .It Dv RLIMIT_MEMLOCK The maximum size (in bytes) which a process may lock into memory using the @@ -83,12 +85,20 @@ The maximum number of open files for this process. .It Dv RLIMIT_NPROC The maximum number of simultaneous processes for this user id. +.It Dv RLIMIT_NPTS +The maximum number of pseudo-terminals created by this user id. .It Dv RLIMIT_RSS -The maximum size (in bytes) to which a process's resident set size may -grow. -This imposes a limit on the amount of physical memory to be given to -a process; if memory is tight, the system will prefer to take memory +The maximum size (in bytes) a process's resident set size may +maintain in main memory if swap is available and there is memory pressure. +If memory is tight and swap is enabled, the system will prefer to take memory from processes that are exceeding their declared resident set size. +On systems that are not under memory pressure or do not have sufficient swap, +this effectively imposes no limit on a process' memory use. +.Pp +Processes that exceed their nominal +.Dv RLIMIT_RSS +limit are not signalled or halted; the limit is simply a hint to the vm daemon +to prefer to deactivate pages from any such process. .It Dv RLIMIT_SBSIZE The maximum size (in bytes) of socket buffer usage for this user. This limits the amount of network memory, and hence the amount of @@ -106,18 +116,19 @@ Please see .Xr tuning 7 for a complete description of this sysctl. -.It Dv RLIMIT_NPTS -The maximum number of pseudo-terminals created by this user id. -.It Dv RLIMIT_KQUEUES -The maximum number of kqueues created by this user id. +.It Dv RLIMIT_VMEM +An alias for +.Dv RLIMIT_AS . .El .Pp A resource limit is specified as a soft limit and a hard limit. -When a -soft limit is exceeded a process may receive a signal (for example, if -the cpu time or file size is exceeded), but it will be allowed to -continue execution until it reaches the hard limit (or modifies -its resource limit). +When a soft limit is exceeded a process may receive a signal (for example, if +the cpu time or file size is exceeded) or it may not (for example, if the +address space soft limit or either RSS limit is exceeded), but it will be +allowed to continue execution until it reaches the hard limit (or modifies its +resource limit). +Even reaching the hard limit does not necessarily halt a process (for example, +if the RSS hard limit is exceeded, nothing happens). The .Vt rlimit structure is used to specify the hard and soft limits on a resource, @@ -170,6 +181,14 @@ .Dv SIGXCPU is sent to the offending process. +.Pp +When an operation would allocate more virtual memory than allowed by the soft +limit of +.Dv RLIMIT_AS , +no signal is raised; however, the operation fails with +.Dv ENOMEM . +The caller is free to raise the soft address space limit up to the hard limit +and retry the allocation. .Sh RETURN VALUES .Rv -std .Sh ERRORS