Print this page
OS-3088 need a lighterweight page invalidation mechanism for zone memcap
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/resource.h
+++ new/usr/src/uts/common/sys/resource.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
|
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2014 Garrrett D'Amore <garrett@damore.org>
23 23 *
24 24 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25 25 * Use is subject to license terms.
26 + * Copyright 2014 Joyent, Inc. All rights reserved.
26 27 */
27 28
28 29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 30 /* All Rights Reserved */
30 31
31 32 /*
32 33 * University Copyright- Copyright (c) 1982, 1986, 1988
33 34 * The Regents of the University of California
34 35 * All Rights Reserved
35 36 *
36 37 * University Acknowledgment- Portions of this document are derived from
37 38 * software developed by the University of California, Berkeley, and its
38 39 * contributors.
39 40 */
40 41
41 42 #ifndef _SYS_RESOURCE_H
42 43 #define _SYS_RESOURCE_H
43 44
44 45 #include <sys/feature_tests.h>
45 46
46 47 #include <sys/types.h>
47 48 #include <sys/time.h>
48 49
49 50 #ifdef __cplusplus
50 51 extern "C" {
51 52 #endif
52 53
53 54 /*
54 55 * Process priority specifications
55 56 */
56 57 #define PRIO_PROCESS 0
57 58 #define PRIO_PGRP 1
58 59 #define PRIO_USER 2
59 60 #define PRIO_GROUP 3
60 61 #define PRIO_SESSION 4
61 62 #define PRIO_LWP 5
62 63 #define PRIO_TASK 6
63 64 #define PRIO_PROJECT 7
64 65 #define PRIO_ZONE 8
65 66 #define PRIO_CONTRACT 9
66 67
67 68 /*
68 69 * Resource limits
69 70 */
70 71 #define RLIMIT_CPU 0 /* cpu time in seconds */
71 72 #define RLIMIT_FSIZE 1 /* maximum file size */
72 73 #define RLIMIT_DATA 2 /* data size */
73 74 #define RLIMIT_STACK 3 /* stack size */
74 75 #define RLIMIT_CORE 4 /* core file size */
75 76 #define RLIMIT_NOFILE 5 /* file descriptors */
76 77 #define RLIMIT_VMEM 6 /* maximum mapped memory */
77 78 #define RLIMIT_AS RLIMIT_VMEM
78 79
79 80 #define RLIM_NLIMITS 7 /* number of resource limits */
80 81
81 82 #if defined(_LP64)
82 83
83 84 typedef unsigned long rlim_t;
84 85
85 86 #define RLIM_INFINITY ((rlim_t)-3)
86 87 #define RLIM_SAVED_MAX ((rlim_t)-2)
87 88 #define RLIM_SAVED_CUR ((rlim_t)-1)
88 89
89 90 #else /* _LP64 */
90 91
91 92 /*
92 93 * The definitions of the following types and constants differ between the
93 94 * regular and large file compilation environments.
94 95 */
95 96 #if _FILE_OFFSET_BITS == 32
96 97
97 98 typedef unsigned long rlim_t;
98 99
99 100 #define RLIM_INFINITY 0x7fffffff
100 101 #define RLIM_SAVED_MAX 0x7ffffffe
101 102 #define RLIM_SAVED_CUR 0x7ffffffd
102 103
103 104 #else /* _FILE_OFFSET_BITS == 32 */
104 105
105 106 typedef u_longlong_t rlim_t;
106 107
107 108 #define RLIM_INFINITY ((rlim_t)-3)
108 109 #define RLIM_SAVED_MAX ((rlim_t)-2)
109 110 #define RLIM_SAVED_CUR ((rlim_t)-1)
110 111
111 112 #endif /* _FILE_OFFSET_BITS == 32 */
112 113
113 114 #endif /* _LP64 */
114 115
115 116 #if defined(_SYSCALL32)
116 117
117 118 /* Kernel's view of user ILP32 rlimits */
118 119
119 120 typedef uint32_t rlim32_t;
120 121
121 122 #define RLIM32_INFINITY 0x7fffffff
122 123 #define RLIM32_SAVED_MAX 0x7ffffffe
123 124 #define RLIM32_SAVED_CUR 0x7ffffffd
124 125
125 126 struct rlimit32 {
126 127 rlim32_t rlim_cur; /* current limit */
127 128 rlim32_t rlim_max; /* maximum value for rlim_cur */
128 129 };
129 130
130 131 #endif /* _SYSCALL32 */
131 132
132 133 struct rlimit {
133 134 rlim_t rlim_cur; /* current limit */
134 135 rlim_t rlim_max; /* maximum value for rlim_cur */
135 136 };
136 137
137 138 /* transitional large file interface versions */
138 139 #ifdef _LARGEFILE64_SOURCE
139 140
140 141 typedef u_longlong_t rlim64_t;
141 142
142 143 #define RLIM64_INFINITY ((rlim64_t)-3)
143 144 #define RLIM64_SAVED_MAX ((rlim64_t)-2)
144 145 #define RLIM64_SAVED_CUR ((rlim64_t)-1)
145 146
146 147 struct rlimit64 {
147 148 rlim64_t rlim_cur; /* current limit */
148 149 rlim64_t rlim_max; /* maximum value for rlim_cur */
149 150 };
150 151
151 152 #endif
152 153
153 154 /*
154 155 * Although the saved rlimits were initially introduced by the large file API,
155 156 * they are now available for all resource limits on the 64-bit kernel and for
156 157 * cpu time and file size limits on the 32-bit kernel.
157 158 */
158 159 #if defined(_LP64)
159 160
160 161 #define RLIM_SAVED(x) (1) /* save all resource limits */
161 162 #define RLIM_NSAVED RLIM_NLIMITS /* size of u_saved_rlimits[] */
162 163
163 164 #else /* _LP64 */
164 165
165 166 #define RLIM_SAVED(x) (x <= RLIMIT_FSIZE) /* cpu time and file size */
166 167 #define RLIM_NSAVED (RLIMIT_FSIZE + 1) /* size of u_saved_rlimits[] */
167 168
168 169 #endif /* _LP64 */
169 170
170 171
171 172 struct rusage {
172 173 struct timeval ru_utime; /* user time used */
173 174 struct timeval ru_stime; /* system time used */
174 175 long ru_maxrss; /* <unimp> */
175 176 long ru_ixrss; /* <unimp> */
176 177 long ru_idrss; /* <unimp> */
177 178 long ru_isrss; /* <unimp> */
178 179 long ru_minflt; /* any page faults not requiring I/O */
179 180 long ru_majflt; /* any page faults requiring I/O */
180 181 long ru_nswap; /* swaps */
181 182 long ru_inblock; /* block input operations */
182 183 long ru_oublock; /* block output operations */
183 184 long ru_msgsnd; /* streams messsages sent */
|
↓ open down ↓ |
148 lines elided |
↑ open up ↑ |
184 185 long ru_msgrcv; /* streams messages received */
185 186 long ru_nsignals; /* signals received */
186 187 long ru_nvcsw; /* voluntary context switches */
187 188 long ru_nivcsw; /* involuntary " */
188 189 };
189 190
190 191 #define _RUSAGESYS_GETRUSAGE 0 /* rusage process */
191 192 #define _RUSAGESYS_GETRUSAGE_CHLD 1 /* rusage child process */
192 193 #define _RUSAGESYS_GETRUSAGE_LWP 2 /* rusage lwp */
193 194 #define _RUSAGESYS_GETVMUSAGE 3 /* getvmusage */
195 +#define _RUSAGESYS_INVALMAP 4 /* vm_map_inval */
194 196
195 197 #if defined(_SYSCALL32)
196 198
197 199 struct rusage32 {
198 200 struct timeval32 ru_utime; /* user time used */
199 201 struct timeval32 ru_stime; /* system time used */
200 202 int ru_maxrss; /* <unimp> */
201 203 int ru_ixrss; /* <unimp> */
202 204 int ru_idrss; /* <unimp> */
203 205 int ru_isrss; /* <unimp> */
204 206 int ru_minflt; /* any page faults not requiring I/O */
205 207 int ru_majflt; /* any page faults requiring I/O */
206 208 int ru_nswap; /* swaps */
207 209 int ru_inblock; /* block input operations */
208 210 int ru_oublock; /* block output operations */
209 211 int ru_msgsnd; /* streams messages sent */
210 212 int ru_msgrcv; /* streams messages received */
211 213 int ru_nsignals; /* signals received */
212 214 int ru_nvcsw; /* voluntary context switches */
213 215 int ru_nivcsw; /* involuntary " */
214 216 };
215 217
216 218 #endif /* _SYSCALL32 */
217 219
218 220
219 221 #ifdef _KERNEL
220 222
221 223 #include <sys/model.h>
222 224
223 225 struct proc;
224 226
225 227 #else
226 228
227 229 #define RUSAGE_SELF 0
228 230 #define RUSAGE_LWP 1
229 231 #define RUSAGE_CHILDREN -1
230 232
231 233
232 234 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
233 235 /*
234 236 * large file compilation environment setup
235 237 */
236 238 #ifdef __PRAGMA_REDEFINE_EXTNAME
237 239 #pragma redefine_extname setrlimit setrlimit64
238 240 #pragma redefine_extname getrlimit getrlimit64
239 241 #else
240 242 #define setrlimit setrlimit64
241 243 #define getrlimit getrlimit64
242 244 #define rlimit rlimit64
243 245 #endif
244 246 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
245 247
246 248 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
247 249 /*
248 250 * In the LP64 compilation environment, map large file interfaces
249 251 * back to native versions where possible.
250 252 */
251 253 #ifdef __PRAGMA_REDEFINE_EXTNAME
252 254 #pragma redefine_extname setrlimit64 setrlimit
253 255 #pragma redefine_extname getrlimit64 getrlimit
254 256 #else
255 257 #define setrlimit64 setrlimit
256 258 #define getrlimit64 getrlimit
257 259 #define rlimit64 rlimit
258 260 #endif
259 261 #endif /* _LP64 && _LARGEFILE64_SOURCE */
260 262
261 263 extern int setrlimit(int, const struct rlimit *);
262 264 extern int getrlimit(int, struct rlimit *);
263 265
264 266 /* transitional large file interfaces */
265 267 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
266 268 !defined(__PRAGMA_REDEFINE_EXTNAME))
267 269 extern int setrlimit64(int, const struct rlimit64 *);
268 270 extern int getrlimit64(int, struct rlimit64 *);
269 271 #endif /* _LARGEFILE64_SOURCE... */
270 272
271 273 extern int getpriority(int, id_t);
272 274 extern int setpriority(int, id_t, int);
273 275 extern int getrusage(int, struct rusage *);
274 276
275 277 #endif /* _KERNEL */
276 278
277 279 #ifdef __cplusplus
278 280 }
279 281 #endif
280 282
281 283 #endif /* _SYS_RESOURCE_H */
|
↓ open down ↓ |
78 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX