xref: /freebsd/lib/libc/gen/ulimit.3 (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
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.\" $FreeBSD$
25.\"
26.Dd January 4, 2003
27.Dt ULIMIT 3
28.Os
29.Sh NAME
30.Nm ulimit
31.Nd get and set process limits
32.Sh LIBRARY
33.Lb libc
34.Sh SYNOPSIS
35.In ulimit.h
36.Ft long
37.Fn ulimit "int cmd" "..."
38.Sh DESCRIPTION
39The
40.Fn ulimit
41function will get and set process limits.
42Currently this is limited to the maximum file size.
43The
44.Fa cmd
45argument is one of the following:
46.Bl -tag -width ".Dv UL_GETFSIZE"
47.It Dv UL_GETFSIZE
48will return the maximum file size in units of 512 blocks of
49the current process.
50.It Dv UL_SETFSIZE
51will attempt to set the maximum file size of the current
52process and its children with the second argument expressed as a long.
53.El
54.Sh RETURN VALUES
55Upon successful completion,
56.Fn ulimit
57returns the value requested;
58otherwise the value \-1 is returned and the global variable
59.Va errno
60is set to indicate the error.
61.Sh ERRORS
62The
63.Fn ulimit
64function will fail if:
65.Bl -tag -width Er
66.It Bq Er EINVAL
67The command specified was invalid.
68.It Bq Er EPERM
69The limit specified to
70.Fn ulimit
71would have raised the maximum limit value,
72and the caller is not the super-user.
73.El
74.Sh SEE ALSO
75.Xr getrlimit 2
76.Sh STANDARDS
77The
78.Fn ulimit
79function conforms to
80.St -p1003.1-2001 .
81.Sh HISTORY
82The
83.Fn ulimit
84function first appeared in
85.Fx 5.0 .
86.Sh BUGS
87The
88.Fn ulimit
89function provides limited precision for
90setting and retrieving process limits.
91If there is a need for greater precision than the
92type
93.Vt long
94provides, the
95.Xr getrlimit 2
96and
97.Xr setrlimit 2
98functions should be considered.
99