long int
ulimit(int cmd, ...)
)
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_GETFSIZElong int,
the result is unspecified.
UL_SETFSIZElong 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.
)
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.
)
function will fail if:
EINVAL]cmd
argument is not valid.
EPERM])
function conforms to
X/Open System Interfaces and Headers Issue 5 (``XSH5'') .