xref: /original-bsd/lib/libcompat/4.1/vlimit.3 (revision 4092c5cc)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)vlimit.3	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt VLIMIT 3
10.Os BSD 4
11.Sh NAME
12.Nm vlimit
13.Nd control maximum system resource consumption
14.Sh SYNOPSIS
15.Fd #include <sys/vlimit.h>
16.Fn vlimit resource value
17.Sh DESCRIPTION
18.Bf -symbolic
19This interface is obsoleted by getrlimit(2).
20It is available from the compatibility library, libcompat.
21.Ef
22.Pp
23Limits the consumption by the current process and each process
24it creates to not individually exceed
25.Fa value
26on the specified
27.Fa resource .
28If
29.Fa value
30is specified as \-1, then the current limit is returned and the
31limit is unchanged.
32The resources which are currently controllable are:
33.Bl -tag -width LIM_NORAISE
34.It Dv LIM_NORAISE
35A pseudo-limit; if set non-zero then the limits may not be raised.
36Only the super-user may remove the
37.Em noraise
38restriction.
39.It Dv LIM_CPU
40the maximum
41number of cpu-seconds to be used by each process
42.It Dv LIM_FSIZE
43the largest single file which can be created
44.It Dv LIM_DATA
45the maximum growth of the data+stack region via
46.Xr sbrk 2
47beyond the end of the program text
48.It Dv LIM_STACK
49the maximum
50size of the automatically-extended stack region
51.It Dv LIM_CORE
52the size of the largest core dump that will be created.
53.It Dv LIM_MAXRSS
54a soft limit for the amount of physical memory (in bytes) to be given
55to the program.  If memory is tight, the system will prefer to take memory
56from processes which are exceeding their declared
57.Dv LIM_MAXRSS.
58.El
59.Pp
60Because this information is stored in the per-process information
61this system call must be executed directly by the shell if it
62is to affect all future processes created by the shell;
63.Xr limit
64is thus a built-in command to
65.Xr csh 1 .
66.Pp
67The system refuses to extend the data or stack space when the limits
68would be exceeded in the normal way; a
69.Xr break 2
70call fails if the data space limit is reached, or the process is
71killed when the stack limit is reached (since the stack cannot be
72extended, there is no way to send a signal!).
73.Pp
74A file
75.Tn I/O
76operation which would create a file which is too large
77will cause a signal
78.Dv SIGXFSZ
79to be generated, this normally terminates
80the process, but may be caught.
81When the cpu time limit is exceeded, a signal
82.Dv SIGXCPU
83is sent to the
84offending process; to allow it time to process the signal it is
85given 5 seconds grace by raising the
86.Tn CPU
87time limit.
88.Sh SEE ALSO
89.Xr csh 1
90.Sh HISTORY
91The
92.Fn vlimit
93function appeared in
94.Bx 4.2 .
95.Sh BUGS
96.Dv LIM_NORAISE
97no longer exists.
98