ulimit(2) manual page
Table of Contents
ulimit - get and set process limits
#include <ulimit.h>
long
ulimit(int cmd, /* newlimit */ ...);
This function provides for
control over process limits. The cmd values available are:
- UL_GETFSIZE
- Get
the regular 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.
- UL_SETFSIZE
- Set the regular file size limit of the process to the value
of newlimit , taken as a long. Any process may decrease this limit, but
only a process with an effective user ID
of super-user may increase the
limit.
- UL_GMEMLIM
- Get the maximum possible break value (see brk(2)
).
- UL_GDESLIM
- Get the current value of the maximum number of open files per process configured
in the system.
The getrlimit() and setrlimit() functions provide a more
general interface for controlling process limits.
Upon successful
completion, a non-negative value is returned. Otherwise, a value of -1 is
returned and errno is set to indicate the error.
ulimit() fails if
the following is true:
- EINVAL
- The cmd argument is not valid.
- EPERM
- The
effective user of the calling process is not super-user.
brk(2)
,
getrlimit(2)
, write(2)
ulimit() is effective in limiting the growth
of regular files. Pipes are limited to {PIPE_MAX} bytes.
Table of Contents