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