xref: /freebsd/lib/libc/gen/ulimit.3 (revision c4fde87a3236b500246d4fce76dbca2a3d64f73a)
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 October 8, 2026
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.Fo ulimit
36.Fa "int cmd"
37.Fa "..."
38.Fc
39.Sh DESCRIPTION
40The
41.Fn ulimit
42function will get and set process limits.
43Currently, this is limited to the maximum file size.
44The
45.Fa cmd
46argument is one of the following:
47.Bl -tag -width ".Dv UL_GETFSIZE"
48.It Dv UL_GETFSIZE
49will return the maximum file size of the current process,
50in units of 512-byte blocks.
51.It Dv UL_SETFSIZE
52will attempt to set the maximum file size of the current
53process and its children, using the second argument (expressed as a long).
54.El
55.Sh RETURN VALUES
56.Rv -std
57.Sh ERRORS
58The
59.Fn ulimit
60function will fail if:
61.Bl -tag -width Er
62.It Bq Er EINVAL
63The command specified was invalid.
64.It Bq Er EPERM
65The limit specified to
66.Fn ulimit
67would have raised the maximum limit value,
68and the caller is not the super-user.
69.El
70.Sh SEE ALSO
71.Xr getrlimit 2
72.Sh STANDARDS
73The
74.Fn ulimit
75function conforms to
76.St -p1003.1-2001 .
77.Sh HISTORY
78The
79.Fn ulimit
80function first appeared in
81.Fx 5.0 .
82.Sh BUGS
83The
84.Fn ulimit
85function provides limited precision for
86setting and retrieving process limits.
87If there is a need for greater precision than the
88type
89.Vt long
90provides, the
91.Xr getrlimit 2
92and
93.Xr setrlimit 2
94functions should be considered.
95