1994-05-06 10:25:29 +04:00
|
|
|
.\" Copyright (c) 1980, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1997-10-09 14:20:07 +04:00
|
|
|
.\" from: @(#)vlimit.3 8.1 (Berkeley) 6/4/93
|
1998-04-29 03:03:56 +04:00
|
|
|
.\" $NetBSD: vlimit.3,v 1.5 1998/04/28 23:03:56 fair Exp $
|
1994-05-06 10:25:29 +04:00
|
|
|
.\"
|
|
|
|
.Dd June 4, 1993
|
|
|
|
.Dt VLIMIT 3
|
|
|
|
.Os BSD 4
|
|
|
|
.Sh NAME
|
|
|
|
.Nm vlimit
|
|
|
|
.Nd control maximum system resource consumption
|
1998-02-05 21:45:17 +03:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libcompat
|
1994-05-06 10:25:29 +04:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Fd #include <sys/vlimit.h>
|
|
|
|
.Fn vlimit resource value
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Bf -symbolic
|
1995-01-13 04:15:53 +03:00
|
|
|
This interface is obsoleted by
|
|
|
|
.Xr getrlimit 2 .
|
1994-05-06 10:25:29 +04:00
|
|
|
It is available from the compatibility library, libcompat.
|
|
|
|
.Ef
|
|
|
|
.Pp
|
|
|
|
Limits the consumption by the current process and each process
|
1998-04-29 03:03:56 +04:00
|
|
|
it creates to not individually exceed
|
1994-05-06 10:25:29 +04:00
|
|
|
.Fa value
|
|
|
|
on the specified
|
|
|
|
.Fa resource .
|
|
|
|
If
|
|
|
|
.Fa value
|
|
|
|
is specified as \-1, then the current limit is returned and the
|
|
|
|
limit is unchanged.
|
|
|
|
The resources which are currently controllable are:
|
|
|
|
.Bl -tag -width LIM_NORAISE
|
|
|
|
.It Dv LIM_NORAISE
|
|
|
|
A pseudo-limit; if set non-zero then the limits may not be raised.
|
|
|
|
Only the super-user may remove the
|
|
|
|
.Em noraise
|
|
|
|
restriction.
|
|
|
|
.It Dv LIM_CPU
|
|
|
|
the maximum
|
|
|
|
number of cpu-seconds to be used by each process
|
|
|
|
.It Dv LIM_FSIZE
|
|
|
|
the largest single file which can be created
|
|
|
|
.It Dv LIM_DATA
|
|
|
|
the maximum growth of the data+stack region via
|
|
|
|
.Xr sbrk 2
|
|
|
|
beyond the end of the program text
|
|
|
|
.It Dv LIM_STACK
|
|
|
|
the maximum
|
|
|
|
size of the automatically-extended stack region
|
|
|
|
.It Dv LIM_CORE
|
|
|
|
the size of the largest core dump that will be created.
|
|
|
|
.It Dv LIM_MAXRSS
|
|
|
|
a soft limit for the amount of physical memory (in bytes) to be given
|
1998-04-29 03:03:56 +04:00
|
|
|
to the program.
|
|
|
|
If memory is tight, the system will prefer to take memory
|
1994-05-06 10:25:29 +04:00
|
|
|
from processes which are exceeding their declared
|
|
|
|
.Dv LIM_MAXRSS.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Because this information is stored in the per-process information
|
|
|
|
this system call must be executed directly by the shell if it
|
|
|
|
is to affect all future processes created by the shell;
|
1998-04-29 03:03:56 +04:00
|
|
|
.Xr limit 1
|
1994-05-06 10:25:29 +04:00
|
|
|
is thus a built-in command to
|
|
|
|
.Xr csh 1 .
|
|
|
|
.Pp
|
|
|
|
The system refuses to extend the data or stack space when the limits
|
|
|
|
would be exceeded in the normal way; a
|
1998-04-29 03:03:56 +04:00
|
|
|
.Xr brk 2
|
1994-05-06 10:25:29 +04:00
|
|
|
call fails if the data space limit is reached, or the process is
|
|
|
|
killed when the stack limit is reached (since the stack cannot be
|
|
|
|
extended, there is no way to send a signal!).
|
|
|
|
.Pp
|
|
|
|
A file
|
|
|
|
.Tn I/O
|
|
|
|
operation which would create a file which is too large
|
|
|
|
will cause a signal
|
|
|
|
.Dv SIGXFSZ
|
|
|
|
to be generated, this normally terminates
|
|
|
|
the process, but may be caught.
|
|
|
|
When the cpu time limit is exceeded, a signal
|
|
|
|
.Dv SIGXCPU
|
|
|
|
is sent to the
|
|
|
|
offending process; to allow it time to process the signal it is
|
|
|
|
given 5 seconds grace by raising the
|
|
|
|
.Tn CPU
|
|
|
|
time limit.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr csh 1
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Fn vlimit
|
1998-04-29 03:03:56 +04:00
|
|
|
function appeared in
|
1994-05-06 10:25:29 +04:00
|
|
|
.Bx 4.2 .
|
|
|
|
.Sh BUGS
|
|
|
|
.Dv LIM_NORAISE
|
|
|
|
no longer exists.
|