1ulimit(2) System Calls ulimit(2)
2
3
4
6 ulimit - get and set process limits
7
9 #include <ulimit.h>
10
11 long ulimit(int cmd, /* newlimit */...);
12
13
15 The ulimit() function provides for control over process limits. It is
16 effective in limiting the growth of regular files. Pipes are limited to
17 PIPE_MAX bytes.
18
19
20 The cmd values, defined in <ulimit.h>, include:
21
22 UL_GETFSIZE Return the soft file size limit of the process. The
23 limit is in units of 512-byte blocks and is inherited by
24 child processes. Files of any size can be read. The
25 return value is the integer part of the soft file size
26 limit divided by 512. If the result cannot be repre‐
27 sented as a long int, the result is unspecified.
28
29
30 UL_SETFSIZE Set the hard and soft file size limits for output opera‐
31 tions of the process to the value of the second argu‐
32 ment, taken as a long int. Any process may decrease its
33 own hard limit, but only a process with appropriate
34 privileges may increase the limit. The new file size
35 limit is returned. The hard and soft file size limits
36 are set to the specified value multiplied by 512. If
37 the result would overflow an rlimit_t, the actual value
38 set is unspecified.
39
40
41 UL_GMEMLIM Get the maximum possible break value (see brk(2)).
42
43
44 UL_GDESLIM Get the current value of the maximum number of open
45 files per process configured in the system.
46
47
49 Upon successful completion, ulimit() returns the value of the requested
50 limit. Otherwise, −1 is returned, the limit is not changed, and errno
51 is set to indicate the error.
52
54 The ulimit() function will fail if:
55
56 EINVAL The cmd argument is not valid.
57
58
59 EPERM A process that has not asserted {PRIV_SYS_RESOURCE} in its
60 effective set is trying to increase its file size limit.
61
62
64 Since all return values are permissible in a successful situation, an
65 application wishing to check for error situations should set errno to
66 0, then call ulimit(), and if it returns −1, check if errno is non-
67 zero.
68
69
70 The getrlimit() and setrlimit() functions provide a more general inter‐
71 face for controlling process limits, and are preferred over ulimit().
72 See getrlimit(2).
73
75 See attributes(5) for descriptions of the following attributes:
76
77
78
79
80 ┌─────────────────────────────┬─────────────────────────────┐
81 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
82 ├─────────────────────────────┼─────────────────────────────┤
83 │Interface Stability │Standard │
84 └─────────────────────────────┴─────────────────────────────┘
85
87 brk(2), getrlimit(2), write(2), attributes(5), privileges(5), stan‐
88 dards(5)
89
90
91
92SunOS 5.11 1 Feb 2003 ulimit(2)