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