sys_getrlimit  [kernel/sys.c]


Retrieves maximum system resource consumption.

Arguments

eax 75
ebx Resource. It must be one of the following values:
RLIMIT_AS The maximum size of the process's virtual memory (address space) in bytes.
RLIMIT_CORE Maximum size of core file.
RLIMIT_CPU The maximum amount of cpu time (in seconds) to be used by each process.
RLIMIT_DATA The maximum size of the process's data segment (initialized data, uninitialized data, and heap).
RLIMIT_FSIZE The maximum size of files that the process may create.
RLIMIT_MEMLOCK The maximum number of bytes of memory that may be locked into RAM.
RLIMIT_MSGQUEUE (Since Linux 2.6.8)
Specifies the limit on the number of bytes that can be allocated for POSIX message queues for the real user ID of the calling process.
RLIMIT_NICE (since kernel 2.6.12, but see Remarks below)
Specifies a ceiling to which the process's nice value can be raised using sys_setpriority or sys_nice.
RLIMIT_NOFILE Specifies a value one greater than the maximum file descriptor number that can be opened by this process.
RLIMIT_NPROC The maximum number of processes that can be created for the real user ID of the calling process.
RLIMIT_RTPRIO (Since Linux 2.6.12, but see Remarks below)
Specifies a ceiling on the real-time priority that may be set for this process using sys_sched_setscheduler and sys_sched_setparam
RLIMIT_SIGPENDING Specifies the limit on the number of signals that may be queued for the real user ID of the calling process.
RLIMIT_STACK The maximum size of the process stack, in bytes.
ecx Pointer to a rlimit structure which will receive the return information:
struc rlimit
{
.rlim_cur rd 1 ; 'soft' limit
.rlim_max rd 1 ; 'hard' limit
}
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).

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EINVAL ebx is not valid
-EFAULT Value in ecx points outside the accessible address space.

Remarks

In older Linux kernels, the SIGXCPU and SIGKILL signals delivered when a process encountered the soft and hard RLIMIT_CPU limits were delivered one (CPU) second later than they should have been. This was fixed in kernel 2.6.8.

A kernel bug means that RLIMIT_RTPRIO does not work in kernel 2.6.12; the problem is fixed in kernel 2.6.13.

In kernel 2.6.12, there was an off-by-one mismatch between the priority ranges returned by sys_getpriority and RLIMIT_NICE. This had the effect that actual ceiling for the nice value was calculated as 19 - rlim_cur. This was fixed in kernel 2.6.13.

In 2.6.x kernels before 2.6.17, a RLIMIT_CPU limit of 0 is wrongly treated as "no limit" (like RLIM_INFINITY). Since kernel 2.6.17, setting a limit of 0 does have an effect, but is actually treated as a limit of 1 second.

See sys_setrlimit for more information.

Compatibility

n/a