1sys_resource.h(0P) POSIX Programmer's Manual sys_resource.h(0P)
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 sys/resource.h — definitions for XSI resource operations
13
15 #include <sys/resource.h>
16
18 The <sys/resource.h> header shall define the following symbolic con‐
19 stants as possible values of the which argument of getpriority() and
20 setpriority():
21
22 PRIO_PROCESS Identifies the who argument as a process ID.
23
24 PRIO_PGRP Identifies the who argument as a process group ID.
25
26 PRIO_USER Identifies the who argument as a user ID.
27
28 The <sys/resource.h> header shall define the following type through
29 typedef:
30
31 rlim_t Unsigned integer type used for limit values.
32
33 The <sys/resource.h> header shall define the following symbolic con‐
34 stants, which shall have values suitable for use in #if preprocessing
35 directives:
36
37 RLIM_INFINITY A value of rlim_t indicating no limit.
38
39 RLIM_SAVED_MAX A value of type rlim_t indicating an unrepresentable
40 saved hard limit.
41
42 RLIM_SAVED_CUR A value of type rlim_t indicating an unrepresentable
43 saved soft limit.
44
45 On implementations where all resource limits are representable in an
46 object of type rlim_t, RLIM_SAVED_MAX and RLIM_SAVED_CUR need not be
47 distinct from RLIM_INFINITY.
48
49 The <sys/resource.h> header shall define the following symbolic con‐
50 stants as possible values of the who parameter of getrusage():
51
52 RUSAGE_SELF Returns information about the current process.
53
54 RUSAGE_CHILDREN Returns information about children of the current
55 process.
56
57 The <sys/resource.h> header shall define the rlimit structure, which
58 shall include at least the following members:
59
60
61 rlim_t rlim_cur The current (soft) limit.
62 rlim_t rlim_max The hard limit.
63
64 The <sys/resource.h> header shall define the rusage structure, which
65 shall include at least the following members:
66
67
68 struct timeval ru_utime User time used.
69 struct timeval ru_stime System time used.
70
71 The <sys/resource.h> header shall define the timeval structure as
72 described in <sys/time.h>.
73
74 The <sys/resource.h> header shall define the following symbolic con‐
75 stants as possible values for the resource argument of getrlimit() and
76 setrlimit():
77
78 RLIMIT_CORE Limit on size of core file.
79
80 RLIMIT_CPU Limit on CPU time per process.
81
82 RLIMIT_DATA Limit on data segment size.
83
84 RLIMIT_FSIZE Limit on file size.
85
86 RLIMIT_NOFILE Limit on number of open files.
87
88 RLIMIT_STACK Limit on stack size.
89
90 RLIMIT_AS Limit on address space size.
91
92 The following shall be declared as functions and may also be defined as
93 macros. Function prototypes shall be provided.
94
95
96 int getpriority(int, id_t);
97 int getrlimit(int, struct rlimit *);
98 int getrusage(int, struct rusage *);
99 int setpriority(int, id_t, int);
100 int setrlimit(int, const struct rlimit *);
101
102 The <sys/resource.h> header shall define the id_t type through typedef,
103 as described in <sys/types.h>.
104
105 Inclusion of the <sys/resource.h> header may also make visible all sym‐
106 bols from <sys/time.h>.
107
108 The following sections are informative.
109
111 None.
112
114 None.
115
117 None.
118
120 <sys_time.h>, <sys_types.h>
121
122 The System Interfaces volume of POSIX.1‐2017, getpriority(), getr‐
123 limit(), getrusage()
124
126 Portions of this text are reprinted and reproduced in electronic form
127 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
128 table Operating System Interface (POSIX), The Open Group Base Specifi‐
129 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
130 Electrical and Electronics Engineers, Inc and The Open Group. In the
131 event of any discrepancy between this version and the original IEEE and
132 The Open Group Standard, the original IEEE and The Open Group Standard
133 is the referee document. The original Standard can be obtained online
134 at http://www.opengroup.org/unix/online.html .
135
136 Any typographical or formatting errors that appear in this page are
137 most likely to have been introduced during the conversion of the source
138 files to man page format. To report such errors, see https://www.ker‐
139 nel.org/doc/man-pages/reporting_bugs.html .
140
141
142
143IEEE/The Open Group 2017 sys_resource.h(0P)