zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

resource.h (19900B) - Raw


      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 #include <Availability.h>
     76 
     77 /* [XSI] The timeval structure shall be defined as described in
     78  * <sys/time.h>
     79  */
     80 #include <sys/_types/_timeval.h>
     81 
     82 /* The id_t type shall be defined as described in <sys/types.h> */
     83 #include <sys/_types/_id_t.h>
     84 
     85 
     86 /*
     87  * Resource limit type (low 63 bits, excluding the sign bit)
     88  */
     89 typedef __uint64_t      rlim_t;
     90 
     91 
     92 /*****
     93  * PRIORITY
     94  */
     95 
     96 /*
     97  * Possible values of the first parameter to getpriority()/setpriority(),
     98  * used to indicate the type of the second parameter.
     99  */
    100 #define PRIO_PROCESS    0               /* Second argument is a PID */
    101 #define PRIO_PGRP       1               /* Second argument is a GID */
    102 #define PRIO_USER       2               /* Second argument is a UID */
    103 
    104 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
    105 #define PRIO_DARWIN_THREAD      3               /* Second argument is always 0 (current thread) */
    106 #define PRIO_DARWIN_PROCESS     4               /* Second argument is a PID */
    107 /* Additional private parameters to getpriority()/setpriority() are in resource_private.h */
    108 
    109 /*
    110  * Range limitations for the value of the third parameter to setpriority().
    111  */
    112 #define PRIO_MIN        -20
    113 #define PRIO_MAX        20
    114 
    115 /*
    116  * use PRIO_DARWIN_BG to set the current thread into "background" state
    117  * which lowers CPU, disk IO, and networking priorites until thread terminates
    118  * or "background" state is revoked
    119  */
    120 #define PRIO_DARWIN_BG 0x1000
    121 
    122 /*
    123  * use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to
    124  * the GPU. (deprecated)
    125  */
    126 #define PRIO_DARWIN_NONUI 0x1001
    127 
    128 #endif  /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
    129 
    130 
    131 
    132 /*****
    133  * RESOURCE USAGE
    134  */
    135 
    136 /*
    137  * Possible values of the first parameter to getrusage(), used to indicate
    138  * the scope of the information to be returned.
    139  */
    140 #define RUSAGE_SELF     0               /* Current process information */
    141 #define RUSAGE_CHILDREN -1              /* Current process' children */
    142 
    143 /*
    144  * A structure representing an accounting of resource utilization.  The
    145  * address of an instance of this structure is the second parameter to
    146  * getrusage().
    147  *
    148  * Note: All values other than ru_utime and ru_stime are implementaiton
    149  *       defined and subject to change in a future release.  Their use
    150  *       is discouraged for standards compliant programs.
    151  */
    152 struct  rusage {
    153 	struct timeval ru_utime;        /* user time used (PL) */
    154 	struct timeval ru_stime;        /* system time used (PL) */
    155 #if __DARWIN_C_LEVEL < __DARWIN_C_FULL
    156 	long    ru_opaque[14];          /* implementation defined */
    157 #else
    158 	/*
    159 	 * Informational aliases for source compatibility with programs
    160 	 * that need more information than that provided by standards,
    161 	 * and which do not mind being OS-dependent.
    162 	 */
    163 	long    ru_maxrss;              /* max resident set size (PL) */
    164 #define ru_first        ru_ixrss        /* internal: ruadd() range start */
    165 	long    ru_ixrss;               /* integral shared memory size (NU) */
    166 	long    ru_idrss;               /* integral unshared data (NU)  */
    167 	long    ru_isrss;               /* integral unshared stack (NU) */
    168 	long    ru_minflt;              /* page reclaims (NU) */
    169 	long    ru_majflt;              /* page faults (NU) */
    170 	long    ru_nswap;               /* swaps (NU) */
    171 	long    ru_inblock;             /* block input operations (atomic) */
    172 	long    ru_oublock;             /* block output operations (atomic) */
    173 	long    ru_msgsnd;              /* messages sent (atomic) */
    174 	long    ru_msgrcv;              /* messages received (atomic) */
    175 	long    ru_nsignals;            /* signals received (atomic) */
    176 	long    ru_nvcsw;               /* voluntary context switches (atomic) */
    177 	long    ru_nivcsw;              /* involuntary " */
    178 #define ru_last         ru_nivcsw       /* internal: ruadd() range end */
    179 #endif  /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
    180 };
    181 
    182 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
    183 /*
    184  * Flavors for proc_pid_rusage().
    185  */
    186 #define RUSAGE_INFO_V0  0
    187 #define RUSAGE_INFO_V1  1
    188 #define RUSAGE_INFO_V2  2
    189 #define RUSAGE_INFO_V3  3
    190 #define RUSAGE_INFO_V4  4
    191 #define RUSAGE_INFO_V5  5
    192 #define RUSAGE_INFO_V6  6
    193 #define RUSAGE_INFO_CURRENT RUSAGE_INFO_V6
    194 
    195 /*
    196  * Flags for RUSAGE_INFO_V5
    197  */
    198 #define RU_PROC_RUNS_RESLIDE    0x00000001      /* proc has reslid shared cache */
    199 
    200 typedef void *rusage_info_t;
    201 
    202 struct rusage_info_v0 {
    203 	uint8_t  ri_uuid[16];
    204 	uint64_t ri_user_time;
    205 	uint64_t ri_system_time;
    206 	uint64_t ri_pkg_idle_wkups;
    207 	uint64_t ri_interrupt_wkups;
    208 	uint64_t ri_pageins;
    209 	uint64_t ri_wired_size;
    210 	uint64_t ri_resident_size;
    211 	uint64_t ri_phys_footprint;
    212 	uint64_t ri_proc_start_abstime;
    213 	uint64_t ri_proc_exit_abstime;
    214 };
    215 
    216 struct rusage_info_v1 {
    217 	uint8_t  ri_uuid[16];
    218 	uint64_t ri_user_time;
    219 	uint64_t ri_system_time;
    220 	uint64_t ri_pkg_idle_wkups;
    221 	uint64_t ri_interrupt_wkups;
    222 	uint64_t ri_pageins;
    223 	uint64_t ri_wired_size;
    224 	uint64_t ri_resident_size;
    225 	uint64_t ri_phys_footprint;
    226 	uint64_t ri_proc_start_abstime;
    227 	uint64_t ri_proc_exit_abstime;
    228 	uint64_t ri_child_user_time;
    229 	uint64_t ri_child_system_time;
    230 	uint64_t ri_child_pkg_idle_wkups;
    231 	uint64_t ri_child_interrupt_wkups;
    232 	uint64_t ri_child_pageins;
    233 	uint64_t ri_child_elapsed_abstime;
    234 };
    235 
    236 struct rusage_info_v2 {
    237 	uint8_t  ri_uuid[16];
    238 	uint64_t ri_user_time;
    239 	uint64_t ri_system_time;
    240 	uint64_t ri_pkg_idle_wkups;
    241 	uint64_t ri_interrupt_wkups;
    242 	uint64_t ri_pageins;
    243 	uint64_t ri_wired_size;
    244 	uint64_t ri_resident_size;
    245 	uint64_t ri_phys_footprint;
    246 	uint64_t ri_proc_start_abstime;
    247 	uint64_t ri_proc_exit_abstime;
    248 	uint64_t ri_child_user_time;
    249 	uint64_t ri_child_system_time;
    250 	uint64_t ri_child_pkg_idle_wkups;
    251 	uint64_t ri_child_interrupt_wkups;
    252 	uint64_t ri_child_pageins;
    253 	uint64_t ri_child_elapsed_abstime;
    254 	uint64_t ri_diskio_bytesread;
    255 	uint64_t ri_diskio_byteswritten;
    256 };
    257 
    258 struct rusage_info_v3 {
    259 	uint8_t  ri_uuid[16];
    260 	uint64_t ri_user_time;
    261 	uint64_t ri_system_time;
    262 	uint64_t ri_pkg_idle_wkups;
    263 	uint64_t ri_interrupt_wkups;
    264 	uint64_t ri_pageins;
    265 	uint64_t ri_wired_size;
    266 	uint64_t ri_resident_size;
    267 	uint64_t ri_phys_footprint;
    268 	uint64_t ri_proc_start_abstime;
    269 	uint64_t ri_proc_exit_abstime;
    270 	uint64_t ri_child_user_time;
    271 	uint64_t ri_child_system_time;
    272 	uint64_t ri_child_pkg_idle_wkups;
    273 	uint64_t ri_child_interrupt_wkups;
    274 	uint64_t ri_child_pageins;
    275 	uint64_t ri_child_elapsed_abstime;
    276 	uint64_t ri_diskio_bytesread;
    277 	uint64_t ri_diskio_byteswritten;
    278 	uint64_t ri_cpu_time_qos_default;
    279 	uint64_t ri_cpu_time_qos_maintenance;
    280 	uint64_t ri_cpu_time_qos_background;
    281 	uint64_t ri_cpu_time_qos_utility;
    282 	uint64_t ri_cpu_time_qos_legacy;
    283 	uint64_t ri_cpu_time_qos_user_initiated;
    284 	uint64_t ri_cpu_time_qos_user_interactive;
    285 	uint64_t ri_billed_system_time;
    286 	uint64_t ri_serviced_system_time;
    287 };
    288 
    289 struct rusage_info_v4 {
    290 	uint8_t  ri_uuid[16];
    291 	uint64_t ri_user_time;
    292 	uint64_t ri_system_time;
    293 	uint64_t ri_pkg_idle_wkups;
    294 	uint64_t ri_interrupt_wkups;
    295 	uint64_t ri_pageins;
    296 	uint64_t ri_wired_size;
    297 	uint64_t ri_resident_size;
    298 	uint64_t ri_phys_footprint;
    299 	uint64_t ri_proc_start_abstime;
    300 	uint64_t ri_proc_exit_abstime;
    301 	uint64_t ri_child_user_time;
    302 	uint64_t ri_child_system_time;
    303 	uint64_t ri_child_pkg_idle_wkups;
    304 	uint64_t ri_child_interrupt_wkups;
    305 	uint64_t ri_child_pageins;
    306 	uint64_t ri_child_elapsed_abstime;
    307 	uint64_t ri_diskio_bytesread;
    308 	uint64_t ri_diskio_byteswritten;
    309 	uint64_t ri_cpu_time_qos_default;
    310 	uint64_t ri_cpu_time_qos_maintenance;
    311 	uint64_t ri_cpu_time_qos_background;
    312 	uint64_t ri_cpu_time_qos_utility;
    313 	uint64_t ri_cpu_time_qos_legacy;
    314 	uint64_t ri_cpu_time_qos_user_initiated;
    315 	uint64_t ri_cpu_time_qos_user_interactive;
    316 	uint64_t ri_billed_system_time;
    317 	uint64_t ri_serviced_system_time;
    318 	uint64_t ri_logical_writes;
    319 	uint64_t ri_lifetime_max_phys_footprint;
    320 	uint64_t ri_instructions;
    321 	uint64_t ri_cycles;
    322 	uint64_t ri_billed_energy;
    323 	uint64_t ri_serviced_energy;
    324 	uint64_t ri_interval_max_phys_footprint;
    325 	uint64_t ri_runnable_time;
    326 };
    327 
    328 struct rusage_info_v5 {
    329 	uint8_t  ri_uuid[16];
    330 	uint64_t ri_user_time;
    331 	uint64_t ri_system_time;
    332 	uint64_t ri_pkg_idle_wkups;
    333 	uint64_t ri_interrupt_wkups;
    334 	uint64_t ri_pageins;
    335 	uint64_t ri_wired_size;
    336 	uint64_t ri_resident_size;
    337 	uint64_t ri_phys_footprint;
    338 	uint64_t ri_proc_start_abstime;
    339 	uint64_t ri_proc_exit_abstime;
    340 	uint64_t ri_child_user_time;
    341 	uint64_t ri_child_system_time;
    342 	uint64_t ri_child_pkg_idle_wkups;
    343 	uint64_t ri_child_interrupt_wkups;
    344 	uint64_t ri_child_pageins;
    345 	uint64_t ri_child_elapsed_abstime;
    346 	uint64_t ri_diskio_bytesread;
    347 	uint64_t ri_diskio_byteswritten;
    348 	uint64_t ri_cpu_time_qos_default;
    349 	uint64_t ri_cpu_time_qos_maintenance;
    350 	uint64_t ri_cpu_time_qos_background;
    351 	uint64_t ri_cpu_time_qos_utility;
    352 	uint64_t ri_cpu_time_qos_legacy;
    353 	uint64_t ri_cpu_time_qos_user_initiated;
    354 	uint64_t ri_cpu_time_qos_user_interactive;
    355 	uint64_t ri_billed_system_time;
    356 	uint64_t ri_serviced_system_time;
    357 	uint64_t ri_logical_writes;
    358 	uint64_t ri_lifetime_max_phys_footprint;
    359 	uint64_t ri_instructions;
    360 	uint64_t ri_cycles;
    361 	uint64_t ri_billed_energy;
    362 	uint64_t ri_serviced_energy;
    363 	uint64_t ri_interval_max_phys_footprint;
    364 	uint64_t ri_runnable_time;
    365 	uint64_t ri_flags;
    366 };
    367 
    368 struct rusage_info_v6 {
    369 	uint8_t  ri_uuid[16];
    370 	uint64_t ri_user_time;
    371 	uint64_t ri_system_time;
    372 	uint64_t ri_pkg_idle_wkups;
    373 	uint64_t ri_interrupt_wkups;
    374 	uint64_t ri_pageins;
    375 	uint64_t ri_wired_size;
    376 	uint64_t ri_resident_size;
    377 	uint64_t ri_phys_footprint;
    378 	uint64_t ri_proc_start_abstime;
    379 	uint64_t ri_proc_exit_abstime;
    380 	uint64_t ri_child_user_time;
    381 	uint64_t ri_child_system_time;
    382 	uint64_t ri_child_pkg_idle_wkups;
    383 	uint64_t ri_child_interrupt_wkups;
    384 	uint64_t ri_child_pageins;
    385 	uint64_t ri_child_elapsed_abstime;
    386 	uint64_t ri_diskio_bytesread;
    387 	uint64_t ri_diskio_byteswritten;
    388 	uint64_t ri_cpu_time_qos_default;
    389 	uint64_t ri_cpu_time_qos_maintenance;
    390 	uint64_t ri_cpu_time_qos_background;
    391 	uint64_t ri_cpu_time_qos_utility;
    392 	uint64_t ri_cpu_time_qos_legacy;
    393 	uint64_t ri_cpu_time_qos_user_initiated;
    394 	uint64_t ri_cpu_time_qos_user_interactive;
    395 	uint64_t ri_billed_system_time;
    396 	uint64_t ri_serviced_system_time;
    397 	uint64_t ri_logical_writes;
    398 	uint64_t ri_lifetime_max_phys_footprint;
    399 	uint64_t ri_instructions;
    400 	uint64_t ri_cycles;
    401 	uint64_t ri_billed_energy;
    402 	uint64_t ri_serviced_energy;
    403 	uint64_t ri_interval_max_phys_footprint;
    404 	uint64_t ri_runnable_time;
    405 	uint64_t ri_flags;
    406 	uint64_t ri_user_ptime;
    407 	uint64_t ri_system_ptime;
    408 	uint64_t ri_pinstructions;
    409 	uint64_t ri_pcycles;
    410 	uint64_t ri_energy_nj;
    411 	uint64_t ri_penergy_nj;
    412 	uint64_t ri_secure_time_in_system;
    413 	uint64_t ri_secure_ptime_in_system;
    414 	uint64_t ri_neural_footprint;
    415 	uint64_t ri_lifetime_max_neural_footprint;
    416 	uint64_t ri_interval_max_neural_footprint;
    417 	uint64_t ri_reserved[9];
    418 };
    419 
    420 typedef struct rusage_info_v6 rusage_info_current;
    421 
    422 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
    423 
    424 
    425 
    426 /*****
    427  * RESOURCE LIMITS
    428  */
    429 
    430 /*
    431  * Symbolic constants for resource limits; since all limits are representable
    432  * as a type rlim_t, we are permitted to define RLIM_SAVED_* in terms of
    433  * RLIM_INFINITY.
    434  */
    435 #define RLIM_INFINITY   (((__uint64_t)1 << 63) - 1)     /* no limit */
    436 #define RLIM_SAVED_MAX  RLIM_INFINITY   /* Unrepresentable hard limit */
    437 #define RLIM_SAVED_CUR  RLIM_INFINITY   /* Unrepresentable soft limit */
    438 
    439 /*
    440  * Possible values of the first parameter to getrlimit()/setrlimit(), to
    441  * indicate for which resource the operation is being performed.
    442  */
    443 #define RLIMIT_CPU      0               /* cpu time per process */
    444 #define RLIMIT_FSIZE    1               /* file size */
    445 #define RLIMIT_DATA     2               /* data segment size */
    446 #define RLIMIT_STACK    3               /* stack size */
    447 #define RLIMIT_CORE     4               /* core file size */
    448 #define RLIMIT_AS       5               /* address space (resident set size) */
    449 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
    450 #define RLIMIT_RSS      RLIMIT_AS       /* source compatibility alias */
    451 #define RLIMIT_MEMLOCK  6               /* locked-in-memory address space */
    452 #define RLIMIT_NPROC    7               /* number of processes */
    453 #endif  /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
    454 #define RLIMIT_NOFILE   8               /* number of open files */
    455 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
    456 #define RLIM_NLIMITS    9               /* total number of resource limits */
    457 #endif  /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
    458 #define _RLIMIT_POSIX_FLAG      0x1000  /* Set bit for strict POSIX */
    459 
    460 /*
    461  * A structure representing a resource limit.  The address of an instance
    462  * of this structure is the second parameter to getrlimit()/setrlimit().
    463  */
    464 struct rlimit {
    465 	rlim_t  rlim_cur;               /* current (soft) limit */
    466 	rlim_t  rlim_max;               /* maximum value for rlim_cur */
    467 };
    468 
    469 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
    470 /*
    471  * proc_rlimit_control()
    472  *
    473  * Resource limit flavors
    474  */
    475 #define RLIMIT_WAKEUPS_MONITOR          0x1 /* Configure the wakeups monitor. */
    476 #define RLIMIT_CPU_USAGE_MONITOR        0x2 /* Configure the CPU usage monitor. */
    477 #define RLIMIT_THREAD_CPULIMITS         0x3 /* Configure a blocking, per-thread, CPU limits. */
    478 #define RLIMIT_FOOTPRINT_INTERVAL       0x4 /* Configure memory footprint interval tracking */
    479 
    480 /*
    481  * Flags for wakeups monitor control.
    482  */
    483 #define WAKEMON_ENABLE                  0x01
    484 #define WAKEMON_DISABLE                 0x02
    485 #define WAKEMON_GET_PARAMS              0x04
    486 #define WAKEMON_SET_DEFAULTS            0x08
    487 #define WAKEMON_MAKE_FATAL              0x10 /* Configure the task so that violations are fatal. */
    488 
    489 /*
    490  * Flags for CPU usage monitor control.
    491  */
    492 #define CPUMON_MAKE_FATAL               0x1000
    493 
    494 /*
    495  * Flags for memory footprint interval tracking.
    496  */
    497 #define FOOTPRINT_INTERVAL_RESET        0x1 /* Reset the footprint interval counter to zero */
    498 
    499 struct proc_rlimit_control_wakeupmon {
    500 	uint32_t wm_flags;
    501 	int32_t wm_rate;
    502 };
    503 
    504 /* Additional private I/O policies are in resource_private.h */
    505 
    506 /* I/O type */
    507 #define IOPOL_TYPE_DISK 0
    508 #define IOPOL_TYPE_VFS_ATIME_UPDATES 2
    509 #define IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES 3
    510 #define IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME 4
    511 #define IOPOL_TYPE_VFS_TRIGGER_RESOLVE 5
    512 #define IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION 6
    513 #define IOPOL_TYPE_VFS_IGNORE_PERMISSIONS 7
    514 #define IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE 8
    515 #define IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES 9
    516 #define IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY 10
    517 
    518 /* scope */
    519 #define IOPOL_SCOPE_PROCESS   0
    520 #define IOPOL_SCOPE_THREAD    1
    521 #define IOPOL_SCOPE_DARWIN_BG 2
    522 
    523 /* I/O Priority */
    524 #define IOPOL_DEFAULT           0
    525 #define IOPOL_IMPORTANT         1
    526 #define IOPOL_PASSIVE           2
    527 #define IOPOL_THROTTLE          3
    528 #define IOPOL_UTILITY           4
    529 #define IOPOL_STANDARD          5
    530 
    531 /* compatibility with older names */
    532 #define IOPOL_APPLICATION       IOPOL_STANDARD
    533 #define IOPOL_NORMAL            IOPOL_IMPORTANT
    534 
    535 #define IOPOL_ATIME_UPDATES_DEFAULT     0
    536 #define IOPOL_ATIME_UPDATES_OFF         1
    537 
    538 #define IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT 0
    539 #define IOPOL_MATERIALIZE_DATALESS_FILES_OFF     1
    540 #define IOPOL_MATERIALIZE_DATALESS_FILES_ON      2
    541 
    542 #define IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT 0
    543 #define IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME   1
    544 
    545 #define IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT 0
    546 #define IOPOL_VFS_TRIGGER_RESOLVE_OFF     1
    547 
    548 #define IOPOL_VFS_CONTENT_PROTECTION_DEFAULT 0
    549 #define IOPOL_VFS_CONTENT_PROTECTION_IGNORE  1
    550 
    551 #define IOPOL_VFS_IGNORE_PERMISSIONS_OFF 0
    552 #define IOPOL_VFS_IGNORE_PERMISSIONS_ON  1
    553 
    554 #define IOPOL_VFS_SKIP_MTIME_UPDATE_OFF    0
    555 #define IOPOL_VFS_SKIP_MTIME_UPDATE_ON     1
    556 #define IOPOL_VFS_SKIP_MTIME_UPDATE_IGNORE 2
    557 
    558 #define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF 0
    559 #define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON 1
    560 
    561 #define IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT 0
    562 #define IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON 1
    563 
    564 #define IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT 0
    565 #define IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON 1
    566 
    567 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
    568 
    569 
    570 __BEGIN_DECLS
    571 int     getpriority(int, id_t);
    572 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
    573 int     getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
    574 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
    575 int     getrlimit(int, struct rlimit *) __DARWIN_ALIAS(getrlimit);
    576 int     getrusage(int, struct rusage *);
    577 int     setpriority(int, id_t, int);
    578 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
    579 int     setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
    580 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
    581 int     setrlimit(int, const struct rlimit *) __DARWIN_ALIAS(setrlimit);
    582 __END_DECLS
    583 
    584 
    585 
    586 #endif  /* !_SYS_RESOURCE_H_ */