]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/resource.h
xnu-6153.61.1.tar.gz
[apple/xnu.git] / bsd / sys / resource.h
1 /*
2 * Copyright (c) 2000-2018 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29 /*
30 * Copyright (c) 1982, 1986, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)resource.h 8.2 (Berkeley) 1/4/94
62 */
63
64 #ifndef _SYS_RESOURCE_H_
65 #define _SYS_RESOURCE_H_
66
67 #include <sys/appleapiopts.h>
68 #include <sys/cdefs.h>
69 #include <sys/_types.h>
70
71 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
72 #include <stdint.h>
73 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
74
75 #ifndef KERNEL
76 #include <Availability.h>
77 #endif
78
79 /* [XSI] The timeval structure shall be defined as described in
80 * <sys/time.h>
81 */
82 #include <sys/_types/_timeval.h>
83 #ifdef KERNEL
84 #include <sys/_types/_user32_timeval.h>
85 #include <sys/_types/_user64_timeval.h>
86 #endif
87
88 /* The id_t type shall be defined as described in <sys/types.h> */
89 #include <sys/_types/_id_t.h>
90
91
92 /*
93 * Resource limit type (low 63 bits, excluding the sign bit)
94 */
95 typedef __uint64_t rlim_t;
96
97
98 /*****
99 * PRIORITY
100 */
101
102 /*
103 * Possible values of the first parameter to getpriority()/setpriority(),
104 * used to indicate the type of the second parameter.
105 */
106 #define PRIO_PROCESS 0 /* Second argument is a PID */
107 #define PRIO_PGRP 1 /* Second argument is a GID */
108 #define PRIO_USER 2 /* Second argument is a UID */
109
110 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
111 #define PRIO_DARWIN_THREAD 3 /* Second argument is always 0 (current thread) */
112 #define PRIO_DARWIN_PROCESS 4 /* Second argument is a PID */
113
114 #ifdef PRIVATE
115
116 #define PRIO_DARWIN_GPU 5 /* Second argument is a PID */
117
118 #define PRIO_DARWIN_GPU_ALLOW 0x1
119 #define PRIO_DARWIN_GPU_DENY 0x2
120
121 #define PRIO_DARWIN_ROLE 6 /* Second argument is a PID */
122
123 #define PRIO_DARWIN_ROLE_DEFAULT 0x0 /* Reset to default state */
124 #define PRIO_DARWIN_ROLE_UI_FOCAL 0x1 /* On screen, focal UI */
125 #define PRIO_DARWIN_ROLE_UI 0x2 /* On screen UI, focal unknown */
126 #define PRIO_DARWIN_ROLE_NON_UI 0x3 /* Off screen, non-focal UI */
127 #define PRIO_DARWIN_ROLE_UI_NON_FOCAL 0x4 /* On screen, non-focal UI */
128 #define PRIO_DARWIN_ROLE_TAL_LAUNCH 0x5 /* Throttled-launch (for OS X TAL resume) */
129 #define PRIO_DARWIN_ROLE_DARWIN_BG 0x6 /* Throttled for running in the background */
130
131 #endif /* PRIVATE */
132
133 /*
134 * Range limitations for the value of the third parameter to setpriority().
135 */
136 #define PRIO_MIN -20
137 #define PRIO_MAX 20
138
139 /*
140 * use PRIO_DARWIN_BG to set the current thread into "background" state
141 * which lowers CPU, disk IO, and networking priorites until thread terminates
142 * or "background" state is revoked
143 */
144 #define PRIO_DARWIN_BG 0x1000
145
146 /*
147 * use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to
148 * the GPU. (deprecated)
149 */
150 #define PRIO_DARWIN_NONUI 0x1001
151
152 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
153
154
155
156 /*****
157 * RESOURCE USAGE
158 */
159
160 /*
161 * Possible values of the first parameter to getrusage(), used to indicate
162 * the scope of the information to be returned.
163 */
164 #define RUSAGE_SELF 0 /* Current process information */
165 #define RUSAGE_CHILDREN -1 /* Current process' children */
166
167 /*
168 * A structure representing an accounting of resource utilization. The
169 * address of an instance of this structure is the second parameter to
170 * getrusage().
171 *
172 * Note: All values other than ru_utime and ru_stime are implementaiton
173 * defined and subject to change in a future release. Their use
174 * is discouraged for standards compliant programs.
175 */
176 struct rusage {
177 struct timeval ru_utime; /* user time used (PL) */
178 struct timeval ru_stime; /* system time used (PL) */
179 #if __DARWIN_C_LEVEL < __DARWIN_C_FULL
180 long ru_opaque[14]; /* implementation defined */
181 #else
182 /*
183 * Informational aliases for source compatibility with programs
184 * that need more information than that provided by standards,
185 * and which do not mind being OS-dependent.
186 */
187 long ru_maxrss; /* max resident set size (PL) */
188 #define ru_first ru_ixrss /* internal: ruadd() range start */
189 long ru_ixrss; /* integral shared memory size (NU) */
190 long ru_idrss; /* integral unshared data (NU) */
191 long ru_isrss; /* integral unshared stack (NU) */
192 long ru_minflt; /* page reclaims (NU) */
193 long ru_majflt; /* page faults (NU) */
194 long ru_nswap; /* swaps (NU) */
195 long ru_inblock; /* block input operations (atomic) */
196 long ru_oublock; /* block output operations (atomic) */
197 long ru_msgsnd; /* messages sent (atomic) */
198 long ru_msgrcv; /* messages received (atomic) */
199 long ru_nsignals; /* signals received (atomic) */
200 long ru_nvcsw; /* voluntary context switches (atomic) */
201 long ru_nivcsw; /* involuntary " */
202 #define ru_last ru_nivcsw /* internal: ruadd() range end */
203 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
204 };
205
206 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
207 /*
208 * Flavors for proc_pid_rusage().
209 */
210 #define RUSAGE_INFO_V0 0
211 #define RUSAGE_INFO_V1 1
212 #define RUSAGE_INFO_V2 2
213 #define RUSAGE_INFO_V3 3
214 #define RUSAGE_INFO_V4 4
215 #define RUSAGE_INFO_CURRENT RUSAGE_INFO_V4
216
217 typedef void *rusage_info_t;
218
219 struct rusage_info_v0 {
220 uint8_t ri_uuid[16];
221 uint64_t ri_user_time;
222 uint64_t ri_system_time;
223 uint64_t ri_pkg_idle_wkups;
224 uint64_t ri_interrupt_wkups;
225 uint64_t ri_pageins;
226 uint64_t ri_wired_size;
227 uint64_t ri_resident_size;
228 uint64_t ri_phys_footprint;
229 uint64_t ri_proc_start_abstime;
230 uint64_t ri_proc_exit_abstime;
231 };
232
233 struct rusage_info_v1 {
234 uint8_t ri_uuid[16];
235 uint64_t ri_user_time;
236 uint64_t ri_system_time;
237 uint64_t ri_pkg_idle_wkups;
238 uint64_t ri_interrupt_wkups;
239 uint64_t ri_pageins;
240 uint64_t ri_wired_size;
241 uint64_t ri_resident_size;
242 uint64_t ri_phys_footprint;
243 uint64_t ri_proc_start_abstime;
244 uint64_t ri_proc_exit_abstime;
245 uint64_t ri_child_user_time;
246 uint64_t ri_child_system_time;
247 uint64_t ri_child_pkg_idle_wkups;
248 uint64_t ri_child_interrupt_wkups;
249 uint64_t ri_child_pageins;
250 uint64_t ri_child_elapsed_abstime;
251 };
252
253 struct rusage_info_v2 {
254 uint8_t ri_uuid[16];
255 uint64_t ri_user_time;
256 uint64_t ri_system_time;
257 uint64_t ri_pkg_idle_wkups;
258 uint64_t ri_interrupt_wkups;
259 uint64_t ri_pageins;
260 uint64_t ri_wired_size;
261 uint64_t ri_resident_size;
262 uint64_t ri_phys_footprint;
263 uint64_t ri_proc_start_abstime;
264 uint64_t ri_proc_exit_abstime;
265 uint64_t ri_child_user_time;
266 uint64_t ri_child_system_time;
267 uint64_t ri_child_pkg_idle_wkups;
268 uint64_t ri_child_interrupt_wkups;
269 uint64_t ri_child_pageins;
270 uint64_t ri_child_elapsed_abstime;
271 uint64_t ri_diskio_bytesread;
272 uint64_t ri_diskio_byteswritten;
273 };
274
275 struct rusage_info_v3 {
276 uint8_t ri_uuid[16];
277 uint64_t ri_user_time;
278 uint64_t ri_system_time;
279 uint64_t ri_pkg_idle_wkups;
280 uint64_t ri_interrupt_wkups;
281 uint64_t ri_pageins;
282 uint64_t ri_wired_size;
283 uint64_t ri_resident_size;
284 uint64_t ri_phys_footprint;
285 uint64_t ri_proc_start_abstime;
286 uint64_t ri_proc_exit_abstime;
287 uint64_t ri_child_user_time;
288 uint64_t ri_child_system_time;
289 uint64_t ri_child_pkg_idle_wkups;
290 uint64_t ri_child_interrupt_wkups;
291 uint64_t ri_child_pageins;
292 uint64_t ri_child_elapsed_abstime;
293 uint64_t ri_diskio_bytesread;
294 uint64_t ri_diskio_byteswritten;
295 uint64_t ri_cpu_time_qos_default;
296 uint64_t ri_cpu_time_qos_maintenance;
297 uint64_t ri_cpu_time_qos_background;
298 uint64_t ri_cpu_time_qos_utility;
299 uint64_t ri_cpu_time_qos_legacy;
300 uint64_t ri_cpu_time_qos_user_initiated;
301 uint64_t ri_cpu_time_qos_user_interactive;
302 uint64_t ri_billed_system_time;
303 uint64_t ri_serviced_system_time;
304 };
305
306 struct rusage_info_v4 {
307 uint8_t ri_uuid[16];
308 uint64_t ri_user_time;
309 uint64_t ri_system_time;
310 uint64_t ri_pkg_idle_wkups;
311 uint64_t ri_interrupt_wkups;
312 uint64_t ri_pageins;
313 uint64_t ri_wired_size;
314 uint64_t ri_resident_size;
315 uint64_t ri_phys_footprint;
316 uint64_t ri_proc_start_abstime;
317 uint64_t ri_proc_exit_abstime;
318 uint64_t ri_child_user_time;
319 uint64_t ri_child_system_time;
320 uint64_t ri_child_pkg_idle_wkups;
321 uint64_t ri_child_interrupt_wkups;
322 uint64_t ri_child_pageins;
323 uint64_t ri_child_elapsed_abstime;
324 uint64_t ri_diskio_bytesread;
325 uint64_t ri_diskio_byteswritten;
326 uint64_t ri_cpu_time_qos_default;
327 uint64_t ri_cpu_time_qos_maintenance;
328 uint64_t ri_cpu_time_qos_background;
329 uint64_t ri_cpu_time_qos_utility;
330 uint64_t ri_cpu_time_qos_legacy;
331 uint64_t ri_cpu_time_qos_user_initiated;
332 uint64_t ri_cpu_time_qos_user_interactive;
333 uint64_t ri_billed_system_time;
334 uint64_t ri_serviced_system_time;
335 uint64_t ri_logical_writes;
336 uint64_t ri_lifetime_max_phys_footprint;
337 uint64_t ri_instructions;
338 uint64_t ri_cycles;
339 uint64_t ri_billed_energy;
340 uint64_t ri_serviced_energy;
341 uint64_t ri_interval_max_phys_footprint;
342 uint64_t ri_runnable_time;
343 };
344
345 typedef struct rusage_info_v4 rusage_info_current;
346
347 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
348
349 #ifdef KERNEL
350
351 struct rusage_superset {
352 struct rusage ru;
353 rusage_info_current ri;
354 };
355
356 struct rusage_info_child {
357 uint64_t ri_child_user_time;
358 uint64_t ri_child_system_time;
359 uint64_t ri_child_pkg_idle_wkups;
360 uint64_t ri_child_interrupt_wkups;
361 uint64_t ri_child_pageins;
362 uint64_t ri_child_elapsed_abstime;
363 };
364
365 struct user64_rusage {
366 struct user64_timeval ru_utime; /* user time used */
367 struct user64_timeval ru_stime; /* system time used */
368 user64_long_t ru_maxrss; /* max resident set size */
369 user64_long_t ru_ixrss; /* integral shared memory size */
370 user64_long_t ru_idrss; /* integral unshared data " */
371 user64_long_t ru_isrss; /* integral unshared stack " */
372 user64_long_t ru_minflt; /* page reclaims */
373 user64_long_t ru_majflt; /* page faults */
374 user64_long_t ru_nswap; /* swaps */
375 user64_long_t ru_inblock; /* block input operations */
376 user64_long_t ru_oublock; /* block output operations */
377 user64_long_t ru_msgsnd; /* messages sent */
378 user64_long_t ru_msgrcv; /* messages received */
379 user64_long_t ru_nsignals; /* signals received */
380 user64_long_t ru_nvcsw; /* voluntary context switches */
381 user64_long_t ru_nivcsw; /* involuntary " */
382 };
383
384 struct user32_rusage {
385 struct user32_timeval ru_utime; /* user time used */
386 struct user32_timeval ru_stime; /* system time used */
387 user32_long_t ru_maxrss; /* max resident set size */
388 user32_long_t ru_ixrss; /* integral shared memory size */
389 user32_long_t ru_idrss; /* integral unshared data " */
390 user32_long_t ru_isrss; /* integral unshared stack " */
391 user32_long_t ru_minflt; /* page reclaims */
392 user32_long_t ru_majflt; /* page faults */
393 user32_long_t ru_nswap; /* swaps */
394 user32_long_t ru_inblock; /* block input operations */
395 user32_long_t ru_oublock; /* block output operations */
396 user32_long_t ru_msgsnd; /* messages sent */
397 user32_long_t ru_msgrcv; /* messages received */
398 user32_long_t ru_nsignals; /* signals received */
399 user32_long_t ru_nvcsw; /* voluntary context switches */
400 user32_long_t ru_nivcsw; /* involuntary " */
401 };
402
403 #endif /* KERNEL */
404
405
406 /*****
407 * RESOURCE LIMITS
408 */
409
410 /*
411 * Symbolic constants for resource limits; since all limits are representable
412 * as a type rlim_t, we are permitted to define RLIM_SAVED_* in terms of
413 * RLIM_INFINITY.
414 */
415 #define RLIM_INFINITY (((__uint64_t)1 << 63) - 1) /* no limit */
416 #define RLIM_SAVED_MAX RLIM_INFINITY /* Unrepresentable hard limit */
417 #define RLIM_SAVED_CUR RLIM_INFINITY /* Unrepresentable soft limit */
418
419 /*
420 * Possible values of the first parameter to getrlimit()/setrlimit(), to
421 * indicate for which resource the operation is being performed.
422 */
423 #define RLIMIT_CPU 0 /* cpu time per process */
424 #define RLIMIT_FSIZE 1 /* file size */
425 #define RLIMIT_DATA 2 /* data segment size */
426 #define RLIMIT_STACK 3 /* stack size */
427 #define RLIMIT_CORE 4 /* core file size */
428 #define RLIMIT_AS 5 /* address space (resident set size) */
429 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
430 #define RLIMIT_RSS RLIMIT_AS /* source compatibility alias */
431 #define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */
432 #define RLIMIT_NPROC 7 /* number of processes */
433 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
434 #define RLIMIT_NOFILE 8 /* number of open files */
435 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
436 #define RLIM_NLIMITS 9 /* total number of resource limits */
437 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
438 #define _RLIMIT_POSIX_FLAG 0x1000 /* Set bit for strict POSIX */
439
440 /*
441 * A structure representing a resource limit. The address of an instance
442 * of this structure is the second parameter to getrlimit()/setrlimit().
443 */
444 struct rlimit {
445 rlim_t rlim_cur; /* current (soft) limit */
446 rlim_t rlim_max; /* maximum value for rlim_cur */
447 };
448
449 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
450 /*
451 * proc_rlimit_control()
452 *
453 * Resource limit flavors
454 */
455 #define RLIMIT_WAKEUPS_MONITOR 0x1 /* Configure the wakeups monitor. */
456 #define RLIMIT_CPU_USAGE_MONITOR 0x2 /* Configure the CPU usage monitor. */
457 #define RLIMIT_THREAD_CPULIMITS 0x3 /* Configure a blocking, per-thread, CPU limits. */
458 #define RLIMIT_FOOTPRINT_INTERVAL 0x4 /* Configure memory footprint interval tracking */
459
460 /*
461 * Flags for wakeups monitor control.
462 */
463 #define WAKEMON_ENABLE 0x01
464 #define WAKEMON_DISABLE 0x02
465 #define WAKEMON_GET_PARAMS 0x04
466 #define WAKEMON_SET_DEFAULTS 0x08
467 #define WAKEMON_MAKE_FATAL 0x10 /* Configure the task so that violations are fatal. */
468
469 /*
470 * Flags for CPU usage monitor control.
471 */
472 #define CPUMON_MAKE_FATAL 0x1000
473
474 /*
475 * Flags for memory footprint interval tracking.
476 */
477 #define FOOTPRINT_INTERVAL_RESET 0x1 /* Reset the footprint interval counter to zero */
478
479 struct proc_rlimit_control_wakeupmon {
480 uint32_t wm_flags;
481 int32_t wm_rate;
482 };
483
484 #if PRIVATE
485 /*
486 * Flags for I/O monitor control.
487 */
488 #define IOMON_ENABLE 0x01
489 #define IOMON_DISABLE 0x02
490
491 #endif /* PRIVATE */
492
493
494 /* I/O type */
495 #define IOPOL_TYPE_DISK 0
496 #if PRIVATE
497 #define IOPOL_TYPE_VFS_HFS_CASE_SENSITIVITY 1
498 #endif
499 #define IOPOL_TYPE_VFS_ATIME_UPDATES 2
500 #define IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES 3
501 #define IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME 4
502
503 /* scope */
504 #define IOPOL_SCOPE_PROCESS 0
505 #define IOPOL_SCOPE_THREAD 1
506 #define IOPOL_SCOPE_DARWIN_BG 2
507
508 /* I/O Priority */
509 #define IOPOL_DEFAULT 0
510 #define IOPOL_IMPORTANT 1
511 #define IOPOL_PASSIVE 2
512 #define IOPOL_THROTTLE 3
513 #define IOPOL_UTILITY 4
514 #define IOPOL_STANDARD 5
515
516 /* compatibility with older names */
517 #define IOPOL_APPLICATION IOPOL_STANDARD
518 #define IOPOL_NORMAL IOPOL_IMPORTANT
519
520 #if PRIVATE
521 #define IOPOL_VFS_HFS_CASE_SENSITIVITY_DEFAULT 0
522 #define IOPOL_VFS_HFS_CASE_SENSITIVITY_FORCE_CASE_SENSITIVE 1
523 #endif
524
525 #define IOPOL_ATIME_UPDATES_DEFAULT 0
526 #define IOPOL_ATIME_UPDATES_OFF 1
527
528 #define IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT 0
529 #define IOPOL_MATERIALIZE_DATALESS_FILES_OFF 1
530 #define IOPOL_MATERIALIZE_DATALESS_FILES_ON 2
531
532 #define IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT 0
533 #define IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME 1
534
535 #ifdef PRIVATE
536 /*
537 * Structures for use in communicating via iopolicysys() between Libc and the
538 * kernel. Not to be used by user programs directly.
539 */
540
541 /*
542 * the command to iopolicysys()
543 */
544 #define IOPOL_CMD_GET 0x00000001 /* Get I/O policy */
545 #define IOPOL_CMD_SET 0x00000002 /* Set I/O policy */
546
547 /*
548 * Second parameter to iopolicysys()
549 */
550 struct _iopol_param_t {
551 int iop_scope; /* current process or a thread */
552 int iop_iotype;
553 int iop_policy;
554 };
555
556 #endif /* PRIVATE */
557 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
558
559 #ifndef KERNEL
560
561 __BEGIN_DECLS
562 int getpriority(int, id_t);
563 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
564 int getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
565 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
566 int getrlimit(int, struct rlimit *) __DARWIN_ALIAS(getrlimit);
567 int getrusage(int, struct rusage *);
568 int setpriority(int, id_t, int);
569 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
570 int setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
571 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
572 int setrlimit(int, const struct rlimit *) __DARWIN_ALIAS(setrlimit);
573 __END_DECLS
574
575 #endif /* !KERNEL */
576 #endif /* !_SYS_RESOURCE_H_ */