2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
47 .TH ULIMIT 2 "Feb 1, 2003"
49 ulimit \- get and set process limits
55 \fBlong\fR \fBulimit\fR(\fBint\fR \fIcmd\fR, \fB/*\fR \fInewlimit\fR */...);
61 The \fBulimit()\fR function provides for control over process limits. It is
62 effective in limiting the growth of regular files. Pipes are limited to
66 The \fIcmd\fR values, defined in <\fBulimit.h\fR>, include:
70 \fB\fBUL_GETFSIZE\fR\fR
73 Return the soft file size limit of the process. The limit is in units of
74 512-byte blocks and is inherited by child processes. Files of any size can be
75 read. The return value is the integer part of the soft file size limit divided
76 by 512. If the result cannot be represented as a \fBlong int\fR, the result is
83 \fB\fBUL_SETFSIZE\fR\fR
86 Set the hard and soft file size limits for output operations of the process to
87 the value of the second argument, taken as a \fBlong int\fR. Any process may
88 decrease its own hard limit, but only a process with appropriate privileges may
89 increase the limit. The new file size limit is returned. The hard and soft file
90 size limits are set to the specified value multiplied by 512. If the result
91 would overflow an \fBrlimit_t\fR, the actual value set is unspecified.
97 \fB\fBUL_GMEMLIM\fR\fR
100 Get the maximum possible break value (see \fBbrk\fR(2)).
106 \fB\fBUL_GDESLIM\fR\fR
109 Get the current value of the maximum number of open files per process
110 configured in the system.
116 Upon successful completion, \fBulimit()\fR returns the value of the requested
117 limit. Otherwise, \fB\(mi1\fR is returned, the limit is not changed, and
118 \fBerrno\fR is set to indicate the error.
122 The \fBulimit()\fR function will fail if:
129 The \fIcmd\fR argument is not valid.
138 A process that has not asserted {\fBPRIV_SYS_RESOURCE\fR} in its effective set
139 is trying to increase its file size limit.
145 Since all return values are permissible in a successful situation, an
146 application wishing to check for error situations should set \fBerrno\fR to 0,
147 then call \fBulimit()\fR, and if it returns \fB\(mi1\fR, check if \fBerrno\fR
151 The \fBgetrlimit()\fR and \fBsetrlimit()\fR functions provide a more general
152 interface for controlling process limits, and are preferred over
153 \fBulimit()\fR. See \fBgetrlimit\fR(2).
157 See \fBattributes\fR(5) for descriptions of the following attributes:
165 ATTRIBUTE TYPE ATTRIBUTE VALUE
167 Interface Stability Standard
173 \fBbrk\fR(2), \fBgetrlimit\fR(2), \fBwrite\fR(2), \fBattributes\fR(5),
174 \fBprivileges\fR(5), \fBstandards\fR(5)