Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | /* * Copyright (c) 2018 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ /* * @header * Non-standard, Darwin-specific additions to the error codes enumerated in * intro(2) and sys/errno.h. */ #ifndef __DARWIN_ERRNO_H #define __DARWIN_ERRNO_H #include <_bounds.h> #include <os/base.h> #include <os/api.h> #include <sys/errno.h> #include <sys/cdefs.h> #include <sysexits.h> _LIBC_SINGLE_BY_DEFAULT() #if DARWIN_TAPI #include "tapi.h" #endif /*! * @enum * Additional POSIX-flavor error codes that are meaningful to Darwin. These * definitions all have a "_NP" suffix to distinguish them from POSIX error * codes (meaning "not POSIX"). */ #define EBASE_NP 200 #define _ENPERR(__c) (EBASE_NP + __c) /*! * @const ENOTENTITLED_NP * The remote process lacked a required entitlement to perform the operation. */ #define ENOTENTITLED_NP _ENPERR(0) /*! * @const ENOTPLATFORM_NP * The operation may only be invoked by platform binaries. */ #define ENOTPLATFORM_NP _ENPERR(1) /*! * @const EROOTLESS_NP * The operation was denied by System Integrity Protection. */ #define EROOTLESS_NP _ENPERR(2) /*! * @const ETAINTED_NP * The operation may only be invoked by processes which are not tainted by * debugging and introspection functionality (e.g. dyld(1) environment * variables, debugger attachment, etc.). */ #define ETAINTED_NP _ENPERR(3) /*! * @const EQUARANTINE_NP * The operation is not permitted on quarantined file. */ #define EQUARANTINE_NP _ENPERR(4) /*! * @const EBADUSER_NP * The operation referenced a user name or identifier that was invalid. */ #define EBADUSER_NP _ENPERR(5) /*! * @const EBADGROUP_NP * The operation referenced a group name or identifier that was invalid. */ #define EBADGROUP_NP _ENPERR(6) /*! * @const EOWNERSHIP_NP * Ownership or access permissions on a file were too permissive. */ #define EOWNERSHIP_NP _ENPERR(7) /*! * @const ENOOOO_NP * A series of operations was executed in the improper order (no out-of-order * operations allowed). */ #define ENOOOO_NP _ENPERR(8) /*! * @const ENOTBUNDLE_NP * The path given to the operation did not refer to a bundle. */ #define ENOTBUNDLE_NP _ENPERR(9) /*! * @const EBADBUNDLE_NP * The path given to the operation did not refer to a valid bundle. */ #define EBADBUNDLE_NP _ENPERR(10) /*! * @const EBADPATH_NP * The path given to the operation was not valid. */ #define EBADPATH_NP _ENPERR(11) /*! * @const EBADPLIST_NP * The plist given to the operation was invalid. */ #define EBADPLIST_NP _ENPERR(12) /*! * @const EBADKEY_NP * A key in the given plist was unrecognized. */ #define EBADKEY_NP _ENPERR(13) /*! * @const EBADVAL_NP * The value for a key in the given plist was either not present (and was * required to be) or was present but not of the appropriate type. */ #define EBADVAL_NP _ENPERR(14) /*! @const EBADSUBSYS_NP * The request referenced a subsystem that did not exist. */ #define EBADSUBSYS_NP _ENPERR(15) /*! * @const E2BIMPL_NP * The operation has not yet been implemented. */ #define E2BIMPL_NP _ENPERR(16) /*! * @const EDEPRECATED_NP * The operation has been deprecated. */ #define EDEPRECATED_NP _ENPERR(17) /*! * @const EREMOVED_NP * The operation has been removed from the implementation. */ #define EREMOVED_NP _ENPERR(18) /*! * @const EDROPPED_NP * The request referenced a data structure that will never achieve the state * required to perform the operation. */ #define EDROPPED_NP _ENPERR(19) /*! * @const EDEFERRED_NP * The request referenced a data structure that was not in the state required * to perform the operation, and the request has been pended until the object * reaches the required state. This code is meant to be used for control flow * purposes in the server and should not be returned to the caller. */ #define EDEFERRED_NP _ENPERR(20) /*! * @const EUSAGE_NP * Improper command line usage. This code is meant to be used for control flow * purposes in a command line tool so that routines may return an error code * indicating improper usage without having to use EX_USAGE, which collides with * the POSIX error space. It should not be passed to exit(3), _exit(2), et al. * and should instead be translated into EX_USAGE either directly or with * {@link darwin_sysexit}. */ #define EUSAGE_NP _ENPERR(21) /*! * @const EUNKNOWN_NP * An error occurred in a subsystem, and insufficient detail as to the nature of * the failure was available to translate it into a more descriptive error code. */ #define EUNKNOWN_NP _ENPERR(22) #define __ELAST_NP _ENPERR(22) /*! * @const EX_BADRECEIPT_NP * An exit code indicating that the program could not verify its purchase * receipt from the Mac App Store. This exit code is inspected by the system to * trigger a re-validation of the purchase receipt. It must be passed to the * exit(3) Libc API and not to _exit(2) system call. This exit code is only * relevant to the macOS variant of Darwin. */ #define EX_BADRECEIPT_NP (173) __BEGIN_DECLS; /*! * @function sysexit_np * Translates a {@link errno_t} or POSIX error code into an exit code * defined in sysexits(3). * * @param code * The error code to translate. * * @result * The sysexits(3) exit code most appropriate for the given error. If no * appropriate exit code could be determined, the designated ¯\_(ツ)_/¯ exit * code, EX_UNAVAILABLE, is returned (cf. sysexits(3)). */ DARWIN_API_AVAILABLE_20170407 OS_EXPORT OS_WARN_RESULT OS_CONST int sysexit_np(int code); __END_DECLS; #endif // __DARWIN_ERRNO_H |