| author | |
| committer | |
| log | 767eb2d4698203a11ee92618d9aff59d77984900 |
| tree | 3934f9f2ecb27ac595b7f37d43e156db357b9993 |
| parent | c760532be04667c8a8d49a7cf1b7582da3d1632d |
9 files changed, 1422 insertions(+), 7 deletions(-)
lib/libc/include/aarch64-macos-gnu/AvailabilityInternal.h+5-5| ... | ... | @@ -55,7 +55,7 @@ |
| 55 | 55 | #ifdef __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ |
| 56 | 56 | /* compiler sets __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ when -mtvos-version-min is used */ |
| 57 | 57 | #define __TV_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ |
| 58 | #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_14_2 | |
| 58 | #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_14_3 | |
| 59 | 59 | /* for compatibility with existing code. New code should use platform specific checks */ |
| 60 | 60 | #define __IPHONE_OS_VERSION_MIN_REQUIRED 90000 |
| 61 | 61 | #endif |
| ... | ... | @@ -65,7 +65,7 @@ |
| 65 | 65 | #ifdef __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ |
| 66 | 66 | /* compiler sets __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ when -mwatchos-version-min is used */ |
| 67 | 67 | #define __WATCH_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ |
| 68 | #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_7_1 | |
| 68 | #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_7_2 | |
| 69 | 69 | /* for compatibility with existing code. New code should use platform specific checks */ |
| 70 | 70 | #define __IPHONE_OS_VERSION_MIN_REQUIRED 90000 |
| 71 | 71 | #endif |
| ... | ... | @@ -75,7 +75,7 @@ |
| 75 | 75 | #ifdef __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ |
| 76 | 76 | |
| 77 | 77 | #define __BRIDGE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ |
| 78 | #define __BRIDGE_OS_VERSION_MAX_ALLOWED 50000 | |
| 78 | #define __BRIDGE_OS_VERSION_MAX_ALLOWED 50100 | |
| 79 | 79 | /* for compatibility with existing code. New code should use platform specific checks */ |
| 80 | 80 | #define __IPHONE_OS_VERSION_MIN_REQUIRED 110000 |
| 81 | 81 | #endif |
| ... | ... | @@ -90,14 +90,14 @@ |
| 90 | 90 | #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED |
| 91 | 91 | /* make sure a default max version is set */ |
| 92 | 92 | #ifndef __MAC_OS_X_VERSION_MAX_ALLOWED |
| 93 | #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_11_0 | |
| 93 | #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_11_1 | |
| 94 | 94 | #endif |
| 95 | 95 | #endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */ |
| 96 | 96 | |
| 97 | 97 | #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED |
| 98 | 98 | /* make sure a default max version is set */ |
| 99 | 99 | #ifndef __IPHONE_OS_VERSION_MAX_ALLOWED |
| 100 | #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_14_2 | |
| 100 | #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_14_3 | |
| 101 | 101 | #endif |
| 102 | 102 | /* make sure a valid min is set */ |
| 103 | 103 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0 |
lib/libc/include/aarch64-macos-gnu/AvailabilityMacros.h+3-2| ... | ... | @@ -118,6 +118,7 @@ |
| 118 | 118 | #define MAC_OS_X_VERSION_10_14_4 101404 |
| 119 | 119 | #define MAC_OS_X_VERSION_10_15 101500 |
| 120 | 120 | #define MAC_OS_VERSION_11_0 110000 |
| 121 | #define MAC_OS_VERSION_11_1 110100 | |
| 121 | 122 | |
| 122 | 123 | /* |
| 123 | 124 | * If min OS not specified, assume 10.4 for intel |
| ... | ... | @@ -144,10 +145,10 @@ |
| 144 | 145 | * if max OS not specified, assume larger of (10.15, min) |
| 145 | 146 | */ |
| 146 | 147 | #ifndef MAC_OS_X_VERSION_MAX_ALLOWED |
| 147 | #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_11_0 | |
| 148 | #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_11_1 | |
| 148 | 149 | #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED |
| 149 | 150 | #else |
| 150 | #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_11_0 | |
| 151 | #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_11_1 | |
| 151 | 152 | #endif |
| 152 | 153 | #endif |
| 153 | 154 |
lib/libc/include/aarch64-macos-gnu/AvailabilityVersions.h+4| ... | ... | @@ -58,6 +58,7 @@ |
| 58 | 58 | #define __MAC_10_15_4 101504 |
| 59 | 59 | #define __MAC_10_16 101600 |
| 60 | 60 | #define __MAC_11_0 110000 |
| 61 | #define __MAC_11_1 110100 | |
| 61 | 62 | /* __MAC_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ |
| 62 | 63 | |
| 63 | 64 | #define __IPHONE_2_0 20000 |
| ... | ... | @@ -110,6 +111,7 @@ |
| 110 | 111 | #define __IPHONE_14_0 140000 |
| 111 | 112 | #define __IPHONE_14_1 140100 |
| 112 | 113 | #define __IPHONE_14_2 140200 |
| 114 | #define __IPHONE_14_3 140300 | |
| 113 | 115 | /* __IPHONE_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ |
| 114 | 116 | |
| 115 | 117 | #define __TVOS_9_0 90000 |
| ... | ... | @@ -136,6 +138,7 @@ |
| 136 | 138 | #define __TVOS_14_0 140000 |
| 137 | 139 | #define __TVOS_14_1 140100 |
| 138 | 140 | #define __TVOS_14_2 140200 |
| 141 | #define __TVOS_14_3 140300 | |
| 139 | 142 | |
| 140 | 143 | #define __WATCHOS_1_0 10000 |
| 141 | 144 | #define __WATCHOS_2_0 20000 |
| ... | ... | @@ -158,6 +161,7 @@ |
| 158 | 161 | #define __WATCHOS_6_2 60200 |
| 159 | 162 | #define __WATCHOS_7_0 70000 |
| 160 | 163 | #define __WATCHOS_7_1 70100 |
| 164 | #define __WATCHOS_7_2 70200 | |
| 161 | 165 | |
| 162 | 166 | /* |
| 163 | 167 | * Set up standard Mac OS X versions |
lib/libc/include/aarch64-macos-gnu/libproc.h created+187| ... | ... | @@ -0,0 +1,187 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2006, 2007, 2010 Apple Inc. All rights reserved. | |
| 3 | * | |
| 4 | * @APPLE_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. Please obtain a copy of the License at | |
| 10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
| 11 | * file. | |
| 12 | * | |
| 13 | * The Original Code and all software distributed under the License are | |
| 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
| 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
| 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
| 18 | * Please see the License for the specific language governing rights and | |
| 19 | * limitations under the License. | |
| 20 | * | |
| 21 | * @APPLE_LICENSE_HEADER_END@ | |
| 22 | */ | |
| 23 | #ifndef _LIBPROC_H_ | |
| 24 | #define _LIBPROC_H_ | |
| 25 | ||
| 26 | #include <sys/cdefs.h> | |
| 27 | #include <sys/param.h> | |
| 28 | #include <sys/types.h> | |
| 29 | #include <sys/stat.h> | |
| 30 | #include <sys/mount.h> | |
| 31 | #include <sys/resource.h> | |
| 32 | #include <stdint.h> | |
| 33 | #include <stdbool.h> | |
| 34 | #include <mach/message.h> /* for audit_token_t */ | |
| 35 | ||
| 36 | #include <sys/proc_info.h> | |
| 37 | ||
| 38 | #include <Availability.h> | |
| 39 | #include <os/availability.h> | |
| 40 | ||
| 41 | /* | |
| 42 | * This header file contains private interfaces to obtain process information. | |
| 43 | * These interfaces are subject to change in future releases. | |
| 44 | */ | |
| 45 | ||
| 46 | /*! | |
| 47 | * @define PROC_LISTPIDSPATH_PATH_IS_VOLUME | |
| 48 | * @discussion This flag indicates that all processes that hold open | |
| 49 | * file references on the volume associated with the specified | |
| 50 | * path should be returned. | |
| 51 | */ | |
| 52 | #define PROC_LISTPIDSPATH_PATH_IS_VOLUME 1 | |
| 53 | ||
| 54 | ||
| 55 | /*! | |
| 56 | * @define PROC_LISTPIDSPATH_EXCLUDE_EVTONLY | |
| 57 | * @discussion This flag indicates that file references that were opened | |
| 58 | * with the O_EVTONLY flag should be excluded from the matching | |
| 59 | * criteria. | |
| 60 | */ | |
| 61 | #define PROC_LISTPIDSPATH_EXCLUDE_EVTONLY 2 | |
| 62 | ||
| 63 | __BEGIN_DECLS | |
| 64 | ||
| 65 | ||
| 66 | /*! | |
| 67 | * @function proc_listpidspath | |
| 68 | * @discussion A function which will search through the current | |
| 69 | * processes looking for open file references which match | |
| 70 | * a specified path or volume. | |
| 71 | * @param type types of processes to be searched (see proc_listpids) | |
| 72 | * @param typeinfo adjunct information for type | |
| 73 | * @param path file or volume path | |
| 74 | * @param pathflags flags to control which files should be considered | |
| 75 | * during the process search. | |
| 76 | * @param buffer a C array of int-sized values to be filled with | |
| 77 | * process identifiers that hold an open file reference | |
| 78 | * matching the specified path or volume. Pass NULL to | |
| 79 | * obtain the minimum buffer size needed to hold the | |
| 80 | * currently active processes. | |
| 81 | * @param buffersize the size (in bytes) of the provided buffer. | |
| 82 | * @result the number of bytes of data returned in the provided buffer; | |
| 83 | * -1 if an error was encountered; | |
| 84 | */ | |
| 85 | int proc_listpidspath(uint32_t type, | |
| 86 | uint32_t typeinfo, | |
| 87 | const char *path, | |
| 88 | uint32_t pathflags, | |
| 89 | void *buffer, | |
| 90 | int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 91 | ||
| 92 | int proc_listpids(uint32_t type, uint32_t typeinfo, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 93 | int proc_listallpids(void * buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_1); | |
| 94 | int proc_listpgrppids(pid_t pgrpid, void * buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_1); | |
| 95 | int proc_listchildpids(pid_t ppid, void * buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_1); | |
| 96 | int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 97 | int proc_pidfdinfo(int pid, int fd, int flavor, void * buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 98 | int proc_pidfileportinfo(int pid, uint32_t fileport, int flavor, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); | |
| 99 | int proc_name(int pid, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 100 | int proc_regionfilename(int pid, uint64_t address, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 101 | int proc_kmsgbuf(void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 102 | int proc_pidpath(int pid, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 103 | int proc_pidpath_audittoken(audit_token_t *audittoken, void * buffer, uint32_t buffersize) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)); | |
| 104 | int proc_libversion(int *major, int * minor) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); | |
| 105 | ||
| 106 | /* | |
| 107 | * Return resource usage information for the given pid, which can be a live process or a zombie. | |
| 108 | * | |
| 109 | * Returns 0 on success; or -1 on failure, with errno set to indicate the specific error. | |
| 110 | */ | |
| 111 | int proc_pid_rusage(int pid, int flavor, rusage_info_t *buffer) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0); | |
| 112 | ||
| 113 | /* | |
| 114 | * A process can use the following api to set its own process control | |
| 115 | * state on resoure starvation. The argument can have one of the PROC_SETPC_XX values | |
| 116 | */ | |
| 117 | #define PROC_SETPC_NONE 0 | |
| 118 | #define PROC_SETPC_THROTTLEMEM 1 | |
| 119 | #define PROC_SETPC_SUSPEND 2 | |
| 120 | #define PROC_SETPC_TERMINATE 3 | |
| 121 | ||
| 122 | int proc_setpcontrol(const int control) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); | |
| 123 | int proc_setpcontrol(const int control); | |
| 124 | ||
| 125 | int proc_track_dirty(pid_t pid, uint32_t flags); | |
| 126 | int proc_set_dirty(pid_t pid, bool dirty); | |
| 127 | int proc_get_dirty(pid_t pid, uint32_t *flags); | |
| 128 | int proc_clear_dirty(pid_t pid, uint32_t flags); | |
| 129 | ||
| 130 | int proc_terminate(pid_t pid, int *sig); | |
| 131 | ||
| 132 | /* | |
| 133 | * NO_SMT means that on an SMT CPU, this thread must be scheduled alone, | |
| 134 | * with the paired CPU idle. | |
| 135 | * | |
| 136 | * Set NO_SMT on the current proc (all existing and future threads) | |
| 137 | * This attribute is inherited on fork and exec | |
| 138 | */ | |
| 139 | int proc_set_no_smt(void) __API_AVAILABLE(macos(11.0)); | |
| 140 | ||
| 141 | /* Set NO_SMT on the current thread */ | |
| 142 | int proc_setthread_no_smt(void) __API_AVAILABLE(macos(11.0)); | |
| 143 | ||
| 144 | /* | |
| 145 | * CPU Security Mitigation APIs | |
| 146 | * | |
| 147 | * Set CPU security mitigation on the current proc (all existing and future threads) | |
| 148 | * This attribute is inherited on fork and exec | |
| 149 | */ | |
| 150 | int proc_set_csm(uint32_t flags) __API_AVAILABLE(macos(11.0)); | |
| 151 | ||
| 152 | /* Set CPU security mitigation on the current thread */ | |
| 153 | int proc_setthread_csm(uint32_t flags) __API_AVAILABLE(macos(11.0)); | |
| 154 | ||
| 155 | /* | |
| 156 | * flags for CPU Security Mitigation APIs | |
| 157 | * PROC_CSM_ALL should be used in most cases, | |
| 158 | * the individual flags are provided only for performance evaluation etc | |
| 159 | */ | |
| 160 | #define PROC_CSM_ALL 0x0001 /* Set all available mitigations */ | |
| 161 | #define PROC_CSM_NOSMT 0x0002 /* Set NO_SMT - see above */ | |
| 162 | #define PROC_CSM_TECS 0x0004 /* Execute VERW on every return to user mode */ | |
| 163 | ||
| 164 | #ifdef PRIVATE | |
| 165 | #include <sys/event.h> | |
| 166 | /* | |
| 167 | * Enumerate potential userspace pointers embedded in kernel data structures. | |
| 168 | * Currently inspects kqueues only. | |
| 169 | * | |
| 170 | * NOTE: returned "pointers" are opaque user-supplied values and thus not | |
| 171 | * guaranteed to address valid objects or be pointers at all. | |
| 172 | * | |
| 173 | * Returns the number of pointers found (which may exceed buffersize), or -1 on | |
| 174 | * failure and errno set appropriately. | |
| 175 | */ | |
| 176 | int proc_list_uptrs(pid_t pid, uint64_t *buffer, uint32_t buffersize); | |
| 177 | ||
| 178 | int proc_list_dynkqueueids(int pid, kqueue_id_t *buf, uint32_t bufsz); | |
| 179 | int proc_piddynkqueueinfo(int pid, int flavor, kqueue_id_t kq_id, void *buffer, | |
| 180 | int buffersize); | |
| 181 | #endif /* PRIVATE */ | |
| 182 | ||
| 183 | int proc_udata_info(int pid, int flavor, void *buffer, int buffersize); | |
| 184 | ||
| 185 | __END_DECLS | |
| 186 | ||
| 187 | #endif /*_LIBPROC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_param.h+4| ... | ... | @@ -87,6 +87,10 @@ |
| 87 | 87 | #define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW) |
| 88 | 88 | #define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW) |
| 89 | 89 | |
| 90 | #define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW 0x0000001000000000ULL | |
| 91 | #define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW 0x0000007000000000ULL | |
| 92 | #define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW) | |
| 93 | #define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW) | |
| 90 | 94 | |
| 91 | 95 | #else /* defined(__arm64__) */ |
| 92 | 96 | #error architecture not supported |
lib/libc/include/aarch64-macos-gnu/net/route.h created+257| ... | ... | @@ -0,0 +1,257 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2000-2017 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 | /* | |
| 29 | * Copyright (c) 1980, 1986, 1993 | |
| 30 | *	The Regents of the University of California. All rights reserved. | |
| 31 | * | |
| 32 | * Redistribution and use in source and binary forms, with or without | |
| 33 | * modification, are permitted provided that the following conditions | |
| 34 | * are met: | |
| 35 | * 1. Redistributions of source code must retain the above copyright | |
| 36 | * notice, this list of conditions and the following disclaimer. | |
| 37 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 38 | * notice, this list of conditions and the following disclaimer in the | |
| 39 | * documentation and/or other materials provided with the distribution. | |
| 40 | * 3. All advertising materials mentioning features or use of this software | |
| 41 | * must display the following acknowledgement: | |
| 42 | *	This product includes software developed by the University of | |
| 43 | *	California, Berkeley and its contributors. | |
| 44 | * 4. Neither the name of the University nor the names of its contributors | |
| 45 | * may be used to endorse or promote products derived from this software | |
| 46 | * without specific prior written permission. | |
| 47 | * | |
| 48 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 49 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 58 | * SUCH DAMAGE. | |
| 59 | * | |
| 60 | *	@(#)route.h	8.3 (Berkeley) 4/19/94 | |
| 61 | * $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $ | |
| 62 | */ | |
| 63 | ||
| 64 | #ifndef _NET_ROUTE_H_ | |
| 65 | #define _NET_ROUTE_H_ | |
| 66 | #include <sys/appleapiopts.h> | |
| 67 | #include <stdint.h> | |
| 68 | #include <sys/types.h> | |
| 69 | #include <sys/socket.h> | |
| 70 | ||
| 71 | /* | |
| 72 | * These numbers are used by reliable protocols for determining | |
| 73 | * retransmission behavior and are included in the routing structure. | |
| 74 | */ | |
| 75 | struct rt_metrics { | |
| 76 | 	u_int32_t rmx_locks; /* Kernel leaves these values alone */ | |
| 77 | 	u_int32_t rmx_mtu; /* MTU for this path */ | |
| 78 | 	u_int32_t rmx_hopcount; /* max hops expected */ | |
| 79 | 	int32_t rmx_expire; /* lifetime for route, e.g. redirect */ | |
| 80 | 	u_int32_t rmx_recvpipe; /* inbound delay-bandwidth product */ | |
| 81 | 	u_int32_t rmx_sendpipe; /* outbound delay-bandwidth product */ | |
| 82 | 	u_int32_t rmx_ssthresh; /* outbound gateway buffer limit */ | |
| 83 | 	u_int32_t rmx_rtt; /* estimated round trip time */ | |
| 84 | 	u_int32_t rmx_rttvar; /* estimated rtt variance */ | |
| 85 | 	u_int32_t rmx_pksent; /* packets sent using this route */ | |
| 86 | 	u_int32_t rmx_state; /* route state */ | |
| 87 | 	u_int32_t rmx_filler[3]; /* will be used for TCP's peer-MSS cache */ | |
| 88 | }; | |
| 89 | ||
| 90 | /* | |
| 91 | * rmx_rtt and rmx_rttvar are stored as microseconds; | |
| 92 | */ | |
| 93 | #define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ | |
| 94 | ||
| 95 | ||
| 96 | ||
| 97 | #define RTF_UP 0x1 /* route usable */ | |
| 98 | #define RTF_GATEWAY 0x2 /* destination is a gateway */ | |
| 99 | #define RTF_HOST 0x4 /* host entry (net otherwise) */ | |
| 100 | #define RTF_REJECT 0x8 /* host or net unreachable */ | |
| 101 | #define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ | |
| 102 | #define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ | |
| 103 | #define RTF_DONE 0x40 /* message confirmed */ | |
| 104 | #define RTF_DELCLONE 0x80 /* delete cloned route */ | |
| 105 | #define RTF_CLONING 0x100 /* generate new routes on use */ | |
| 106 | #define RTF_XRESOLVE 0x200 /* external daemon resolves name */ | |
| 107 | #define RTF_LLINFO 0x400 /* DEPRECATED - exists ONLY for backward | |
| 108 | 	 * compatibility */ | |
| 109 | #define RTF_LLDATA 0x400 /* used by apps to add/del L2 entries */ | |
| 110 | #define RTF_STATIC 0x800 /* manually added */ | |
| 111 | #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ | |
| 112 | #define RTF_NOIFREF 0x2000 /* not eligible for RTF_IFREF */ | |
| 113 | #define RTF_PROTO2 0x4000 /* protocol specific routing flag */ | |
| 114 | #define RTF_PROTO1 0x8000 /* protocol specific routing flag */ | |
| 115 | ||
| 116 | #define RTF_PRCLONING 0x10000 /* protocol requires cloning */ | |
| 117 | #define RTF_WASCLONED 0x20000 /* route generated through cloning */ | |
| 118 | #define RTF_PROTO3 0x40000 /* protocol specific routing flag */ | |
| 119 | /* 0x80000 unused */ | |
| 120 | #define RTF_PINNED 0x100000 /* future use */ | |
| 121 | #define RTF_LOCAL 0x200000 /* route represents a local address */ | |
| 122 | #define RTF_BROADCAST 0x400000 /* route represents a bcast address */ | |
| 123 | #define RTF_MULTICAST 0x800000 /* route represents a mcast address */ | |
| 124 | #define RTF_IFSCOPE 0x1000000 /* has valid interface scope */ | |
| 125 | #define RTF_CONDEMNED 0x2000000 /* defunct; no longer modifiable */ | |
| 126 | #define RTF_IFREF 0x4000000 /* route holds a ref to interface */ | |
| 127 | #define RTF_PROXY 0x8000000 /* proxying, no interface scope */ | |
| 128 | #define RTF_ROUTER 0x10000000 /* host is a router */ | |
| 129 | #define RTF_DEAD 0x20000000 /* Route entry is being freed */ | |
| 130 | /* 0x40000000 and up unassigned */ | |
| 131 | ||
| 132 | #define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ | |
| 133 | #define RTF_BITS \ | |
| 134 | 	"\020\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE" \ | |
| 135 | 	"\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \ | |
| 136 | 	"\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \ | |
| 137 | 	"\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \ | |
| 138 | 	"\33IFREF\34PROXY\35ROUTER" | |
| 139 | ||
| 140 | #define IS_DIRECT_HOSTROUTE(rt) \ | |
| 141 | 	(((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST) | |
| 142 | /* | |
| 143 | * Routing statistics. | |
| 144 | */ | |
| 145 | struct rtstat { | |
| 146 | 	short rts_badredirect; /* bogus redirect calls */ | |
| 147 | 	short rts_dynamic; /* routes created by redirects */ | |
| 148 | 	short rts_newgateway; /* routes modified by redirects */ | |
| 149 | 	short rts_unreach; /* lookups which failed */ | |
| 150 | 	short rts_wildcard; /* lookups satisfied by a wildcard */ | |
| 151 | 	short rts_badrtgwroute; /* route to gateway is not direct */ | |
| 152 | }; | |
| 153 | ||
| 154 | /* | |
| 155 | * Structures for routing messages. | |
| 156 | */ | |
| 157 | struct rt_msghdr { | |
| 158 | 	u_short rtm_msglen; /* to skip over non-understood messages */ | |
| 159 | 	u_char rtm_version; /* future binary compatibility */ | |
| 160 | 	u_char rtm_type; /* message type */ | |
| 161 | 	u_short rtm_index; /* index for associated ifp */ | |
| 162 | 	int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ | |
| 163 | 	int rtm_addrs; /* bitmask identifying sockaddrs in msg */ | |
| 164 | 	pid_t rtm_pid; /* identify sender */ | |
| 165 | 	int rtm_seq; /* for sender to identify action */ | |
| 166 | 	int rtm_errno; /* why failed */ | |
| 167 | 	int rtm_use; /* from rtentry */ | |
| 168 | 	u_int32_t rtm_inits; /* which metrics we are initializing */ | |
| 169 | 	struct rt_metrics rtm_rmx; /* metrics themselves */ | |
| 170 | }; | |
| 171 | ||
| 172 | struct rt_msghdr2 { | |
| 173 | 	u_short rtm_msglen; /* to skip over non-understood messages */ | |
| 174 | 	u_char rtm_version; /* future binary compatibility */ | |
| 175 | 	u_char rtm_type; /* message type */ | |
| 176 | 	u_short rtm_index; /* index for associated ifp */ | |
| 177 | 	int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ | |
| 178 | 	int rtm_addrs; /* bitmask identifying sockaddrs in msg */ | |
| 179 | 	int32_t rtm_refcnt; /* reference count */ | |
| 180 | 	int rtm_parentflags; /* flags of the parent route */ | |
| 181 | 	int rtm_reserved; /* reserved field set to 0 */ | |
| 182 | 	int rtm_use; /* from rtentry */ | |
| 183 | 	u_int32_t rtm_inits; /* which metrics we are initializing */ | |
| 184 | 	struct rt_metrics rtm_rmx; /* metrics themselves */ | |
| 185 | }; | |
| 186 | ||
| 187 | ||
| 188 | #define RTM_VERSION 5 /* Up the ante and ignore older versions */ | |
| 189 | ||
| 190 | /* | |
| 191 | * Message types. | |
| 192 | */ | |
| 193 | #define RTM_ADD 0x1 /* Add Route */ | |
| 194 | #define RTM_DELETE 0x2 /* Delete Route */ | |
| 195 | #define RTM_CHANGE 0x3 /* Change Metrics or flags */ | |
| 196 | #define RTM_GET 0x4 /* Report Metrics */ | |
| 197 | #define RTM_LOSING 0x5 /* RTM_LOSING is no longer generated by xnu | |
| 198 | 	 * and is deprecated */ | |
| 199 | #define RTM_REDIRECT 0x6 /* Told to use different route */ | |
| 200 | #define RTM_MISS 0x7 /* Lookup failed on this address */ | |
| 201 | #define RTM_LOCK 0x8 /* fix specified metrics */ | |
| 202 | #define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ | |
| 203 | #define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ | |
| 204 | #define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ | |
| 205 | #define RTM_NEWADDR 0xc /* address being added to iface */ | |
| 206 | #define RTM_DELADDR 0xd /* address being removed from iface */ | |
| 207 | #define RTM_IFINFO 0xe /* iface going up/down etc. */ | |
| 208 | #define RTM_NEWMADDR 0xf /* mcast group membership being added to if */ | |
| 209 | #define RTM_DELMADDR 0x10 /* mcast group membership being deleted */ | |
| 210 | #define RTM_IFINFO2 0x12 /* */ | |
| 211 | #define RTM_NEWMADDR2 0x13 /* */ | |
| 212 | #define RTM_GET2 0x14 /* */ | |
| 213 | ||
| 214 | /* | |
| 215 | * Bitmask values for rtm_inits and rmx_locks. | |
| 216 | */ | |
| 217 | #define RTV_MTU 0x1 /* init or lock _mtu */ | |
| 218 | #define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ | |
| 219 | #define RTV_EXPIRE 0x4 /* init or lock _expire */ | |
| 220 | #define RTV_RPIPE 0x8 /* init or lock _recvpipe */ | |
| 221 | #define RTV_SPIPE 0x10 /* init or lock _sendpipe */ | |
| 222 | #define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ | |
| 223 | #define RTV_RTT 0x40 /* init or lock _rtt */ | |
| 224 | #define RTV_RTTVAR 0x80 /* init or lock _rttvar */ | |
| 225 | ||
| 226 | /* | |
| 227 | * Bitmask values for rtm_addrs. | |
| 228 | */ | |
| 229 | #define RTA_DST 0x1 /* destination sockaddr present */ | |
| 230 | #define RTA_GATEWAY 0x2 /* gateway sockaddr present */ | |
| 231 | #define RTA_NETMASK 0x4 /* netmask sockaddr present */ | |
| 232 | #define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ | |
| 233 | #define RTA_IFP 0x10 /* interface name sockaddr present */ | |
| 234 | #define RTA_IFA 0x20 /* interface addr sockaddr present */ | |
| 235 | #define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ | |
| 236 | #define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ | |
| 237 | ||
| 238 | /* | |
| 239 | * Index offsets for sockaddr array for alternate internal encoding. | |
| 240 | */ | |
| 241 | #define RTAX_DST 0 /* destination sockaddr present */ | |
| 242 | #define RTAX_GATEWAY 1 /* gateway sockaddr present */ | |
| 243 | #define RTAX_NETMASK 2 /* netmask sockaddr present */ | |
| 244 | #define RTAX_GENMASK 3 /* cloning mask sockaddr present */ | |
| 245 | #define RTAX_IFP 4 /* interface name sockaddr present */ | |
| 246 | #define RTAX_IFA 5 /* interface addr sockaddr present */ | |
| 247 | #define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ | |
| 248 | #define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ | |
| 249 | #define RTAX_MAX 8 /* size of array to allocate */ | |
| 250 | ||
| 251 | struct rt_addrinfo { | |
| 252 | 	int rti_addrs; | |
| 253 | 	struct sockaddr *rti_info[RTAX_MAX]; | |
| 254 | }; | |
| 255 | ||
| 256 | ||
| 257 | #endif /* _NET_ROUTE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-macos-gnu/sys/_symbol_aliasing.h+12| ... | ... | @@ -329,6 +329,12 @@ |
| 329 | 329 | #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_2(x) |
| 330 | 330 | #endif |
| 331 | 331 | |
| 332 | #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140300 | |
| 333 | #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_3(x) x | |
| 334 | #else | |
| 335 | #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_3(x) | |
| 336 | #endif | |
| 337 | ||
| 332 | 338 | #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1000 |
| 333 | 339 | #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x) x |
| 334 | 340 | #else |
| ... | ... | @@ -531,4 +537,10 @@ |
| 531 | 537 | #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_0(x) x |
| 532 | 538 | #else |
| 533 | 539 | #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_0(x) |
| 540 | #endif | |
| 541 | ||
| 542 | #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110100 | |
| 543 | #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x) x | |
| 544 | #else | |
| 545 | #define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x) | |
| 534 | 546 | #endif |
| \ No newline at end of file |
lib/libc/include/aarch64-macos-gnu/sys/kern_control.h created+151| ... | ... | @@ -0,0 +1,151 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2000-2004, 2012-2016 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 | /*! | |
| 29 | * @header kern_control.h | |
| 30 | * This header defines an API to communicate between a kernel | |
| 31 | * extension and a process outside of the kernel. | |
| 32 | */ | |
| 33 | ||
| 34 | #ifndef KPI_KERN_CONTROL_H | |
| 35 | #define KPI_KERN_CONTROL_H | |
| 36 | ||
| 37 | ||
| 38 | #include <sys/appleapiopts.h> | |
| 39 | #include <sys/_types/_u_char.h> | |
| 40 | #include <sys/_types/_u_int16_t.h> | |
| 41 | #include <sys/_types/_u_int32_t.h> | |
| 42 | ||
| 43 | /* | |
| 44 | * Define Controller event subclass, and associated events. | |
| 45 | * Subclass of KEV_SYSTEM_CLASS | |
| 46 | */ | |
| 47 | ||
| 48 | /*! | |
| 49 | * @defined KEV_CTL_SUBCLASS | |
| 50 | * @discussion The kernel event subclass for kernel control events. | |
| 51 | */ | |
| 52 | #define KEV_CTL_SUBCLASS 2 | |
| 53 | ||
| 54 | /*! | |
| 55 | * @defined KEV_CTL_REGISTERED | |
| 56 | * @discussion The event code indicating a new controller was | |
| 57 | * registered. The data portion will contain a ctl_event_data. | |
| 58 | */ | |
| 59 | #define KEV_CTL_REGISTERED 1 /* a new controller appears */ | |
| 60 | ||
| 61 | /*! | |
| 62 | * @defined KEV_CTL_DEREGISTERED | |
| 63 | * @discussion The event code indicating a controller was unregistered. | |
| 64 | * The data portion will contain a ctl_event_data. | |
| 65 | */ | |
| 66 | #define KEV_CTL_DEREGISTERED 2 /* a controller disappears */ | |
| 67 | ||
| 68 | /*! | |
| 69 | * @struct ctl_event_data | |
| 70 | * @discussion This structure is used for KEV_CTL_SUBCLASS kernel | |
| 71 | * events. | |
| 72 | * @field ctl_id The kernel control id. | |
| 73 | * @field ctl_unit The kernel control unit. | |
| 74 | */ | |
| 75 | struct ctl_event_data { | |
| 76 | 	u_int32_t ctl_id; /* Kernel Controller ID */ | |
| 77 | 	u_int32_t ctl_unit; | |
| 78 | }; | |
| 79 | ||
| 80 | /* | |
| 81 | * Controls destined to the Controller Manager. | |
| 82 | */ | |
| 83 | ||
| 84 | /*! | |
| 85 | * @defined CTLIOCGCOUNT | |
| 86 | * @discussion The CTLIOCGCOUNT ioctl can be used to determine the | |
| 87 | * number of kernel controllers registered. | |
| 88 | */ | |
| 89 | #define CTLIOCGCOUNT _IOR('N', 2, int) /* get number of control structures registered */ | |
| 90 | ||
| 91 | /*! | |
| 92 | * @defined CTLIOCGINFO | |
| 93 | * @discussion The CTLIOCGINFO ioctl can be used to convert a kernel | |
| 94 | * control name to a kernel control id. | |
| 95 | */ | |
| 96 | #define CTLIOCGINFO _IOWR('N', 3, struct ctl_info) /* get id from name */ | |
| 97 | ||
| 98 | ||
| 99 | /*! | |
| 100 | * @defined MAX_KCTL_NAME | |
| 101 | * @discussion Kernel control names must be no longer than | |
| 102 | * MAX_KCTL_NAME. | |
| 103 | */ | |
| 104 | #define MAX_KCTL_NAME 96 | |
| 105 | ||
| 106 | /* | |
| 107 | * Controls destined to the Controller Manager. | |
| 108 | */ | |
| 109 | ||
| 110 | /*! | |
| 111 | * @struct ctl_info | |
| 112 | * @discussion This structure is used with the CTLIOCGINFO ioctl to | |
| 113 | * translate from a kernel control name to a control id. | |
| 114 | * @field ctl_id The kernel control id, filled out upon return. | |
| 115 | * @field ctl_name The kernel control name to find. | |
| 116 | */ | |
| 117 | struct ctl_info { | |
| 118 | 	u_int32_t ctl_id; /* Kernel Controller ID */ | |
| 119 | 	char ctl_name[MAX_KCTL_NAME]; /* Kernel Controller Name (a C string) */ | |
| 120 | }; | |
| 121 | ||
| 122 | ||
| 123 | /*! | |
| 124 | * @struct sockaddr_ctl | |
| 125 | * @discussion The controller address structure is used to establish | |
| 126 | * contact between a user client and a kernel controller. The | |
| 127 | * sc_id/sc_unit uniquely identify each controller. sc_id is a | |
| 128 | * unique identifier assigned to the controller. The identifier can | |
| 129 | * be assigned by the system at registration time or be a 32-bit | |
| 130 | * creator code obtained from Apple Computer. sc_unit is a unit | |
| 131 | * number for this sc_id, and is privately used by the kernel | |
| 132 | * controller to identify several instances of the controller. | |
| 133 | * @field sc_len The length of the structure. | |
| 134 | * @field sc_family AF_SYSTEM. | |
| 135 | * @field ss_sysaddr AF_SYS_KERNCONTROL. | |
| 136 | * @field sc_id Controller unique identifier. | |
| 137 | * @field sc_unit Kernel controller private unit number. | |
| 138 | * @field sc_reserved Reserved, must be set to zero. | |
| 139 | */ | |
| 140 | struct sockaddr_ctl { | |
| 141 | 	u_char sc_len; /* depends on size of bundle ID string */ | |
| 142 | 	u_char sc_family; /* AF_SYSTEM */ | |
| 143 | 	u_int16_t ss_sysaddr; /* AF_SYS_KERNCONTROL */ | |
| 144 | 	u_int32_t sc_id; /* Controller unique identifier */ | |
| 145 | 	u_int32_t sc_unit; /* Developer private unit number */ | |
| 146 | 	u_int32_t sc_reserved[5]; | |
| 147 | }; | |
| 148 | ||
| 149 | ||
| 150 | ||
| 151 | #endif /* KPI_KERN_CONTROL_H */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-macos-gnu/sys/proc_info.h created+799| ... | ... | @@ -0,0 +1,799 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2005-2020 Apple Computer, 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 | ||
| 29 | #ifndef _SYS_PROC_INFO_H | |
| 30 | #define _SYS_PROC_INFO_H | |
| 31 | ||
| 32 | #include <sys/cdefs.h> | |
| 33 | #include <sys/param.h> | |
| 34 | #include <sys/types.h> | |
| 35 | #include <sys/stat.h> | |
| 36 | #include <sys/mount.h> | |
| 37 | #include <sys/socket.h> | |
| 38 | #include <sys/un.h> | |
| 39 | #include <sys/kern_control.h> | |
| 40 | #include <sys/event.h> | |
| 41 | #include <net/if.h> | |
| 42 | #include <net/route.h> | |
| 43 | #include <netinet/in.h> | |
| 44 | #include <netinet/tcp.h> | |
| 45 | #include <mach/machine.h> | |
| 46 | #include <uuid/uuid.h> | |
| 47 | ||
| 48 | ||
| 49 | __BEGIN_DECLS | |
| 50 | ||
| 51 | ||
| 52 | #define PROC_ALL_PIDS 1 | |
| 53 | #define PROC_PGRP_ONLY 2 | |
| 54 | #define PROC_TTY_ONLY 3 | |
| 55 | #define PROC_UID_ONLY 4 | |
| 56 | #define PROC_RUID_ONLY 5 | |
| 57 | #define PROC_PPID_ONLY 6 | |
| 58 | #define PROC_KDBG_ONLY 7 | |
| 59 | ||
| 60 | struct proc_bsdinfo { | |
| 61 | 	uint32_t pbi_flags; /* 64bit; emulated etc */ | |
| 62 | 	uint32_t pbi_status; | |
| 63 | 	uint32_t pbi_xstatus; | |
| 64 | 	uint32_t pbi_pid; | |
| 65 | 	uint32_t pbi_ppid; | |
| 66 | 	uid_t pbi_uid; | |
| 67 | 	gid_t pbi_gid; | |
| 68 | 	uid_t pbi_ruid; | |
| 69 | 	gid_t pbi_rgid; | |
| 70 | 	uid_t pbi_svuid; | |
| 71 | 	gid_t pbi_svgid; | |
| 72 | 	uint32_t rfu_1; /* reserved */ | |
| 73 | 	char pbi_comm[MAXCOMLEN]; | |
| 74 | 	char pbi_name[2 * MAXCOMLEN]; /* empty if no name is registered */ | |
| 75 | 	uint32_t pbi_nfiles; | |
| 76 | 	uint32_t pbi_pgid; | |
| 77 | 	uint32_t pbi_pjobc; | |
| 78 | 	uint32_t e_tdev; /* controlling tty dev */ | |
| 79 | 	uint32_t e_tpgid; /* tty process group id */ | |
| 80 | 	int32_t pbi_nice; | |
| 81 | 	uint64_t pbi_start_tvsec; | |
| 82 | 	uint64_t pbi_start_tvusec; | |
| 83 | }; | |
| 84 | ||
| 85 | ||
| 86 | struct proc_bsdshortinfo { | |
| 87 | 	uint32_t pbsi_pid; /* process id */ | |
| 88 | 	uint32_t pbsi_ppid; /* process parent id */ | |
| 89 | 	uint32_t pbsi_pgid; /* process perp id */ | |
| 90 | 	uint32_t pbsi_status; /* p_stat value, SZOMB, SRUN, etc */ | |
| 91 | 	char pbsi_comm[MAXCOMLEN]; /* upto 16 characters of process name */ | |
| 92 | 	uint32_t pbsi_flags; /* 64bit; emulated etc */ | |
| 93 | 	uid_t pbsi_uid; /* current uid on process */ | |
| 94 | 	gid_t pbsi_gid; /* current gid on process */ | |
| 95 | 	uid_t pbsi_ruid; /* current ruid on process */ | |
| 96 | 	gid_t pbsi_rgid; /* current tgid on process */ | |
| 97 | 	uid_t pbsi_svuid; /* current svuid on process */ | |
| 98 | 	gid_t pbsi_svgid; /* current svgid on process */ | |
| 99 | 	uint32_t pbsi_rfu; /* reserved for future use*/ | |
| 100 | }; | |
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | ||
| 105 | /* pbi_flags values */ | |
| 106 | #define PROC_FLAG_SYSTEM 1 /* System process */ | |
| 107 | #define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */ | |
| 108 | #define PROC_FLAG_INEXIT 4 /* process is working its way in exit() */ | |
| 109 | #define PROC_FLAG_PPWAIT 8 | |
| 110 | #define PROC_FLAG_LP64 0x10 /* 64bit process */ | |
| 111 | #define PROC_FLAG_SLEADER 0x20 /* The process is the session leader */ | |
| 112 | #define PROC_FLAG_CTTY 0x40 /* process has a control tty */ | |
| 113 | #define PROC_FLAG_CONTROLT 0x80 /* Has a controlling terminal */ | |
| 114 | #define PROC_FLAG_THCWD 0x100 /* process has a thread with cwd */ | |
| 115 | /* process control bits for resource starvation */ | |
| 116 | #define PROC_FLAG_PC_THROTTLE 0x200 /* In resource starvation situations, this process is to be throttled */ | |
| 117 | #define PROC_FLAG_PC_SUSP 0x400 /* In resource starvation situations, this process is to be suspended */ | |
| 118 | #define PROC_FLAG_PC_KILL 0x600 /* In resource starvation situations, this process is to be terminated */ | |
| 119 | #define PROC_FLAG_PC_MASK 0x600 | |
| 120 | /* process action bits for resource starvation */ | |
| 121 | #define PROC_FLAG_PA_THROTTLE 0x800 /* The process is currently throttled due to resource starvation */ | |
| 122 | #define PROC_FLAG_PA_SUSP 0x1000 /* The process is currently suspended due to resource starvation */ | |
| 123 | #define PROC_FLAG_PSUGID 0x2000 /* process has set privileges since last exec */ | |
| 124 | #define PROC_FLAG_EXEC 0x4000 /* process has called exec */ | |
| 125 | ||
| 126 | ||
| 127 | struct proc_taskinfo { | |
| 128 | 	uint64_t pti_virtual_size; /* virtual memory size (bytes) */ | |
| 129 | 	uint64_t pti_resident_size; /* resident memory size (bytes) */ | |
| 130 | 	uint64_t pti_total_user; /* total time */ | |
| 131 | 	uint64_t pti_total_system; | |
| 132 | 	uint64_t pti_threads_user; /* existing threads only */ | |
| 133 | 	uint64_t pti_threads_system; | |
| 134 | 	int32_t pti_policy; /* default policy for new threads */ | |
| 135 | 	int32_t pti_faults; /* number of page faults */ | |
| 136 | 	int32_t pti_pageins; /* number of actual pageins */ | |
| 137 | 	int32_t pti_cow_faults; /* number of copy-on-write faults */ | |
| 138 | 	int32_t pti_messages_sent; /* number of messages sent */ | |
| 139 | 	int32_t pti_messages_received; /* number of messages received */ | |
| 140 | 	int32_t pti_syscalls_mach; /* number of mach system calls */ | |
| 141 | 	int32_t pti_syscalls_unix; /* number of unix system calls */ | |
| 142 | 	int32_t pti_csw; /* number of context switches */ | |
| 143 | 	int32_t pti_threadnum; /* number of threads in the task */ | |
| 144 | 	int32_t pti_numrunning; /* number of running threads */ | |
| 145 | 	int32_t pti_priority; /* task priority*/ | |
| 146 | }; | |
| 147 | ||
| 148 | struct proc_taskallinfo { | |
| 149 | 	struct proc_bsdinfo pbsd; | |
| 150 | 	struct proc_taskinfo ptinfo; | |
| 151 | }; | |
| 152 | ||
| 153 | #define MAXTHREADNAMESIZE 64 | |
| 154 | ||
| 155 | struct proc_threadinfo { | |
| 156 | 	uint64_t pth_user_time; /* user run time */ | |
| 157 | 	uint64_t pth_system_time; /* system run time */ | |
| 158 | 	int32_t pth_cpu_usage; /* scaled cpu usage percentage */ | |
| 159 | 	int32_t pth_policy; /* scheduling policy in effect */ | |
| 160 | 	int32_t pth_run_state; /* run state (see below) */ | |
| 161 | 	int32_t pth_flags; /* various flags (see below) */ | |
| 162 | 	int32_t pth_sleep_time; /* number of seconds that thread */ | |
| 163 | 	int32_t pth_curpri; /* cur priority*/ | |
| 164 | 	int32_t pth_priority; /* priority*/ | |
| 165 | 	int32_t pth_maxpriority; /* max priority*/ | |
| 166 | 	char pth_name[MAXTHREADNAMESIZE]; /* thread name, if any */ | |
| 167 | }; | |
| 168 | ||
| 169 | struct proc_regioninfo { | |
| 170 | 	uint32_t pri_protection; | |
| 171 | 	uint32_t pri_max_protection; | |
| 172 | 	uint32_t pri_inheritance; | |
| 173 | 	uint32_t pri_flags; /* shared, external pager, is submap */ | |
| 174 | 	uint64_t pri_offset; | |
| 175 | 	uint32_t pri_behavior; | |
| 176 | 	uint32_t pri_user_wired_count; | |
| 177 | 	uint32_t pri_user_tag; | |
| 178 | 	uint32_t pri_pages_resident; | |
| 179 | 	uint32_t pri_pages_shared_now_private; | |
| 180 | 	uint32_t pri_pages_swapped_out; | |
| 181 | 	uint32_t pri_pages_dirtied; | |
| 182 | 	uint32_t pri_ref_count; | |
| 183 | 	uint32_t pri_shadow_depth; | |
| 184 | 	uint32_t pri_share_mode; | |
| 185 | 	uint32_t pri_private_pages_resident; | |
| 186 | 	uint32_t pri_shared_pages_resident; | |
| 187 | 	uint32_t pri_obj_id; | |
| 188 | 	uint32_t pri_depth; | |
| 189 | 	uint64_t pri_address; | |
| 190 | 	uint64_t pri_size; | |
| 191 | }; | |
| 192 | ||
| 193 | #define PROC_REGION_SUBMAP 1 | |
| 194 | #define PROC_REGION_SHARED 2 | |
| 195 | ||
| 196 | #define SM_COW 1 | |
| 197 | #define SM_PRIVATE 2 | |
| 198 | #define SM_EMPTY 3 | |
| 199 | #define SM_SHARED 4 | |
| 200 | #define SM_TRUESHARED 5 | |
| 201 | #define SM_PRIVATE_ALIASED 6 | |
| 202 | #define SM_SHARED_ALIASED 7 | |
| 203 | #define SM_LARGE_PAGE 8 | |
| 204 | ||
| 205 | ||
| 206 | /* | |
| 207 | *	Thread run states (state field). | |
| 208 | */ | |
| 209 | ||
| 210 | #define TH_STATE_RUNNING 1 /* thread is running normally */ | |
| 211 | #define TH_STATE_STOPPED 2 /* thread is stopped */ | |
| 212 | #define TH_STATE_WAITING 3 /* thread is waiting normally */ | |
| 213 | #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible | |
| 214 | 	 * wait */ | |
| 215 | #define TH_STATE_HALTED 5 /* thread is halted at a | |
| 216 | 	 * clean point */ | |
| 217 | ||
| 218 | /* | |
| 219 | *	Thread flags (flags field). | |
| 220 | */ | |
| 221 | #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */ | |
| 222 | #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */ | |
| 223 | ||
| 224 | ||
| 225 | struct proc_workqueueinfo { | |
| 226 | 	uint32_t pwq_nthreads; /* total number of workqueue threads */ | |
| 227 | 	uint32_t pwq_runthreads; /* total number of running workqueue threads */ | |
| 228 | 	uint32_t pwq_blockedthreads; /* total number of blocked workqueue threads */ | |
| 229 | 	uint32_t pwq_state; | |
| 230 | }; | |
| 231 | ||
| 232 | /* | |
| 233 | *	workqueue state (pwq_state field) | |
| 234 | */ | |
| 235 | #define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1 | |
| 236 | #define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2 | |
| 237 | #define WQ_FLAGS_AVAILABLE 0x4 | |
| 238 | ||
| 239 | struct proc_fileinfo { | |
| 240 | 	uint32_t fi_openflags; | |
| 241 | 	uint32_t fi_status; | |
| 242 | 	off_t fi_offset; | |
| 243 | 	int32_t fi_type; | |
| 244 | 	uint32_t fi_guardflags; | |
| 245 | }; | |
| 246 | ||
| 247 | /* stats flags in proc_fileinfo */ | |
| 248 | #define PROC_FP_SHARED 1 /* shared by more than one fd */ | |
| 249 | #define PROC_FP_CLEXEC 2 /* close on exec */ | |
| 250 | #define PROC_FP_GUARDED 4 /* guarded fd */ | |
| 251 | #define PROC_FP_CLFORK 8 /* close on fork */ | |
| 252 | ||
| 253 | #define PROC_FI_GUARD_CLOSE (1u << 0) | |
| 254 | #define PROC_FI_GUARD_DUP (1u << 1) | |
| 255 | #define PROC_FI_GUARD_SOCKET_IPC (1u << 2) | |
| 256 | #define PROC_FI_GUARD_FILEPORT (1u << 3) | |
| 257 | ||
| 258 | struct proc_exitreasonbasicinfo { | |
| 259 | 	uint32_t beri_namespace; | |
| 260 | 	uint64_t beri_code; | |
| 261 | 	uint64_t beri_flags; | |
| 262 | 	uint32_t beri_reason_buf_size; | |
| 263 | } __attribute__((packed)); | |
| 264 | ||
| 265 | struct proc_exitreasoninfo { | |
| 266 | 	uint32_t eri_namespace; | |
| 267 | 	uint64_t eri_code; | |
| 268 | 	uint64_t eri_flags; | |
| 269 | 	uint32_t eri_reason_buf_size; | |
| 270 | 	uint64_t eri_kcd_buf; | |
| 271 | } __attribute__((packed)); | |
| 272 | ||
| 273 | /* | |
| 274 | * A copy of stat64 with static sized fields. | |
| 275 | */ | |
| 276 | struct vinfo_stat { | |
| 277 | 	uint32_t vst_dev; /* [XSI] ID of device containing file */ | |
| 278 | 	uint16_t vst_mode; /* [XSI] Mode of file (see below) */ | |
| 279 | 	uint16_t vst_nlink; /* [XSI] Number of hard links */ | |
| 280 | 	uint64_t vst_ino; /* [XSI] File serial number */ | |
| 281 | 	uid_t vst_uid; /* [XSI] User ID of the file */ | |
| 282 | 	gid_t vst_gid; /* [XSI] Group ID of the file */ | |
| 283 | 	int64_t vst_atime; /* [XSI] Time of last access */ | |
| 284 | 	int64_t vst_atimensec; /* nsec of last access */ | |
| 285 | 	int64_t vst_mtime; /* [XSI] Last data modification time */ | |
| 286 | 	int64_t vst_mtimensec; /* last data modification nsec */ | |
| 287 | 	int64_t vst_ctime; /* [XSI] Time of last status change */ | |
| 288 | 	int64_t vst_ctimensec; /* nsec of last status change */ | |
| 289 | 	int64_t vst_birthtime; /* File creation time(birth) */ | |
| 290 | 	int64_t vst_birthtimensec; /* nsec of File creation time */ | |
| 291 | 	off_t vst_size; /* [XSI] file size, in bytes */ | |
| 292 | 	int64_t vst_blocks; /* [XSI] blocks allocated for file */ | |
| 293 | 	int32_t vst_blksize; /* [XSI] optimal blocksize for I/O */ | |
| 294 | 	uint32_t vst_flags; /* user defined flags for file */ | |
| 295 | 	uint32_t vst_gen; /* file generation number */ | |
| 296 | 	uint32_t vst_rdev; /* [XSI] Device ID */ | |
| 297 | 	int64_t vst_qspare[2]; /* RESERVED: DO NOT USE! */ | |
| 298 | }; | |
| 299 | ||
| 300 | struct vnode_info { | |
| 301 | 	struct vinfo_stat vi_stat; | |
| 302 | 	int vi_type; | |
| 303 | 	int vi_pad; | |
| 304 | 	fsid_t vi_fsid; | |
| 305 | }; | |
| 306 | ||
| 307 | struct vnode_info_path { | |
| 308 | 	struct vnode_info vip_vi; | |
| 309 | 	char vip_path[MAXPATHLEN]; /* tail end of it */ | |
| 310 | }; | |
| 311 | ||
| 312 | struct vnode_fdinfo { | |
| 313 | 	struct proc_fileinfo pfi; | |
| 314 | 	struct vnode_info pvi; | |
| 315 | }; | |
| 316 | ||
| 317 | struct vnode_fdinfowithpath { | |
| 318 | 	struct proc_fileinfo pfi; | |
| 319 | 	struct vnode_info_path pvip; | |
| 320 | }; | |
| 321 | ||
| 322 | struct proc_regionwithpathinfo { | |
| 323 | 	struct proc_regioninfo prp_prinfo; | |
| 324 | 	struct vnode_info_path prp_vip; | |
| 325 | }; | |
| 326 | ||
| 327 | struct proc_regionpath { | |
| 328 | 	uint64_t prpo_addr; | |
| 329 | 	uint64_t prpo_regionlength; | |
| 330 | 	char prpo_path[MAXPATHLEN]; | |
| 331 | }; | |
| 332 | ||
| 333 | struct proc_vnodepathinfo { | |
| 334 | 	struct vnode_info_path pvi_cdir; | |
| 335 | 	struct vnode_info_path pvi_rdir; | |
| 336 | }; | |
| 337 | ||
| 338 | struct proc_threadwithpathinfo { | |
| 339 | 	struct proc_threadinfo pt; | |
| 340 | 	struct vnode_info_path pvip; | |
| 341 | }; | |
| 342 | ||
| 343 | /* | |
| 344 | * Socket | |
| 345 | */ | |
| 346 | ||
| 347 | ||
| 348 | /* | |
| 349 | * IPv4 and IPv6 Sockets | |
| 350 | */ | |
| 351 | ||
| 352 | #define INI_IPV4 0x1 | |
| 353 | #define INI_IPV6 0x2 | |
| 354 | ||
| 355 | struct in4in6_addr { | |
| 356 | 	u_int32_t i46a_pad32[3]; | |
| 357 | 	struct in_addr i46a_addr4; | |
| 358 | }; | |
| 359 | ||
| 360 | struct in_sockinfo { | |
| 361 | 	int insi_fport; /* foreign port */ | |
| 362 | 	int insi_lport; /* local port */ | |
| 363 | 	uint64_t insi_gencnt; /* generation count of this instance */ | |
| 364 | 	uint32_t insi_flags; /* generic IP/datagram flags */ | |
| 365 | 	uint32_t insi_flow; | |
| 366 | ||
| 367 | 	uint8_t insi_vflag; /* ini_IPV4 or ini_IPV6 */ | |
| 368 | 	uint8_t insi_ip_ttl; /* time to live proto */ | |
| 369 | 	uint32_t rfu_1; /* reserved */ | |
| 370 | 	/* protocol dependent part */ | |
| 371 | 	union { | |
| 372 | 		struct in4in6_addr ina_46; | |
| 373 | 		struct in6_addr ina_6; | |
| 374 | 	} insi_faddr; /* foreign host table entry */ | |
| 375 | 	union { | |
| 376 | 		struct in4in6_addr ina_46; | |
| 377 | 		struct in6_addr ina_6; | |
| 378 | 	} insi_laddr; /* local host table entry */ | |
| 379 | 	struct { | |
| 380 | 		u_char in4_tos; /* type of service */ | |
| 381 | 	} insi_v4; | |
| 382 | 	struct { | |
| 383 | 		uint8_t in6_hlim; | |
| 384 | 		int in6_cksum; | |
| 385 | 		u_short in6_ifindex; | |
| 386 | 		short in6_hops; | |
| 387 | 	} insi_v6; | |
| 388 | }; | |
| 389 | ||
| 390 | /* | |
| 391 | * TCP Sockets | |
| 392 | */ | |
| 393 | ||
| 394 | #define TSI_T_REXMT 0 /* retransmit */ | |
| 395 | #define TSI_T_PERSIST 1 /* retransmit persistence */ | |
| 396 | #define TSI_T_KEEP 2 /* keep alive */ | |
| 397 | #define TSI_T_2MSL 3 /* 2*msl quiet time timer */ | |
| 398 | #define TSI_T_NTIMERS 4 | |
| 399 | ||
| 400 | #define TSI_S_CLOSED 0 /* closed */ | |
| 401 | #define TSI_S_LISTEN 1 /* listening for connection */ | |
| 402 | #define TSI_S_SYN_SENT 2 /* active, have sent syn */ | |
| 403 | #define TSI_S_SYN_RECEIVED 3 /* have send and received syn */ | |
| 404 | #define TSI_S_ESTABLISHED 4 /* established */ | |
| 405 | #define TSI_S__CLOSE_WAIT 5 /* rcvd fin, waiting for close */ | |
| 406 | #define TSI_S_FIN_WAIT_1 6 /* have closed, sent fin */ | |
| 407 | #define TSI_S_CLOSING 7 /* closed xchd FIN; await FIN ACK */ | |
| 408 | #define TSI_S_LAST_ACK 8 /* had fin and close; await FIN ACK */ | |
| 409 | #define TSI_S_FIN_WAIT_2 9 /* have closed, fin is acked */ | |
| 410 | #define TSI_S_TIME_WAIT 10 /* in 2*msl quiet wait after close */ | |
| 411 | #define TSI_S_RESERVED 11 /* pseudo state: reserved */ | |
| 412 | ||
| 413 | struct tcp_sockinfo { | |
| 414 | 	struct in_sockinfo tcpsi_ini; | |
| 415 | 	int tcpsi_state; | |
| 416 | 	int tcpsi_timer[TSI_T_NTIMERS]; | |
| 417 | 	int tcpsi_mss; | |
| 418 | 	uint32_t tcpsi_flags; | |
| 419 | 	uint32_t rfu_1; /* reserved */ | |
| 420 | 	uint64_t tcpsi_tp; /* opaque handle of TCP protocol control block */ | |
| 421 | }; | |
| 422 | ||
| 423 | /* | |
| 424 | * Unix Domain Sockets | |
| 425 | */ | |
| 426 | ||
| 427 | ||
| 428 | struct un_sockinfo { | |
| 429 | 	uint64_t unsi_conn_so; /* opaque handle of connected socket */ | |
| 430 | 	uint64_t unsi_conn_pcb; /* opaque handle of connected protocol control block */ | |
| 431 | 	union { | |
| 432 | 		struct sockaddr_un ua_sun; | |
| 433 | 		char ua_dummy[SOCK_MAXADDRLEN]; | |
| 434 | 	} unsi_addr; /* bound address */ | |
| 435 | 	union { | |
| 436 | 		struct sockaddr_un ua_sun; | |
| 437 | 		char ua_dummy[SOCK_MAXADDRLEN]; | |
| 438 | 	} unsi_caddr; /* address of socket connected to */ | |
| 439 | }; | |
| 440 | ||
| 441 | /* | |
| 442 | * PF_NDRV Sockets | |
| 443 | */ | |
| 444 | ||
| 445 | struct ndrv_info { | |
| 446 | 	uint32_t ndrvsi_if_family; | |
| 447 | 	uint32_t ndrvsi_if_unit; | |
| 448 | 	char ndrvsi_if_name[IF_NAMESIZE]; | |
| 449 | }; | |
| 450 | ||
| 451 | /* | |
| 452 | * Kernel Event Sockets | |
| 453 | */ | |
| 454 | ||
| 455 | struct kern_event_info { | |
| 456 | 	uint32_t kesi_vendor_code_filter; | |
| 457 | 	uint32_t kesi_class_filter; | |
| 458 | 	uint32_t kesi_subclass_filter; | |
| 459 | }; | |
| 460 | ||
| 461 | /* | |
| 462 | * Kernel Control Sockets | |
| 463 | */ | |
| 464 | ||
| 465 | struct kern_ctl_info { | |
| 466 | 	uint32_t kcsi_id; | |
| 467 | 	uint32_t kcsi_reg_unit; | |
| 468 | 	uint32_t kcsi_flags; /* support flags */ | |
| 469 | 	uint32_t kcsi_recvbufsize; /* request more than the default buffer size */ | |
| 470 | 	uint32_t kcsi_sendbufsize; /* request more than the default buffer size */ | |
| 471 | 	uint32_t kcsi_unit; | |
| 472 | 	char kcsi_name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */ | |
| 473 | }; | |
| 474 | ||
| 475 | /* | |
| 476 | * VSock Sockets | |
| 477 | */ | |
| 478 | ||
| 479 | struct vsock_sockinfo { | |
| 480 | 	uint32_t local_cid; | |
| 481 | 	uint32_t local_port; | |
| 482 | 	uint32_t remote_cid; | |
| 483 | 	uint32_t remote_port; | |
| 484 | }; | |
| 485 | ||
| 486 | /* soi_state */ | |
| 487 | ||
| 488 | #define SOI_S_NOFDREF 0x0001 /* no file table ref any more */ | |
| 489 | #define SOI_S_ISCONNECTED 0x0002 /* socket connected to a peer */ | |
| 490 | #define SOI_S_ISCONNECTING 0x0004 /* in process of connecting to peer */ | |
| 491 | #define SOI_S_ISDISCONNECTING 0x0008 /* in process of disconnecting */ | |
| 492 | #define SOI_S_CANTSENDMORE 0x0010 /* can't send more data to peer */ | |
| 493 | #define SOI_S_CANTRCVMORE 0x0020 /* can't receive more data from peer */ | |
| 494 | #define SOI_S_RCVATMARK 0x0040 /* at mark on input */ | |
| 495 | #define SOI_S_PRIV 0x0080 /* privileged for broadcast, raw... */ | |
| 496 | #define SOI_S_NBIO 0x0100 /* non-blocking ops */ | |
| 497 | #define SOI_S_ASYNC 0x0200 /* async i/o notify */ | |
| 498 | #define SOI_S_INCOMP 0x0800 /* Unaccepted, incomplete connection */ | |
| 499 | #define SOI_S_COMP 0x1000 /* unaccepted, complete connection */ | |
| 500 | #define SOI_S_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ | |
| 501 | #define SOI_S_DRAINING 0x4000 /* close waiting for blocked system calls to drain */ | |
| 502 | ||
| 503 | struct sockbuf_info { | |
| 504 | 	uint32_t sbi_cc; | |
| 505 | 	uint32_t sbi_hiwat; /* SO_RCVBUF, SO_SNDBUF */ | |
| 506 | 	uint32_t sbi_mbcnt; | |
| 507 | 	uint32_t sbi_mbmax; | |
| 508 | 	uint32_t sbi_lowat; | |
| 509 | 	short sbi_flags; | |
| 510 | 	short sbi_timeo; | |
| 511 | }; | |
| 512 | ||
| 513 | enum { | |
| 514 | 	SOCKINFO_GENERIC = 0, | |
| 515 | 	SOCKINFO_IN = 1, | |
| 516 | 	SOCKINFO_TCP = 2, | |
| 517 | 	SOCKINFO_UN = 3, | |
| 518 | 	SOCKINFO_NDRV = 4, | |
| 519 | 	SOCKINFO_KERN_EVENT = 5, | |
| 520 | 	SOCKINFO_KERN_CTL = 6, | |
| 521 | 	SOCKINFO_VSOCK = 7, | |
| 522 | }; | |
| 523 | ||
| 524 | struct socket_info { | |
| 525 | 	struct vinfo_stat soi_stat; | |
| 526 | 	uint64_t soi_so; /* opaque handle of socket */ | |
| 527 | 	uint64_t soi_pcb; /* opaque handle of protocol control block */ | |
| 528 | 	int soi_type; | |
| 529 | 	int soi_protocol; | |
| 530 | 	int soi_family; | |
| 531 | 	short soi_options; | |
| 532 | 	short soi_linger; | |
| 533 | 	short soi_state; | |
| 534 | 	short soi_qlen; | |
| 535 | 	short soi_incqlen; | |
| 536 | 	short soi_qlimit; | |
| 537 | 	short soi_timeo; | |
| 538 | 	u_short soi_error; | |
| 539 | 	uint32_t soi_oobmark; | |
| 540 | 	struct sockbuf_info soi_rcv; | |
| 541 | 	struct sockbuf_info soi_snd; | |
| 542 | 	int soi_kind; | |
| 543 | 	uint32_t rfu_1; /* reserved */ | |
| 544 | 	union { | |
| 545 | 		struct in_sockinfo pri_in; /* SOCKINFO_IN */ | |
| 546 | 		struct tcp_sockinfo pri_tcp; /* SOCKINFO_TCP */ | |
| 547 | 		struct un_sockinfo pri_un; /* SOCKINFO_UN */ | |
| 548 | 		struct ndrv_info pri_ndrv; /* SOCKINFO_NDRV */ | |
| 549 | 		struct kern_event_info pri_kern_event; /* SOCKINFO_KERN_EVENT */ | |
| 550 | 		struct kern_ctl_info pri_kern_ctl; /* SOCKINFO_KERN_CTL */ | |
| 551 | 		struct vsock_sockinfo pri_vsock; /* SOCKINFO_VSOCK */ | |
| 552 | 	} soi_proto; | |
| 553 | }; | |
| 554 | ||
| 555 | struct socket_fdinfo { | |
| 556 | 	struct proc_fileinfo pfi; | |
| 557 | 	struct socket_info psi; | |
| 558 | }; | |
| 559 | ||
| 560 | ||
| 561 | ||
| 562 | struct psem_info { | |
| 563 | 	struct vinfo_stat psem_stat; | |
| 564 | 	char psem_name[MAXPATHLEN]; | |
| 565 | }; | |
| 566 | ||
| 567 | struct psem_fdinfo { | |
| 568 | 	struct proc_fileinfo pfi; | |
| 569 | 	struct psem_info pseminfo; | |
| 570 | }; | |
| 571 | ||
| 572 | ||
| 573 | ||
| 574 | struct pshm_info { | |
| 575 | 	struct vinfo_stat pshm_stat; | |
| 576 | 	uint64_t pshm_mappaddr; | |
| 577 | 	char pshm_name[MAXPATHLEN]; | |
| 578 | }; | |
| 579 | ||
| 580 | struct pshm_fdinfo { | |
| 581 | 	struct proc_fileinfo pfi; | |
| 582 | 	struct pshm_info pshminfo; | |
| 583 | }; | |
| 584 | ||
| 585 | ||
| 586 | struct pipe_info { | |
| 587 | 	struct vinfo_stat pipe_stat; | |
| 588 | 	uint64_t pipe_handle; | |
| 589 | 	uint64_t pipe_peerhandle; | |
| 590 | 	int pipe_status; | |
| 591 | 	int rfu_1; /* reserved */ | |
| 592 | }; | |
| 593 | ||
| 594 | struct pipe_fdinfo { | |
| 595 | 	struct proc_fileinfo pfi; | |
| 596 | 	struct pipe_info pipeinfo; | |
| 597 | }; | |
| 598 | ||
| 599 | ||
| 600 | struct kqueue_info { | |
| 601 | 	struct vinfo_stat kq_stat; | |
| 602 | 	uint32_t kq_state; | |
| 603 | 	uint32_t rfu_1; /* reserved */ | |
| 604 | }; | |
| 605 | ||
| 606 | struct kqueue_dyninfo { | |
| 607 | 	struct kqueue_info kqdi_info; | |
| 608 | 	uint64_t kqdi_servicer; | |
| 609 | 	uint64_t kqdi_owner; | |
| 610 | 	uint32_t kqdi_sync_waiters; | |
| 611 | 	uint8_t kqdi_sync_waiter_qos; | |
| 612 | 	uint8_t kqdi_async_qos; | |
| 613 | 	uint16_t kqdi_request_state; | |
| 614 | 	uint8_t kqdi_events_qos; | |
| 615 | 	uint8_t kqdi_pri; | |
| 616 | 	uint8_t kqdi_pol; | |
| 617 | 	uint8_t kqdi_cpupercent; | |
| 618 | 	uint8_t _kqdi_reserved0[4]; | |
| 619 | 	uint64_t _kqdi_reserved1[4]; | |
| 620 | }; | |
| 621 | ||
| 622 | /* keep in sync with KQ_* in sys/eventvar.h */ | |
| 623 | #define PROC_KQUEUE_SELECT 0x01 | |
| 624 | #define PROC_KQUEUE_SLEEP 0x02 | |
| 625 | #define PROC_KQUEUE_32 0x08 | |
| 626 | #define PROC_KQUEUE_64 0x10 | |
| 627 | #define PROC_KQUEUE_QOS 0x20 | |
| 628 | ||
| 629 | ||
| 630 | struct kqueue_fdinfo { | |
| 631 | 	struct proc_fileinfo pfi; | |
| 632 | 	struct kqueue_info kqueueinfo; | |
| 633 | }; | |
| 634 | ||
| 635 | struct appletalk_info { | |
| 636 | 	struct vinfo_stat atalk_stat; | |
| 637 | }; | |
| 638 | ||
| 639 | struct appletalk_fdinfo { | |
| 640 | 	struct proc_fileinfo pfi; | |
| 641 | 	struct appletalk_info appletalkinfo; | |
| 642 | }; | |
| 643 | ||
| 644 | typedef uint64_t proc_info_udata_t; | |
| 645 | ||
| 646 | /* defns of process file desc type */ | |
| 647 | #define PROX_FDTYPE_ATALK 0 | |
| 648 | #define PROX_FDTYPE_VNODE 1 | |
| 649 | #define PROX_FDTYPE_SOCKET 2 | |
| 650 | #define PROX_FDTYPE_PSHM 3 | |
| 651 | #define PROX_FDTYPE_PSEM 4 | |
| 652 | #define PROX_FDTYPE_KQUEUE 5 | |
| 653 | #define PROX_FDTYPE_PIPE 6 | |
| 654 | #define PROX_FDTYPE_FSEVENTS 7 | |
| 655 | #define PROX_FDTYPE_NETPOLICY 9 | |
| 656 | ||
| 657 | struct proc_fdinfo { | |
| 658 | 	int32_t proc_fd; | |
| 659 | 	uint32_t proc_fdtype; | |
| 660 | }; | |
| 661 | ||
| 662 | struct proc_fileportinfo { | |
| 663 | 	uint32_t proc_fileport; | |
| 664 | 	uint32_t proc_fdtype; | |
| 665 | }; | |
| 666 | ||
| 667 | ||
| 668 | /* Flavors for proc_pidinfo() */ | |
| 669 | #define PROC_PIDLISTFDS 1 | |
| 670 | #define PROC_PIDLISTFD_SIZE (sizeof(struct proc_fdinfo)) | |
| 671 | ||
| 672 | #define PROC_PIDTASKALLINFO 2 | |
| 673 | #define PROC_PIDTASKALLINFO_SIZE (sizeof(struct proc_taskallinfo)) | |
| 674 | ||
| 675 | #define PROC_PIDTBSDINFO 3 | |
| 676 | #define PROC_PIDTBSDINFO_SIZE (sizeof(struct proc_bsdinfo)) | |
| 677 | ||
| 678 | #define PROC_PIDTASKINFO 4 | |
| 679 | #define PROC_PIDTASKINFO_SIZE (sizeof(struct proc_taskinfo)) | |
| 680 | ||
| 681 | #define PROC_PIDTHREADINFO 5 | |
| 682 | #define PROC_PIDTHREADINFO_SIZE (sizeof(struct proc_threadinfo)) | |
| 683 | ||
| 684 | #define PROC_PIDLISTTHREADS 6 | |
| 685 | #define PROC_PIDLISTTHREADS_SIZE (2* sizeof(uint32_t)) | |
| 686 | ||
| 687 | #define PROC_PIDREGIONINFO 7 | |
| 688 | #define PROC_PIDREGIONINFO_SIZE (sizeof(struct proc_regioninfo)) | |
| 689 | ||
| 690 | #define PROC_PIDREGIONPATHINFO 8 | |
| 691 | #define PROC_PIDREGIONPATHINFO_SIZE (sizeof(struct proc_regionwithpathinfo)) | |
| 692 | ||
| 693 | #define PROC_PIDVNODEPATHINFO 9 | |
| 694 | #define PROC_PIDVNODEPATHINFO_SIZE (sizeof(struct proc_vnodepathinfo)) | |
| 695 | ||
| 696 | #define PROC_PIDTHREADPATHINFO 10 | |
| 697 | #define PROC_PIDTHREADPATHINFO_SIZE (sizeof(struct proc_threadwithpathinfo)) | |
| 698 | ||
| 699 | #define PROC_PIDPATHINFO 11 | |
| 700 | #define PROC_PIDPATHINFO_SIZE (MAXPATHLEN) | |
| 701 | #define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN) | |
| 702 | ||
| 703 | #define PROC_PIDWORKQUEUEINFO 12 | |
| 704 | #define PROC_PIDWORKQUEUEINFO_SIZE (sizeof(struct proc_workqueueinfo)) | |
| 705 | ||
| 706 | #define PROC_PIDT_SHORTBSDINFO 13 | |
| 707 | #define PROC_PIDT_SHORTBSDINFO_SIZE (sizeof(struct proc_bsdshortinfo)) | |
| 708 | ||
| 709 | #define PROC_PIDLISTFILEPORTS 14 | |
| 710 | #define PROC_PIDLISTFILEPORTS_SIZE (sizeof(struct proc_fileportinfo)) | |
| 711 | ||
| 712 | #define PROC_PIDTHREADID64INFO 15 | |
| 713 | #define PROC_PIDTHREADID64INFO_SIZE (sizeof(struct proc_threadinfo)) | |
| 714 | ||
| 715 | #define PROC_PID_RUSAGE 16 | |
| 716 | #define PROC_PID_RUSAGE_SIZE 0 | |
| 717 | ||
| 718 | /* Flavors for proc_pidfdinfo */ | |
| 719 | ||
| 720 | #define PROC_PIDFDVNODEINFO 1 | |
| 721 | #define PROC_PIDFDVNODEINFO_SIZE (sizeof(struct vnode_fdinfo)) | |
| 722 | ||
| 723 | #define PROC_PIDFDVNODEPATHINFO 2 | |
| 724 | #define PROC_PIDFDVNODEPATHINFO_SIZE (sizeof(struct vnode_fdinfowithpath)) | |
| 725 | ||
| 726 | #define PROC_PIDFDSOCKETINFO 3 | |
| 727 | #define PROC_PIDFDSOCKETINFO_SIZE (sizeof(struct socket_fdinfo)) | |
| 728 | ||
| 729 | #define PROC_PIDFDPSEMINFO 4 | |
| 730 | #define PROC_PIDFDPSEMINFO_SIZE (sizeof(struct psem_fdinfo)) | |
| 731 | ||
| 732 | #define PROC_PIDFDPSHMINFO 5 | |
| 733 | #define PROC_PIDFDPSHMINFO_SIZE (sizeof(struct pshm_fdinfo)) | |
| 734 | ||
| 735 | #define PROC_PIDFDPIPEINFO 6 | |
| 736 | #define PROC_PIDFDPIPEINFO_SIZE (sizeof(struct pipe_fdinfo)) | |
| 737 | ||
| 738 | #define PROC_PIDFDKQUEUEINFO 7 | |
| 739 | #define PROC_PIDFDKQUEUEINFO_SIZE (sizeof(struct kqueue_fdinfo)) | |
| 740 | ||
| 741 | #define PROC_PIDFDATALKINFO 8 | |
| 742 | #define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo)) | |
| 743 | ||
| 744 | ||
| 745 | ||
| 746 | /* Flavors for proc_pidfileportinfo */ | |
| 747 | ||
| 748 | #define PROC_PIDFILEPORTVNODEPATHINFO 2 /* out: vnode_fdinfowithpath */ | |
| 749 | #define PROC_PIDFILEPORTVNODEPATHINFO_SIZE \ | |
| 750 | 	 PROC_PIDFDVNODEPATHINFO_SIZE | |
| 751 | ||
| 752 | #define PROC_PIDFILEPORTSOCKETINFO 3 /* out: socket_fdinfo */ | |
| 753 | #define PROC_PIDFILEPORTSOCKETINFO_SIZE PROC_PIDFDSOCKETINFO_SIZE | |
| 754 | ||
| 755 | #define PROC_PIDFILEPORTPSHMINFO 5 /* out: pshm_fdinfo */ | |
| 756 | #define PROC_PIDFILEPORTPSHMINFO_SIZE PROC_PIDFDPSHMINFO_SIZE | |
| 757 | ||
| 758 | #define PROC_PIDFILEPORTPIPEINFO 6 /* out: pipe_fdinfo */ | |
| 759 | #define PROC_PIDFILEPORTPIPEINFO_SIZE PROC_PIDFDPIPEINFO_SIZE | |
| 760 | ||
| 761 | /* used for proc_setcontrol */ | |
| 762 | #define PROC_SELFSET_PCONTROL 1 | |
| 763 | ||
| 764 | #define PROC_SELFSET_THREADNAME 2 | |
| 765 | #define PROC_SELFSET_THREADNAME_SIZE (MAXTHREADNAMESIZE -1) | |
| 766 | ||
| 767 | #define PROC_SELFSET_VMRSRCOWNER 3 | |
| 768 | ||
| 769 | #define PROC_SELFSET_DELAYIDLESLEEP 4 | |
| 770 | ||
| 771 | /* used for proc_dirtycontrol */ | |
| 772 | #define PROC_DIRTYCONTROL_TRACK 1 | |
| 773 | #define PROC_DIRTYCONTROL_SET 2 | |
| 774 | #define PROC_DIRTYCONTROL_GET 3 | |
| 775 | #define PROC_DIRTYCONTROL_CLEAR 4 | |
| 776 | ||
| 777 | /* proc_track_dirty() flags */ | |
| 778 | #define PROC_DIRTY_TRACK 0x1 | |
| 779 | #define PROC_DIRTY_ALLOW_IDLE_EXIT 0x2 | |
| 780 | #define PROC_DIRTY_DEFER 0x4 | |
| 781 | #define PROC_DIRTY_LAUNCH_IN_PROGRESS 0x8 | |
| 782 | #define PROC_DIRTY_DEFER_ALWAYS 0x10 | |
| 783 | ||
| 784 | /* proc_get_dirty() flags */ | |
| 785 | #define PROC_DIRTY_TRACKED 0x1 | |
| 786 | #define PROC_DIRTY_ALLOWS_IDLE_EXIT 0x2 | |
| 787 | #define PROC_DIRTY_IS_DIRTY 0x4 | |
| 788 | #define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8 | |
| 789 | ||
| 790 | /* Flavors for proc_udata_info */ | |
| 791 | #define PROC_UDATA_INFO_GET 1 | |
| 792 | #define PROC_UDATA_INFO_SET 2 | |
| 793 | ||
| 794 | ||
| 795 | ||
| 796 | ||
| 797 | __END_DECLS | |
| 798 | ||
| 799 | #endif /*_SYS_PROC_INFO_H */ | |
| \ No newline at end of file |