COHERENT manpages

This page displays the COHERENT manpage for ulimit() [Get/set limits for a process].

List of available manpages
Index


ulimit() -- System Call (libc)

Get/set limits for a process
#include <ulimit.h>
long ulimit (command [, blocks^])
int command, blocks^;

The system call ulimit() retrieves or sets limits on what a process can do.
command indicates what you want it to do, as follows:

UL_GETFSIZE
   Return the maximum  size, in blocks, of a file  that the current process
   can create.

UL_SETFSIZE
   Limit  to blocks  the size  of  any regular  file that  any process  can
   create.  A process may decrease this  limit, but only a process owned by
   the superuser root can increase it.

UL_GMEMLIM
   Return  the current  process's break  value.  For  details on  the break
   value, see the Lexicon entry for brk().

UL_GDESLIM
   Return the maximum number of files that this process can open.

Each of  the above commands  is defined in  the header file  ulimit.h. When
called  to execute  the  command UL_SETFSIZE,  ulimit()  requires a  second
integer argument; when called  to execute any other command, ulimit() takes
only one argument.

If all goes well, ulimit() returns a non-negative value.  ulimit() fails if
any of the following occur:

-> A process  owned by someone  other than the superuser  root attempted to
   increase its  file-size limit.   ulimit() returns  -1 and sets  errno to
   EPERM.

-> The  first argument  to ulimit()  was  something other  than one  of the
   above-named values.  ulimit() returns -1 and sets errno to EINVAL.

See Also

brk(),
libc,
ulimit.h

Notes

ulimit() does not fail per se  if you invoke it with option UL_SETFSIZE and
do not supply a second argument.   However, doing so will (or should) crash
the process.  Caveat utilitor.