Update.
[glibc.git] / sysdeps / unix / sysv / linux / bits / resource.h
blob9ee6ea5b27c3a5673842bbde862ea9467dbcda92
1 /* Bit values & structures for resource limits. Linux version.
2 Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #include <asm/resource.h>
21 #include <bits/types.h>
23 /* Transmute defines to enumerations. The macro re-definitions are
24 necessary because some programs want to test for operating system
25 features with #ifdef RUSAGE_SELF. In ISO C the reflexive
26 definition is a no-op. */
28 /* Kinds of resource limit. */
29 enum __rlimit_resource
31 /* Per-process CPU limit, in seconds. */
32 _RLIMIT_CPU = RLIMIT_CPU,
33 #undef RLIMIT_CPU
34 RLIMIT_CPU = _RLIMIT_CPU,
35 #define RLIMIT_CPU RLIMIT_CPU
37 /* Largest file that can be created, in bytes. */
38 _RLIMIT_FSIZE = RLIMIT_FSIZE,
39 #undef RLIMIT_FSIZE
40 RLIMIT_FSIZE = _RLIMIT_FSIZE,
41 #define RLIMIT_FSIZE RLIMIT_FSIZE
43 /* Maximum size of data segment, in bytes. */
44 _RLIMIT_DATA = RLIMIT_DATA,
45 #undef RLIMIT_DATA
46 RLIMIT_DATA = _RLIMIT_DATA,
47 #define RLIMIT_DATA RLIMIT_DATA
49 /* Maximum size of stack segment, in bytes. */
50 _RLIMIT_STACK = RLIMIT_STACK,
51 #undef RLIMIT_STACK
52 RLIMIT_STACK = _RLIMIT_STACK,
53 #define RLIMIT_STACK RLIMIT_STACK
55 /* Largest core file that can be created, in bytes. */
56 _RLIMIT_CORE = RLIMIT_CORE,
57 #undef RLIMIT_CORE
58 RLIMIT_CORE = _RLIMIT_CORE,
59 #define RLIMIT_CORE RLIMIT_CORE
61 /* Largest resident set size, in bytes.
62 This affects swapping; processes that are exceeding their
63 resident set size will be more likely to have physical memory
64 taken from them. */
65 _RLIMIT_RSS = RLIMIT_RSS,
66 #undef RLIMIT_RSS
67 RLIMIT_RSS = _RLIMIT_RSS,
68 #define RLIMIT_RSS RLIMIT_RSS
70 /* Number of open files. */
71 _RLIMIT_NOFILE = RLIMIT_NOFILE,
72 #undef RLIMIT_NOFILE
73 RLIMIT_NOFILE = _RLIMIT_NOFILE,
74 RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */
75 #define RLIMIT_NOFILE RLIMIT_NOFILE
76 #define RLIMIT_OFILE RLIMIT_OFILE
78 /* Address space limit (?) */
79 _RLIMIT_AS = RLIMIT_AS,
80 #undef RLIMIT_AS
81 RLIMIT_AS = _RLIMIT_AS,
82 #define RLIMIT_AS RLIMIT_AS
84 /* Number of processes. */
85 _RLIMIT_NPROC = RLIMIT_NPROC,
86 #undef RLIMIT_NPROC
87 RLIMIT_NPROC = _RLIMIT_NPROC,
88 #define RLIMIT_NPROC RLIMIT_NPROC
90 /* Locked-in-memory address space. */
91 _RLIMIT_MEMLOCK = RLIMIT_MEMLOCK,
92 #undef RLIMIT_MEMLOCK
93 RLIMIT_MEMLOCK = _RLIMIT_MEMLOCK,
94 #define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
96 RLIMIT_NLIMITS = RLIM_NLIMITS,
97 #undef RLIM_NLIMITS
98 RLIM_NLIMITS = RLIMIT_NLIMITS,
99 #define RLIMIT_NLIMITS RLIMIT_NLIMITS
100 #define RLIM_NLIMITS RLIM_NLIMITS
102 /* Value to indicate that there is no limit. */
103 RLIM_INFINITY = (long int)(~0UL >> 1)
104 #define RLIM_INFINITY RLIM_INFINITY
107 /* Type for resource quantity measurement. */
108 #ifndef __USE_FILE_OFFSET64
109 typedef __rlim_t rlim_t;
110 #else
111 typedef __rlim64_t rlim_t;
112 #endif
113 #ifdef __USE_LARGEFILE64
114 typedef __rlim64_t rlim64_t;
115 #endif
117 struct rlimit
119 /* The current (soft) limit. */
120 rlim_t rlim_cur;
121 /* The hard limit. */
122 rlim_t rlim_max;
125 #ifdef __USE_LARGEFILE64
126 struct rlimit64
128 /* The current (soft) limit. */
129 rlim64_t rlim_cur;
130 /* The hard limit. */
131 rlim64_t rlim_max;
133 #endif
135 /* Whose usage statistics do you want? */
136 enum __rusage_who
138 /* The calling process. */
139 RUSAGE_SELF = 0,
140 #define RUSAGE_SELF RUSAGE_SELF
142 /* All of its terminated child processes. */
143 RUSAGE_CHILDREN = -1,
144 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
146 /* Both. */
147 RUSAGE_BOTH = -2
148 #define RUSAGE_BOTH RUSAGE_BOTH
151 #include <sys/time.h> /* For `struct timeval'. */
153 /* Structure which says how much of each resource has been used. */
154 struct rusage
156 /* Total amount of user time used. */
157 struct timeval ru_utime;
158 /* Total amount of system time used. */
159 struct timeval ru_stime;
160 /* Maximum resident set size (in kilobytes). */
161 long int ru_maxrss;
162 /* Amount of sharing of text segment memory
163 with other processes (kilobyte-seconds). */
164 long int ru_ixrss;
165 /* Amount of data segment memory used (kilobyte-seconds). */
166 long int ru_idrss;
167 /* Amount of stack memory used (kilobyte-seconds). */
168 long int ru_isrss;
169 /* Number of soft page faults (i.e. those serviced by reclaiming
170 a page from the list of pages awaiting reallocation. */
171 long int ru_minflt;
172 /* Number of hard page faults (i.e. those that required I/O). */
173 long int ru_majflt;
174 /* Number of times a process was swapped out of physical memory. */
175 long int ru_nswap;
176 /* Number of input operations via the file system. Note: This
177 and `ru_oublock' do not include operations with the cache. */
178 long int ru_inblock;
179 /* Number of output operations via the file system. */
180 long int ru_oublock;
181 /* Number of IPC messages sent. */
182 long int ru_msgsnd;
183 /* Number of IPC messages received. */
184 long int ru_msgrcv;
185 /* Number of signals delivered. */
186 long int ru_nsignals;
187 /* Number of voluntary context switches, i.e. because the process
188 gave up the process before it had to (usually to wait for some
189 resource to be available). */
190 long int ru_nvcsw;
191 /* Number of involuntary context switches, i.e. a higher priority process
192 became runnable or the current process used up its time slice. */
193 long int ru_nivcsw;
196 /* Priority limits. */
197 #define PRIO_MIN -20 /* Minimum priority a process can have. */
198 #define PRIO_MAX 20 /* Maximum priority a process can have. */
200 /* The type of the WHICH argument to `getpriority' and `setpriority',
201 indicating what flavor of entity the WHO argument specifies. */
202 enum __priority_which
204 PRIO_PROCESS = 0, /* WHO is a process ID. */
205 PRIO_PGRP = 1, /* WHO is a process group ID. */
206 PRIO_USER = 2 /* WHO is a user ID. */