Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
getrlimit(2)		      System Calls Manual		  getrlimit(2)

NAME
       getrlimit(), setrlimit()	- control maximum resource consumption

SYNOPSIS
DESCRIPTION
       Limits  on  the	consumption  of	 a variety of resources	by the calling
       process may be obtained with and	set with Each call to either or	 iden-
       tifies  a  specific  resource to	be operated upon as well as a resource
       limit.  A resource limit	is represented by an structure,	pointed	to  by
       the rlp argument	and includes the following members:

	      rlim_t rlim_cur;	      /* Current (soft)	limit */
	      rlim_t rlim_max;	      /* Hard limit */

       The member specifies the	current	or soft	limit and the member specifies
       the maximum or hard limit.  Soft	limits may be changed by a process  to
       any  value that is less than or equal to	the hard limit.	 A process may
       (irreversibly) lower its	hard limit to any value	that is	 greater  than
       or equal	to the soft limit.  Only a process with	appropriate privileges
       can raise a hard	limit.	Both hard and soft limits can be changed in  a
       single call to subject to the constraints described above.

       The  value  defined  in is considered to	be larger than any other limit
       value.  If a call to returns for	a resource, it means  the  implementa-
       tion  does  not enforce limits on that resource.	 Specifying as any re-
       source limit value on a successful call to inhibits enforcement of that
       resource	limit.

       The following resources are defined:

       This is the maximum size	of a core file in bytes	that may
				be  created  by	 a process.  A limit of	0 will
				prevent	the creation of	a core file.  If  this
				limit  is exceeded, the	writing	of a core file
				will terminate at this size.

       This is the maximum amount of CPU time in seconds allowed
				for a UNIX 95 conforming application.  If this
				limit is exceeded, is generated	for the	appli-
				cation.	 The default action for	a UNIX 95 con-
				forming	application is to kill the process and
				leave a	core file.  If the process  is	block-
				ing,  catching or ignoring the behavior	is un-
				specified.  If the application	is  a  Classic
				HP-UX  application,  the  kernel will not send
				the signal as a	result of  exceeding  the  CPU
				limit.	 However,  if  this signal is sent ex-
				plicitly to a Classic HP-UX application	by an-
				other  application  or	via  the command, this
				signal will be delivered and the  default  ac-
				tion  will be taken.  In order for an applica-
				tion to	be UNIX	95, it must be linked with ei-
				ther directly or indirectly.  For example:

				Or,

       This is the maximum size	of a process data segment in bytes.
				If  this  limit	is exceeded, the and functions
				will fail with set to ENOMEM.  Attempts	to set
				to  will  always fail.	The upper limit	is en-
				forced through the tunable

       This option is only applicable to UNIX 95 conforming applications.
				Please see option  above  for  explanation  on
				UNIX  95 conforming applications.  This	is the
				maximum	size of	a file in bytes	 that  may  be
				created	 by a process.	A limit	of 0 will pre-
				vent the creation of a file.  If  a  write  or
				truncate  operation  would cause this limit to
				be exceeded, is	generated for the process.  If
				the  process is	blocking, catching or ignoring
				continued attempts to increase the size	 of  a
				file from end-of-file to beyond	the limit will
				fail with set to EFBIG.

       This is a number	one greater than the maximum value that	the system
				may assign to a	newly-created descriptor.   If
				this  limit  is	exceeded, functions that allo-
				cate new file descriptors may fail with	set to
				EMFILE.	  This	limit constrains the number of
				file descriptors that a	process	may allocate.

       This is the maximum size	of a process stack in bytes.
				The implementation will	not automatically grow
				the stack beyond this limit.  If this limit is
				exceeded, is generated for  the	 process.   If
				the  process  is  blocking  or	ignoring or is
				catching and has not made arrangements to  use
				an alternate stack, the	disposition of will be
				set to before it is  generated.	  Attempts  to
				set  to	 will always fail.  The	upper limit is
				enforced through the tunable

       This is the maximum size	of a process's total available memory,
				in bytes.  If this limit is exceeded, the  and
				functions  will	 fail  with set	to ENOMEM.  In
				addition, the automatic	stack growth will fail
				with the effects outlined above.

       This is the maximum number of POSIX Asynchronous	I/O operations
				that  a	 process  can have enqueued simultane-
				ously.	If this	limit  is  exceeded,  the  and
				functions will fail with set to	EAGAIN.

       This is the maximum number of bytes of memory that can be locked
				simultaneously	by  POSIX Asynchronous I/O re-
				quests from a single process.

RETURN VALUE
       Upon successful completion, and return 0.  Otherwise,  these  functions
       return -1 and set to indicate the error.

ERRORS
       The and functions will fail if:

	      [EINVAL]	     An	 invalid resource was specified; or in a call,
			     the new rlim_cur exceeds the new rlim_max.

	      [EFAULT]	     The address specified for rlp is invalid.	 Reli-
			     able  detection  of  this error is	implementation
			     dependent.

	      [EPERM]	     The limit specified to would have raised the max-
			     imum  limit  value,  and the calling process does
			     not have appropriate privileges.

       The function may	fail if:

	      [EINVAL]	     The limit specified  cannot  be  lowered  because
			     current usage is already higher than the limit.

	      [EPERM]	     The  rlp  argument	specified a hard or soft limit
			     higher than the current hard limit	value, and the
			     caller does not have the appropriate privileges.

	      [EINVAL]	     A	user with appropriate privileges has attempted
			     to	raise  rlp->rlim_cur  or  rlp->rlim_max	 to  a
			     value  greater than the system is capable of sup-
			     porting.

	      [EINVAL]	     The value of rlp->rlim_cur	is less	than the  num-
			     ber  of  file descriptors the process already has
			     allocated.

	      [EINVAL]	     The value of rlp->rlim_max	is less	than the  cur-
			     rent soft limit.

WARNINGS
       The maximum size	of a file returned by is in terms of bytes.  The maxi-
       mum size	of a file returned by (see ulimit(2))  with  is	 in  terms  of
       blocks  of size 512 bytes.  The value returned by with may thus have to
       be rounded down to a multiple of	512.

       The total address space used by a process depends on the	platform it is
       run  on.	  When porting applications, limits set	by with	may need to be
       adjusted.  For example, programs	tend to	use more memory	on IA  systems
       than on PA systems.

AUTHOR
       and  were  developed  by	 HP,  AT&T,  and the University	of California,
       Berkeley.

SEE ALSO
       brk(2), exec(2),	 fork(2),  creat64(2),	malloc(3C),  open(2),  sigalt-
       stack(2),  sysconf(2),  ulimit(2), maxdsiz(5), maxssiz(5), <stropts.h>,
       <sys/resource.h>.

CHANGE HISTORY
       First released in Issue 4, Version 2.

								  getrlimit(2)

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | WARNINGS | AUTHOR | SEE ALSO | CHANGE HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=getrlimit&sektion=2&manpath=HP-UX+11.22>

home | help