Annotation of src/lib/libc/gen/ulimit.3, Revision 1.7
1.7 ! wiz 1: .\" $NetBSD: ulimit.3,v 1.6 2002/10/01 16:59:48 wiz Exp $
1.1 kleink 2: .\"
3: .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
4: .\" All rights reserved.
5: .\"
6: .\" This code is derived from software contributed to The NetBSD Foundation
7: .\" by Klaus Klein.
8: .\"
9: .\" Redistribution and use in source and binary forms, with or without
10: .\" modification, are permitted provided that the following conditions
11: .\" are met:
12: .\" 1. Redistributions of source code must retain the above copyright
13: .\" notice, this list of conditions and the following disclaimer.
14: .\" 2. Redistributions in binary form must reproduce the above copyright
15: .\" notice, this list of conditions and the following disclaimer in the
16: .\" documentation and/or other materials provided with the distribution.
17: .\" 3. All advertising materials mentioning features or use of this software
18: .\" must display the following acknowledgement:
19: .\" This product includes software developed by the NetBSD
20: .\" Foundation, Inc. and its contributors.
21: .\" 4. Neither the name of The NetBSD Foundation nor the names of its
22: .\" contributors may be used to endorse or promote products derived
23: .\" from this software without specific prior written permission.
24: .\"
25: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28: .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35: .\" POSSIBILITY OF SUCH DAMAGE.
36: .\"
37: .Dd September 13, 1999
38: .Dt ULIMIT 3
39: .Os
40: .Sh NAME
41: .Nm ulimit
42: .Nd get and set process limits
43: .Sh LIBRARY
44: .Lb libc
45: .Sh SYNOPSIS
1.7 ! wiz 46: .In ulimit.h
1.1 kleink 47: .Ft long int
48: .Fn ulimit "int cmd" ...
49: .Sh DESCRIPTION
50: The
51: .Fn ulimit
52: function provides a method to query or alter resource limits of the calling
1.5 wiz 53: process.
54: The method to be performed is specified by the
1.1 kleink 55: .Fa cmd
56: argument; possible values are:
57: .Bl -tag -width UL_GETFSIZEXX
58: .It Li UL_GETFSIZE
59: Return the soft file size limit of the process.
60: The value returned is in units of 512-byte blocks.
61: If the result cannot be represented in an object of type
62: .Fa long int ,
63: the result is unspecified.
64: .It Li UL_SETFSIZE
65: Set the hard and soft file size limits of the process to the value of the
66: second argument passed, which is in units of 512-byte blocks, and which is
67: expected to be of type
68: .Fa long int .
69: The new file size limit of the process is returned.
70: Any process may decrease the limit, but raising it is only permitted if
71: the caller is the super-user.
72: .El
73: .Pp
74: If successful, the
75: .Fn ulimit
76: function will not change the setting of
1.2 kleink 77: .Va errno .
1.1 kleink 78: .Pp
79: The
80: .Fn ulimit
81: function is an obsolete interface; applications are encouraged to use
82: .Xr getrlimit 2
83: and
84: .Xr setrlimit 2
85: instead.
1.3 wiz 86: .Sh RETURN VALUES
1.1 kleink 87: If successful, the
88: .Fn ulimit
89: function returns the value of the requested limit.
1.6 wiz 90: Otherwise, it returns \-1, sets
1.1 kleink 91: .Va errno
92: to indicate an error, and the limit is not changed.
93: Therefore, to detect an error condition applications should set
1.2 kleink 94: .Va errno
1.1 kleink 95: to 0, call
96: .Fn ulimit ,
1.6 wiz 97: and check if \-1 is returned and
1.2 kleink 98: .Va errno
99: is non-zero.
1.1 kleink 100: .Sh ERRORS
101: The
102: .Fn ulimit
103: function will fail if:
104: .Bl -tag -width Er
105: .It Bq Er EINVAL
106: The
107: .Fa cmd
108: argument is not valid.
109: .It Bq Er EPERM
110: It was attempted to increase a limit, and the caller is not the super-user.
111: .El
112: .Sh SEE ALSO
113: .Xr getrlimit 2 ,
114: .Xr setrlimit 2
115: .Sh STANDARDS
116: The
117: .Fn ulimit
118: function conforms to
119: .St -xsh5 .
CVSweb <webmaster@jp.NetBSD.org>