ulimit(2) ulimit(2)
NAME
ulimit - get and set process limits
SYNOPSIS
#include <ulimit.h>
long int ulimit(int cmd, ... /* newlimit */ );
DESCRIPTION
This function provides for control over process limits. The cmd values
available are:
ULGETFSIZE Return the soft file size limit of the process. The limit
is in units of 512-byte blocks and is inherited by child
processes. Files of any size can be read. The return
value is the integer part of the soft file size limit
divided by 512. If the result cannot be represented as a
long int the result is unspecified.
ULSETFSIZE Set the hard and soft file size limits for output opera-
tions of the process to the value of the second argument,
taken as a long int. Any process may decrease its own hard
limit, but only a process with appropriate privileges may
increase the limit. The new file size limit is returned.
The hard and soft file size limits are set to the speci-
fied value multiplied by 512. If the result would overflow
an rlimitt the actual value set is unspecified.
ULGMEMLIM Gets the maximum possible break value [see brk(2)].
ULGDESLIM Gets the current value of the maximum number of open
files per process configured in the system.
ERRORS
The following error code descriptions are function-specific. You will
find a general description in introprm2(2) or in errno(5).
The ulimit() system call fails if either of the following applies:
EINVAL The cmd argument is not valid.
EPERM A process with an effective user ID other than superuser
attempts to increase its file size limit.
NOTES
ulimit() is effective in limiting the growth of regular files. Pipes
are currently limited to PIPEMAX.
The ulimit() function will return "unlimited" if the current soft file
size limit cannot be represented correctly in an object of type long.
As this function is already obsolescent, the use of getrlimit() and
setrlimit() is recommended for getting and setting process limits.
Page 1 Reliant UNIX 5.44 Printed 11/98
ulimit(2) ulimit(2)
RESULT
Upon successful completion, a non-negative value is returned. Other-
wise, a value of -1 is returned and errno is set to indicate the
error.
SEE ALSO
brk(2), getrlimit(2), setrlimit(2), write(2), lfs(5), ulimit(5).
Page 2 Reliant UNIX 5.44 Printed 11/98