Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-5.9)
Apropos / Subsearch:
optional field

System Calls                                            ulimit(2)

     ulimit - get and set process limits

     #include <ulimit.h>

     long ulimit(int cmd, /* newlimit */...);

     The ulimit() function provides for control over process lim-
     its.  It  is  effective  in  limiting  the growth of regular
     files. Pipes are limited to PIPE_MAX bytes.

     The cmd values, defined in <ulimit.h>, include:

           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.

           Set the hard and soft  file  size  limits  for  output
           operations  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 specified value  multiplied
           by 512.  If the result would overflow an rlimit_t, the
           actual value set is unspecified.

           Get the maximum possible break value (see brk(2)).

           Get the current value of the maximum  number  of  open
           files per process configured in the system.

     Upon successful completion, ulimit() returns  the  value  of
     the  requested  limit.  Otherwise, -1 is returned, the limit
     is not changed, and errno is set to indicate the error.

     The ulimit() function will fail if:

           The cmd argument is not valid.

SunOS 5.9           Last change: 18 Apr 1997                    1

System Calls                                            ulimit(2)

     EPERM A process not having appropriate  privileges  attempts
           to increase its file size limit.

     Since all return values  are  permissible  in  a  successful
     situation,  an application wishing to check for error situa-
     tions should set errno to 0, then call ulimit(), and  if  it
     returns -1, check if errno is non-zero.

     The getrlimit() and setrlimit()  functions  provide  a  more
     general  interface  for  controlling process limits, and are
     preferred over ulimit().  See getrlimit(2).

     brk(2), getrlimit(2), write(2)

SunOS 5.9           Last change: 18 Apr 1997                    2