HP-UX Reference (11i v2 04/09) - 2 System Calls (vol 5)
g
getrlimit(2) getrlimit(2)
attempts to increase the size of a file from end-of-file to beyond the limit will
fail with errno set to [EFBIG].
RLIMIT_NOFILE
This is a number one greater than the maximum value that the system may
assign to a newly-created descriptor. If this limit is exceeded, functions that
allocate new file descriptors may fail with errno set to [EMFILE]. This limit
constrains the number of file descriptors that a process may allocate.
RLIMIT_STACK This is the maximum size of a process stack in bytes. The implementation will
not automatically grow the stack beyond this limit. If this limit is exceeded,
SIGSEGV is generated for the process. If the process is blocking or ignoring
SIGSEGV, or is catching SIGSEGV and has not made arrangements to use an
alternate stack, the disposition of SIGSEGV will be set to
SIG_DFL before it
is generated. Attempts to set
RLIMIT_STACK to RLIM_INFINITY
will
always fail. The upper limit is enforced through the tunable
maxssiz.
RLIMIT_AS This is the maximum size of a process’s total available memory, in bytes. If
this limit is exceeded, the
brk(), malloc()
, mmap(), and sbrk() func-
tions will fail with
errno set to [ENOMEM]. In addition, the automatic stack
growth will fail with the effects outlined above.
RLIMIT_AIO_OPS
This is the maximum number of POSIX Asynchronous I/O operations that a
process can have enqueued simultaneously. If this limit is exceeded, the
aio_read(), aio_write(), and lio_listio() functions will fail with
errno set to [EAGAIN].
RLIMIT_AIO_MEM This is the maximum number of bytes of memory that can be locked simul-
taneously by POSIX Asynchronous I/O requests from a single process.
RETURN VALUE
Upon successful completion,
getrlimit() and setrlimit() return 0. Otherwise, these functions
return −1 and set errno to indicate the error.
ERRORS
The
getrlimit() and setrlimit() functions will fail if:
[EINVAL] An invalid resource was specified; or in a
setrlimit() call, the new rlim_cur
exceeds the new rlim_max .
[EFAULT] The address specified for rlp is invalid. Reliable detection of this error is implemen-
tation dependent.
[EPERM] The limit specified to
setrlimit() would have raised the maximum limit value,
and the calling process does not have appropriate privileges.
The
setrlimit() function may fail if:
[EINVAL] The limit specified cannot be lowered because current usage is already higher than
the limit.
[EPERM] The rlp argument specified a hard or soft limit higher than the current hard limit
value, and the caller does not have the appropriate privileges.
[EINVAL] A user with appropriate privileges has attempted to raise rlp−>rlim_cur or
rlp−>rlim_max to a value greater than the system is capable of supporting.
[EINVAL] The value of rlp −>rlim_cur is less than the number of file descriptors the process
already has allocated.
[EINVAL] The value of rlp−>rlim_max is less than the current soft limit.
WARNINGS
The maximum size of a file returned by
getrlimit() is in terms of bytes. The maximum size of a file
returned by ulimit (see ulimit (2)) with UL_GETFSIZE is in terms of blocks of size 512 bytes. The
value returned by ulimit with UL_GETFSIZE may thus have to be rounded down to a multiple of 512.
The total address space used by a process depends on the platform it is run on. When porting applica-
tions, limits set by
setrlimit() with RLIMIT_AS may need to be adjusted. For example, programs
tend to use more memory on Itanium-based systems than on PA-RISC systems.
Section 2−−112 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: September 2004