ulimit - get and set process limits
Standard C Library (libc, -lc)
#include <ulimit.h>
long int
ulimit(int cmd, ...);
The 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_GETFSIZE Return the soft file size limit of the process. The value
returned is in units of 512-byte blocks. If the result
cannot be represented in an object of type long int, the
result is unspecified.
UL_SETFSIZE Set the hard and soft file size limits of the process to
the value of the second argument passed, which is in units
of 512-byte blocks, and which is expected to be of type
long int. The new file size limit of the process is
returned. Any process may decrease the limit, but raising
it is only permitted if the caller is the super-user.
If successful, the ulimit() function will not change the setting of
errno.
The ulimit() function is an obsolete interface; applications are encouraged
to use getrlimit(2) and setrlimit(2) instead.
If successful, the 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.
The ulimit() function will fail if:
[EINVAL] The cmd argument is not valid.
[EPERM] It was attempted to increase a limit, and the caller
is not the super-user.
getrlimit(2), setrlimit(2)
The ulimit() function conforms to X/Open System Interfaces and Headers
Issue 5 (``XSH5'').
BSD September 13, 1999 BSD
[ Back ] |