getrlimit man page on DigitalUNIX

Printed from

getrlimit(2)							  getrlimit(2)

       getrlimit, setrlimit - Control maximum system resource consumption

       #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	 back‐
       ward compatibility: int setrlimit
	       int resource1,
	       struct rlimit *rlp );

       Interfaces  documented on this reference page conform to industry stan‐
       dards as follows:

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

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

       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 remain‐
       ing 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 dis‐
	      cussion 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	 auto‐
	      matically	 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.

       The  getrlimit() function obtains the limits on the consumption of sys‐
       tem 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.

       The  ulimit()  function	is implemented in terms of setrlimit(). There‐
       fore, 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 setr‐
       limit() function and for which _XOPEN_SOURCE_EXTENDED has been defined,
       use  _Esetrlimit to refer to the setrlimit() call. See standards(5) for
       additional information.

       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.

       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	privi‐

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

       Standards: standards(5)


List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net