Annotation of src/lib/libc/gen/ulimit.3, Revision 1.2
1.2 ! kleink 1: .\" $NetBSD: ulimit.3,v 1.1 1999/09/13 18:38:06 kleink 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
46: .Fd #include <ulimit.h>
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
53: process. The method to be performed is specified by the
54: .Fa cmd
55: argument; possible values are:
56: .Bl -tag -width UL_GETFSIZEXX
57: .It Li UL_GETFSIZE
58: Return the soft file size limit of the process.
59: The value returned is in units of 512-byte blocks.
60: If the result cannot be represented in an object of type
61: .Fa long int ,
62: the result is unspecified.
63: .It Li UL_SETFSIZE
64: Set the hard and soft file size limits of the process to the value of the
65: second argument passed, which is in units of 512-byte blocks, and which is
66: expected to be of type
67: .Fa long int .
68: The new file size limit of the process is returned.
69: Any process may decrease the limit, but raising it is only permitted if
70: the caller is the super-user.
71: .El
72: .Pp
73: If successful, the
74: .Fn ulimit
75: function will not change the setting of
1.2 ! kleink 76: .Va errno .
1.1 kleink 77: .Pp
78: The
79: .Fn ulimit
80: function is an obsolete interface; applications are encouraged to use
81: .Xr getrlimit 2
82: and
83: .Xr setrlimit 2
84: instead.
85: .Sh RETURN VALUE
86: If successful, the
87: .Fn ulimit
88: function returns the value of the requested limit.
89: Otherwise, it returns -1, sets
90: .Va errno
91: to indicate an error, and the limit is not changed.
92: Therefore, to detect an error condition applications should set
1.2 ! kleink 93: .Va errno
1.1 kleink 94: to 0, call
95: .Fn ulimit ,
96: and check if -1 is returned and
1.2 ! kleink 97: .Va errno
! 98: is non-zero.
1.1 kleink 99: .Sh ERRORS
100: The
101: .Fn ulimit
102: function will fail if:
103: .Bl -tag -width Er
104: .It Bq Er EINVAL
105: The
106: .Fa cmd
107: argument is not valid.
108: .It Bq Er EPERM
109: It was attempted to increase a limit, and the caller is not the super-user.
110: .El
111: .Sh SEE ALSO
112: .Xr getrlimit 2 ,
113: .Xr setrlimit 2
114: .Sh STANDARDS
115: The
116: .Fn ulimit
117: function conforms to
118: .St -xsh5 .
CVSweb <webmaster@jp.NetBSD.org>