Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man1 / limit.1
blob4ee12fd390fac58cba3db4e8ce9eea9777f4eaa5
1 .\"
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/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
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.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
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.
30 .\"
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.
35 .\"
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]
41 .\"
42 .\"
43 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
44 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
45 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
46 .\"
47 .TH LIMIT 1 "Nov 2, 2007"
48 .SH NAME
49 limit, ulimit, unlimit \- set or get limitations on the system resources
50 available to the current shell and its descendents
51 .SH SYNOPSIS
52 .LP
53 .nf
54 \fB/usr/bin/ulimit\fR [\fB-f\fR] [\fIblocks\fR]
55 .fi
57 .SS "sh"
58 .LP
59 .nf
60 \fBulimit\fR [\fB-\fR [HS] [a | cdfnstv]]
61 .fi
63 .LP
64 .nf
65 \fBulimit\fR [\fB-\fR [HS] [c | d | f | n | s | t | v]] \fIlimit\fR
66 .fi
68 .SS "csh"
69 .LP
70 .nf
71 \fBlimit\fR [\fB-h\fR] [\fIresource\fR [\fIlimit\fR]]
72 .fi
74 .LP
75 .nf
76 \fBunlimit\fR [\fB-h\fR] [\fIresource\fR]
77 .fi
79 .SS "ksh"
80 .LP
81 .nf
82 \fBulimit\fR [\fB-HSacdfnstv\fR] [\fIlimit\fR]
83 .fi
85 .SS "ksh93"
86 .LP
87 .nf
88 \fBulimit\fR [\fB-HSacdfmnpstv\fR] [\fIlimit\fR]
89 .fi
91 .SH DESCRIPTION
92 .SS "/usr/bin/ulimit"
93 .sp
94 .LP
95 The \fBulimit\fR utility sets or reports the file-size writing limit imposed on
96 files written by the shell and its child processes (files of any size can be
97 read). Only a process with appropriate privileges can increase the limit.
98 .SS "sh"
99 .sp
101 The Bourne shell built-in function, \fBulimit\fR, prints or sets hard or soft
102 resource limits. These limits are described in \fBgetrlimit\fR(2).
105 If \fIlimit\fR is not present, \fBulimit\fR prints the specified limits. Any
106 number of limits can be printed at one time. The \fB-a\fR option prints all
107 limits.
110 If \fIlimit\fR is present, \fBulimit\fR sets the specified limit to\fIlimit\fR.
111 The string \fBunlimited\fR requests that the current limit, if any, be removed.
112 Any user can set a soft limit to any value less than or equal to the hard
113 limit. Any user can lower a hard limit. Only a user with appropriate privileges
114 can raise or remove a hard limit. See \fBgetrlimit\fR(2).
117 The \fB-H\fR option specifies a hard limit. The \fB-S\fR option specifies a
118 soft limit. If neither option is specified, \fBulimit\fR sets both limits and
119 prints the soft limit.
122 The following options specify the resource whose limits are to be printed or
123 set. If no option is specified, the file size limit is printed or set.
125 .ne 2
127 \fB\fB-c\fR\fR
129 .RS 6n
130 Maximum core file size (in 512-byte blocks)
134 .ne 2
136 \fB\fB-d\fR\fR
138 .RS 6n
139 Maximum size of data segment or heap (in Kbytes)
143 .ne 2
145 \fB\fB-f\fR\fR
147 .RS 6n
148 Maximum file size (in 512-byte blocks)
152 .ne 2
154 \fB\fB-n\fR\fR
156 .RS 6n
157 Maximum file descriptor plus 1
161 .ne 2
163 \fB\fB-s\fR\fR
165 .RS 6n
166 Maximum size of stack segment (in Kbytes)
170 .ne 2
172 \fB\fB-t\fR\fR
174 .RS 6n
175 Maximum CPU time (in seconds)
179 .ne 2
181 \fB\fB-v\fR\fR
183 .RS 6n
184 Maximum size of virtual memory (in Kbytes)
187 .SS "csh"
190 The C-shell built-in function, \fBlimit\fR, limits the consumption by the
191 current process or any process it spawns, each not to exceed \fIlimit\fR on the
192 specified \fIresource\fR. The string \fBunlimited\fR requests that the current
193 limit, if any, be removed. If \fIlimit\fR is omitted, prints the current limit.
194 If \fIresource\fR is omitted, displays all limits.
196 .ne 2
198 \fB\fB-h\fR\fR
200 .RS 6n
201 Use hard limits instead of the current limits. Hard limits impose a ceiling on
202 the values of the current limits. Only the privileged user can raise the hard
203 limits.
208 \fIresource\fR is one of:
210 .ne 2
212 \fB\fBcputime\fR\fR
214 .RS 16n
215 Maximum \fBCPU\fR seconds per process.
219 .ne 2
221 \fB\fBfilesize\fR\fR
223 .RS 16n
224 Largest single file allowed. Limited to the size of the filesystem (see
225 \fBdf\fR(8)).
229 .ne 2
231 \fB\fBdatasize\fR\fR
233 .RS 16n
234 The maximum size of a process's heap in kilobytes.
238 .ne 2
240 \fB\fBstacksize\fR\fR
242 .RS 16n
243 Maximum stack size for the process. The default stack size is 2^64.
247 .ne 2
249 \fB\fBcoredumpsize\fR\fR
251 .RS 16n
252 Maximum size of a core dump (file). This is limited to the size of the
253 filesystem.
257 .ne 2
259 \fB\fBdescriptors\fR\fR
261 .RS 16n
262 Maximum number of file descriptors. Run the \fBsysdef\fR(8) command to obtain
263 the maximum possible limits for your system. The values reported are in
264 hexadecimal, but can be translated into decimal numbers using the \fBbc\fR(1)
265 command.
269 .ne 2
271 \fB\fBmemorysize\fR\fR
273 .RS 16n
274 Maximum size of virtual memory.
279 \fIlimit\fR is a number, with an optional scaling factor, as follows:
281 .ne 2
283 \fB\fIn\fR\fBh\fR\fR
285 .RS 9n
286 Hours (for \fBcputime\fR).
290 .ne 2
292 \fB\fIn\fR\fBk\fR\fR
294 .RS 9n
295 \fIn\fR kilobytes. This is the default for all but \fBcputime\fR.
299 .ne 2
301 \fB\fIn\fR\fBm\fR\fR
303 .RS 9n
304 \fIn\fR megabytes or minutes (for \fBcputime\fR).
308 .ne 2
310 \fB\fImm\fR\fB:\fR\fIss\fR\fR
312 .RS 9n
313 Minutes and seconds (for \fBcputime\fR).
318 \fBunlimit\fR removes a limitation on \fIresource\fR. If no \fIresource\fR is
319 specified, then all resource limitations are removed. See the description of
320 the \fBlimit\fR command for the list of resource names.
322 .ne 2
324 \fB\fB-h\fR\fR
326 .RS 6n
327 Remove corresponding hard limits. Only the privileged user can do this.
330 .SS "ksh"
333 The Korn shell built-in function, \fBulimit\fR, sets or displays a resource
334 limit. The available resources limits are listed below. Many systems do not
335 contain one or more of these limits. The limit for a specified resource is set
336 when \fIlimit\fR is specified. The value of \fIlimit\fR can be a number in the
337 unit specified below with each resource, or the value \fBunlimited\fR. The
338 string \fBunlimited\fR requests that the current limit, if any, be removed. The
339 \fB-H\fR and \fB-S\fR flags specify whether the hard limit or the soft limit
340 for the specified resource is set. A hard limit cannot be increased once it is
341 set. A soft limit can be increased up to the value of the hard limit. If
342 neither the \fB-H\fR or \fB-S\fR options is specified, the limit applies to
343 both. The current resource limit is printed when \fIlimit\fR is omitted. In
344 this case, the soft limit is printed unless \fB-H\fR is specified. When more
345 than one resource is specified, then the limit name and unit is printed before
346 the value.
348 .ne 2
350 \fB\fB-a\fR\fR
352 .RS 6n
353 Lists all of the current resource limits.
357 .ne 2
359 \fB\fB-c\fR\fR
361 .RS 6n
362 The number of 512-byte blocks on the size of core dumps.
366 .ne 2
368 \fB\fB-d\fR\fR
370 .RS 6n
371 The number of K-bytes on the size of the data area.
375 .ne 2
377 \fB\fB-f\fR\fR
379 .RS 6n
380 The number of 512-byte blocks on files written by child processes (files of any
381 size can be read).
385 .ne 2
387 \fB\fB-n\fR\fR
389 .RS 6n
390 The number of file descriptors plus 1.
394 .ne 2
396 \fB\fB-s\fR\fR
398 .RS 6n
399 The number of K-bytes on the size of the stack area.
403 .ne 2
405 \fB\fB-t\fR\fR
407 .RS 6n
408 The number of seconds (CPU time) to be used by each process.
412 .ne 2
414 \fB\fB-v\fR\fR
416 .RS 6n
417 The number of K-bytes for virtual memory.
422 If no option is specified, \fB-f\fR is assumed.
423 .SS "Per-Shell Memory Parameters"
426 The \fBheapsize\fR, \fBdatasize\fR, and \fBstacksize\fR parameters are not
427 system tunables. The only controls for these are hard limits, set in a shell
428 startup file, or system-wide soft limits, which, for the current version of the
429 Solaris OS, is 2^64bytes.
430 .SS "ksh93"
433 \fBulimit\fR sets or displays resource limits. These limits apply to the
434 current process and to each child process created after the resource limit has
435 been set. If \fIlimit\fR is specified, the resource limit is set, otherwise,
436 its current value is displayed on standard output.
439 Increasing the limit for a resource usually requires special privileges. Some
440 systems allow you to lower resource limits and later increase them. These are
441 called soft limits. Once a hard limit is set the resource cannot be increased.
444 Different systems allow you to specify different resources and some restrict
445 how much you can raise the limit of the resource.
448 The value of \fIlimit\fR depends on the unit of the resource listed for each
449 resource. In addition, \fIlimit\fR can be "unlimited" to indicate no limit for
450 that resource.
453 If you do not specify \fB-H\fR or \fB-S\fR, \fB-S\fR is used for listing and
454 both \fB-S\fR and \fB-H\fR are used for setting resources.
457 If you do not specify any resource, the default is \fB-f.\fR
460 The following options are available for \fBulimit\fR in \fBksh93\fR:
462 .ne 2
464 \fB\fB-a\fR\fR
466 .RS 13n
467 Displays all current resource limits.
471 .ne 2
473 \fB\fB-b\fR\fR
477 \fB\fB--sbsize\fR\fR
479 .RS 13n
480 Specifies the socket buffer size in bytes.
484 .ne 2
486 \fB\fB-c\fR\fR
490 \fB\fB--core\fR\fR
492 .RS 13n
493 Specifies the core file size in blocks.
497 .ne 2
499 \fB\fB-d\fR\fR
503 \fB\fB--data\fR\fR
505 .RS 13n
506 Specifies the data size in kbytes.
510 .ne 2
512 \fB\fB-f\fR\fR
516 \fB\fB--fsize\fR\fR
518 .RS 13n
519 Specifies the file size in blocks.
523 .ne 2
525 \fB\fB-H\fR\fR
527 .RS 13n
528 Displays or sets a hard limit.
532 .ne 2
534 \fB\fB-L\fR\fR
538 \fB\fB--locks\fR\fR
540 .RS 13n
541 Specifies the number of file locks.
545 .ne 2
547 \fB\fB-l\fR\fR
551 \fB\fB--memlock\fR\fR
553 .RS 13n
554 Specifies the locked address space in Kbytes.
558 .ne 2
560 \fB\fB-M\fR\fR
564 \fB\fB--as\fR\fR
566 .RS 13n
567 Specifies the address space limit in Kbytes.
571 .ne 2
573 \fB\fB-n\fR\fR
577 \fB\fB--nofile\fR\fR
579 .RS 13n
580 Specifies the number of open files.
584 .ne 2
586 \fB\fB-p\fR\fR
590 \fB\fB--pipe\fR\fR
592 .RS 13n
593 Specifies the pipe buffer size in bytes.
597 .ne 2
599 \fB\fB-m\fR\fR
603 \fB\fB--rss\fR\fR
605 .RS 13n
606 Specifies the resident set size in Kbytes
610 .ne 2
612 \fB\fB-S\fR\fR
614 .RS 13n
615 Displays or sets a soft limit.
619 .ne 2
621 \fB\fB-s\fR\fR
625 \fB\fB--stack\fR\fR
627 .RS 13n
628 Specifies the stack size in Kbytes.
632 .ne 2
634 \fB\fB-T\fR\fR
638 \fB\fB--threads\fR\fR
640 .RS 13n
641 Specifies the number of threads.
645 .ne 2
647 \fB\fB-t\fR\fR
651 \fB\fB--cpu\fR\fR
653 .RS 13n
654 Specifies the CPU time in seconds.
658 .ne 2
660 \fB\fB-u\fR\fR
664 \fB\fB--nproc\fR\fR
666 .RS 13n
667 Specifies the number of processes.
671 .ne 2
673 \fB\fB-v\fR\fR
677 \fB\fB--vmem\fR\fR
679 .RS 13n
680 Specifies the process size in Kbytes.
683 .SH OPTIONS
686 The following option is supported by \fB/usr/bin/ulimit\fR:
688 .ne 2
690 \fB\fB-f\fR\fR
692 .RS 6n
693 Sets (or reports, if no \fIblocks\fR operand is present), the file size limit
694 in blocks. The \fB-f\fR option is also the default case.
697 .SH OPERANDS
700 The following operand is supported by \fB/usr/bin/ulimit\fR:
702 .ne 2
704 \fB\fIblocks\fR\fR
706 .RS 10n
707 The number of 512-byte blocks to use as the new file size limit.
710 .SH EXAMPLES
711 .SS "/usr/bin/ulimit"
713 \fBExample 1 \fRLimiting the Stack Size
716 The following example limits the stack size to 512 kilobytes:
719 .in +2
721 example% \fBulimit -s 512\fR
722 example% \fBulimit -a\fR
723 time(seconds)         unlimited
724 file(blocks)            100
725 data(kbytes)            523256
726 stack(kbytes)           512
727 coredump(blocks)        200
728 nofiles(descriptors)    64
729 memory(kbytes)          unlimited
731 .in -2
734 .SS "sh/ksh"
736 \fBExample 2 \fRLimiting the Number of File Descriptors
739 The following command limits the number of file descriptors to 12:
742 .in +2
744 example$ \fBulimit -n 12\fR
745 example$ \fBulimit -a\fR
746 time(seconds)            unlimited
747 file(blocks)             41943
748 data(kbytes)             523256
749 stack(kbytes)            8192
750 coredump(blocks)         200
751 nofiles(descriptors)     12
752 vmemory(kbytes)          unlimited
754 .in -2
757 .SS "csh"
759 \fBExample 3 \fRLimiting the Core Dump File Size
762 The following command limits the size of a core dump file size to 0 kilobytes:
765 .in +2
767 example% \fBlimit coredumpsize 0\fR
768 example% \fBlimit\fR
769 cputime                 unlimited
770 filesize                unlimited
771 datasize                523256 kbytes
772 stacksize               8192 kbytes
773 coredumpsize            0 kbytes
774 descriptors             64
775 memorysize              unlimited
777 .in -2
781 \fBExample 4 \fRRemoving the limitation for core file size
784 The following command removes the above limitation for the core file size:
787 .in +2
789 example% \fBunlimit coredumpsize\fR
790 example% \fBlimit\fR
791 cputime                 unlimited
792 filesize                unlimited
793 datasize                523256 kbytes
794 stacksize               8192 kbytes
795 coredumpsize            unlimited
796 descriptors             64
797 memorysize              unlimited
799 .in -2
802 .SH ENVIRONMENT VARIABLES
805 See \fBenviron\fR(5) for descriptions of the following environment variables
806 that affect the execution of \fBulimit\fR: \fBLANG\fR, \fBLC_ALL\fR,
807 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
808 .SH EXIT STATUS
811 The following exit values are returned by \fBulimit\fR:
813 .ne 2
815 \fB\fB0\fR\fR
817 .RS 6n
818 Successful completion.
822 .ne 2
824 \fB\fB>0\fR\fR
826 .RS 6n
827 A request for a higher limit was rejected or an error occurred.
830 .SH ATTRIBUTES
833 See \fBattributes\fR(5) for descriptions of the following attributes:
834 .SS "/usr/bin/ulimit, csh, ksh, sh"
839 box;
840 c | c
841 l | l .
842 ATTRIBUTE TYPE  ATTRIBUTE VALUE
844 Interface Stability     Committed
846 Standard        See \fBstandards\fR(5).
849 .SS "ksh93"
854 box;
855 c | c
856 l | l .
857 ATTRIBUTE TYPE  ATTRIBUTE VALUE
859 Interface Stability     Uncommitted
862 .SH SEE ALSO
865 \fBbc\fR(1), \fBcsh\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBsh\fR(1),
866 \fBdf\fR(8), \fBsu\fR(8), \fBswap\fR(8), \fBsysdef\fR(8),
867 \fBgetrlimit\fR(2), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)