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
20 The ulimit() function shall control process limits. The process limits
21 that can be controlled by this function include the maximum size of a
22 single file that can be written (this is equivalent to using setr‐
23 limit() with RLIMIT_FSIZE). The cmd values, defined in <ulimit.h>,
24 include:
25
26 UL_GETFSIZE Return the file size limit (RLIMIT_FSIZE) of the process.
27 The limit shall be in units of 512-byte blocks and shall be
28 inherited by child processes. Files of any size can be
29 read. The return value shall be the integer part of the
30 soft file size limit divided by 512. If the result cannot
31 be represented as a long, the result is unspecified.
32
33 UL_SETFSIZE Set the file size limit for output operations of the
34 process to the value of the second argument, taken as a
35 long, multiplied by 512. If the result would overflow an
36 rlim_t, the actual value set is unspecified. Any process
37 may decrease its own limit, but only a process with appro‐
38 priate privileges may increase the limit. The return value
39 shall be the integer part of the new file size limit
40 divided by 512.
41
42 The ulimit() function shall not change the setting of errno if success‐
43 ful.
44
45 As all return values are permissible in a successful situation, an
46 application wishing to check for error situations should set errno to
47 0, then call ulimit(), and, if it returns -1, check to see if errno is
48 non-zero.
49
51 Upon successful completion, ulimit() shall return the value of the
52 requested limit. Otherwise, -1 shall be returned and errno set to indi‐
53 cate the error.
54
56 The ulimit() function shall fail and the limit shall be unchanged if:
57
58 EINVAL The cmd argument is not valid.
59
60 EPERM A process not having appropriate privileges attempts to increase
61 its file size limit.
62
63 The following sections are informative.
64
66 None.
67
69 Since the ulimit() function uses type long rather than rlim_t, this
70 function is not sufficient for file sizes on many current systems.
71 Applications should use the getrlimit() or setrlimit() functions
72 instead of the obsolescent ulimit() function.
73
75 None.
76
78 The ulimit() function may be removed in a future version.
79
81 exec, getrlimit(), write()
82
83 The Base Definitions volume of POSIX.1‐2017, <ulimit.h>
84
86 Portions of this text are reprinted and reproduced in electronic form
87 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
88 table Operating System Interface (POSIX), The Open Group Base Specifi‐
89 cations Issue 7, 2018 Edition, Copyright (C) 2018 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 Any typographical or formatting errors that appear in this page are
97 most likely to have been introduced during the conversion of the source
98 files to man page format. To report such errors, see https://www.ker‐
99 nel.org/doc/man-pages/reporting_bugs.html .
100
101
102
103IEEE/The Open Group 2017 ULIMIT(3P)