xref: /freebsd/lib/libc/gen/ulimit.3 (revision 5e3190f700637fcfc1a52daeaa4a031fdd2557c7)
1.\" Copyright (c) 2002 Kyle Martin.  All rights reserved.
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
6.\" 1. Redistributions of source code must retain the above copyright
7.\"    notice, this list of conditions and the following disclaimer.
8.\" 2. Redistributions in binary form must reproduce the above copyright
9.\"    notice, this list of conditions and the following disclaimer in the
10.\"    documentation and/or other materials provided with the distribution.
11.\"
12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22.\" SUCH DAMAGE.
23.\"
24.Dd January 4, 2003
25.Dt ULIMIT 3
26.Os
27.Sh NAME
28.Nm ulimit
29.Nd get and set process limits
30.Sh LIBRARY
31.Lb libc
32.Sh SYNOPSIS
33.In ulimit.h
34.Ft long
35.Fn ulimit "int cmd" "..."
36.Sh DESCRIPTION
37The
38.Fn ulimit
39function will get and set process limits.
40Currently this is limited to the maximum file size.
41The
42.Fa cmd
43argument is one of the following:
44.Bl -tag -width ".Dv UL_GETFSIZE"
45.It Dv UL_GETFSIZE
46will return the maximum file size in units of 512 blocks of
47the current process.
48.It Dv UL_SETFSIZE
49will attempt to set the maximum file size of the current
50process and its children with the second argument expressed as a long.
51.El
52.Sh RETURN VALUES
53Upon successful completion,
54.Fn ulimit
55returns the value requested;
56otherwise the value \-1 is returned and the global variable
57.Va errno
58is set to indicate the error.
59.Sh ERRORS
60The
61.Fn ulimit
62function will fail if:
63.Bl -tag -width Er
64.It Bq Er EINVAL
65The command specified was invalid.
66.It Bq Er EPERM
67The limit specified to
68.Fn ulimit
69would have raised the maximum limit value,
70and the caller is not the super-user.
71.El
72.Sh SEE ALSO
73.Xr getrlimit 2
74.Sh STANDARDS
75The
76.Fn ulimit
77function conforms to
78.St -p1003.1-2001 .
79.Sh HISTORY
80The
81.Fn ulimit
82function first appeared in
83.Fx 5.0 .
84.Sh BUGS
85The
86.Fn ulimit
87function provides limited precision for
88setting and retrieving process limits.
89If there is a need for greater precision than the
90type
91.Vt long
92provides, the
93.Xr getrlimit 2
94and
95.Xr setrlimit 2
96functions should be considered.
97