Update.
[glibc.git] / sysdeps / unix / sysv / linux / resourcebits.h
blob05cae8324457b4dd62d7874c2b24fbc10797e77f
1 /* Bit values & structures for resource limits. Linux version.
2 Copyright (C) 1994, 1996 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>
22 /* Transmute defines to enumerations. The macro re-definitions are
23 necessary because some programs want to test for operating system
24 features with #ifdef RUSAGE_SELF. In ISO C the reflexive
25 definition is a no-op. */
27 /* Kinds of resource limit. */
28 enum __rlimit_resource
30 /* Per-process CPU limit, in seconds. */
31 _RLIMIT_CPU = RLIMIT_CPU,
32 #undef RLIMIT_CPU
33 RLIMIT_CPU = _RLIMIT_CPU,
34 #define RLIMIT_CPU RLIMIT_CPU
36 /* Largest file that can be created, in bytes. */
37 _RLIMIT_FSIZE = RLIMIT_FSIZE,
38 #undef RLIMIT_FSIZE
39 RLIMIT_FSIZE = _RLIMIT_FSIZE,
40 #define RLIMIT_FSIZE RLIMIT_FSIZE
42 /* Maximum size of data segment, in bytes. */
43 _RLIMIT_DATA = RLIMIT_DATA,
44 #undef RLIMIT_DATA
45 RLIMIT_DATA = _RLIMIT_DATA,
46 #define RLIMIT_DATA RLIMIT_DATA
48 /* Maximum size of stack segment, in bytes. */
49 _RLIMIT_STACK = RLIMIT_STACK,
50 #undef RLIMIT_STACK
51 RLIMIT_STACK = _RLIMIT_STACK,
52 #define RLIMIT_STACK RLIMIT_STACK
54 /* Largest core file that can be created, in bytes. */
55 _RLIMIT_CORE = RLIMIT_CORE,
56 #undef RLIMIT_CORE
57 RLIMIT_CORE = _RLIMIT_CORE,
58 #define RLIMIT_CORE RLIMIT_CORE
60 /* Largest resident set size, in bytes.
61 This affects swapping; processes that are exceeding their
62 resident set size will be more likely to have physical memory
63 taken from them. */
64 _RLIMIT_RSS = RLIMIT_RSS,
65 #undef RLIMIT_RSS
66 RLIMIT_RSS = _RLIMIT_RSS,
67 #define RLIMIT_RSS RLIMIT_RSS
69 /* Number of open files. */
70 _RLIMIT_NOFILE = RLIMIT_NOFILE,
71 #undef RLIMIT_NOFILE
72 RLIMIT_NOFILE = _RLIMIT_NOFILE,
73 RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */
74 #define RLIMIT_NOFILE RLIMIT_NOFILE
75 #define RLIMIT_OFILE RLIMIT_OFILE
77 /* Address space limit (?) */
78 _RLIMIT_AS = RLIMIT_AS,
79 #undef RLIMIT_AS
80 RLIMIT_AS = _RLIMIT_AS,
81 #define RLIMIT_AS RLIMIT_AS
83 /* Number of processes. */
84 _RLIMIT_NPROC = RLIMIT_NPROC,
85 #undef RLIMIT_NPROC
86 RLIMIT_NPROC = _RLIMIT_NPROC,
87 #define RLIMIT_NPROC RLIMIT_NPROC
89 /* Locked-in-memory address space. */
90 _RLIMIT_MEMLOCK = RLIMIT_MEMLOCK,
91 #undef RLIMIT_MEMLOCK
92 RLIMIT_MEMLOCK = _RLIMIT_MEMLOCK,
93 #define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
95 RLIMIT_NLIMITS = RLIM_NLIMITS,
96 #undef RLIM_NLIMITS
97 RLIM_NLIMITS = RLIMIT_NLIMITS,
98 #define RLIMIT_NLIMITS RLIMIT_NLIMITS
99 #define RLIM_NLIMITS RLIM_NLIMITS
101 /* Value to indicate that there is no limit. */
102 RLIM_INFINITY = (long int)(~0UL >> 1)
103 #define RLIM_INFINITY RLIM_INFINITY
106 struct rlimit
108 /* The current (soft) limit. */
109 long int rlim_cur;
110 /* The hard limit. */
111 long int rlim_max;
114 /* Whose usage statistics do you want? */
115 enum __rusage_who
117 /* The calling process. */
118 RUSAGE_SELF = 0,
119 #define RUSAGE_SELF RUSAGE_SELF
121 /* All of its terminated child processes. */
122 RUSAGE_CHILDREN = -1,
123 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
125 /* Both. */
126 RUSAGE_BOTH = -2
127 #define RUSAGE_BOTH RUSAGE_BOTH
130 #include <sys/time.h> /* For `struct timeval'. */
132 /* Structure which says how much of each resource has been used. */
133 struct rusage
135 /* Total amount of user time used. */
136 struct timeval ru_utime;
137 /* Total amount of system time used. */
138 struct timeval ru_stime;
139 /* Maximum resident set size (in kilobytes). */
140 long int ru_maxrss;
141 /* Amount of sharing of text segment memory
142 with other processes (kilobyte-seconds). */
143 long int ru_ixrss;
144 /* Amount of data segment memory used (kilobyte-seconds). */
145 long int ru_idrss;
146 /* Amount of stack memory used (kilobyte-seconds). */
147 long int ru_isrss;
148 /* Number of soft page faults (i.e. those serviced by reclaiming
149 a page from the list of pages awaiting reallocation. */
150 long int ru_minflt;
151 /* Number of hard page faults (i.e. those that required I/O). */
152 long int ru_majflt;
153 /* Number of times a process was swapped out of physical memory. */
154 long int ru_nswap;
155 /* Number of input operations via the file system. Note: This
156 and `ru_oublock' do not include operations with the cache. */
157 long int ru_inblock;
158 /* Number of output operations via the file system. */
159 long int ru_oublock;
160 /* Number of IPC messages sent. */
161 long int ru_msgsnd;
162 /* Number of IPC messages received. */
163 long int ru_msgrcv;
164 /* Number of signals delivered. */
165 long int ru_nsignals;
166 /* Number of voluntary context switches, i.e. because the process
167 gave up the process before it had to (usually to wait for some
168 resource to be available). */
169 long int ru_nvcsw;
170 /* Number of involuntary context switches, i.e. a higher priority process
171 became runnable or the current process used up its time slice. */
172 long int ru_nivcsw;
175 /* Priority limits. */
176 #define PRIO_MIN -20 /* Minimum priority a process can have. */
177 #define PRIO_MAX 20 /* Maximum priority a process can have. */
179 /* The type of the WHICH argument to `getpriority' and `setpriority',
180 indicating what flavor of entity the WHO argument specifies. */
181 enum __priority_which
183 PRIO_PROCESS = 0, /* WHO is a process ID. */
184 PRIO_PGRP = 1, /* WHO is a process group ID. */
185 PRIO_USER = 2 /* WHO is a user ID. */