*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> setrlimit (2)              
Title
Content
Arch
Section
 

getrlimit(2)

Contents


NAME    [Toc]    [Back]

       getrlimit,  setrlimit  -  Control  maximum system resource
       consumption

SYNOPSIS    [Toc]    [Back]

       #include <sys/resource.h>

       int getrlimit(
               int resource1,
               struct rlimit *rlp ); int setrlimit(
               int resource1,
               const struct rlimit *rlp );

       Application developers may want  to  specify  an  #include
       statement    for   <sys/time.h>   before   the   one   for
       <sys/resource.h> if programs are being developed for  multiple
  platforms. The additional #include statement is not
       required on Tru64 UNIX systems or by ISO or XSH standards,
       but may be required on other vendors' systems that conform
       to these standards.

       [Tru64 UNIX]  The following declaration of the setrlimit()
       function does not conform to current standards and is supported
 only for backward compatibility: int setrlimit
               int resource1,
               struct rlimit *rlp );

STANDARDS    [Toc]    [Back]

       Interfaces documented on this reference  page  conform  to
       industry standards as follows:

       getrlimit(), setrlimit(): XSH4.2, XSH5.0

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies one of the following values: The  maximum  size,
       in  bytes,  of  the  total  memory available to a process.
       Exceeding this limit causes the brk(),  malloc(),  mmap(),
       and  sbrk()  functions to fail with errno set to [ENOMEM].
       Also, the  automatic  stack  growth  will  fail  with  the
       effects  described  under RLIMIT_STACK.  The largest size,
       in bytes, of a core file that can be created. A limit of 0
       (zero)  prevents the process from creating a core file. If
       a process exceeds this limit, any  remaining  data  to  be
       written  to  the core file is lost.  The maximum amount of
       CPU time, in seconds, to be used by a process. If the process
 exceeds this limit, the system sends the SIGXCPU signal
 to the process.  The maximum size, in bytes, of a process's
  data  segment.  Exceeding  this  limit  causes the
       brk(), malloc(), mmap(), and sbrk() functions to fail with
       errno set to [ENOMEM].  The maximum size, in bytes, of any
       single file that can be created. A limit of 0 (zero)  prevents
  the process from creating a file. If write attempts
       to extend a file already at its limit or a truncate operation
  would  cause  this  limit to be exceeded, the system
       generates the SIGXFSZ signal. If the process is  blocking,
       catching,  or  ignoring  SIGXFSZ,  continued  attempts  to
       increase the size of a file from end-of-file to beyond the
       limit  will  fail  with errno set to [EFBIG].  The maximum
       number of open file descriptors that the process can have.
       Any  functions that attempt to create new file descriptors
       when the maximum hard limit has  been  reached  will  fail
       with errno set to [EMFILE].

              [Tru64  UNIX]  The  default  maximum  is  4096 file
              descriptors. The maximum can be 64K  file  descriptors
  when  a  process has enabled support for more
              than 4096 open file descriptors. See the discussion
              of   the  open_max_hard  and  open_max_soft  system
              attributes  in  sys_attrs_proc(5)  for  information
              about  increasing the soft and hard limits for open
              file descriptors.  [Tru64 UNIX]  The maximum  size,
              in  bytes,  to  which a process's resident set size
              can grow. This value imposes a limit on the  amount
              of  physical memory that can be given to a process.
              If memory is in short supply, the system prefers to
              take memory from processes that are exceeding their
              declared resident set size.  The maximum  size,  in
              bytes,  of  a  process's stack. The system will not
              automatically grow the stack beyond this limit.  If
              this  limit  is  exceeded, SIGSEGV is generated for
              the process. If the process is blocking or ignoring
              SIGSEGV,  or  is  catching SIGSEGV and has not made
              arrangements to use an alternate stack, the  disposition
  of  SIGSEGV  is set to SIG_DFL before it is
              generated.  Points to the rlimit  structure,  which
              contains the current soft and hard limits.  For the
              getrlimit()  function,  the  requested  limits  are
              returned  in  this  structure;  for the setrlimit()
              function, the  desired  new  limits  are  specified
              here.

DESCRIPTION    [Toc]    [Back]

       The  getrlimit()  function  obtains the limits on the consumption
 of system resources by the  current  process  and
       each  process it creates. You use the setrlimit() function
       to set these resources.

       Each resource limit is specified as either a soft limit or
       a hard limit.  When a soft limit is exceeded (for example,
       if the CPU time is exceeded), a process can receive a signal
  until  it reaches the hard limit or until it modifies
       its resource limit. The rlimit structure is used to  specify
  the hard and soft limits on a resource, as defined in
       the <sys/resource.h> header file.

       The calling process must have superuser privilege in order
       to  raise  the maximum limits. An unprivileged process can
       alter the rlim_cur field of the  rlimit  structure  within
       the  range from 0 (zero) to rlim_max or can (irreversibly)
       lower rlim_max.

       An infinite value for a limit is defined as RLIM_INFINITY,
       which  means  that  no limit is enforced for the specified
       resource.

       Because this information  is  stored  in  the  per-process
       information,  and  inherited  by  fork(),  the setrlimit()
       function should be executed directly by the shell in order
       to affect all future processes created by the shell. Thus,
       rlimit is a built-in command to the shells.





NOTES    [Toc]    [Back]

       The ulimit() function is implemented  in  terms  of  setrlimit().
  Therefore, the two interfaces should not be used
       in the same program. The result of doing so is  undefined.

       [Tru64  UNIX]  When  compiled  in the X/Open UNIX environment,
 calls to the  setrlimit()  function  are  internally
       renamed  by  prepending  _E to the function name. When you
       are debugging a module that includes the setrlimit() function
   and   for  which  _XOPEN_SOURCE_EXTENDED  has  been
       defined, use _Esetrlimit to refer to the setrlimit() call.
       See standards(5) for additional information.

RETURN VALUES    [Toc]    [Back]

       Upon successful completion, these functions return a value
       of 0 (zero).  Otherwise, the functions return a  value  of
       -1 and set errno to indicate the error.

ERRORS    [Toc]    [Back]

       If the getrlimit() or setrlimit() function fails, errno is
       set to one of the following values for the specified  conditions:
  [Tru64  UNIX]  The address specified for the rlp
       parameter is invalid.  An invalid resource was  specified,
       or  the  new  rlim_cur  specified  in  a  setrlimit() call
       exceeds the new rlim_max specified in that same call.  The
       limit  specified  to  the  setrlimit() function would have
       raised the maximum limit value, and  the  calling  process
       does not have appropriate privilege.

SEE ALSO    [Toc]    [Back]

      
      
       Functions:   quotactl(2),   setsysinfo(2),   sigaction(2),
       sigstack(2), sigvec(2), ulimit(3)

       Standards: standards(5)



                                                     getrlimit(2)
[ Back ]
 Similar pages
Name OS Title
getrlimit HP-UX control maximum resource consumption
setrlimit HP-UX control maximum resource consumption
cvmeter IRIX examine process resource consumption data
strctlsz HP-UX maximum size of streams message control (bytes)
STRCTLSZ HP-UX maximum size of streams message control (bytes)
msgmni HP-UX maximum number of system-wide System V IPC message queues (IDs) allowed
msgtql HP-UX maximum number of System V IPC messages in the system at any time
semvmx HP-UX maximum value of any single System V IPC semaphore
gss_wrap_size_limit Tru64 set the maximum input message size for the required maximum output token
msgmax HP-UX maximum System V IPC message size in bytes
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service