| ULIMIT(3) | Library Functions Manual | ULIMIT(3) |
ulimit —
#include <ulimit.h>
long int
ulimit(int
cmd, ...);
ulimit() function provides a method to query or
alter resource limits of the calling process. The method to be performed is
specified by the cmd argument; possible values are:
UL_GETFSIZEUL_SETFSIZEIf successful, the ulimit() function will
not change the setting of errno.
ulimit() function returns the value
of the requested limit. Otherwise, it returns -1, sets
errno to indicate an error, and the limit is not
changed. Therefore, to detect an error condition applications should set
errno to 0, call ulimit(), and
check if -1 is returned and errno is non-zero.
ulimit() function will fail if:
ulimit() function conforms to
X/Open System Interfaces and Headers Issue 5
(“XSH5”) and IEEE Std 1003.1-2001
(“POSIX.1”). It was marked as obsolete in the
IEEE Std 1003.1-2008 (“POSIX.1”)
revision, which recommended the use of
getrlimit(2) and
setrlimit(2) instead, noting
that because ulimit() uses the type
long rather than rlim_t, it may
not be sufficient for file sizes on many current systems.
| April 30, 2010 | NetBSD 10.1 |