1ULIMIT(3P) POSIX Programmer's Manual ULIMIT(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 ulimit - get and set process limits
13
15 #include <ulimit.h>
16
17 long ulimit(int cmd, ...);
18
19
21 The ulimit() function shall control process limits. The process limits
22 that can be controlled by this function include the maximum size of a
23 single file that can be written (this is equivalent to using setr‐
24 limit() with RLIMIT_FSIZE). The cmd values, defined in <ulimit.h>,
25 include:
26
27 UL_GETFSIZE
28 Return the file size limit (RLIMIT_FSIZE) of the process. The
29 limit shall be in units of 512-byte blocks and shall be inher‐
30 ited by child processes. Files of any size can be read. The
31 return value shall be the integer part of the soft file size
32 limit divided by 512. If the result cannot be represented as a
33 long, the result is unspecified.
34
35 UL_SETFSIZE
36 Set the file size limit for output operations of the process to
37 the value of the second argument, taken as a long, multiplied by
38 512. If the result would overflow an rlim_t, the actual value
39 set is unspecified. Any process may decrease its own limit, but
40 only a process with appropriate privileges may increase the
41 limit. The return value shall be the integer part of the new
42 file size limit divided by 512.
43
44
45 The ulimit() function shall not change the setting of errno if success‐
46 ful.
47
48 As all return values are permissible in a successful situation, an
49 application wishing to check for error situations should set errno to
50 0, then call ulimit(), and, if it returns -1, check to see if errno is
51 non-zero.
52
54 Upon successful completion, ulimit() shall return the value of the
55 requested limit. Otherwise, -1 shall be returned and errno set to indi‐
56 cate the error.
57
59 The ulimit() function shall fail and the limit shall be unchanged if:
60
61 EINVAL The cmd argument is not valid.
62
63 EPERM A process not having appropriate privileges attempts to increase
64 its file size limit.
65
66
67 The following sections are informative.
68
70 None.
71
73 None.
74
76 None.
77
79 None.
80
82 getrlimit(), setrlimit(), write(), the Base Definitions volume of
83 IEEE Std 1003.1-2001, <ulimit.h>
84
86 Portions of this text are reprinted and reproduced in electronic form
87 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
88 -- Portable Operating System Interface (POSIX), The Open Group Base
89 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
90 Electrical and Electronics Engineers, Inc and The Open Group. In the
91 event of any discrepancy between this version and the original IEEE and
92 The Open Group Standard, the original IEEE and The Open Group Standard
93 is the referee document. The original Standard can be obtained online
94 at http://www.opengroup.org/unix/online.html .
95
96
97
98IEEE/The Open Group 2003 ULIMIT(3P)