authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-03-31 21:20:41+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-03-31 21:20:47+02:00
log26c88e4f4580db1278e5e35914512b40bed345a8
treee3c6736cc486a87103f42aaba2a812b0a2ca8ea4
parent5b82b40043e3a930e6693867c83de00ab3d20ef7

libc: update macOS libc headers to latest SDK 13.3


35 files changed, 7060 insertions(+), 2116 deletions(-)

lib/libc/include/aarch64-macos.13-none/mach/arm/thread_status.h+5
......@@ -76,6 +76,11 @@
7676#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) 0
7777#endif
7878
79#define FLAVOR_MODIFIES_CORE_CPU_REGISTERS(x) \
80((x == ARM_THREAD_STATE) || \
81 (x == ARM_THREAD_STATE32) || \
82 (x == ARM_THREAD_STATE64))
83
7984#define VALID_THREAD_STATE_FLAVOR(x) \
8085 ((x == ARM_THREAD_STATE) || \
8186 (x == ARM_VFP_STATE) || \
lib/libc/include/any-macos-any/libkern/OSKextLib.h deleted-571
......@@ -1,571 +0,0 @@
1/*
2 * Copyright (c) 2008 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#ifndef _LIBKERN_OSKEXTLIB_H
30#define _LIBKERN_OSKEXTLIB_H
31
32#include <sys/cdefs.h>
33__BEGIN_DECLS
34
35#include <stdint.h>
36#include <mach/kmod.h>
37#include <mach/vm_types.h>
38#include <uuid/uuid.h>
39
40#include <libkern/OSReturn.h>
41
42/*!
43 * @header
44 *
45 * Declares functions, basic return values, and other constants
46 * related to kernel extensions (kexts).
47 */
48
49#if PRAGMA_MARK
50#pragma mark -
51/********************************************************************/
52#pragma mark OSReturn Values for Kernel Extensions
53/********************************************************************/
54#endif
55/*!
56 * @group OSReturn Values for Kernel Extensions
57 * Many kext-related functions return these values,
58 * as well as those defined under
59 * <code>@link //apple_ref/c/tdef/OSReturn OSReturn@/link</code>
60 * and other variants of <code>kern_return_t</code>.
61 */
62
63
64#define sub_libkern_kext err_sub(2)
65#define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code))
66
67
68/*!
69 * @define kOSKextReturnInternalError
70 * @abstract An internal error in the kext library.
71 * Contrast with <code>@link //apple_ref/c/econst/OSReturnError
72 * OSReturnError@/link</code>.
73 */
74#define kOSKextReturnInternalError libkern_kext_err(0x1)
75
76/*!
77 * @define kOSKextReturnNoMemory
78 * @abstract Memory allocation failed.
79 */
80#define kOSKextReturnNoMemory libkern_kext_err(0x2)
81
82/*!
83 * @define kOSKextReturnNoResources
84 * @abstract Some resource other than memory (such as available load tags)
85 * is exhausted.
86 */
87#define kOSKextReturnNoResources libkern_kext_err(0x3)
88
89/*!
90 * @define kOSKextReturnNotPrivileged
91 * @abstract The caller lacks privileges to perform the requested operation.
92 */
93#define kOSKextReturnNotPrivileged libkern_kext_err(0x4)
94
95/*!
96 * @define kOSKextReturnInvalidArgument
97 * @abstract Invalid argument.
98 */
99#define kOSKextReturnInvalidArgument libkern_kext_err(0x5)
100
101/*!
102 * @define kOSKextReturnNotFound
103 * @abstract Search item not found.
104 */
105#define kOSKextReturnNotFound libkern_kext_err(0x6)
106
107/*!
108 * @define kOSKextReturnBadData
109 * @abstract Malformed data (not used for XML).
110 */
111#define kOSKextReturnBadData libkern_kext_err(0x7)
112
113/*!
114 * @define kOSKextReturnSerialization
115 * @abstract Error converting or (un)serializing URL, string, or XML.
116 */
117#define kOSKextReturnSerialization libkern_kext_err(0x8)
118
119/*!
120 * @define kOSKextReturnUnsupported
121 * @abstract Operation is no longer or not yet supported.
122 */
123#define kOSKextReturnUnsupported libkern_kext_err(0x9)
124
125/*!
126 * @define kOSKextReturnDisabled
127 * @abstract Operation is currently disabled.
128 */
129#define kOSKextReturnDisabled libkern_kext_err(0xa)
130
131/*!
132 * @define kOSKextReturnNotAKext
133 * @abstract Bundle is not a kernel extension.
134 */
135#define kOSKextReturnNotAKext libkern_kext_err(0xb)
136
137/*!
138 * @define kOSKextReturnValidation
139 * @abstract Validation failures encountered; check diagnostics for details.
140 */
141#define kOSKextReturnValidation libkern_kext_err(0xc)
142
143/*!
144 * @define kOSKextReturnAuthentication
145 * @abstract Authetication failures encountered; check diagnostics for details.
146 */
147#define kOSKextReturnAuthentication libkern_kext_err(0xd)
148
149/*!
150 * @define kOSKextReturnDependencies
151 * @abstract Dependency resolution failures encountered; check diagnostics for details.
152 */
153#define kOSKextReturnDependencies libkern_kext_err(0xe)
154
155/*!
156 * @define kOSKextReturnArchNotFound
157 * @abstract Kext does not contain code for the requested architecture.
158 */
159#define kOSKextReturnArchNotFound libkern_kext_err(0xf)
160
161/*!
162 * @define kOSKextReturnCache
163 * @abstract An error occurred processing a system kext cache.
164 */
165#define kOSKextReturnCache libkern_kext_err(0x10)
166
167/*!
168 * @define kOSKextReturnDeferred
169 * @abstract Operation has been posted asynchronously to user space (kernel only).
170 */
171#define kOSKextReturnDeferred libkern_kext_err(0x11)
172
173/*!
174 * @define kOSKextReturnBootLevel
175 * @abstract Kext not loadable or operation not allowed at current boot level.
176 */
177#define kOSKextReturnBootLevel libkern_kext_err(0x12)
178
179/*!
180 * @define kOSKextReturnNotLoadable
181 * @abstract Kext cannot be loaded; check diagnostics for details.
182 */
183#define kOSKextReturnNotLoadable libkern_kext_err(0x13)
184
185/*!
186 * @define kOSKextReturnLoadedVersionDiffers
187 * @abstract A different version (or executable UUID, or executable by checksum)
188 * of the requested kext is already loaded.
189 */
190#define kOSKextReturnLoadedVersionDiffers libkern_kext_err(0x14)
191
192/*!
193 * @define kOSKextReturnDependencyLoadError
194 * @abstract A load error occurred on a dependency of the kext being loaded.
195 */
196#define kOSKextReturnDependencyLoadError libkern_kext_err(0x15)
197
198/*!
199 * @define kOSKextReturnLinkError
200 * @abstract A link failure occured with this kext or a dependency.
201 */
202#define kOSKextReturnLinkError libkern_kext_err(0x16)
203
204/*!
205 * @define kOSKextReturnStartStopError
206 * @abstract The kext start or stop routine returned an error.
207 */
208#define kOSKextReturnStartStopError libkern_kext_err(0x17)
209
210/*!
211 * @define kOSKextReturnInUse
212 * @abstract The kext is currently in use or has outstanding references,
213 * and cannot be unloaded.
214 */
215#define kOSKextReturnInUse libkern_kext_err(0x18)
216
217/*!
218 * @define kOSKextReturnTimeout
219 * @abstract A kext request has timed out.
220 */
221#define kOSKextReturnTimeout libkern_kext_err(0x19)
222
223/*!
224 * @define kOSKextReturnStopping
225 * @abstract The kext is in the process of stopping; requests cannot be made.
226 */
227#define kOSKextReturnStopping libkern_kext_err(0x1a)
228
229/*!
230 * @define kOSKextReturnSystemPolicy
231 * @abstract The kext was prevented from loading due to system policy.
232 */
233#define kOSKextReturnSystemPolicy libkern_kext_err(0x1b)
234
235/*!
236 * @define kOSKextReturnKCLoadFailure
237 * @abstract Loading of the System KC failed
238 */
239#define kOSKextReturnKCLoadFailure libkern_kext_err(0x1c)
240
241/*!
242 * @define kOSKextReturnKCLoadFailureSystemKC
243 * @abstract Loading of the System KC failed
244 *
245 * This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
246 * with: kOSKextReturnKCLoadFailureAuxKC
247 *
248 * If both the System and Aux KCs fail to load, then the error code will be:
249 * libkern_kext_err(0x1f)
250 */
251#define kOSKextReturnKCLoadFailureSystemKC libkern_kext_err(0x1d)
252
253/*!
254 * @define kOSKextReturnKCLoadFailureAuxKC
255 * @abstract Loading of the Aux KC failed
256 *
257 * This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
258 * with: kOSKextReturnKCLoadFailureSystemKC
259 *
260 * If both the System and Aux KCs fail to load, then the error code will be:
261 * libkern_kext_err(0x1f)
262 */
263#define kOSKextReturnKCLoadFailureAuxKC libkern_kext_err(0x1e)
264
265/* next available error is: libkern_kext_err(0x20) */
266
267#if PRAGMA_MARK
268#pragma mark -
269/********************************************************************/
270#pragma mark Kext/OSBundle Property List Keys
271/********************************************************************/
272#endif
273/*!
274 * @group Kext Property List Keys
275 * These constants cover CFBundle properties defined for kernel extensions.
276 * Because they are used in the kernel, if you want to use one with
277 * CFBundle APIs you'll need to wrap it in a <code>CFSTR()</code> macro.
278 */
279
280
281/*!
282 * @define kOSBundleCompatibleVersionKey
283 * @abstract A string giving the backwards-compatible version of a library kext
284 * in extended Mac OS 'vers' format (####.##.##s{1-255} where 's'
285 * is a build stage 'd', 'a', 'b', 'f' or 'fc').
286 */
287#define kOSBundleCompatibleVersionKey "OSBundleCompatibleVersion"
288
289/*!
290 * @define kOSBundleEnableKextLoggingKey
291 * @abstract Set to true to have the kernel kext logging spec applied
292 * to the kext.
293 * See <code>@link //apple_ref/c/econst/OSKextLogSpec
294 * OSKextLogSpec@/link</code>.
295 */
296#define kOSBundleEnableKextLoggingKey "OSBundleEnableKextLogging"
297
298/*!
299 * @define kOSBundleIsInterfaceKey
300 * @abstract A boolean value indicating whether the kext executable
301 * contains only symbol references.
302 */
303#define kOSBundleIsInterfaceKey "OSBundleIsInterface"
304
305/*!
306 * @define kOSBundleLibrariesKey
307 * @abstract A dictionary listing link dependencies for this kext.
308 * Keys are bundle identifiers, values are version strings.
309 */
310#define kOSBundleLibrariesKey "OSBundleLibraries"
311
312/*!
313 * @define kOSBundleRequiredKey
314 * @abstract A string indicating in which kinds of startup this kext
315 * may need to load during early startup (before
316 * <code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>).
317 * @discussion
318 * The value is one of:
319 * <ul>
320 * <li>@link kOSBundleRequiredRoot "OSBundleRequiredRoot"@/link</li>
321 * <li>@link kOSBundleRequiredLocalRoot "OSBundleRequiredLocalRoot"@/link</li>
322 * <li>@link kOSBundleRequiredNetworkRoot "OSBundleRequiredNetworkRoot"@/link</li>
323 * <li>@link kOSBundleRequiredSafeBoot "OSBundleRequiredSafeBoot"@/link</li>
324 * <li>@link kOSBundleRequiredConsole "OSBundleRequiredConsole"@/link</li>
325 * </ul>
326 *
327 * Use this property judiciously.
328 * Every kext that declares a value other than "OSBundleRequiredSafeBoot"
329 * increases startup time, as the booter must read it into memory,
330 * or startup kext caches must include it.
331 */
332#define kOSBundleRequiredKey "OSBundleRequired"
333
334/*!
335 * @define kOSBundleRequireExplicitLoadKey
336 * @abstract A boolean value indicating whether the kext requires an
337 * explicit kextload in order to start/match.
338 */
339#define kOSBundleRequireExplicitLoadKey "OSBundleRequireExplicitLoad"
340
341/*!
342 * @define kOSBundleAllowUserLoadKey
343 * @abstract A boolean value indicating whether
344 * <code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>
345 * will honor a non-root process's request to load a kext.
346 * @discussion
347 * See <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithURL
348 * KextManagerLoadKextWithURL@/link</code>
349 * and <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithIdentifier
350 * KextManagerLoadKextWithIdentifier@/link</code>.
351 */
352#define kOSBundleAllowUserLoadKey "OSBundleAllowUserLoad"
353
354/*!
355 * @define kOSBundleAllowUserTerminateKey
356 * @abstract A boolean value indicating whether the kextunload tool
357 * is allowed to issue IOService terminate to classes defined in this kext.
358 * @discussion A boolean value indicating whether the kextunload tool
359 * is allowed to issue IOService terminate to classes defined in this kext.
360 */
361#define kOSBundleAllowUserTerminateKey "OSBundleAllowUserTerminate"
362
363/*!
364 * @define kOSKernelResourceKey
365 * @abstract A boolean value indicating whether the kext represents a built-in
366 * component of the kernel.
367 */
368#define kOSKernelResourceKey "OSKernelResource"
369
370/*!
371 * @define kOSKextVariantOverrideKey
372 * @abstract A dictionary with target names as key and a target-specific variant
373 * name as value.
374 */
375#define kOSKextVariantOverrideKey "OSKextVariantOverride"
376
377/*!
378 * @define kIOKitPersonalitiesKey
379 * @abstract A dictionary of dictionaries used in matching for I/O Kit drivers.
380 */
381#define kIOKitPersonalitiesKey "IOKitPersonalities"
382
383/*
384 * @define kIOPersonalityPublisherKey
385 * @abstract Used in personalities sent to the I/O Kit,
386 * contains the CFBundleIdentifier of the kext
387 * that the personality originated in.
388 */
389#define kIOPersonalityPublisherKey "IOPersonalityPublisher"
390
391#if CONFIG_KEC_FIPS
392/*
393 * @define kAppleTextHashesKey
394 * @abstract A dictionary conataining hashes for corecrypto kext.
395 */
396#define kAppleTextHashesKey "AppleTextHashes"
397#endif
398
399/*!
400 * @define kOSMutableSegmentCopy
401 * @abstract A boolean value indicating whether the kext requires a copy of
402 * its mutable segments to be kept in memory, and then reset when the kext
403 * unloads. This should be used with caution as it will increase the
404 * amount of memory used by the kext.
405 */
406#define kOSMutableSegmentCopy "OSMutableSegmentCopy"
407
408
409#if PRAGMA_MARK
410/********************************************************************/
411#pragma mark Kext/OSBundle Property Deprecated Keys
412/********************************************************************/
413#endif
414/*
415 * @define kOSBundleDebugLevelKey
416 * @abstract
417 * Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard).
418 * Value is an integer from 1-6, corresponding to the verbose levels
419 * of kext tools on those releases.
420 * On 10.6 Snow Leopard, use <code>@link OSKextEnableKextLogging
421 * OSKextEnableKextLogging@/link</code>.
422 */
423#define kOSBundleDebugLevelKey "OSBundleDebugLevel"
424
425/*!
426 * @define kOSBundleSharedExecutableIdentifierKey
427 * @abstract Deprecated (used on some releases of Mac OS X
428 * prior to 10.6 Snow Leopard).
429 * Value is the bundle identifier of the pseudokext
430 * that contains an executable shared by this kext.
431 */
432#define kOSBundleSharedExecutableIdentifierKey "OSBundleSharedExecutableIdentifier"
433
434
435#if PRAGMA_MARK
436/********************************************************************/
437#pragma mark Kext/OSBundle Property List Values
438/********************************************************************/
439#endif
440
441/*!
442 * @group Kext Property List Values
443 * These constants encompass established values
444 * for kernel extension bundle properties.
445 */
446
447/*!
448 * @define kOSKextKernelIdentifier
449 * @abstract
450 * This is the CFBundleIdentifier user for the kernel itself.
451 */
452#define kOSKextKernelIdentifier "__kernel__"
453
454/*!
455 * @define kOSKextBundlePackageTypeKext
456 * @abstract
457 * The bundle type value for Kernel Extensions.
458 */
459#define kOSKextBundlePackageTypeKext "KEXT"
460
461/*!
462 * @define kOSKextBundlePackageTypeDriverKit
463 * @abstract
464 * The bundle type value for Driver Extensions.
465 */
466#define kOSKextBundlePackageTypeDriverKit "DEXT"
467
468/*!
469 * @define kOSBundleRequiredRoot
470 * @abstract
471 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
472 * value indicates that the kext may be needed to mount the root filesystem
473 * whether starting from a local or a network volume.
474 */
475#define kOSBundleRequiredRoot "Root"
476
477/*!
478 * @define kOSBundleRequiredLocalRoot
479 * @abstract
480 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
481 * value indicates that the kext may be needed to mount the root filesystem
482 * when starting from a local disk.
483 */
484#define kOSBundleRequiredLocalRoot "Local-Root"
485
486/*!
487 * @define kOSBundleRequiredNetworkRoot
488 * @abstract
489 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
490 * value indicates that the kext may be needed to mount the root filesystem
491 * when starting over a network connection.
492 */
493#define kOSBundleRequiredNetworkRoot "Network-Root"
494
495/*!
496 * @define kOSBundleRequiredSafeBoot
497 * @abstract
498 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
499 * value indicates that the kext can be loaded during a safe startup.
500 * This value does not normally cause the kext to be read by the booter
501 * or included in startup kext caches.
502 */
503#define kOSBundleRequiredSafeBoot "Safe Boot"
504
505/*!
506 * @define kOSBundleRequiredConsole
507 * @abstract
508 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
509 * value indicates that the kext may be needed for console access
510 * (specifically in a single-user startup when
511 * <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code>.
512 * does not run)
513 * and should be loaded during early startup.
514 */
515#define kOSBundleRequiredConsole "Console"
516
517/*!
518 * @define kOSBundleRequiredDriverKit
519 * @abstract
520 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
521 * value indicates that the driver extension's (DriverKit driver's)
522 * personalities must be present in the kernel at early boot (specifically
523 * before <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code> starts)
524 * in order to compete with kexts built into the prelinkedkernel. Note that
525 * kextd is still required to launch the user space driver binary. The IOKit
526 * matching will happen during early boot, and the actual driver launch
527 * will happen after kextd starts.
528 */
529#define kOSBundleRequiredDriverKit "DriverKit"
530
531#if PRAGMA_MARK
532#pragma mark -
533/********************************************************************/
534#pragma mark Kext Information
535/********************************************************************/
536#endif
537/*!
538 * @group Kext Information
539 * Types, constants, and macros providing a kext with information
540 * about itself.
541 */
542
543/*!
544 * @typedef OSKextLoadTag
545 *
546 * @abstract
547 * A unique identifier assigned to a loaded instanace of a kext.
548 *
549 * @discussion
550 * If a kext is unloaded and later reloaded, the new instance
551 * has a different load tag.
552 *
553 * A kext can get its own load tag in the <code>kmod_info_t</code>
554 * structure passed into its module start routine, as the
555 * <code>id</code> field (cast to this type).
556 */
557typedef uint32_t OSKextLoadTag;
558
559/*!
560 * @define kOSKextInvalidLoadTag
561 *
562 * @abstract
563 * A load tag value that will never be used for a loaded kext;
564 * indicates kext not found.
565 */
566#define kOSKextInvalidLoadTag ((OSKextLoadTag)(-1))
567
568
569__END_DECLS
570
571#endif /* _LIBKERN_OSKEXTLIB_H */
\ No newline at end of file
lib/libc/include/any-macos-any/sys/attr.h deleted-592
......@@ -1,592 +0,0 @@
1/*
2 * Copyright (c) 2000-2018 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/*
30 * attr.h - attribute data structures and interfaces
31 *
32 * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved.
33 */
34
35#ifndef _SYS_ATTR_H_
36#define _SYS_ATTR_H_
37
38#include <sys/appleapiopts.h>
39
40#ifdef __APPLE_API_UNSTABLE
41#include <sys/types.h>
42#include <sys/ucred.h>
43#include <sys/time.h>
44#include <sys/cdefs.h>
45
46#define FSOPT_NOFOLLOW 0x00000001
47#define FSOPT_NOINMEMUPDATE 0x00000002
48#define FSOPT_REPORT_FULLSIZE 0x00000004
49/* The following option only valid when requesting ATTR_CMN_RETURNED_ATTRS */
50#define FSOPT_PACK_INVAL_ATTRS 0x00000008
51
52
53#define FSOPT_ATTR_CMN_EXTENDED 0x00000020
54#define FSOPT_RETURN_REALDEV 0x00000200
55#define FSOPT_NOFOLLOW_ANY 0x00000800
56
57/* we currently aren't anywhere near this amount for a valid
58 * fssearchblock.sizeofsearchparams1 or fssearchblock.sizeofsearchparams2
59 * but we put a sanity check in to avoid abuse of the value passed in from
60 * user land.
61 */
62#define SEARCHFS_MAX_SEARCHPARMS 4096
63
64typedef u_int32_t text_encoding_t;
65
66typedef u_int32_t fsobj_type_t;
67
68typedef u_int32_t fsobj_tag_t;
69
70typedef u_int32_t fsfile_type_t;
71
72typedef u_int32_t fsvolid_t;
73
74#include <sys/_types/_fsobj_id_t.h> /* file object id type */
75
76typedef u_int32_t attrgroup_t;
77
78struct attrlist {
79 u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */
80 u_int16_t reserved; /* (to maintain 4-byte alignment) */
81 attrgroup_t commonattr; /* common attribute group */
82 attrgroup_t volattr; /* Volume attribute group */
83 attrgroup_t dirattr; /* directory attribute group */
84 attrgroup_t fileattr; /* file attribute group */
85 attrgroup_t forkattr; /* fork attribute group */
86};
87
88#define ATTR_BIT_MAP_COUNT 5
89
90typedef struct attribute_set {
91 attrgroup_t commonattr; /* common attribute group */
92 attrgroup_t volattr; /* Volume attribute group */
93 attrgroup_t dirattr; /* directory attribute group */
94 attrgroup_t fileattr; /* file attribute group */
95 attrgroup_t forkattr; /* fork attribute group */
96} attribute_set_t;
97
98#define ATTRIBUTE_SET_INIT(a) do {(a)->commonattr = (a)->volattr = (a)->dirattr = (a)->fileattr = (a)->forkattr = 0; } while(0)
99
100
101typedef struct attrreference {
102 int32_t attr_dataoffset;
103 u_int32_t attr_length;
104} attrreference_t;
105
106/* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */
107
108struct diskextent {
109 u_int32_t startblock; /* first block allocated */
110 u_int32_t blockcount; /* number of blocks allocated */
111};
112
113typedef struct diskextent extentrecord[8];
114
115typedef u_int32_t vol_capabilities_set_t[4];
116
117#define VOL_CAPABILITIES_FORMAT 0
118#define VOL_CAPABILITIES_INTERFACES 1
119#define VOL_CAPABILITIES_RESERVED1 2
120#define VOL_CAPABILITIES_RESERVED2 3
121
122typedef struct vol_capabilities_attr {
123 vol_capabilities_set_t capabilities;
124 vol_capabilities_set_t valid;
125} vol_capabilities_attr_t;
126
127/*
128 * XXX this value needs to be raised - 3893388
129 */
130#define ATTR_MAX_BUFFER 8192
131
132/*
133 * VOL_CAP_FMT_PERSISTENTOBJECTIDS: When set, the volume has object IDs
134 * that are persistent (retain their values even when the volume is
135 * unmounted and remounted), and a file or directory can be looked up
136 * by ID. Volumes that support VolFS and can support Carbon File ID
137 * references should set this bit.
138 *
139 * VOL_CAP_FMT_SYMBOLICLINKS: When set, the volume supports symbolic
140 * links. The symlink(), readlink(), and lstat() calls all use this
141 * symbolic link.
142 *
143 * VOL_CAP_FMT_HARDLINKS: When set, the volume supports hard links.
144 * The link() call creates hard links.
145 *
146 * VOL_CAP_FMT_JOURNAL: When set, the volume is capable of supporting
147 * a journal used to speed recovery in case of unplanned shutdown
148 * (such as a power outage or crash). This bit does not necessarily
149 * mean the volume is actively using a journal for recovery.
150 *
151 * VOL_CAP_FMT_JOURNAL_ACTIVE: When set, the volume is currently using
152 * a journal for use in speeding recovery after an unplanned shutdown.
153 * This bit can be set only if VOL_CAP_FMT_JOURNAL is also set.
154 *
155 * VOL_CAP_FMT_NO_ROOT_TIMES: When set, the volume format does not
156 * store reliable times for the root directory, so you should not
157 * depend on them to detect changes, etc.
158 *
159 * VOL_CAP_FMT_SPARSE_FILES: When set, the volume supports sparse files.
160 * That is, files which can have "holes" that have never been written
161 * to, and are not allocated on disk. Sparse files may have an
162 * allocated size that is less than the file's logical length.
163 *
164 * VOL_CAP_FMT_ZERO_RUNS: For security reasons, parts of a file (runs)
165 * that have never been written to must appear to contain zeroes. When
166 * this bit is set, the volume keeps track of allocated but unwritten
167 * runs of a file so that it can substitute zeroes without actually
168 * writing zeroes to the media. This provides performance similar to
169 * sparse files, but not the space savings.
170 *
171 * VOL_CAP_FMT_CASE_SENSITIVE: When set, file and directory names are
172 * case sensitive (upper and lower case are different). When clear,
173 * an upper case character is equivalent to a lower case character,
174 * and you can't have two names that differ solely in the case of
175 * the characters.
176 *
177 * VOL_CAP_FMT_CASE_PRESERVING: When set, file and directory names
178 * preserve the difference between upper and lower case. If clear,
179 * the volume may change the case of some characters (typically
180 * making them all upper or all lower case). A volume that sets
181 * VOL_CAP_FMT_CASE_SENSITIVE should also set VOL_CAP_FMT_CASE_PRESERVING.
182 *
183 * VOL_CAP_FMT_FAST_STATFS: This bit is used as a hint to upper layers
184 * (especially Carbon) that statfs() is fast enough that its results
185 * need not be cached by those upper layers. A volume that caches
186 * the statfs information in its in-memory structures should set this bit.
187 * A volume that must always read from disk or always perform a network
188 * transaction should not set this bit.
189 *
190 * VOL_CAP_FMT_2TB_FILESIZE: If this bit is set the volume format supports
191 * file sizes larger than 4GB, and potentially up to 2TB; it does not
192 * indicate whether the filesystem supports files larger than that.
193 *
194 * VOL_CAP_FMT_OPENDENYMODES: When set, the volume supports open deny
195 * modes (e.g. "open for read write, deny write"; effectively, mandatory
196 * file locking based on open modes).
197 *
198 * VOL_CAP_FMT_HIDDEN_FILES: When set, the volume supports the UF_HIDDEN
199 * file flag, and the UF_HIDDEN flag is mapped to that volume's native
200 * "hidden" or "invisible" bit (which may be the invisible bit from the
201 * Finder Info extended attribute).
202 *
203 * VOL_CAP_FMT_PATH_FROM_ID: When set, the volume supports the ability
204 * to derive a pathname to the root of the file system given only the
205 * id of an object. This also implies that object ids on this file
206 * system are persistent and not recycled. This is a very specialized
207 * capability and it is assumed that most file systems will not support
208 * it. Its use is for legacy non-posix APIs like ResolveFileIDRef.
209 *
210 * VOL_CAP_FMT_NO_VOLUME_SIZES: When set, the volume does not support
211 * returning values for total data blocks, available blocks, or free blocks
212 * (as in f_blocks, f_bavail, or f_bfree in "struct statfs"). Historically,
213 * those values were set to 0xFFFFFFFF for volumes that did not support them.
214 *
215 * VOL_CAP_FMT_DECMPFS_COMPRESSION: When set, the volume supports transparent
216 * decompression of compressed files using decmpfs.
217 *
218 * VOL_CAP_FMT_64BIT_OBJECT_IDS: When set, the volume uses object IDs that
219 * are 64-bit. This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the
220 * only legitimate attributes for obtaining object IDs from this volume and the
221 * 32-bit fid_objno fields of the fsobj_id_t returned by ATTR_CMN_OBJID,
222 * ATTR_CMN_OBJPERMID, and ATTR_CMN_PAROBJID are undefined.
223 *
224 * VOL_CAP_FMT_DIR_HARDLINKS: When set, the volume supports directory
225 * hard links.
226 *
227 * VOL_CAP_FMT_DOCUMENT_ID: When set, the volume supports document IDs
228 * (an ID which persists across object ID changes) for document revisions.
229 *
230 * VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write
231 * generation counts (a count of how many times an object has been modified)
232 *
233 * VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support
234 * setting the UF_IMMUTABLE flag.
235 *
236 * VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting
237 * permissions.
238 *
239 * VOL_CAP_FMT_SHARED_SPACE: When set, the volume supports sharing space with
240 * other filesystems i.e. multiple logical filesystems can exist in the same
241 * "partition". An implication of this is that the filesystem which sets
242 * this capability treats waitfor arguments to VFS_SYNC as bit flags.
243 *
244 * VOL_CAP_FMT_VOL_GROUPS: When set, this volume is part of a volume-group
245 * that implies multiple volumes must be mounted in order to boot and root the
246 * operating system. Typically, this means a read-only system volume and a
247 * writable data volume.
248 *
249 * VOL_CAP_FMT_SEALED: When set, this volume is cryptographically sealed.
250 * Any modifications to volume data or metadata will be detected and may
251 * render the volume unusable.
252 */
253#define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001
254#define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002
255#define VOL_CAP_FMT_HARDLINKS 0x00000004
256#define VOL_CAP_FMT_JOURNAL 0x00000008
257#define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010
258#define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020
259#define VOL_CAP_FMT_SPARSE_FILES 0x00000040
260#define VOL_CAP_FMT_ZERO_RUNS 0x00000080
261#define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100
262#define VOL_CAP_FMT_CASE_PRESERVING 0x00000200
263#define VOL_CAP_FMT_FAST_STATFS 0x00000400
264#define VOL_CAP_FMT_2TB_FILESIZE 0x00000800
265#define VOL_CAP_FMT_OPENDENYMODES 0x00001000
266#define VOL_CAP_FMT_HIDDEN_FILES 0x00002000
267#define VOL_CAP_FMT_PATH_FROM_ID 0x00004000
268#define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000
269#define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000
270#define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000
271#define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000
272#define VOL_CAP_FMT_DOCUMENT_ID 0x00080000
273#define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000
274#define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000
275#define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000
276#define VOL_CAP_FMT_SHARED_SPACE 0x00800000
277#define VOL_CAP_FMT_VOL_GROUPS 0x01000000
278#define VOL_CAP_FMT_SEALED 0x02000000
279
280/*
281 * VOL_CAP_INT_SEARCHFS: When set, the volume implements the
282 * searchfs() system call (the vnop_searchfs vnode operation).
283 *
284 * VOL_CAP_INT_ATTRLIST: When set, the volume implements the
285 * getattrlist() and setattrlist() system calls (vnop_getattrlist
286 * and vnop_setattrlist vnode operations) for the volume, files,
287 * and directories. The volume may or may not implement the
288 * readdirattr() system call. XXX Is there any minimum set
289 * of attributes that should be supported? To determine the
290 * set of supported attributes, get the ATTR_VOL_ATTRIBUTES
291 * attribute of the volume.
292 *
293 * VOL_CAP_INT_NFSEXPORT: When set, the volume implements exporting
294 * of NFS volumes.
295 *
296 * VOL_CAP_INT_READDIRATTR: When set, the volume implements the
297 * readdirattr() system call (vnop_readdirattr vnode operation).
298 *
299 * VOL_CAP_INT_EXCHANGEDATA: When set, the volume implements the
300 * exchangedata() system call (VNOP_EXCHANGE vnode operation).
301 *
302 * VOL_CAP_INT_COPYFILE: When set, the volume implements the
303 * VOP_COPYFILE vnode operation. (XXX There should be a copyfile()
304 * system call in <unistd.h>.)
305 *
306 * VOL_CAP_INT_ALLOCATE: When set, the volume implements the
307 * VNOP_ALLOCATE vnode operation, which means it implements the
308 * F_PREALLOCATE selector of fcntl(2).
309 *
310 * VOL_CAP_INT_VOL_RENAME: When set, the volume implements the
311 * ATTR_VOL_NAME attribute for both getattrlist() and setattrlist().
312 * The volume can be renamed by setting ATTR_VOL_NAME with setattrlist().
313 *
314 * VOL_CAP_INT_ADVLOCK: When set, the volume implements POSIX style
315 * byte range locks via vnop_advlock (accessible from fcntl(2)).
316 *
317 * VOL_CAP_INT_FLOCK: When set, the volume implements whole-file flock(2)
318 * style locks via vnop_advlock. This includes the O_EXLOCK and O_SHLOCK
319 * flags of the open(2) call.
320 *
321 * VOL_CAP_INT_EXTENDED_SECURITY: When set, the volume implements
322 * extended security (ACLs).
323 *
324 * VOL_CAP_INT_USERACCESS: When set, the volume supports the
325 * ATTR_CMN_USERACCESS attribute (used to get the user's access
326 * mode to the file).
327 *
328 * VOL_CAP_INT_MANLOCK: When set, the volume supports AFP-style
329 * mandatory byte range locks via an ioctl().
330 *
331 * VOL_CAP_INT_EXTENDED_ATTR: When set, the volume implements
332 * native extended attribues.
333 *
334 * VOL_CAP_INT_NAMEDSTREAMS: When set, the volume supports
335 * native named streams.
336 *
337 * VOL_CAP_INT_CLONE: When set, the volume supports clones.
338 *
339 * VOL_CAP_INT_SNAPSHOT: When set, the volume supports snapshots.
340 *
341 * VOL_CAP_INT_RENAME_SWAP: When set, the volume supports swapping
342 * file system objects.
343 *
344 * VOL_CAP_INT_RENAME_EXCL: When set, the volume supports an
345 * exclusive rename operation.
346 *
347 * VOL_CAP_INT_RENAME_OPENFAIL: When set, the volume may fail rename
348 * operations on files that are open.
349 */
350#define VOL_CAP_INT_SEARCHFS 0x00000001
351#define VOL_CAP_INT_ATTRLIST 0x00000002
352#define VOL_CAP_INT_NFSEXPORT 0x00000004
353#define VOL_CAP_INT_READDIRATTR 0x00000008
354#define VOL_CAP_INT_EXCHANGEDATA 0x00000010
355#define VOL_CAP_INT_COPYFILE 0x00000020
356#define VOL_CAP_INT_ALLOCATE 0x00000040
357#define VOL_CAP_INT_VOL_RENAME 0x00000080
358#define VOL_CAP_INT_ADVLOCK 0x00000100
359#define VOL_CAP_INT_FLOCK 0x00000200
360#define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400
361#define VOL_CAP_INT_USERACCESS 0x00000800
362#define VOL_CAP_INT_MANLOCK 0x00001000
363#define VOL_CAP_INT_NAMEDSTREAMS 0x00002000
364#define VOL_CAP_INT_EXTENDED_ATTR 0x00004000
365#define VOL_CAP_INT_CLONE 0x00010000
366#define VOL_CAP_INT_SNAPSHOT 0x00020000
367#define VOL_CAP_INT_RENAME_SWAP 0x00040000
368#define VOL_CAP_INT_RENAME_EXCL 0x00080000
369#define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000
370
371typedef struct vol_attributes_attr {
372 attribute_set_t validattr;
373 attribute_set_t nativeattr;
374} vol_attributes_attr_t;
375
376#define ATTR_CMN_NAME 0x00000001
377#define ATTR_CMN_DEVID 0x00000002
378#define ATTR_CMN_FSID 0x00000004
379#define ATTR_CMN_OBJTYPE 0x00000008
380#define ATTR_CMN_OBJTAG 0x00000010
381#define ATTR_CMN_OBJID 0x00000020
382#define ATTR_CMN_OBJPERMANENTID 0x00000040
383#define ATTR_CMN_PAROBJID 0x00000080
384#define ATTR_CMN_SCRIPT 0x00000100
385#define ATTR_CMN_CRTIME 0x00000200
386#define ATTR_CMN_MODTIME 0x00000400
387#define ATTR_CMN_CHGTIME 0x00000800
388#define ATTR_CMN_ACCTIME 0x00001000
389#define ATTR_CMN_BKUPTIME 0x00002000
390#define ATTR_CMN_FNDRINFO 0x00004000
391#define ATTR_CMN_OWNERID 0x00008000
392#define ATTR_CMN_GRPID 0x00010000
393#define ATTR_CMN_ACCESSMASK 0x00020000
394#define ATTR_CMN_FLAGS 0x00040000
395
396/* The following were defined as: */
397/* #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 */
398/* #define ATTR_CMN_NAMEDATTRLIST 0x00100000 */
399/* These bits have been salvaged for use as: */
400/* #define ATTR_CMN_GEN_COUNT 0x00080000 */
401/* #define ATTR_CMN_DOCUMENT_ID 0x00100000 */
402/* They can only be used with the FSOPT_ATTR_CMN_EXTENDED */
403/* option flag. */
404
405#define ATTR_CMN_GEN_COUNT 0x00080000
406#define ATTR_CMN_DOCUMENT_ID 0x00100000
407
408#define ATTR_CMN_USERACCESS 0x00200000
409#define ATTR_CMN_EXTENDED_SECURITY 0x00400000
410#define ATTR_CMN_UUID 0x00800000
411#define ATTR_CMN_GRPUUID 0x01000000
412#define ATTR_CMN_FILEID 0x02000000
413#define ATTR_CMN_PARENTID 0x04000000
414#define ATTR_CMN_FULLPATH 0x08000000
415#define ATTR_CMN_ADDEDTIME 0x10000000
416#define ATTR_CMN_ERROR 0x20000000
417#define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000
418
419/*
420 * ATTR_CMN_RETURNED_ATTRS is only valid with getattrlist(2) and
421 * getattrlistbulk(2). It is always the first attribute in the return buffer.
422 */
423#define ATTR_CMN_RETURNED_ATTRS 0x80000000
424
425#define ATTR_CMN_VALIDMASK 0xFFFFFFFF
426/*
427 * The settable ATTR_CMN_* attributes include the following:
428 * ATTR_CMN_SCRIPT
429 * ATTR_CMN_CRTIME
430 * ATTR_CMN_MODTIME
431 * ATTR_CMN_CHGTIME
432 *
433 * ATTR_CMN_ACCTIME
434 * ATTR_CMN_BKUPTIME
435 * ATTR_CMN_FNDRINFO
436 * ATTR_CMN_OWNERID
437 *
438 * ATTR_CMN_GRPID
439 * ATTR_CMN_ACCESSMASK
440 * ATTR_CMN_FLAGS
441 *
442 * ATTR_CMN_EXTENDED_SECURITY
443 * ATTR_CMN_UUID
444 *
445 * ATTR_CMN_GRPUUID
446 *
447 * ATTR_CMN_DATA_PROTECT_FLAGS
448 */
449#define ATTR_CMN_SETMASK 0x51C7FF00
450#define ATTR_CMN_VOLSETMASK 0x00006700
451
452#define ATTR_VOL_FSTYPE 0x00000001
453#define ATTR_VOL_SIGNATURE 0x00000002
454#define ATTR_VOL_SIZE 0x00000004
455#define ATTR_VOL_SPACEFREE 0x00000008
456#define ATTR_VOL_SPACEAVAIL 0x00000010
457#define ATTR_VOL_MINALLOCATION 0x00000020
458#define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
459#define ATTR_VOL_IOBLOCKSIZE 0x00000080
460#define ATTR_VOL_OBJCOUNT 0x00000100
461#define ATTR_VOL_FILECOUNT 0x00000200
462#define ATTR_VOL_DIRCOUNT 0x00000400
463#define ATTR_VOL_MAXOBJCOUNT 0x00000800
464#define ATTR_VOL_MOUNTPOINT 0x00001000
465#define ATTR_VOL_NAME 0x00002000
466#define ATTR_VOL_MOUNTFLAGS 0x00004000
467#define ATTR_VOL_MOUNTEDDEVICE 0x00008000
468#define ATTR_VOL_ENCODINGSUSED 0x00010000
469#define ATTR_VOL_CAPABILITIES 0x00020000
470#define ATTR_VOL_UUID 0x00040000
471#define ATTR_VOL_SPACEUSED 0x00800000
472#define ATTR_VOL_QUOTA_SIZE 0x10000000
473#define ATTR_VOL_RESERVED_SIZE 0x20000000
474#define ATTR_VOL_ATTRIBUTES 0x40000000
475#define ATTR_VOL_INFO 0x80000000
476
477#define ATTR_VOL_VALIDMASK 0xF087FFFF
478
479/*
480 * The list of settable ATTR_VOL_* attributes include the following:
481 * ATTR_VOL_NAME
482 * ATTR_VOL_INFO
483 */
484#define ATTR_VOL_SETMASK 0x80002000
485
486
487/* File/directory attributes: */
488#define ATTR_DIR_LINKCOUNT 0x00000001
489#define ATTR_DIR_ENTRYCOUNT 0x00000002
490#define ATTR_DIR_MOUNTSTATUS 0x00000004
491#define ATTR_DIR_ALLOCSIZE 0x00000008
492#define ATTR_DIR_IOBLOCKSIZE 0x00000010
493#define ATTR_DIR_DATALENGTH 0x00000020
494
495/* ATTR_DIR_MOUNTSTATUS Flags: */
496#define DIR_MNTSTATUS_MNTPOINT 0x00000001
497#define DIR_MNTSTATUS_TRIGGER 0x00000002
498
499#define ATTR_DIR_VALIDMASK 0x0000003f
500#define ATTR_DIR_SETMASK 0x00000000
501
502#define ATTR_FILE_LINKCOUNT 0x00000001
503#define ATTR_FILE_TOTALSIZE 0x00000002
504#define ATTR_FILE_ALLOCSIZE 0x00000004
505#define ATTR_FILE_IOBLOCKSIZE 0x00000008
506#define ATTR_FILE_DEVTYPE 0x00000020
507#define ATTR_FILE_FORKCOUNT 0x00000080
508#define ATTR_FILE_FORKLIST 0x00000100
509#define ATTR_FILE_DATALENGTH 0x00000200
510#define ATTR_FILE_DATAALLOCSIZE 0x00000400
511#define ATTR_FILE_RSRCLENGTH 0x00001000
512#define ATTR_FILE_RSRCALLOCSIZE 0x00002000
513
514#define ATTR_FILE_VALIDMASK 0x000037FF
515/*
516 * Settable ATTR_FILE_* attributes include:
517 * ATTR_FILE_DEVTYPE
518 */
519#define ATTR_FILE_SETMASK 0x00000020
520
521/* CMNEXT attributes extend the common attributes, but in the forkattr field */
522#define ATTR_CMNEXT_RELPATH 0x00000004
523#define ATTR_CMNEXT_PRIVATESIZE 0x00000008
524#define ATTR_CMNEXT_LINKID 0x00000010
525#define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020
526#define ATTR_CMNEXT_REALDEVID 0x00000040
527#define ATTR_CMNEXT_REALFSID 0x00000080
528#define ATTR_CMNEXT_CLONEID 0x00000100
529#define ATTR_CMNEXT_EXT_FLAGS 0x00000200
530#define ATTR_CMNEXT_RECURSIVE_GENCOUNT 0x00000400
531
532#define ATTR_CMNEXT_VALIDMASK 0x000007fc
533#define ATTR_CMNEXT_SETMASK 0x00000000
534
535/* Deprecated fork attributes */
536#define ATTR_FORK_TOTALSIZE 0x00000001
537#define ATTR_FORK_ALLOCSIZE 0x00000002
538#define ATTR_FORK_RESERVED 0xffffffff
539
540#define ATTR_FORK_VALIDMASK 0x00000003
541#define ATTR_FORK_SETMASK 0x00000000
542
543/* Obsolete, implemented, not supported */
544#define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
545#define ATTR_CMN_NAMEDATTRLIST 0x00100000
546#define ATTR_FILE_CLUMPSIZE 0x00000010 /* obsolete */
547#define ATTR_FILE_FILETYPE 0x00000040 /* always zero */
548#define ATTR_FILE_DATAEXTENTS 0x00000800 /* obsolete, HFS-specific */
549#define ATTR_FILE_RSRCEXTENTS 0x00004000 /* obsolete, HFS-specific */
550
551/* Required attributes for getattrlistbulk(2) */
552#define ATTR_BULK_REQUIRED (ATTR_CMN_NAME | ATTR_CMN_RETURNED_ATTRS)
553
554/*
555 * Searchfs
556 */
557#define SRCHFS_START 0x00000001
558#define SRCHFS_MATCHPARTIALNAMES 0x00000002
559#define SRCHFS_MATCHDIRS 0x00000004
560#define SRCHFS_MATCHFILES 0x00000008
561#define SRCHFS_SKIPLINKS 0x00000010
562#define SRCHFS_SKIPINVISIBLE 0x00000020
563#define SRCHFS_SKIPPACKAGES 0x00000040
564#define SRCHFS_SKIPINAPPROPRIATE 0x00000080
565
566#define SRCHFS_NEGATEPARAMS 0x80000000
567#define SRCHFS_VALIDOPTIONSMASK 0x800000FF
568
569struct fssearchblock {
570 struct attrlist *returnattrs;
571 void *returnbuffer;
572 size_t returnbuffersize;
573 u_long maxmatches;
574 struct timeval timelimit;
575 void *searchparams1;
576 size_t sizeofsearchparams1;
577 void *searchparams2;
578 size_t sizeofsearchparams2;
579 struct attrlist searchattrs;
580};
581
582
583struct searchstate {
584 uint32_t ss_union_flags; // for SRCHFS_START
585 uint32_t ss_union_layer; // 0 = top
586 u_char ss_fsstate[548]; // fs private
587} __attribute__((packed));
588
589#define FST_EOF (-1) /* end-of-file offset */
590
591#endif /* __APPLE_API_UNSTABLE */
592#endif /* !_SYS_ATTR_H_ */
\ No newline at end of file
lib/libc/include/any-macos-any/sys/timex.h created+198
......@@ -0,0 +1,198 @@
1/*-
2 ***********************************************************************
3 * *
4 * Copyright (c) David L. Mills 1993-2001 *
5 * Copyright (c) Poul-Henning Kamp 2000-2001 *
6 * *
7 * Permission to use, copy, modify, and distribute this software and *
8 * its documentation for any purpose and without fee is hereby *
9 * granted, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission *
11 * notice appear in supporting documentation, and that the name *
12 * University of Delaware not be used in advertising or publicity *
13 * pertaining to distribution of the software without specific, *
14 * written prior permission. The University of Delaware makes no *
15 * representations about the suitability this software for any *
16 * purpose. It is provided "as is" without express or implied *
17 * warranty. *
18 * *
19 ***********************************************************************
20 *
21 * $FreeBSD$
22 *
23 * This header file defines the Network Time Protocol (NTP) interfaces
24 * for user and daemon application programs.
25 *
26 * This file was originally created 17 Sep 93 by David L. Mills, Professor
27 * of University of Delaware, building on work which had already been ongoing
28 * for a decade and a half at that point in time.
29 *
30 * In 2000 the APIs got a upgrade from microseconds to nanoseconds,
31 * a joint work between Poul-Henning Kamp and David L. Mills.
32 *
33 */
34
35/*
36 * Copyright (c) 2017 Apple Computer, Inc. All rights reserved.
37 *
38 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
39 *
40 * This file contains Original Code and/or Modifications of Original Code
41 * as defined in and that are subject to the Apple Public Source License
42 * Version 2.0 (the 'License'). You may not use this file except in
43 * compliance with the License. The rights granted to you under the License
44 * may not be used to create, or enable the creation or redistribution of,
45 * unlawful or unlicensed copies of an Apple operating system, or to
46 * circumvent, violate, or enable the circumvention or violation of, any
47 * terms of an Apple operating system software license agreement.
48 *
49 * Please obtain a copy of the License at
50 * http://www.opensource.apple.com/apsl/ and read it before using this file.
51 *
52 * The Original Code and all software distributed under the License are
53 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
54 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
55 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
56 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
57 * Please see the License for the specific language governing rights and
58 * limitations under the License.
59 *
60 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
61 */
62
63#ifndef _SYS_TIMEX_H_
64#define _SYS_TIMEX_H_ 1
65
66#include <sys/time.h>
67
68#define NTP_API 4 /* NTP API version */
69
70/*
71 * The following defines establish the performance envelope of the
72 * kernel discipline loop. Phase or frequency errors greater than
73 * NAXPHASE or MAXFREQ are clamped to these maxima. For update intervals
74 * less than MINSEC, the loop always operates in PLL mode; while, for
75 * update intervals greater than MAXSEC, the loop always operates in FLL
76 * mode. Between these two limits the operating mode is selected by the
77 * STA_FLL bit in the status word.
78 */
79
80#define MAXPHASE 500000000L /* max phase error (ns) */
81#define MAXFREQ 500000L /* max freq error (ns/s) */
82#define MINSEC 256 /* min FLL update interval (s) */
83#define MAXSEC 2048 /* max PLL update interval (s) */
84#define NANOSECOND 1000000000L /* nanoseconds in one second */
85#define SCALE_PPM (65536 / 1000) /* crude ns/s to scaled PPM */
86#define MAXTC 10 /* max time constant */
87
88/* Codes for PPS (pulse-per-second) signals or leap seconds are not used but kept
89 * unchanged and commented for future compatibility.
90 */
91
92/*
93 * Control mode codes (timex.modes)
94 */
95#define MOD_OFFSET 0x0001 /* set time offset */
96#define MOD_FREQUENCY 0x0002 /* set frequency offset */
97#define MOD_MAXERROR 0x0004 /* set maximum time error */
98#define MOD_ESTERROR 0x0008 /* set estimated time error */
99#define MOD_STATUS 0x0010 /* set clock status bits */
100#define MOD_TIMECONST 0x0020 /* set PLL time constant */
101#define MOD_PPSMAX 0x0040 /* set PPS maximum averaging time */
102#define MOD_TAI 0x0080 /* set TAI offset */
103#define MOD_MICRO 0x1000 /* select microsecond resolution */
104#define MOD_NANO 0x2000 /* select nanosecond resolution */
105#define MOD_CLKB 0x4000 /* select clock B */
106#define MOD_CLKA 0x8000 /* select clock A */
107
108/*
109 * Status codes (timex.status)
110 */
111#define STA_PLL 0x0001 /* enable PLL updates (rw) */
112#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
113#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
114#define STA_FLL 0x0008 /* enable FLL mode (rw) */
115#define STA_INS 0x0010 /* insert leap (rw) */
116#define STA_DEL 0x0020 /* delete leap (rw) */
117#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
118#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
119#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
120#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
121#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
122#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
123#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
124#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
125#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
126#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
127
128#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
129 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
130
131#define STA_SUPPORTED (STA_PLL | STA_FLL | STA_UNSYNC | STA_FREQHOLD | \
132 STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
133
134/*
135 * Clock states (ntptimeval.time_state)
136 */
137#define TIME_OK 0 /* no leap second warning */
138#define TIME_INS 1 /* insert leap second warning */
139#define TIME_DEL 2 /* delete leap second warning */
140#define TIME_OOP 3 /* leap second in progress */
141#define TIME_WAIT 4 /* leap second has occurred */
142#define TIME_ERROR 5 /* error (see status word) */
143
144/*
145 * NTP user interface -- ntp_gettime - used to read kernel clock values
146 */
147struct ntptimeval {
148 struct timespec time; /* current time (ns) (ro) */
149 long maxerror; /* maximum error (us) (ro) */
150 long esterror; /* estimated error (us) (ro) */
151 long tai; /* TAI offset */
152 int time_state; /* time status */
153};
154
155/*
156 * NTP daemon interface -- ntp_adjtime -- used to discipline CPU clock
157 * oscillator and control/determine status.
158 *
159 * Note: The offset, precision and jitter members are in microseconds if
160 * STA_NANO is zero and nanoseconds if not.
161 */
162struct timex {
163 unsigned int modes; /* clock mode bits (wo) */
164 long offset; /* time offset (ns/us) (rw) */
165 long freq; /* frequency offset (scaled PPM) (rw) */
166 long maxerror; /* maximum error (us) (rw) */
167 long esterror; /* estimated error (us) (rw) */
168 int status; /* clock status bits (rw) */
169 long constant; /* poll interval (log2 s) (rw) */
170 long precision; /* clock precision (ns/us) (ro) */
171 long tolerance; /* clock frequency tolerance (scaled
172 * PPM) (ro) */
173 /*
174 * The following read-only structure members are used by
175 * the PPS signal discipline that is currently not supported.
176 * They are included for compatibility.
177 */
178 long ppsfreq; /* PPS frequency (scaled PPM) (ro) */
179 long jitter; /* PPS jitter (ns/us) (ro) */
180 int shift; /* interval duration (s) (shift) (ro) */
181 long stabil; /* PPS stability (scaled PPM) (ro) */
182 long jitcnt; /* jitter limit exceeded (ro) */
183 long calcnt; /* calibration intervals (ro) */
184 long errcnt; /* calibration errors (ro) */
185 long stbcnt; /* stability limit exceeded (ro) */
186};
187
188#include <sys/cdefs.h>
189
190__BEGIN_DECLS
191#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
192int ntp_adjtime(struct timex *);
193int ntp_gettime(struct ntptimeval *);
194#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
195__END_DECLS
196
197
198#endif /* !_SYS_TIMEX_H_ */
\ No newline at end of file
lib/libc/include/any-macos-any/unistd.h deleted-791
......@@ -1,791 +0,0 @@
1/*
2 * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 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/*-
24 * Copyright (c) 1998-1999 Apple Computer, Inc. All Rights Reserved
25 * Copyright (c) 1991, 1993, 1994
26 * The Regents of the University of California. All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. All advertising materials mentioning features or use of this software
37 * must display the following acknowledgement:
38 * This product includes software developed by the University of
39 * California, Berkeley and its contributors.
40 * 4. Neither the name of the University nor the names of its contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
43 *
44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * SUCH DAMAGE.
55 *
56 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
57 *
58 * Copyright (c) 1998 Apple Compter, Inc.
59 * All Rights Reserved
60 */
61
62/* History:
63 7/14/99 EKN at Apple fixed getdirentriesattr from getdirentryattr
64 3/26/98 CHW at Apple added real interface to searchfs call
65 3/5/98 CHW at Apple added hfs semantic system calls headers
66*/
67
68#ifndef _UNISTD_H_
69#define _UNISTD_H_
70
71#include <_types.h>
72#include <sys/unistd.h>
73#include <Availability.h>
74#include <sys/_types/_gid_t.h>
75#include <sys/_types/_intptr_t.h>
76#include <sys/_types/_off_t.h>
77#include <sys/_types/_pid_t.h>
78/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
79 * _GCC_SIZE_T */
80#include <sys/_types/_size_t.h>
81#include <sys/_types/_ssize_t.h>
82#include <sys/_types/_uid_t.h>
83#include <sys/_types/_useconds_t.h>
84#include <sys/_types/_null.h>
85
86#define STDIN_FILENO 0 /* standard input file descriptor */
87#define STDOUT_FILENO 1 /* standard output file descriptor */
88#define STDERR_FILENO 2 /* standard error file descriptor */
89
90
91/* Version test macros */
92/* _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h */
93#define _XOPEN_VERSION 600 /* [XSI] */
94#define _XOPEN_XCU_VERSION 4 /* Older standard */
95
96
97/* Please keep this list in the same order as the applicable standard */
98#define _POSIX_ADVISORY_INFO (-1) /* [ADV] */
99#define _POSIX_ASYNCHRONOUS_IO (-1) /* [AIO] */
100#define _POSIX_BARRIERS (-1) /* [BAR] */
101#define _POSIX_CHOWN_RESTRICTED 200112L
102#define _POSIX_CLOCK_SELECTION (-1) /* [CS] */
103#define _POSIX_CPUTIME (-1) /* [CPT] */
104#define _POSIX_FSYNC 200112L /* [FSC] */
105#define _POSIX_IPV6 200112L
106#define _POSIX_JOB_CONTROL 200112L
107#define _POSIX_MAPPED_FILES 200112L /* [MF] */
108#define _POSIX_MEMLOCK (-1) /* [ML] */
109#define _POSIX_MEMLOCK_RANGE (-1) /* [MR] */
110#define _POSIX_MEMORY_PROTECTION 200112L /* [MPR] */
111#define _POSIX_MESSAGE_PASSING (-1) /* [MSG] */
112#define _POSIX_MONOTONIC_CLOCK (-1) /* [MON] */
113#define _POSIX_NO_TRUNC 200112L
114#define _POSIX_PRIORITIZED_IO (-1) /* [PIO] */
115#define _POSIX_PRIORITY_SCHEDULING (-1) /* [PS] */
116#define _POSIX_RAW_SOCKETS (-1) /* [RS] */
117#define _POSIX_READER_WRITER_LOCKS 200112L /* [THR] */
118#define _POSIX_REALTIME_SIGNALS (-1) /* [RTS] */
119#define _POSIX_REGEXP 200112L
120#define _POSIX_SAVED_IDS 200112L /* XXX required */
121#define _POSIX_SEMAPHORES (-1) /* [SEM] */
122#define _POSIX_SHARED_MEMORY_OBJECTS (-1) /* [SHM] */
123#define _POSIX_SHELL 200112L
124#define _POSIX_SPAWN (-1) /* [SPN] */
125#define _POSIX_SPIN_LOCKS (-1) /* [SPI] */
126#define _POSIX_SPORADIC_SERVER (-1) /* [SS] */
127#define _POSIX_SYNCHRONIZED_IO (-1) /* [SIO] */
128#define _POSIX_THREAD_ATTR_STACKADDR 200112L /* [TSA] */
129#define _POSIX_THREAD_ATTR_STACKSIZE 200112L /* [TSS] */
130#define _POSIX_THREAD_CPUTIME (-1) /* [TCT] */
131#define _POSIX_THREAD_PRIO_INHERIT (-1) /* [TPI] */
132#define _POSIX_THREAD_PRIO_PROTECT (-1) /* [TPP] */
133#define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* [TPS] */
134#define _POSIX_THREAD_PROCESS_SHARED 200112L /* [TSH] */
135#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L /* [TSF] */
136#define _POSIX_THREAD_SPORADIC_SERVER (-1) /* [TSP] */
137#define _POSIX_THREADS 200112L /* [THR] */
138#define _POSIX_TIMEOUTS (-1) /* [TMO] */
139#define _POSIX_TIMERS (-1) /* [TMR] */
140#define _POSIX_TRACE (-1) /* [TRC] */
141#define _POSIX_TRACE_EVENT_FILTER (-1) /* [TEF] */
142#define _POSIX_TRACE_INHERIT (-1) /* [TRI] */
143#define _POSIX_TRACE_LOG (-1) /* [TRL] */
144#define _POSIX_TYPED_MEMORY_OBJECTS (-1) /* [TYM] */
145#ifndef _POSIX_VDISABLE
146#define _POSIX_VDISABLE 0xff /* same as sys/termios.h */
147#endif /* _POSIX_VDISABLE */
148
149#if __DARWIN_C_LEVEL >= 199209L
150#define _POSIX2_C_BIND 200112L
151#define _POSIX2_C_DEV 200112L /* c99 command */
152#define _POSIX2_CHAR_TERM 200112L
153#define _POSIX2_FORT_DEV (-1) /* fort77 command */
154#define _POSIX2_FORT_RUN 200112L
155#define _POSIX2_LOCALEDEF 200112L /* localedef command */
156#define _POSIX2_PBS (-1)
157#define _POSIX2_PBS_ACCOUNTING (-1)
158#define _POSIX2_PBS_CHECKPOINT (-1)
159#define _POSIX2_PBS_LOCATE (-1)
160#define _POSIX2_PBS_MESSAGE (-1)
161#define _POSIX2_PBS_TRACK (-1)
162#define _POSIX2_SW_DEV 200112L
163#define _POSIX2_UPE 200112L /* XXXX no fc, newgrp, tabs */
164#endif /* __DARWIN_C_LEVEL */
165
166#define __ILP32_OFF32 (-1)
167#define __ILP32_OFFBIG (-1)
168
169#define __LP64_OFF64 (1)
170#define __LPBIG_OFFBIG (1)
171
172#if __DARWIN_C_LEVEL >= 200112L
173#define _POSIX_V6_ILP32_OFF32 __ILP32_OFF32
174#define _POSIX_V6_ILP32_OFFBIG __ILP32_OFFBIG
175#define _POSIX_V6_LP64_OFF64 __LP64_OFF64
176#define _POSIX_V6_LPBIG_OFFBIG __LPBIG_OFFBIG
177#endif /* __DARWIN_C_LEVEL >= 200112L */
178
179#if __DARWIN_C_LEVEL >= 200809L
180#define _POSIX_V7_ILP32_OFF32 __ILP32_OFF32
181#define _POSIX_V7_ILP32_OFFBIG __ILP32_OFFBIG
182#define _POSIX_V7_LP64_OFF64 __LP64_OFF64
183#define _POSIX_V7_LPBIG_OFFBIG __LPBIG_OFFBIG
184#endif /* __DARWIN_C_LEVEL >= 200809L */
185
186#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
187#define _V6_ILP32_OFF32 __ILP32_OFF32
188#define _V6_ILP32_OFFBIG __ILP32_OFFBIG
189#define _V6_LP64_OFF64 __LP64_OFF64
190#define _V6_LPBIG_OFFBIG __LPBIG_OFFBIG
191#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
192
193#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
194/* Removed in Issue 7 */
195#define _XBS5_ILP32_OFF32 __ILP32_OFF32
196#define _XBS5_ILP32_OFFBIG __ILP32_OFFBIG
197#define _XBS5_LP64_OFF64 __LP64_OFF64
198#define _XBS5_LPBIG_OFFBIG __LPBIG_OFFBIG
199#endif /* __DARWIN_C_LEVEL < 200809L */
200
201#if __DARWIN_C_LEVEL >= 199506L /* This really should be XSI */
202#define _XOPEN_CRYPT (1)
203#define _XOPEN_ENH_I18N (1) /* XXX required */
204#define _XOPEN_LEGACY (-1) /* no ftime gcvt, wcswcs */
205#define _XOPEN_REALTIME (-1) /* no q'ed signals, mq_* */
206#define _XOPEN_REALTIME_THREADS (-1) /* no posix_spawn, et. al. */
207#define _XOPEN_SHM (1)
208#define _XOPEN_STREAMS (-1) /* Issue 6 */
209#define _XOPEN_UNIX (1)
210#endif /* XSI */
211
212/* configurable system variables */
213#define _SC_ARG_MAX 1
214#define _SC_CHILD_MAX 2
215#define _SC_CLK_TCK 3
216#define _SC_NGROUPS_MAX 4
217#define _SC_OPEN_MAX 5
218#define _SC_JOB_CONTROL 6
219#define _SC_SAVED_IDS 7
220#define _SC_VERSION 8
221#define _SC_BC_BASE_MAX 9
222#define _SC_BC_DIM_MAX 10
223#define _SC_BC_SCALE_MAX 11
224#define _SC_BC_STRING_MAX 12
225#define _SC_COLL_WEIGHTS_MAX 13
226#define _SC_EXPR_NEST_MAX 14
227#define _SC_LINE_MAX 15
228#define _SC_RE_DUP_MAX 16
229#define _SC_2_VERSION 17
230#define _SC_2_C_BIND 18
231#define _SC_2_C_DEV 19
232#define _SC_2_CHAR_TERM 20
233#define _SC_2_FORT_DEV 21
234#define _SC_2_FORT_RUN 22
235#define _SC_2_LOCALEDEF 23
236#define _SC_2_SW_DEV 24
237#define _SC_2_UPE 25
238#define _SC_STREAM_MAX 26
239#define _SC_TZNAME_MAX 27
240
241#if __DARWIN_C_LEVEL >= 199309L
242#define _SC_ASYNCHRONOUS_IO 28
243#define _SC_PAGESIZE 29
244#define _SC_MEMLOCK 30
245#define _SC_MEMLOCK_RANGE 31
246#define _SC_MEMORY_PROTECTION 32
247#define _SC_MESSAGE_PASSING 33
248#define _SC_PRIORITIZED_IO 34
249#define _SC_PRIORITY_SCHEDULING 35
250#define _SC_REALTIME_SIGNALS 36
251#define _SC_SEMAPHORES 37
252#define _SC_FSYNC 38
253#define _SC_SHARED_MEMORY_OBJECTS 39
254#define _SC_SYNCHRONIZED_IO 40
255#define _SC_TIMERS 41
256#define _SC_AIO_LISTIO_MAX 42
257#define _SC_AIO_MAX 43
258#define _SC_AIO_PRIO_DELTA_MAX 44
259#define _SC_DELAYTIMER_MAX 45
260#define _SC_MQ_OPEN_MAX 46
261#define _SC_MAPPED_FILES 47 /* swap _SC_PAGESIZE vs. BSD */
262#define _SC_RTSIG_MAX 48
263#define _SC_SEM_NSEMS_MAX 49
264#define _SC_SEM_VALUE_MAX 50
265#define _SC_SIGQUEUE_MAX 51
266#define _SC_TIMER_MAX 52
267#endif /* __DARWIN_C_LEVEL >= 199309L */
268
269#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
270#define _SC_NPROCESSORS_CONF 57
271#define _SC_NPROCESSORS_ONLN 58
272#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
273
274#if __DARWIN_C_LEVEL >= 200112L
275#define _SC_2_PBS 59
276#define _SC_2_PBS_ACCOUNTING 60
277#define _SC_2_PBS_CHECKPOINT 61
278#define _SC_2_PBS_LOCATE 62
279#define _SC_2_PBS_MESSAGE 63
280#define _SC_2_PBS_TRACK 64
281#define _SC_ADVISORY_INFO 65
282#define _SC_BARRIERS 66
283#define _SC_CLOCK_SELECTION 67
284#define _SC_CPUTIME 68
285#define _SC_FILE_LOCKING 69
286#define _SC_GETGR_R_SIZE_MAX 70
287#define _SC_GETPW_R_SIZE_MAX 71
288#define _SC_HOST_NAME_MAX 72
289#define _SC_LOGIN_NAME_MAX 73
290#define _SC_MONOTONIC_CLOCK 74
291#define _SC_MQ_PRIO_MAX 75
292#define _SC_READER_WRITER_LOCKS 76
293#define _SC_REGEXP 77
294#define _SC_SHELL 78
295#define _SC_SPAWN 79
296#define _SC_SPIN_LOCKS 80
297#define _SC_SPORADIC_SERVER 81
298#define _SC_THREAD_ATTR_STACKADDR 82
299#define _SC_THREAD_ATTR_STACKSIZE 83
300#define _SC_THREAD_CPUTIME 84
301#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85
302#define _SC_THREAD_KEYS_MAX 86
303#define _SC_THREAD_PRIO_INHERIT 87
304#define _SC_THREAD_PRIO_PROTECT 88
305#define _SC_THREAD_PRIORITY_SCHEDULING 89
306#define _SC_THREAD_PROCESS_SHARED 90
307#define _SC_THREAD_SAFE_FUNCTIONS 91
308#define _SC_THREAD_SPORADIC_SERVER 92
309#define _SC_THREAD_STACK_MIN 93
310#define _SC_THREAD_THREADS_MAX 94
311#define _SC_TIMEOUTS 95
312#define _SC_THREADS 96
313#define _SC_TRACE 97
314#define _SC_TRACE_EVENT_FILTER 98
315#define _SC_TRACE_INHERIT 99
316#define _SC_TRACE_LOG 100
317#define _SC_TTY_NAME_MAX 101
318#define _SC_TYPED_MEMORY_OBJECTS 102
319#define _SC_V6_ILP32_OFF32 103
320#define _SC_V6_ILP32_OFFBIG 104
321#define _SC_V6_LP64_OFF64 105
322#define _SC_V6_LPBIG_OFFBIG 106
323#define _SC_IPV6 118
324#define _SC_RAW_SOCKETS 119
325#define _SC_SYMLOOP_MAX 120
326#endif /* __DARWIN_C_LEVEL >= 200112L */
327
328#if __DARWIN_C_LEVEL >= 199506L /* Really XSI */
329#define _SC_ATEXIT_MAX 107
330#define _SC_IOV_MAX 56
331#define _SC_PAGE_SIZE _SC_PAGESIZE
332#define _SC_XOPEN_CRYPT 108
333#define _SC_XOPEN_ENH_I18N 109
334#define _SC_XOPEN_LEGACY 110 /* Issue 6 */
335#define _SC_XOPEN_REALTIME 111 /* Issue 6 */
336#define _SC_XOPEN_REALTIME_THREADS 112 /* Issue 6 */
337#define _SC_XOPEN_SHM 113
338#define _SC_XOPEN_STREAMS 114 /* Issue 6 */
339#define _SC_XOPEN_UNIX 115
340#define _SC_XOPEN_VERSION 116
341#define _SC_XOPEN_XCU_VERSION 121
342#endif /* XSI */
343
344#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
345/* Removed in Issue 7 */
346#define _SC_XBS5_ILP32_OFF32 122
347#define _SC_XBS5_ILP32_OFFBIG 123
348#define _SC_XBS5_LP64_OFF64 124
349#define _SC_XBS5_LPBIG_OFFBIG 125
350#endif /* __DARWIN_C_LEVEL <= 200809L */
351
352#if __DARWIN_C_LEVEL >= 200112L
353#define _SC_SS_REPL_MAX 126
354#define _SC_TRACE_EVENT_NAME_MAX 127
355#define _SC_TRACE_NAME_MAX 128
356#define _SC_TRACE_SYS_MAX 129
357#define _SC_TRACE_USER_EVENT_MAX 130
358#endif
359
360#if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
361/* Removed in Issue 6 */
362#define _SC_PASS_MAX 131
363#endif
364
365/* 132-199 available for future use */
366#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
367#define _SC_PHYS_PAGES 200
368#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
369
370#if __DARWIN_C_LEVEL >= 199209L
371#ifndef _CS_PATH /* Defined in <sys/unistd.h> */
372#define _CS_PATH 1
373#endif
374#endif
375
376#if __DARWIN_C_LEVEL >= 200112
377#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
378#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
379#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
380#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
381#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
382#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
383#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
384#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
385#define _CS_POSIX_V6_LP64_OFF64_LIBS 10
386#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
387#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
388#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
389#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
390#endif
391
392#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
393/* Removed in Issue 7 */
394#define _CS_XBS5_ILP32_OFF32_CFLAGS 20
395#define _CS_XBS5_ILP32_OFF32_LDFLAGS 21
396#define _CS_XBS5_ILP32_OFF32_LIBS 22
397#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 23
398#define _CS_XBS5_ILP32_OFFBIG_CFLAGS 24
399#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 25
400#define _CS_XBS5_ILP32_OFFBIG_LIBS 26
401#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 27
402#define _CS_XBS5_LP64_OFF64_CFLAGS 28
403#define _CS_XBS5_LP64_OFF64_LDFLAGS 29
404#define _CS_XBS5_LP64_OFF64_LIBS 30
405#define _CS_XBS5_LP64_OFF64_LINTFLAGS 31
406#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 32
407#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 33
408#define _CS_XBS5_LPBIG_OFFBIG_LIBS 34
409#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 35
410#endif
411
412#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
413#define _CS_DARWIN_USER_DIR 65536
414#define _CS_DARWIN_USER_TEMP_DIR 65537
415#define _CS_DARWIN_USER_CACHE_DIR 65538
416#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
417
418
419#ifdef _DARWIN_UNLIMITED_GETGROUPS
420#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
421#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it."
422#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
423#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it."
424#endif
425#endif
426
427/* POSIX.1-1990 */
428
429__BEGIN_DECLS
430void _exit(int) __dead2;
431int access(const char *, int);
432unsigned int
433 alarm(unsigned int);
434int chdir(const char *);
435int chown(const char *, uid_t, gid_t);
436
437int close(int) __DARWIN_ALIAS_C(close);
438
439int dup(int);
440int dup2(int, int);
441int execl(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
442int execle(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
443int execlp(const char * __file, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
444int execv(const char * __path, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
445int execve(const char * __file, char * const * __argv, char * const * __envp) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
446int execvp(const char * __file, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
447pid_t fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
448long fpathconf(int, int);
449char *getcwd(char *, size_t);
450gid_t getegid(void);
451uid_t geteuid(void);
452gid_t getgid(void);
453#if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE)
454int getgroups(int, gid_t []) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(getgroups));
455#else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */
456int getgroups(int, gid_t []);
457#endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */
458char *getlogin(void);
459pid_t getpgrp(void);
460pid_t getpid(void);
461pid_t getppid(void);
462uid_t getuid(void);
463int isatty(int);
464int link(const char *, const char *);
465off_t lseek(int, off_t, int);
466long pathconf(const char *, int);
467
468int pause(void) __DARWIN_ALIAS_C(pause);
469
470int pipe(int [2]);
471
472ssize_t read(int, void *, size_t) __DARWIN_ALIAS_C(read);
473
474int rmdir(const char *);
475int setgid(gid_t);
476int setpgid(pid_t, pid_t);
477pid_t setsid(void);
478int setuid(uid_t);
479
480unsigned int
481 sleep(unsigned int) __DARWIN_ALIAS_C(sleep);
482
483long sysconf(int);
484pid_t tcgetpgrp(int);
485int tcsetpgrp(int, pid_t);
486char *ttyname(int);
487
488#if __DARWIN_UNIX03
489int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r);
490#else /* !__DARWIN_UNIX03 */
491char *ttyname_r(int, char *, size_t);
492#endif /* __DARWIN_UNIX03 */
493
494int unlink(const char *);
495
496ssize_t write(int __fd, const void * __buf, size_t __nbyte) __DARWIN_ALIAS_C(write);
497__END_DECLS
498
499
500
501/* Additional functionality provided by:
502 * POSIX.2-1992 C Language Binding Option
503 */
504
505#if __DARWIN_C_LEVEL >= 199209L
506__BEGIN_DECLS
507size_t confstr(int, char *, size_t) __DARWIN_ALIAS(confstr);
508
509int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt);
510
511extern char *optarg; /* getopt(3) external variables */
512extern int optind, opterr, optopt;
513__END_DECLS
514#endif /* __DARWIN_C_LEVEL >= 199209L */
515
516
517
518/* Additional functionality provided by:
519 * POSIX.1c-1995,
520 * POSIX.1i-1995,
521 * and the omnibus ISO/IEC 9945-1: 1996
522 */
523
524#if __DARWIN_C_LEVEL >= 199506L
525#include <_ctermid.h>
526 /* These F_* are really XSI or Issue 6 */
527#define F_ULOCK 0 /* unlock locked section */
528#define F_LOCK 1 /* lock a section for exclusive use */
529#define F_TLOCK 2 /* test and lock a section for exclusive use */
530#define F_TEST 3 /* test a section for locks by other procs */
531
532 __BEGIN_DECLS
533
534/* Begin XSI */
535/* Removed in Issue 6 */
536#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
537#if !defined(_POSIX_C_SOURCE)
538__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
539#endif
540void *brk(const void *);
541int chroot(const char *) __POSIX_C_DEPRECATED(199506L);
542#endif
543
544char *crypt(const char *, const char *);
545#if __DARWIN_UNIX03
546void encrypt(char *, int) __DARWIN_ALIAS(encrypt);
547#else /* !__DARWIN_UNIX03 */
548int encrypt(char *, int);
549#endif /* __DARWIN_UNIX03 */
550int fchdir(int);
551long gethostid(void);
552pid_t getpgid(pid_t);
553pid_t getsid(pid_t);
554
555/* Removed in Issue 6 */
556#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
557int getdtablesize(void) __POSIX_C_DEPRECATED(199506L);
558int getpagesize(void) __pure2 __POSIX_C_DEPRECATED(199506L);
559char *getpass(const char *) __POSIX_C_DEPRECATED(199506L);
560#endif
561
562/* Removed in Issue 7 */
563#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
564char *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */
565#endif
566
567int lchown(const char *, uid_t, gid_t) __DARWIN_ALIAS(lchown);
568
569int lockf(int, int, off_t) __DARWIN_ALIAS_C(lockf);
570
571int nice(int) __DARWIN_ALIAS(nice);
572
573ssize_t pread(int __fd, void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pread);
574
575ssize_t pwrite(int __fd, const void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pwrite);
576
577/* Removed in Issue 6 */
578#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
579/* Note that Issue 5 changed the argument as intprt_t,
580 * but we keep it as int for binary compatability. */
581#if !defined(_POSIX_C_SOURCE)
582__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
583#endif
584void *sbrk(int);
585#endif
586
587#if __DARWIN_UNIX03
588pid_t setpgrp(void) __DARWIN_ALIAS(setpgrp);
589#else /* !__DARWIN_UNIX03 */
590int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
591#endif /* __DARWIN_UNIX03 */
592
593int setregid(gid_t, gid_t) __DARWIN_ALIAS(setregid);
594
595int setreuid(uid_t, uid_t) __DARWIN_ALIAS(setreuid);
596
597void swab(const void * __restrict, void * __restrict, ssize_t);
598void sync(void);
599int truncate(const char *, off_t);
600useconds_t ualarm(useconds_t, useconds_t);
601int usleep(useconds_t) __DARWIN_ALIAS_C(usleep);
602
603#if !defined(_POSIX_C_SOURCE)
604__deprecated_msg("Use posix_spawn or fork")
605#endif
606pid_t vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
607/* End XSI */
608
609int fsync(int) __DARWIN_ALIAS_C(fsync);
610
611int ftruncate(int, off_t);
612int getlogin_r(char *, size_t);
613__END_DECLS
614#endif /* __DARWIN_C_LEVEL >= 199506L */
615
616
617
618/* Additional functionality provided by:
619 * POSIX.1-2001
620 * ISO C99
621 */
622
623#if __DARWIN_C_LEVEL >= 200112L
624__BEGIN_DECLS
625int fchown(int, uid_t, gid_t);
626int gethostname(char *, size_t);
627ssize_t readlink(const char * __restrict, char * __restrict, size_t);
628int setegid(gid_t);
629int seteuid(uid_t);
630int symlink(const char *, const char *);
631__END_DECLS
632#endif /* __DARWIN_C_LEVEL >= 200112L */
633
634
635
636/* Darwin extensions */
637
638#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
639#include <sys/select.h>
640
641#include <sys/_types/_dev_t.h>
642#include <sys/_types/_mode_t.h>
643#include <sys/_types/_uuid_t.h>
644
645__BEGIN_DECLS
646void _Exit(int) __dead2;
647int accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t);
648int acct(const char *);
649int add_profil(char *, size_t, unsigned long, unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
650void endusershell(void);
651int execvP(const char * __file, const char * __searchpath, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
652char *fflagstostr(unsigned long);
653int getdomainname(char *, int);
654int getgrouplist(const char *, int, int *, int *);
655#if defined(__has_include)
656#if __has_include(<gethostuuid_private.h>)
657#include <gethostuuid_private.h>
658#else
659#include <gethostuuid.h>
660#endif
661#else
662#include <gethostuuid.h>
663#endif
664mode_t getmode(const void *, mode_t);
665int getpeereid(int, uid_t *, gid_t *);
666int getsgroups_np(int *, uuid_t);
667char *getusershell(void);
668int getwgroups_np(int *, uuid_t);
669int initgroups(const char *, int);
670int issetugid(void);
671char *mkdtemp(char *);
672int mknod(const char *, mode_t, dev_t);
673int mkpath_np(const char *path, mode_t omode) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); /* returns errno */
674int mkpathat_np(int dfd, const char *path, mode_t omode) /* returns errno */
675 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
676 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
677int mkstemp(char *);
678int mkstemps(char *, int);
679char *mktemp(char *);
680int mkostemp(char *path, int oflags)
681 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
682 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
683int mkostemps(char *path, int slen, int oflags)
684 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
685 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
686/* Non-portable mkstemp that uses open_dprotected_np */
687int mkstemp_dprotected_np(char *path, int dpclass, int dpflags)
688 __OSX_UNAVAILABLE __IOS_AVAILABLE(10.0)
689 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
690char *mkdtempat_np(int dfd, char *path)
691 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
692 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
693int mkstempsat_np(int dfd, char *path, int slen)
694 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
695 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
696int mkostempsat_np(int dfd, char *path, int slen, int oflags)
697 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
698 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
699int nfssvc(int, void *);
700int profil(char *, size_t, unsigned long, unsigned int);
701
702__deprecated_msg("Use of per-thread security contexts is error-prone and discouraged.")
703int pthread_setugid_np(uid_t, gid_t);
704int pthread_getugid_np( uid_t *, gid_t *);
705
706int reboot(int);
707int revoke(const char *);
708
709__deprecated int rcmd(char **, int, const char *, const char *, const char *, int *);
710__deprecated int rcmd_af(char **, int, const char *, const char *, const char *, int *,
711 int);
712__deprecated int rresvport(int *);
713__deprecated int rresvport_af(int *, int);
714__deprecated int iruserok(unsigned long, int, const char *, const char *);
715__deprecated int iruserok_sa(const void *, int, int, const char *, const char *);
716__deprecated int ruserok(const char *, int, const char *, const char *);
717
718int setdomainname(const char *, int);
719int setgroups(int, const gid_t *);
720void sethostid(long);
721int sethostname(const char *, int);
722#if __DARWIN_UNIX03
723void setkey(const char *) __DARWIN_ALIAS(setkey);
724#else /* !__DARWIN_UNIX03 */
725int setkey(const char *);
726#endif /* __DARWIN_UNIX03 */
727int setlogin(const char *);
728void *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(setmode));
729int setrgid(gid_t);
730int setruid(uid_t);
731int setsgroups_np(int, const uuid_t);
732void setusershell(void);
733int setwgroups_np(int, const uuid_t);
734int strtofflags(char **, unsigned long *, unsigned long *);
735int swapon(const char *);
736int ttyslot(void);
737int undelete(const char *);
738int unwhiteout(const char *);
739void *valloc(size_t);
740
741__WATCHOS_PROHIBITED __TVOS_PROHIBITED
742__OS_AVAILABILITY_MSG(ios,deprecated=10.0,"syscall(2) is unsupported; "
743 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
744__OS_AVAILABILITY_MSG(macosx,deprecated=10.12,"syscall(2) is unsupported; "
745 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
746int syscall(int, ...);
747
748extern char *suboptarg; /* getsubopt(3) external variable */
749int getsubopt(char **, char * const *, char **);
750
751/* HFS & HFS Plus semantics system calls go here */
752#ifdef __LP64__
753int fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
754int fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
755int getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist);
756int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist);
757int exchangedata(const char*,const char*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
758int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
759
760#else /* __LP64__ */
761int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
762int fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
763int getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist);
764int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist);
765int exchangedata(const char*,const char*,unsigned long)
766 __OSX_DEPRECATED(10.0, 10.13, "use renamex_np with the RENAME_SWAP flag")
767 __IOS_DEPRECATED(2.0, 11.0, "use renamex_np with the RENAME_SWAP flag")
768 __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
769int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
770
771#endif /* __LP64__ */
772
773struct fssearchblock;
774struct searchstate;
775
776int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
777int fsctl(const char *,unsigned long,void*,unsigned int);
778int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
779
780#define SYNC_VOLUME_FULLSYNC 0x01 /* Flush data and metadata to platter, not just to disk cache */
781#define SYNC_VOLUME_WAIT 0x02 /* Wait for sync to complete */
782
783int fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
784int sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
785
786extern int optreset;
787
788__END_DECLS
789#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
790
791#endif /* _UNISTD_H_ */
\ No newline at end of file
lib/libc/include/any-macos-any/xpc/availability.h deleted-130
......@@ -1,130 +0,0 @@
1#ifndef __XPC_AVAILABILITY_H__
2#define __XPC_AVAILABILITY_H__
3
4#include <Availability.h>
5
6// Certain parts of the project use all the project's headers but have to build
7// against newer OSX SDKs than ebuild uses -- liblaunch_host being the example.
8// So we need to define these.
9#ifndef __MAC_10_16
10#define __MAC_10_16 101600
11#endif // __MAC_10_16
12
13#ifndef __MAC_10_15
14#define __MAC_10_15 101500
15#define __AVAILABILITY_INTERNAL__MAC_10_15 \
16__attribute__((availability(macosx, introduced=10.15)))
17#endif // __MAC_10_15
18
19#ifndef __MAC_10_14
20#define __MAC_10_14 101400
21#define __AVAILABILITY_INTERNAL__MAC_10_14 \
22__attribute__((availability(macosx, introduced=10.14)))
23#endif // __MAC_10_14
24
25#ifndef __MAC_10_13
26#define __MAC_10_13 101300
27#define __AVAILABILITY_INTERNAL__MAC_10_13 \
28 __attribute__((availability(macosx, introduced=10.13)))
29#endif // __MAC_10_13
30
31#ifndef __MAC_10_12
32#define __MAC_10_12 101200
33#define __AVAILABILITY_INTERNAL__MAC_10_12 \
34 __attribute__((availability(macosx, introduced=10.12)))
35#endif // __MAC_10_12
36
37#ifndef __MAC_10_11
38#define __MAC_10_11 101100
39#define __AVAILABILITY_INTERNAL__MAC_10_11 \
40 __attribute__((availability(macosx, introduced=10.11)))
41#endif // __MAC_10_11
42
43#ifndef __MAC_12_0
44#define __MAC_12_0 120000
45#define __AVAILABILITY_INTERNAL__MAC_12_0 \
46 __attribute__((availability(macosx, introduced=12.0)))
47#endif // __MAC_12_0
48
49#ifndef __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
50#define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
51#endif // __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
52
53#ifndef __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
54#define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
55#endif // __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
56
57#ifndef __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
58#define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
59#endif // __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
60
61#ifndef __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
62#define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
63#endif // __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
64
65#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
66#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
67#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
68
69#ifndef __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
70#define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
71#endif // __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
72
73#ifndef __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
74#define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
75#endif // __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
76
77#ifndef __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
78#define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
79#endif // __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
80
81#ifndef __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
82#define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
83#endif // __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
84
85#ifndef __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
86#define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
87#endif // __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
88
89#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
90#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
91#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
92
93#if __has_include(<simulator_host.h>)
94#include <simulator_host.h>
95#else // __has_include(<simulator_host.h>)
96#ifndef IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED
97#define IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED 999999
98#endif // IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED
99#endif // __has_include(<simulator_host.h>)
100
101#ifndef __WATCHOS_UNAVAILABLE
102#define __WATCHOS_UNAVAILABLE
103#endif
104
105#ifndef __TVOS_UNAVAILABLE
106#define __TVOS_UNAVAILABLE
107#endif
108
109// simulator host-side bits build against SDKs not having __*_AVAILABLE() yet
110#ifndef __OSX_AVAILABLE
111#define __OSX_AVAILABLE(...)
112#endif
113
114#ifndef __IOS_AVAILABLE
115#define __IOS_AVAILABLE(...)
116#endif
117
118#ifndef __TVOS_AVAILABLE
119#define __TVOS_AVAILABLE(...)
120#endif
121
122#ifndef __WATCHOS_AVAILABLE
123#define __WATCHOS_AVAILABLE(...)
124#endif
125
126#ifndef __API_AVAILABLE
127#define __API_AVAILABLE(...)
128#endif
129
130#endif // __XPC_AVAILABILITY_H__
\ No newline at end of file
lib/libc/include/any-macos.12-any/libkern/OSKextLib.h created+571
......@@ -0,0 +1,571 @@
1/*
2 * Copyright (c) 2008 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#ifndef _LIBKERN_OSKEXTLIB_H
30#define _LIBKERN_OSKEXTLIB_H
31
32#include <sys/cdefs.h>
33__BEGIN_DECLS
34
35#include <stdint.h>
36#include <mach/kmod.h>
37#include <mach/vm_types.h>
38#include <uuid/uuid.h>
39
40#include <libkern/OSReturn.h>
41
42/*!
43 * @header
44 *
45 * Declares functions, basic return values, and other constants
46 * related to kernel extensions (kexts).
47 */
48
49#if PRAGMA_MARK
50#pragma mark -
51/********************************************************************/
52#pragma mark OSReturn Values for Kernel Extensions
53/********************************************************************/
54#endif
55/*!
56 * @group OSReturn Values for Kernel Extensions
57 * Many kext-related functions return these values,
58 * as well as those defined under
59 * <code>@link //apple_ref/c/tdef/OSReturn OSReturn@/link</code>
60 * and other variants of <code>kern_return_t</code>.
61 */
62
63
64#define sub_libkern_kext err_sub(2)
65#define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code))
66
67
68/*!
69 * @define kOSKextReturnInternalError
70 * @abstract An internal error in the kext library.
71 * Contrast with <code>@link //apple_ref/c/econst/OSReturnError
72 * OSReturnError@/link</code>.
73 */
74#define kOSKextReturnInternalError libkern_kext_err(0x1)
75
76/*!
77 * @define kOSKextReturnNoMemory
78 * @abstract Memory allocation failed.
79 */
80#define kOSKextReturnNoMemory libkern_kext_err(0x2)
81
82/*!
83 * @define kOSKextReturnNoResources
84 * @abstract Some resource other than memory (such as available load tags)
85 * is exhausted.
86 */
87#define kOSKextReturnNoResources libkern_kext_err(0x3)
88
89/*!
90 * @define kOSKextReturnNotPrivileged
91 * @abstract The caller lacks privileges to perform the requested operation.
92 */
93#define kOSKextReturnNotPrivileged libkern_kext_err(0x4)
94
95/*!
96 * @define kOSKextReturnInvalidArgument
97 * @abstract Invalid argument.
98 */
99#define kOSKextReturnInvalidArgument libkern_kext_err(0x5)
100
101/*!
102 * @define kOSKextReturnNotFound
103 * @abstract Search item not found.
104 */
105#define kOSKextReturnNotFound libkern_kext_err(0x6)
106
107/*!
108 * @define kOSKextReturnBadData
109 * @abstract Malformed data (not used for XML).
110 */
111#define kOSKextReturnBadData libkern_kext_err(0x7)
112
113/*!
114 * @define kOSKextReturnSerialization
115 * @abstract Error converting or (un)serializing URL, string, or XML.
116 */
117#define kOSKextReturnSerialization libkern_kext_err(0x8)
118
119/*!
120 * @define kOSKextReturnUnsupported
121 * @abstract Operation is no longer or not yet supported.
122 */
123#define kOSKextReturnUnsupported libkern_kext_err(0x9)
124
125/*!
126 * @define kOSKextReturnDisabled
127 * @abstract Operation is currently disabled.
128 */
129#define kOSKextReturnDisabled libkern_kext_err(0xa)
130
131/*!
132 * @define kOSKextReturnNotAKext
133 * @abstract Bundle is not a kernel extension.
134 */
135#define kOSKextReturnNotAKext libkern_kext_err(0xb)
136
137/*!
138 * @define kOSKextReturnValidation
139 * @abstract Validation failures encountered; check diagnostics for details.
140 */
141#define kOSKextReturnValidation libkern_kext_err(0xc)
142
143/*!
144 * @define kOSKextReturnAuthentication
145 * @abstract Authetication failures encountered; check diagnostics for details.
146 */
147#define kOSKextReturnAuthentication libkern_kext_err(0xd)
148
149/*!
150 * @define kOSKextReturnDependencies
151 * @abstract Dependency resolution failures encountered; check diagnostics for details.
152 */
153#define kOSKextReturnDependencies libkern_kext_err(0xe)
154
155/*!
156 * @define kOSKextReturnArchNotFound
157 * @abstract Kext does not contain code for the requested architecture.
158 */
159#define kOSKextReturnArchNotFound libkern_kext_err(0xf)
160
161/*!
162 * @define kOSKextReturnCache
163 * @abstract An error occurred processing a system kext cache.
164 */
165#define kOSKextReturnCache libkern_kext_err(0x10)
166
167/*!
168 * @define kOSKextReturnDeferred
169 * @abstract Operation has been posted asynchronously to user space (kernel only).
170 */
171#define kOSKextReturnDeferred libkern_kext_err(0x11)
172
173/*!
174 * @define kOSKextReturnBootLevel
175 * @abstract Kext not loadable or operation not allowed at current boot level.
176 */
177#define kOSKextReturnBootLevel libkern_kext_err(0x12)
178
179/*!
180 * @define kOSKextReturnNotLoadable
181 * @abstract Kext cannot be loaded; check diagnostics for details.
182 */
183#define kOSKextReturnNotLoadable libkern_kext_err(0x13)
184
185/*!
186 * @define kOSKextReturnLoadedVersionDiffers
187 * @abstract A different version (or executable UUID, or executable by checksum)
188 * of the requested kext is already loaded.
189 */
190#define kOSKextReturnLoadedVersionDiffers libkern_kext_err(0x14)
191
192/*!
193 * @define kOSKextReturnDependencyLoadError
194 * @abstract A load error occurred on a dependency of the kext being loaded.
195 */
196#define kOSKextReturnDependencyLoadError libkern_kext_err(0x15)
197
198/*!
199 * @define kOSKextReturnLinkError
200 * @abstract A link failure occured with this kext or a dependency.
201 */
202#define kOSKextReturnLinkError libkern_kext_err(0x16)
203
204/*!
205 * @define kOSKextReturnStartStopError
206 * @abstract The kext start or stop routine returned an error.
207 */
208#define kOSKextReturnStartStopError libkern_kext_err(0x17)
209
210/*!
211 * @define kOSKextReturnInUse
212 * @abstract The kext is currently in use or has outstanding references,
213 * and cannot be unloaded.
214 */
215#define kOSKextReturnInUse libkern_kext_err(0x18)
216
217/*!
218 * @define kOSKextReturnTimeout
219 * @abstract A kext request has timed out.
220 */
221#define kOSKextReturnTimeout libkern_kext_err(0x19)
222
223/*!
224 * @define kOSKextReturnStopping
225 * @abstract The kext is in the process of stopping; requests cannot be made.
226 */
227#define kOSKextReturnStopping libkern_kext_err(0x1a)
228
229/*!
230 * @define kOSKextReturnSystemPolicy
231 * @abstract The kext was prevented from loading due to system policy.
232 */
233#define kOSKextReturnSystemPolicy libkern_kext_err(0x1b)
234
235/*!
236 * @define kOSKextReturnKCLoadFailure
237 * @abstract Loading of the System KC failed
238 */
239#define kOSKextReturnKCLoadFailure libkern_kext_err(0x1c)
240
241/*!
242 * @define kOSKextReturnKCLoadFailureSystemKC
243 * @abstract Loading of the System KC failed
244 *
245 * This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
246 * with: kOSKextReturnKCLoadFailureAuxKC
247 *
248 * If both the System and Aux KCs fail to load, then the error code will be:
249 * libkern_kext_err(0x1f)
250 */
251#define kOSKextReturnKCLoadFailureSystemKC libkern_kext_err(0x1d)
252
253/*!
254 * @define kOSKextReturnKCLoadFailureAuxKC
255 * @abstract Loading of the Aux KC failed
256 *
257 * This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
258 * with: kOSKextReturnKCLoadFailureSystemKC
259 *
260 * If both the System and Aux KCs fail to load, then the error code will be:
261 * libkern_kext_err(0x1f)
262 */
263#define kOSKextReturnKCLoadFailureAuxKC libkern_kext_err(0x1e)
264
265/* next available error is: libkern_kext_err(0x20) */
266
267#if PRAGMA_MARK
268#pragma mark -
269/********************************************************************/
270#pragma mark Kext/OSBundle Property List Keys
271/********************************************************************/
272#endif
273/*!
274 * @group Kext Property List Keys
275 * These constants cover CFBundle properties defined for kernel extensions.
276 * Because they are used in the kernel, if you want to use one with
277 * CFBundle APIs you'll need to wrap it in a <code>CFSTR()</code> macro.
278 */
279
280
281/*!
282 * @define kOSBundleCompatibleVersionKey
283 * @abstract A string giving the backwards-compatible version of a library kext
284 * in extended Mac OS 'vers' format (####.##.##s{1-255} where 's'
285 * is a build stage 'd', 'a', 'b', 'f' or 'fc').
286 */
287#define kOSBundleCompatibleVersionKey "OSBundleCompatibleVersion"
288
289/*!
290 * @define kOSBundleEnableKextLoggingKey
291 * @abstract Set to true to have the kernel kext logging spec applied
292 * to the kext.
293 * See <code>@link //apple_ref/c/econst/OSKextLogSpec
294 * OSKextLogSpec@/link</code>.
295 */
296#define kOSBundleEnableKextLoggingKey "OSBundleEnableKextLogging"
297
298/*!
299 * @define kOSBundleIsInterfaceKey
300 * @abstract A boolean value indicating whether the kext executable
301 * contains only symbol references.
302 */
303#define kOSBundleIsInterfaceKey "OSBundleIsInterface"
304
305/*!
306 * @define kOSBundleLibrariesKey
307 * @abstract A dictionary listing link dependencies for this kext.
308 * Keys are bundle identifiers, values are version strings.
309 */
310#define kOSBundleLibrariesKey "OSBundleLibraries"
311
312/*!
313 * @define kOSBundleRequiredKey
314 * @abstract A string indicating in which kinds of startup this kext
315 * may need to load during early startup (before
316 * <code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>).
317 * @discussion
318 * The value is one of:
319 * <ul>
320 * <li>@link kOSBundleRequiredRoot "OSBundleRequiredRoot"@/link</li>
321 * <li>@link kOSBundleRequiredLocalRoot "OSBundleRequiredLocalRoot"@/link</li>
322 * <li>@link kOSBundleRequiredNetworkRoot "OSBundleRequiredNetworkRoot"@/link</li>
323 * <li>@link kOSBundleRequiredSafeBoot "OSBundleRequiredSafeBoot"@/link</li>
324 * <li>@link kOSBundleRequiredConsole "OSBundleRequiredConsole"@/link</li>
325 * </ul>
326 *
327 * Use this property judiciously.
328 * Every kext that declares a value other than "OSBundleRequiredSafeBoot"
329 * increases startup time, as the booter must read it into memory,
330 * or startup kext caches must include it.
331 */
332#define kOSBundleRequiredKey "OSBundleRequired"
333
334/*!
335 * @define kOSBundleRequireExplicitLoadKey
336 * @abstract A boolean value indicating whether the kext requires an
337 * explicit kextload in order to start/match.
338 */
339#define kOSBundleRequireExplicitLoadKey "OSBundleRequireExplicitLoad"
340
341/*!
342 * @define kOSBundleAllowUserLoadKey
343 * @abstract A boolean value indicating whether
344 * <code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>
345 * will honor a non-root process's request to load a kext.
346 * @discussion
347 * See <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithURL
348 * KextManagerLoadKextWithURL@/link</code>
349 * and <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithIdentifier
350 * KextManagerLoadKextWithIdentifier@/link</code>.
351 */
352#define kOSBundleAllowUserLoadKey "OSBundleAllowUserLoad"
353
354/*!
355 * @define kOSBundleAllowUserTerminateKey
356 * @abstract A boolean value indicating whether the kextunload tool
357 * is allowed to issue IOService terminate to classes defined in this kext.
358 * @discussion A boolean value indicating whether the kextunload tool
359 * is allowed to issue IOService terminate to classes defined in this kext.
360 */
361#define kOSBundleAllowUserTerminateKey "OSBundleAllowUserTerminate"
362
363/*!
364 * @define kOSKernelResourceKey
365 * @abstract A boolean value indicating whether the kext represents a built-in
366 * component of the kernel.
367 */
368#define kOSKernelResourceKey "OSKernelResource"
369
370/*!
371 * @define kOSKextVariantOverrideKey
372 * @abstract A dictionary with target names as key and a target-specific variant
373 * name as value.
374 */
375#define kOSKextVariantOverrideKey "OSKextVariantOverride"
376
377/*!
378 * @define kIOKitPersonalitiesKey
379 * @abstract A dictionary of dictionaries used in matching for I/O Kit drivers.
380 */
381#define kIOKitPersonalitiesKey "IOKitPersonalities"
382
383/*
384 * @define kIOPersonalityPublisherKey
385 * @abstract Used in personalities sent to the I/O Kit,
386 * contains the CFBundleIdentifier of the kext
387 * that the personality originated in.
388 */
389#define kIOPersonalityPublisherKey "IOPersonalityPublisher"
390
391#if CONFIG_KEC_FIPS
392/*
393 * @define kAppleTextHashesKey
394 * @abstract A dictionary conataining hashes for corecrypto kext.
395 */
396#define kAppleTextHashesKey "AppleTextHashes"
397#endif
398
399/*!
400 * @define kOSMutableSegmentCopy
401 * @abstract A boolean value indicating whether the kext requires a copy of
402 * its mutable segments to be kept in memory, and then reset when the kext
403 * unloads. This should be used with caution as it will increase the
404 * amount of memory used by the kext.
405 */
406#define kOSMutableSegmentCopy "OSMutableSegmentCopy"
407
408
409#if PRAGMA_MARK
410/********************************************************************/
411#pragma mark Kext/OSBundle Property Deprecated Keys
412/********************************************************************/
413#endif
414/*
415 * @define kOSBundleDebugLevelKey
416 * @abstract
417 * Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard).
418 * Value is an integer from 1-6, corresponding to the verbose levels
419 * of kext tools on those releases.
420 * On 10.6 Snow Leopard, use <code>@link OSKextEnableKextLogging
421 * OSKextEnableKextLogging@/link</code>.
422 */
423#define kOSBundleDebugLevelKey "OSBundleDebugLevel"
424
425/*!
426 * @define kOSBundleSharedExecutableIdentifierKey
427 * @abstract Deprecated (used on some releases of Mac OS X
428 * prior to 10.6 Snow Leopard).
429 * Value is the bundle identifier of the pseudokext
430 * that contains an executable shared by this kext.
431 */
432#define kOSBundleSharedExecutableIdentifierKey "OSBundleSharedExecutableIdentifier"
433
434
435#if PRAGMA_MARK
436/********************************************************************/
437#pragma mark Kext/OSBundle Property List Values
438/********************************************************************/
439#endif
440
441/*!
442 * @group Kext Property List Values
443 * These constants encompass established values
444 * for kernel extension bundle properties.
445 */
446
447/*!
448 * @define kOSKextKernelIdentifier
449 * @abstract
450 * This is the CFBundleIdentifier user for the kernel itself.
451 */
452#define kOSKextKernelIdentifier "__kernel__"
453
454/*!
455 * @define kOSKextBundlePackageTypeKext
456 * @abstract
457 * The bundle type value for Kernel Extensions.
458 */
459#define kOSKextBundlePackageTypeKext "KEXT"
460
461/*!
462 * @define kOSKextBundlePackageTypeDriverKit
463 * @abstract
464 * The bundle type value for Driver Extensions.
465 */
466#define kOSKextBundlePackageTypeDriverKit "DEXT"
467
468/*!
469 * @define kOSBundleRequiredRoot
470 * @abstract
471 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
472 * value indicates that the kext may be needed to mount the root filesystem
473 * whether starting from a local or a network volume.
474 */
475#define kOSBundleRequiredRoot "Root"
476
477/*!
478 * @define kOSBundleRequiredLocalRoot
479 * @abstract
480 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
481 * value indicates that the kext may be needed to mount the root filesystem
482 * when starting from a local disk.
483 */
484#define kOSBundleRequiredLocalRoot "Local-Root"
485
486/*!
487 * @define kOSBundleRequiredNetworkRoot
488 * @abstract
489 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
490 * value indicates that the kext may be needed to mount the root filesystem
491 * when starting over a network connection.
492 */
493#define kOSBundleRequiredNetworkRoot "Network-Root"
494
495/*!
496 * @define kOSBundleRequiredSafeBoot
497 * @abstract
498 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
499 * value indicates that the kext can be loaded during a safe startup.
500 * This value does not normally cause the kext to be read by the booter
501 * or included in startup kext caches.
502 */
503#define kOSBundleRequiredSafeBoot "Safe Boot"
504
505/*!
506 * @define kOSBundleRequiredConsole
507 * @abstract
508 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
509 * value indicates that the kext may be needed for console access
510 * (specifically in a single-user startup when
511 * <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code>.
512 * does not run)
513 * and should be loaded during early startup.
514 */
515#define kOSBundleRequiredConsole "Console"
516
517/*!
518 * @define kOSBundleRequiredDriverKit
519 * @abstract
520 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
521 * value indicates that the driver extension's (DriverKit driver's)
522 * personalities must be present in the kernel at early boot (specifically
523 * before <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code> starts)
524 * in order to compete with kexts built into the prelinkedkernel. Note that
525 * kextd is still required to launch the user space driver binary. The IOKit
526 * matching will happen during early boot, and the actual driver launch
527 * will happen after kextd starts.
528 */
529#define kOSBundleRequiredDriverKit "DriverKit"
530
531#if PRAGMA_MARK
532#pragma mark -
533/********************************************************************/
534#pragma mark Kext Information
535/********************************************************************/
536#endif
537/*!
538 * @group Kext Information
539 * Types, constants, and macros providing a kext with information
540 * about itself.
541 */
542
543/*!
544 * @typedef OSKextLoadTag
545 *
546 * @abstract
547 * A unique identifier assigned to a loaded instanace of a kext.
548 *
549 * @discussion
550 * If a kext is unloaded and later reloaded, the new instance
551 * has a different load tag.
552 *
553 * A kext can get its own load tag in the <code>kmod_info_t</code>
554 * structure passed into its module start routine, as the
555 * <code>id</code> field (cast to this type).
556 */
557typedef uint32_t OSKextLoadTag;
558
559/*!
560 * @define kOSKextInvalidLoadTag
561 *
562 * @abstract
563 * A load tag value that will never be used for a loaded kext;
564 * indicates kext not found.
565 */
566#define kOSKextInvalidLoadTag ((OSKextLoadTag)(-1))
567
568
569__END_DECLS
570
571#endif /* _LIBKERN_OSKEXTLIB_H */
\ No newline at end of file
lib/libc/include/any-macos.12-any/sys/attr.h created+592
......@@ -0,0 +1,592 @@
1/*
2 * Copyright (c) 2000-2018 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/*
30 * attr.h - attribute data structures and interfaces
31 *
32 * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved.
33 */
34
35#ifndef _SYS_ATTR_H_
36#define _SYS_ATTR_H_
37
38#include <sys/appleapiopts.h>
39
40#ifdef __APPLE_API_UNSTABLE
41#include <sys/types.h>
42#include <sys/ucred.h>
43#include <sys/time.h>
44#include <sys/cdefs.h>
45
46#define FSOPT_NOFOLLOW 0x00000001
47#define FSOPT_NOINMEMUPDATE 0x00000002
48#define FSOPT_REPORT_FULLSIZE 0x00000004
49/* The following option only valid when requesting ATTR_CMN_RETURNED_ATTRS */
50#define FSOPT_PACK_INVAL_ATTRS 0x00000008
51
52
53#define FSOPT_ATTR_CMN_EXTENDED 0x00000020
54#define FSOPT_RETURN_REALDEV 0x00000200
55#define FSOPT_NOFOLLOW_ANY 0x00000800
56
57/* we currently aren't anywhere near this amount for a valid
58 * fssearchblock.sizeofsearchparams1 or fssearchblock.sizeofsearchparams2
59 * but we put a sanity check in to avoid abuse of the value passed in from
60 * user land.
61 */
62#define SEARCHFS_MAX_SEARCHPARMS 4096
63
64typedef u_int32_t text_encoding_t;
65
66typedef u_int32_t fsobj_type_t;
67
68typedef u_int32_t fsobj_tag_t;
69
70typedef u_int32_t fsfile_type_t;
71
72typedef u_int32_t fsvolid_t;
73
74#include <sys/_types/_fsobj_id_t.h> /* file object id type */
75
76typedef u_int32_t attrgroup_t;
77
78struct attrlist {
79 u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */
80 u_int16_t reserved; /* (to maintain 4-byte alignment) */
81 attrgroup_t commonattr; /* common attribute group */
82 attrgroup_t volattr; /* Volume attribute group */
83 attrgroup_t dirattr; /* directory attribute group */
84 attrgroup_t fileattr; /* file attribute group */
85 attrgroup_t forkattr; /* fork attribute group */
86};
87
88#define ATTR_BIT_MAP_COUNT 5
89
90typedef struct attribute_set {
91 attrgroup_t commonattr; /* common attribute group */
92 attrgroup_t volattr; /* Volume attribute group */
93 attrgroup_t dirattr; /* directory attribute group */
94 attrgroup_t fileattr; /* file attribute group */
95 attrgroup_t forkattr; /* fork attribute group */
96} attribute_set_t;
97
98#define ATTRIBUTE_SET_INIT(a) do {(a)->commonattr = (a)->volattr = (a)->dirattr = (a)->fileattr = (a)->forkattr = 0; } while(0)
99
100
101typedef struct attrreference {
102 int32_t attr_dataoffset;
103 u_int32_t attr_length;
104} attrreference_t;
105
106/* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */
107
108struct diskextent {
109 u_int32_t startblock; /* first block allocated */
110 u_int32_t blockcount; /* number of blocks allocated */
111};
112
113typedef struct diskextent extentrecord[8];
114
115typedef u_int32_t vol_capabilities_set_t[4];
116
117#define VOL_CAPABILITIES_FORMAT 0
118#define VOL_CAPABILITIES_INTERFACES 1
119#define VOL_CAPABILITIES_RESERVED1 2
120#define VOL_CAPABILITIES_RESERVED2 3
121
122typedef struct vol_capabilities_attr {
123 vol_capabilities_set_t capabilities;
124 vol_capabilities_set_t valid;
125} vol_capabilities_attr_t;
126
127/*
128 * XXX this value needs to be raised - 3893388
129 */
130#define ATTR_MAX_BUFFER 8192
131
132/*
133 * VOL_CAP_FMT_PERSISTENTOBJECTIDS: When set, the volume has object IDs
134 * that are persistent (retain their values even when the volume is
135 * unmounted and remounted), and a file or directory can be looked up
136 * by ID. Volumes that support VolFS and can support Carbon File ID
137 * references should set this bit.
138 *
139 * VOL_CAP_FMT_SYMBOLICLINKS: When set, the volume supports symbolic
140 * links. The symlink(), readlink(), and lstat() calls all use this
141 * symbolic link.
142 *
143 * VOL_CAP_FMT_HARDLINKS: When set, the volume supports hard links.
144 * The link() call creates hard links.
145 *
146 * VOL_CAP_FMT_JOURNAL: When set, the volume is capable of supporting
147 * a journal used to speed recovery in case of unplanned shutdown
148 * (such as a power outage or crash). This bit does not necessarily
149 * mean the volume is actively using a journal for recovery.
150 *
151 * VOL_CAP_FMT_JOURNAL_ACTIVE: When set, the volume is currently using
152 * a journal for use in speeding recovery after an unplanned shutdown.
153 * This bit can be set only if VOL_CAP_FMT_JOURNAL is also set.
154 *
155 * VOL_CAP_FMT_NO_ROOT_TIMES: When set, the volume format does not
156 * store reliable times for the root directory, so you should not
157 * depend on them to detect changes, etc.
158 *
159 * VOL_CAP_FMT_SPARSE_FILES: When set, the volume supports sparse files.
160 * That is, files which can have "holes" that have never been written
161 * to, and are not allocated on disk. Sparse files may have an
162 * allocated size that is less than the file's logical length.
163 *
164 * VOL_CAP_FMT_ZERO_RUNS: For security reasons, parts of a file (runs)
165 * that have never been written to must appear to contain zeroes. When
166 * this bit is set, the volume keeps track of allocated but unwritten
167 * runs of a file so that it can substitute zeroes without actually
168 * writing zeroes to the media. This provides performance similar to
169 * sparse files, but not the space savings.
170 *
171 * VOL_CAP_FMT_CASE_SENSITIVE: When set, file and directory names are
172 * case sensitive (upper and lower case are different). When clear,
173 * an upper case character is equivalent to a lower case character,
174 * and you can't have two names that differ solely in the case of
175 * the characters.
176 *
177 * VOL_CAP_FMT_CASE_PRESERVING: When set, file and directory names
178 * preserve the difference between upper and lower case. If clear,
179 * the volume may change the case of some characters (typically
180 * making them all upper or all lower case). A volume that sets
181 * VOL_CAP_FMT_CASE_SENSITIVE should also set VOL_CAP_FMT_CASE_PRESERVING.
182 *
183 * VOL_CAP_FMT_FAST_STATFS: This bit is used as a hint to upper layers
184 * (especially Carbon) that statfs() is fast enough that its results
185 * need not be cached by those upper layers. A volume that caches
186 * the statfs information in its in-memory structures should set this bit.
187 * A volume that must always read from disk or always perform a network
188 * transaction should not set this bit.
189 *
190 * VOL_CAP_FMT_2TB_FILESIZE: If this bit is set the volume format supports
191 * file sizes larger than 4GB, and potentially up to 2TB; it does not
192 * indicate whether the filesystem supports files larger than that.
193 *
194 * VOL_CAP_FMT_OPENDENYMODES: When set, the volume supports open deny
195 * modes (e.g. "open for read write, deny write"; effectively, mandatory
196 * file locking based on open modes).
197 *
198 * VOL_CAP_FMT_HIDDEN_FILES: When set, the volume supports the UF_HIDDEN
199 * file flag, and the UF_HIDDEN flag is mapped to that volume's native
200 * "hidden" or "invisible" bit (which may be the invisible bit from the
201 * Finder Info extended attribute).
202 *
203 * VOL_CAP_FMT_PATH_FROM_ID: When set, the volume supports the ability
204 * to derive a pathname to the root of the file system given only the
205 * id of an object. This also implies that object ids on this file
206 * system are persistent and not recycled. This is a very specialized
207 * capability and it is assumed that most file systems will not support
208 * it. Its use is for legacy non-posix APIs like ResolveFileIDRef.
209 *
210 * VOL_CAP_FMT_NO_VOLUME_SIZES: When set, the volume does not support
211 * returning values for total data blocks, available blocks, or free blocks
212 * (as in f_blocks, f_bavail, or f_bfree in "struct statfs"). Historically,
213 * those values were set to 0xFFFFFFFF for volumes that did not support them.
214 *
215 * VOL_CAP_FMT_DECMPFS_COMPRESSION: When set, the volume supports transparent
216 * decompression of compressed files using decmpfs.
217 *
218 * VOL_CAP_FMT_64BIT_OBJECT_IDS: When set, the volume uses object IDs that
219 * are 64-bit. This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the
220 * only legitimate attributes for obtaining object IDs from this volume and the
221 * 32-bit fid_objno fields of the fsobj_id_t returned by ATTR_CMN_OBJID,
222 * ATTR_CMN_OBJPERMID, and ATTR_CMN_PAROBJID are undefined.
223 *
224 * VOL_CAP_FMT_DIR_HARDLINKS: When set, the volume supports directory
225 * hard links.
226 *
227 * VOL_CAP_FMT_DOCUMENT_ID: When set, the volume supports document IDs
228 * (an ID which persists across object ID changes) for document revisions.
229 *
230 * VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write
231 * generation counts (a count of how many times an object has been modified)
232 *
233 * VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support
234 * setting the UF_IMMUTABLE flag.
235 *
236 * VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting
237 * permissions.
238 *
239 * VOL_CAP_FMT_SHARED_SPACE: When set, the volume supports sharing space with
240 * other filesystems i.e. multiple logical filesystems can exist in the same
241 * "partition". An implication of this is that the filesystem which sets
242 * this capability treats waitfor arguments to VFS_SYNC as bit flags.
243 *
244 * VOL_CAP_FMT_VOL_GROUPS: When set, this volume is part of a volume-group
245 * that implies multiple volumes must be mounted in order to boot and root the
246 * operating system. Typically, this means a read-only system volume and a
247 * writable data volume.
248 *
249 * VOL_CAP_FMT_SEALED: When set, this volume is cryptographically sealed.
250 * Any modifications to volume data or metadata will be detected and may
251 * render the volume unusable.
252 */
253#define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001
254#define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002
255#define VOL_CAP_FMT_HARDLINKS 0x00000004
256#define VOL_CAP_FMT_JOURNAL 0x00000008
257#define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010
258#define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020
259#define VOL_CAP_FMT_SPARSE_FILES 0x00000040
260#define VOL_CAP_FMT_ZERO_RUNS 0x00000080
261#define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100
262#define VOL_CAP_FMT_CASE_PRESERVING 0x00000200
263#define VOL_CAP_FMT_FAST_STATFS 0x00000400
264#define VOL_CAP_FMT_2TB_FILESIZE 0x00000800
265#define VOL_CAP_FMT_OPENDENYMODES 0x00001000
266#define VOL_CAP_FMT_HIDDEN_FILES 0x00002000
267#define VOL_CAP_FMT_PATH_FROM_ID 0x00004000
268#define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000
269#define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000
270#define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000
271#define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000
272#define VOL_CAP_FMT_DOCUMENT_ID 0x00080000
273#define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000
274#define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000
275#define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000
276#define VOL_CAP_FMT_SHARED_SPACE 0x00800000
277#define VOL_CAP_FMT_VOL_GROUPS 0x01000000
278#define VOL_CAP_FMT_SEALED 0x02000000
279
280/*
281 * VOL_CAP_INT_SEARCHFS: When set, the volume implements the
282 * searchfs() system call (the vnop_searchfs vnode operation).
283 *
284 * VOL_CAP_INT_ATTRLIST: When set, the volume implements the
285 * getattrlist() and setattrlist() system calls (vnop_getattrlist
286 * and vnop_setattrlist vnode operations) for the volume, files,
287 * and directories. The volume may or may not implement the
288 * readdirattr() system call. XXX Is there any minimum set
289 * of attributes that should be supported? To determine the
290 * set of supported attributes, get the ATTR_VOL_ATTRIBUTES
291 * attribute of the volume.
292 *
293 * VOL_CAP_INT_NFSEXPORT: When set, the volume implements exporting
294 * of NFS volumes.
295 *
296 * VOL_CAP_INT_READDIRATTR: When set, the volume implements the
297 * readdirattr() system call (vnop_readdirattr vnode operation).
298 *
299 * VOL_CAP_INT_EXCHANGEDATA: When set, the volume implements the
300 * exchangedata() system call (VNOP_EXCHANGE vnode operation).
301 *
302 * VOL_CAP_INT_COPYFILE: When set, the volume implements the
303 * VOP_COPYFILE vnode operation. (XXX There should be a copyfile()
304 * system call in <unistd.h>.)
305 *
306 * VOL_CAP_INT_ALLOCATE: When set, the volume implements the
307 * VNOP_ALLOCATE vnode operation, which means it implements the
308 * F_PREALLOCATE selector of fcntl(2).
309 *
310 * VOL_CAP_INT_VOL_RENAME: When set, the volume implements the
311 * ATTR_VOL_NAME attribute for both getattrlist() and setattrlist().
312 * The volume can be renamed by setting ATTR_VOL_NAME with setattrlist().
313 *
314 * VOL_CAP_INT_ADVLOCK: When set, the volume implements POSIX style
315 * byte range locks via vnop_advlock (accessible from fcntl(2)).
316 *
317 * VOL_CAP_INT_FLOCK: When set, the volume implements whole-file flock(2)
318 * style locks via vnop_advlock. This includes the O_EXLOCK and O_SHLOCK
319 * flags of the open(2) call.
320 *
321 * VOL_CAP_INT_EXTENDED_SECURITY: When set, the volume implements
322 * extended security (ACLs).
323 *
324 * VOL_CAP_INT_USERACCESS: When set, the volume supports the
325 * ATTR_CMN_USERACCESS attribute (used to get the user's access
326 * mode to the file).
327 *
328 * VOL_CAP_INT_MANLOCK: When set, the volume supports AFP-style
329 * mandatory byte range locks via an ioctl().
330 *
331 * VOL_CAP_INT_EXTENDED_ATTR: When set, the volume implements
332 * native extended attribues.
333 *
334 * VOL_CAP_INT_NAMEDSTREAMS: When set, the volume supports
335 * native named streams.
336 *
337 * VOL_CAP_INT_CLONE: When set, the volume supports clones.
338 *
339 * VOL_CAP_INT_SNAPSHOT: When set, the volume supports snapshots.
340 *
341 * VOL_CAP_INT_RENAME_SWAP: When set, the volume supports swapping
342 * file system objects.
343 *
344 * VOL_CAP_INT_RENAME_EXCL: When set, the volume supports an
345 * exclusive rename operation.
346 *
347 * VOL_CAP_INT_RENAME_OPENFAIL: When set, the volume may fail rename
348 * operations on files that are open.
349 */
350#define VOL_CAP_INT_SEARCHFS 0x00000001
351#define VOL_CAP_INT_ATTRLIST 0x00000002
352#define VOL_CAP_INT_NFSEXPORT 0x00000004
353#define VOL_CAP_INT_READDIRATTR 0x00000008
354#define VOL_CAP_INT_EXCHANGEDATA 0x00000010
355#define VOL_CAP_INT_COPYFILE 0x00000020
356#define VOL_CAP_INT_ALLOCATE 0x00000040
357#define VOL_CAP_INT_VOL_RENAME 0x00000080
358#define VOL_CAP_INT_ADVLOCK 0x00000100
359#define VOL_CAP_INT_FLOCK 0x00000200
360#define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400
361#define VOL_CAP_INT_USERACCESS 0x00000800
362#define VOL_CAP_INT_MANLOCK 0x00001000
363#define VOL_CAP_INT_NAMEDSTREAMS 0x00002000
364#define VOL_CAP_INT_EXTENDED_ATTR 0x00004000
365#define VOL_CAP_INT_CLONE 0x00010000
366#define VOL_CAP_INT_SNAPSHOT 0x00020000
367#define VOL_CAP_INT_RENAME_SWAP 0x00040000
368#define VOL_CAP_INT_RENAME_EXCL 0x00080000
369#define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000
370
371typedef struct vol_attributes_attr {
372 attribute_set_t validattr;
373 attribute_set_t nativeattr;
374} vol_attributes_attr_t;
375
376#define ATTR_CMN_NAME 0x00000001
377#define ATTR_CMN_DEVID 0x00000002
378#define ATTR_CMN_FSID 0x00000004
379#define ATTR_CMN_OBJTYPE 0x00000008
380#define ATTR_CMN_OBJTAG 0x00000010
381#define ATTR_CMN_OBJID 0x00000020
382#define ATTR_CMN_OBJPERMANENTID 0x00000040
383#define ATTR_CMN_PAROBJID 0x00000080
384#define ATTR_CMN_SCRIPT 0x00000100
385#define ATTR_CMN_CRTIME 0x00000200
386#define ATTR_CMN_MODTIME 0x00000400
387#define ATTR_CMN_CHGTIME 0x00000800
388#define ATTR_CMN_ACCTIME 0x00001000
389#define ATTR_CMN_BKUPTIME 0x00002000
390#define ATTR_CMN_FNDRINFO 0x00004000
391#define ATTR_CMN_OWNERID 0x00008000
392#define ATTR_CMN_GRPID 0x00010000
393#define ATTR_CMN_ACCESSMASK 0x00020000
394#define ATTR_CMN_FLAGS 0x00040000
395
396/* The following were defined as: */
397/* #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 */
398/* #define ATTR_CMN_NAMEDATTRLIST 0x00100000 */
399/* These bits have been salvaged for use as: */
400/* #define ATTR_CMN_GEN_COUNT 0x00080000 */
401/* #define ATTR_CMN_DOCUMENT_ID 0x00100000 */
402/* They can only be used with the FSOPT_ATTR_CMN_EXTENDED */
403/* option flag. */
404
405#define ATTR_CMN_GEN_COUNT 0x00080000
406#define ATTR_CMN_DOCUMENT_ID 0x00100000
407
408#define ATTR_CMN_USERACCESS 0x00200000
409#define ATTR_CMN_EXTENDED_SECURITY 0x00400000
410#define ATTR_CMN_UUID 0x00800000
411#define ATTR_CMN_GRPUUID 0x01000000
412#define ATTR_CMN_FILEID 0x02000000
413#define ATTR_CMN_PARENTID 0x04000000
414#define ATTR_CMN_FULLPATH 0x08000000
415#define ATTR_CMN_ADDEDTIME 0x10000000
416#define ATTR_CMN_ERROR 0x20000000
417#define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000
418
419/*
420 * ATTR_CMN_RETURNED_ATTRS is only valid with getattrlist(2) and
421 * getattrlistbulk(2). It is always the first attribute in the return buffer.
422 */
423#define ATTR_CMN_RETURNED_ATTRS 0x80000000
424
425#define ATTR_CMN_VALIDMASK 0xFFFFFFFF
426/*
427 * The settable ATTR_CMN_* attributes include the following:
428 * ATTR_CMN_SCRIPT
429 * ATTR_CMN_CRTIME
430 * ATTR_CMN_MODTIME
431 * ATTR_CMN_CHGTIME
432 *
433 * ATTR_CMN_ACCTIME
434 * ATTR_CMN_BKUPTIME
435 * ATTR_CMN_FNDRINFO
436 * ATTR_CMN_OWNERID
437 *
438 * ATTR_CMN_GRPID
439 * ATTR_CMN_ACCESSMASK
440 * ATTR_CMN_FLAGS
441 *
442 * ATTR_CMN_EXTENDED_SECURITY
443 * ATTR_CMN_UUID
444 *
445 * ATTR_CMN_GRPUUID
446 *
447 * ATTR_CMN_DATA_PROTECT_FLAGS
448 */
449#define ATTR_CMN_SETMASK 0x51C7FF00
450#define ATTR_CMN_VOLSETMASK 0x00006700
451
452#define ATTR_VOL_FSTYPE 0x00000001
453#define ATTR_VOL_SIGNATURE 0x00000002
454#define ATTR_VOL_SIZE 0x00000004
455#define ATTR_VOL_SPACEFREE 0x00000008
456#define ATTR_VOL_SPACEAVAIL 0x00000010
457#define ATTR_VOL_MINALLOCATION 0x00000020
458#define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
459#define ATTR_VOL_IOBLOCKSIZE 0x00000080
460#define ATTR_VOL_OBJCOUNT 0x00000100
461#define ATTR_VOL_FILECOUNT 0x00000200
462#define ATTR_VOL_DIRCOUNT 0x00000400
463#define ATTR_VOL_MAXOBJCOUNT 0x00000800
464#define ATTR_VOL_MOUNTPOINT 0x00001000
465#define ATTR_VOL_NAME 0x00002000
466#define ATTR_VOL_MOUNTFLAGS 0x00004000
467#define ATTR_VOL_MOUNTEDDEVICE 0x00008000
468#define ATTR_VOL_ENCODINGSUSED 0x00010000
469#define ATTR_VOL_CAPABILITIES 0x00020000
470#define ATTR_VOL_UUID 0x00040000
471#define ATTR_VOL_SPACEUSED 0x00800000
472#define ATTR_VOL_QUOTA_SIZE 0x10000000
473#define ATTR_VOL_RESERVED_SIZE 0x20000000
474#define ATTR_VOL_ATTRIBUTES 0x40000000
475#define ATTR_VOL_INFO 0x80000000
476
477#define ATTR_VOL_VALIDMASK 0xF087FFFF
478
479/*
480 * The list of settable ATTR_VOL_* attributes include the following:
481 * ATTR_VOL_NAME
482 * ATTR_VOL_INFO
483 */
484#define ATTR_VOL_SETMASK 0x80002000
485
486
487/* File/directory attributes: */
488#define ATTR_DIR_LINKCOUNT 0x00000001
489#define ATTR_DIR_ENTRYCOUNT 0x00000002
490#define ATTR_DIR_MOUNTSTATUS 0x00000004
491#define ATTR_DIR_ALLOCSIZE 0x00000008
492#define ATTR_DIR_IOBLOCKSIZE 0x00000010
493#define ATTR_DIR_DATALENGTH 0x00000020
494
495/* ATTR_DIR_MOUNTSTATUS Flags: */
496#define DIR_MNTSTATUS_MNTPOINT 0x00000001
497#define DIR_MNTSTATUS_TRIGGER 0x00000002
498
499#define ATTR_DIR_VALIDMASK 0x0000003f
500#define ATTR_DIR_SETMASK 0x00000000
501
502#define ATTR_FILE_LINKCOUNT 0x00000001
503#define ATTR_FILE_TOTALSIZE 0x00000002
504#define ATTR_FILE_ALLOCSIZE 0x00000004
505#define ATTR_FILE_IOBLOCKSIZE 0x00000008
506#define ATTR_FILE_DEVTYPE 0x00000020
507#define ATTR_FILE_FORKCOUNT 0x00000080
508#define ATTR_FILE_FORKLIST 0x00000100
509#define ATTR_FILE_DATALENGTH 0x00000200
510#define ATTR_FILE_DATAALLOCSIZE 0x00000400
511#define ATTR_FILE_RSRCLENGTH 0x00001000
512#define ATTR_FILE_RSRCALLOCSIZE 0x00002000
513
514#define ATTR_FILE_VALIDMASK 0x000037FF
515/*
516 * Settable ATTR_FILE_* attributes include:
517 * ATTR_FILE_DEVTYPE
518 */
519#define ATTR_FILE_SETMASK 0x00000020
520
521/* CMNEXT attributes extend the common attributes, but in the forkattr field */
522#define ATTR_CMNEXT_RELPATH 0x00000004
523#define ATTR_CMNEXT_PRIVATESIZE 0x00000008
524#define ATTR_CMNEXT_LINKID 0x00000010
525#define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020
526#define ATTR_CMNEXT_REALDEVID 0x00000040
527#define ATTR_CMNEXT_REALFSID 0x00000080
528#define ATTR_CMNEXT_CLONEID 0x00000100
529#define ATTR_CMNEXT_EXT_FLAGS 0x00000200
530#define ATTR_CMNEXT_RECURSIVE_GENCOUNT 0x00000400
531
532#define ATTR_CMNEXT_VALIDMASK 0x000007fc
533#define ATTR_CMNEXT_SETMASK 0x00000000
534
535/* Deprecated fork attributes */
536#define ATTR_FORK_TOTALSIZE 0x00000001
537#define ATTR_FORK_ALLOCSIZE 0x00000002
538#define ATTR_FORK_RESERVED 0xffffffff
539
540#define ATTR_FORK_VALIDMASK 0x00000003
541#define ATTR_FORK_SETMASK 0x00000000
542
543/* Obsolete, implemented, not supported */
544#define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
545#define ATTR_CMN_NAMEDATTRLIST 0x00100000
546#define ATTR_FILE_CLUMPSIZE 0x00000010 /* obsolete */
547#define ATTR_FILE_FILETYPE 0x00000040 /* always zero */
548#define ATTR_FILE_DATAEXTENTS 0x00000800 /* obsolete, HFS-specific */
549#define ATTR_FILE_RSRCEXTENTS 0x00004000 /* obsolete, HFS-specific */
550
551/* Required attributes for getattrlistbulk(2) */
552#define ATTR_BULK_REQUIRED (ATTR_CMN_NAME | ATTR_CMN_RETURNED_ATTRS)
553
554/*
555 * Searchfs
556 */
557#define SRCHFS_START 0x00000001
558#define SRCHFS_MATCHPARTIALNAMES 0x00000002
559#define SRCHFS_MATCHDIRS 0x00000004
560#define SRCHFS_MATCHFILES 0x00000008
561#define SRCHFS_SKIPLINKS 0x00000010
562#define SRCHFS_SKIPINVISIBLE 0x00000020
563#define SRCHFS_SKIPPACKAGES 0x00000040
564#define SRCHFS_SKIPINAPPROPRIATE 0x00000080
565
566#define SRCHFS_NEGATEPARAMS 0x80000000
567#define SRCHFS_VALIDOPTIONSMASK 0x800000FF
568
569struct fssearchblock {
570 struct attrlist *returnattrs;
571 void *returnbuffer;
572 size_t returnbuffersize;
573 u_long maxmatches;
574 struct timeval timelimit;
575 void *searchparams1;
576 size_t sizeofsearchparams1;
577 void *searchparams2;
578 size_t sizeofsearchparams2;
579 struct attrlist searchattrs;
580};
581
582
583struct searchstate {
584 uint32_t ss_union_flags; // for SRCHFS_START
585 uint32_t ss_union_layer; // 0 = top
586 u_char ss_fsstate[548]; // fs private
587} __attribute__((packed));
588
589#define FST_EOF (-1) /* end-of-file offset */
590
591#endif /* __APPLE_API_UNSTABLE */
592#endif /* !_SYS_ATTR_H_ */
\ No newline at end of file
lib/libc/include/any-macos.12-any/unistd.h created+791
......@@ -0,0 +1,791 @@
1/*
2 * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 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/*-
24 * Copyright (c) 1998-1999 Apple Computer, Inc. All Rights Reserved
25 * Copyright (c) 1991, 1993, 1994
26 * The Regents of the University of California. All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. All advertising materials mentioning features or use of this software
37 * must display the following acknowledgement:
38 * This product includes software developed by the University of
39 * California, Berkeley and its contributors.
40 * 4. Neither the name of the University nor the names of its contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
43 *
44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * SUCH DAMAGE.
55 *
56 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
57 *
58 * Copyright (c) 1998 Apple Compter, Inc.
59 * All Rights Reserved
60 */
61
62/* History:
63 7/14/99 EKN at Apple fixed getdirentriesattr from getdirentryattr
64 3/26/98 CHW at Apple added real interface to searchfs call
65 3/5/98 CHW at Apple added hfs semantic system calls headers
66*/
67
68#ifndef _UNISTD_H_
69#define _UNISTD_H_
70
71#include <_types.h>
72#include <sys/unistd.h>
73#include <Availability.h>
74#include <sys/_types/_gid_t.h>
75#include <sys/_types/_intptr_t.h>
76#include <sys/_types/_off_t.h>
77#include <sys/_types/_pid_t.h>
78/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
79 * _GCC_SIZE_T */
80#include <sys/_types/_size_t.h>
81#include <sys/_types/_ssize_t.h>
82#include <sys/_types/_uid_t.h>
83#include <sys/_types/_useconds_t.h>
84#include <sys/_types/_null.h>
85
86#define STDIN_FILENO 0 /* standard input file descriptor */
87#define STDOUT_FILENO 1 /* standard output file descriptor */
88#define STDERR_FILENO 2 /* standard error file descriptor */
89
90
91/* Version test macros */
92/* _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h */
93#define _XOPEN_VERSION 600 /* [XSI] */
94#define _XOPEN_XCU_VERSION 4 /* Older standard */
95
96
97/* Please keep this list in the same order as the applicable standard */
98#define _POSIX_ADVISORY_INFO (-1) /* [ADV] */
99#define _POSIX_ASYNCHRONOUS_IO (-1) /* [AIO] */
100#define _POSIX_BARRIERS (-1) /* [BAR] */
101#define _POSIX_CHOWN_RESTRICTED 200112L
102#define _POSIX_CLOCK_SELECTION (-1) /* [CS] */
103#define _POSIX_CPUTIME (-1) /* [CPT] */
104#define _POSIX_FSYNC 200112L /* [FSC] */
105#define _POSIX_IPV6 200112L
106#define _POSIX_JOB_CONTROL 200112L
107#define _POSIX_MAPPED_FILES 200112L /* [MF] */
108#define _POSIX_MEMLOCK (-1) /* [ML] */
109#define _POSIX_MEMLOCK_RANGE (-1) /* [MR] */
110#define _POSIX_MEMORY_PROTECTION 200112L /* [MPR] */
111#define _POSIX_MESSAGE_PASSING (-1) /* [MSG] */
112#define _POSIX_MONOTONIC_CLOCK (-1) /* [MON] */
113#define _POSIX_NO_TRUNC 200112L
114#define _POSIX_PRIORITIZED_IO (-1) /* [PIO] */
115#define _POSIX_PRIORITY_SCHEDULING (-1) /* [PS] */
116#define _POSIX_RAW_SOCKETS (-1) /* [RS] */
117#define _POSIX_READER_WRITER_LOCKS 200112L /* [THR] */
118#define _POSIX_REALTIME_SIGNALS (-1) /* [RTS] */
119#define _POSIX_REGEXP 200112L
120#define _POSIX_SAVED_IDS 200112L /* XXX required */
121#define _POSIX_SEMAPHORES (-1) /* [SEM] */
122#define _POSIX_SHARED_MEMORY_OBJECTS (-1) /* [SHM] */
123#define _POSIX_SHELL 200112L
124#define _POSIX_SPAWN (-1) /* [SPN] */
125#define _POSIX_SPIN_LOCKS (-1) /* [SPI] */
126#define _POSIX_SPORADIC_SERVER (-1) /* [SS] */
127#define _POSIX_SYNCHRONIZED_IO (-1) /* [SIO] */
128#define _POSIX_THREAD_ATTR_STACKADDR 200112L /* [TSA] */
129#define _POSIX_THREAD_ATTR_STACKSIZE 200112L /* [TSS] */
130#define _POSIX_THREAD_CPUTIME (-1) /* [TCT] */
131#define _POSIX_THREAD_PRIO_INHERIT (-1) /* [TPI] */
132#define _POSIX_THREAD_PRIO_PROTECT (-1) /* [TPP] */
133#define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* [TPS] */
134#define _POSIX_THREAD_PROCESS_SHARED 200112L /* [TSH] */
135#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L /* [TSF] */
136#define _POSIX_THREAD_SPORADIC_SERVER (-1) /* [TSP] */
137#define _POSIX_THREADS 200112L /* [THR] */
138#define _POSIX_TIMEOUTS (-1) /* [TMO] */
139#define _POSIX_TIMERS (-1) /* [TMR] */
140#define _POSIX_TRACE (-1) /* [TRC] */
141#define _POSIX_TRACE_EVENT_FILTER (-1) /* [TEF] */
142#define _POSIX_TRACE_INHERIT (-1) /* [TRI] */
143#define _POSIX_TRACE_LOG (-1) /* [TRL] */
144#define _POSIX_TYPED_MEMORY_OBJECTS (-1) /* [TYM] */
145#ifndef _POSIX_VDISABLE
146#define _POSIX_VDISABLE 0xff /* same as sys/termios.h */
147#endif /* _POSIX_VDISABLE */
148
149#if __DARWIN_C_LEVEL >= 199209L
150#define _POSIX2_C_BIND 200112L
151#define _POSIX2_C_DEV 200112L /* c99 command */
152#define _POSIX2_CHAR_TERM 200112L
153#define _POSIX2_FORT_DEV (-1) /* fort77 command */
154#define _POSIX2_FORT_RUN 200112L
155#define _POSIX2_LOCALEDEF 200112L /* localedef command */
156#define _POSIX2_PBS (-1)
157#define _POSIX2_PBS_ACCOUNTING (-1)
158#define _POSIX2_PBS_CHECKPOINT (-1)
159#define _POSIX2_PBS_LOCATE (-1)
160#define _POSIX2_PBS_MESSAGE (-1)
161#define _POSIX2_PBS_TRACK (-1)
162#define _POSIX2_SW_DEV 200112L
163#define _POSIX2_UPE 200112L /* XXXX no fc, newgrp, tabs */
164#endif /* __DARWIN_C_LEVEL */
165
166#define __ILP32_OFF32 (-1)
167#define __ILP32_OFFBIG (-1)
168
169#define __LP64_OFF64 (1)
170#define __LPBIG_OFFBIG (1)
171
172#if __DARWIN_C_LEVEL >= 200112L
173#define _POSIX_V6_ILP32_OFF32 __ILP32_OFF32
174#define _POSIX_V6_ILP32_OFFBIG __ILP32_OFFBIG
175#define _POSIX_V6_LP64_OFF64 __LP64_OFF64
176#define _POSIX_V6_LPBIG_OFFBIG __LPBIG_OFFBIG
177#endif /* __DARWIN_C_LEVEL >= 200112L */
178
179#if __DARWIN_C_LEVEL >= 200809L
180#define _POSIX_V7_ILP32_OFF32 __ILP32_OFF32
181#define _POSIX_V7_ILP32_OFFBIG __ILP32_OFFBIG
182#define _POSIX_V7_LP64_OFF64 __LP64_OFF64
183#define _POSIX_V7_LPBIG_OFFBIG __LPBIG_OFFBIG
184#endif /* __DARWIN_C_LEVEL >= 200809L */
185
186#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
187#define _V6_ILP32_OFF32 __ILP32_OFF32
188#define _V6_ILP32_OFFBIG __ILP32_OFFBIG
189#define _V6_LP64_OFF64 __LP64_OFF64
190#define _V6_LPBIG_OFFBIG __LPBIG_OFFBIG
191#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
192
193#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
194/* Removed in Issue 7 */
195#define _XBS5_ILP32_OFF32 __ILP32_OFF32
196#define _XBS5_ILP32_OFFBIG __ILP32_OFFBIG
197#define _XBS5_LP64_OFF64 __LP64_OFF64
198#define _XBS5_LPBIG_OFFBIG __LPBIG_OFFBIG
199#endif /* __DARWIN_C_LEVEL < 200809L */
200
201#if __DARWIN_C_LEVEL >= 199506L /* This really should be XSI */
202#define _XOPEN_CRYPT (1)
203#define _XOPEN_ENH_I18N (1) /* XXX required */
204#define _XOPEN_LEGACY (-1) /* no ftime gcvt, wcswcs */
205#define _XOPEN_REALTIME (-1) /* no q'ed signals, mq_* */
206#define _XOPEN_REALTIME_THREADS (-1) /* no posix_spawn, et. al. */
207#define _XOPEN_SHM (1)
208#define _XOPEN_STREAMS (-1) /* Issue 6 */
209#define _XOPEN_UNIX (1)
210#endif /* XSI */
211
212/* configurable system variables */
213#define _SC_ARG_MAX 1
214#define _SC_CHILD_MAX 2
215#define _SC_CLK_TCK 3
216#define _SC_NGROUPS_MAX 4
217#define _SC_OPEN_MAX 5
218#define _SC_JOB_CONTROL 6
219#define _SC_SAVED_IDS 7
220#define _SC_VERSION 8
221#define _SC_BC_BASE_MAX 9
222#define _SC_BC_DIM_MAX 10
223#define _SC_BC_SCALE_MAX 11
224#define _SC_BC_STRING_MAX 12
225#define _SC_COLL_WEIGHTS_MAX 13
226#define _SC_EXPR_NEST_MAX 14
227#define _SC_LINE_MAX 15
228#define _SC_RE_DUP_MAX 16
229#define _SC_2_VERSION 17
230#define _SC_2_C_BIND 18
231#define _SC_2_C_DEV 19
232#define _SC_2_CHAR_TERM 20
233#define _SC_2_FORT_DEV 21
234#define _SC_2_FORT_RUN 22
235#define _SC_2_LOCALEDEF 23
236#define _SC_2_SW_DEV 24
237#define _SC_2_UPE 25
238#define _SC_STREAM_MAX 26
239#define _SC_TZNAME_MAX 27
240
241#if __DARWIN_C_LEVEL >= 199309L
242#define _SC_ASYNCHRONOUS_IO 28
243#define _SC_PAGESIZE 29
244#define _SC_MEMLOCK 30
245#define _SC_MEMLOCK_RANGE 31
246#define _SC_MEMORY_PROTECTION 32
247#define _SC_MESSAGE_PASSING 33
248#define _SC_PRIORITIZED_IO 34
249#define _SC_PRIORITY_SCHEDULING 35
250#define _SC_REALTIME_SIGNALS 36
251#define _SC_SEMAPHORES 37
252#define _SC_FSYNC 38
253#define _SC_SHARED_MEMORY_OBJECTS 39
254#define _SC_SYNCHRONIZED_IO 40
255#define _SC_TIMERS 41
256#define _SC_AIO_LISTIO_MAX 42
257#define _SC_AIO_MAX 43
258#define _SC_AIO_PRIO_DELTA_MAX 44
259#define _SC_DELAYTIMER_MAX 45
260#define _SC_MQ_OPEN_MAX 46
261#define _SC_MAPPED_FILES 47 /* swap _SC_PAGESIZE vs. BSD */
262#define _SC_RTSIG_MAX 48
263#define _SC_SEM_NSEMS_MAX 49
264#define _SC_SEM_VALUE_MAX 50
265#define _SC_SIGQUEUE_MAX 51
266#define _SC_TIMER_MAX 52
267#endif /* __DARWIN_C_LEVEL >= 199309L */
268
269#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
270#define _SC_NPROCESSORS_CONF 57
271#define _SC_NPROCESSORS_ONLN 58
272#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
273
274#if __DARWIN_C_LEVEL >= 200112L
275#define _SC_2_PBS 59
276#define _SC_2_PBS_ACCOUNTING 60
277#define _SC_2_PBS_CHECKPOINT 61
278#define _SC_2_PBS_LOCATE 62
279#define _SC_2_PBS_MESSAGE 63
280#define _SC_2_PBS_TRACK 64
281#define _SC_ADVISORY_INFO 65
282#define _SC_BARRIERS 66
283#define _SC_CLOCK_SELECTION 67
284#define _SC_CPUTIME 68
285#define _SC_FILE_LOCKING 69
286#define _SC_GETGR_R_SIZE_MAX 70
287#define _SC_GETPW_R_SIZE_MAX 71
288#define _SC_HOST_NAME_MAX 72
289#define _SC_LOGIN_NAME_MAX 73
290#define _SC_MONOTONIC_CLOCK 74
291#define _SC_MQ_PRIO_MAX 75
292#define _SC_READER_WRITER_LOCKS 76
293#define _SC_REGEXP 77
294#define _SC_SHELL 78
295#define _SC_SPAWN 79
296#define _SC_SPIN_LOCKS 80
297#define _SC_SPORADIC_SERVER 81
298#define _SC_THREAD_ATTR_STACKADDR 82
299#define _SC_THREAD_ATTR_STACKSIZE 83
300#define _SC_THREAD_CPUTIME 84
301#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85
302#define _SC_THREAD_KEYS_MAX 86
303#define _SC_THREAD_PRIO_INHERIT 87
304#define _SC_THREAD_PRIO_PROTECT 88
305#define _SC_THREAD_PRIORITY_SCHEDULING 89
306#define _SC_THREAD_PROCESS_SHARED 90
307#define _SC_THREAD_SAFE_FUNCTIONS 91
308#define _SC_THREAD_SPORADIC_SERVER 92
309#define _SC_THREAD_STACK_MIN 93
310#define _SC_THREAD_THREADS_MAX 94
311#define _SC_TIMEOUTS 95
312#define _SC_THREADS 96
313#define _SC_TRACE 97
314#define _SC_TRACE_EVENT_FILTER 98
315#define _SC_TRACE_INHERIT 99
316#define _SC_TRACE_LOG 100
317#define _SC_TTY_NAME_MAX 101
318#define _SC_TYPED_MEMORY_OBJECTS 102
319#define _SC_V6_ILP32_OFF32 103
320#define _SC_V6_ILP32_OFFBIG 104
321#define _SC_V6_LP64_OFF64 105
322#define _SC_V6_LPBIG_OFFBIG 106
323#define _SC_IPV6 118
324#define _SC_RAW_SOCKETS 119
325#define _SC_SYMLOOP_MAX 120
326#endif /* __DARWIN_C_LEVEL >= 200112L */
327
328#if __DARWIN_C_LEVEL >= 199506L /* Really XSI */
329#define _SC_ATEXIT_MAX 107
330#define _SC_IOV_MAX 56
331#define _SC_PAGE_SIZE _SC_PAGESIZE
332#define _SC_XOPEN_CRYPT 108
333#define _SC_XOPEN_ENH_I18N 109
334#define _SC_XOPEN_LEGACY 110 /* Issue 6 */
335#define _SC_XOPEN_REALTIME 111 /* Issue 6 */
336#define _SC_XOPEN_REALTIME_THREADS 112 /* Issue 6 */
337#define _SC_XOPEN_SHM 113
338#define _SC_XOPEN_STREAMS 114 /* Issue 6 */
339#define _SC_XOPEN_UNIX 115
340#define _SC_XOPEN_VERSION 116
341#define _SC_XOPEN_XCU_VERSION 121
342#endif /* XSI */
343
344#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
345/* Removed in Issue 7 */
346#define _SC_XBS5_ILP32_OFF32 122
347#define _SC_XBS5_ILP32_OFFBIG 123
348#define _SC_XBS5_LP64_OFF64 124
349#define _SC_XBS5_LPBIG_OFFBIG 125
350#endif /* __DARWIN_C_LEVEL <= 200809L */
351
352#if __DARWIN_C_LEVEL >= 200112L
353#define _SC_SS_REPL_MAX 126
354#define _SC_TRACE_EVENT_NAME_MAX 127
355#define _SC_TRACE_NAME_MAX 128
356#define _SC_TRACE_SYS_MAX 129
357#define _SC_TRACE_USER_EVENT_MAX 130
358#endif
359
360#if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
361/* Removed in Issue 6 */
362#define _SC_PASS_MAX 131
363#endif
364
365/* 132-199 available for future use */
366#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
367#define _SC_PHYS_PAGES 200
368#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
369
370#if __DARWIN_C_LEVEL >= 199209L
371#ifndef _CS_PATH /* Defined in <sys/unistd.h> */
372#define _CS_PATH 1
373#endif
374#endif
375
376#if __DARWIN_C_LEVEL >= 200112
377#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
378#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
379#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
380#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
381#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
382#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
383#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
384#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
385#define _CS_POSIX_V6_LP64_OFF64_LIBS 10
386#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
387#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
388#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
389#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
390#endif
391
392#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
393/* Removed in Issue 7 */
394#define _CS_XBS5_ILP32_OFF32_CFLAGS 20
395#define _CS_XBS5_ILP32_OFF32_LDFLAGS 21
396#define _CS_XBS5_ILP32_OFF32_LIBS 22
397#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 23
398#define _CS_XBS5_ILP32_OFFBIG_CFLAGS 24
399#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 25
400#define _CS_XBS5_ILP32_OFFBIG_LIBS 26
401#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 27
402#define _CS_XBS5_LP64_OFF64_CFLAGS 28
403#define _CS_XBS5_LP64_OFF64_LDFLAGS 29
404#define _CS_XBS5_LP64_OFF64_LIBS 30
405#define _CS_XBS5_LP64_OFF64_LINTFLAGS 31
406#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 32
407#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 33
408#define _CS_XBS5_LPBIG_OFFBIG_LIBS 34
409#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 35
410#endif
411
412#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
413#define _CS_DARWIN_USER_DIR 65536
414#define _CS_DARWIN_USER_TEMP_DIR 65537
415#define _CS_DARWIN_USER_CACHE_DIR 65538
416#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
417
418
419#ifdef _DARWIN_UNLIMITED_GETGROUPS
420#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
421#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it."
422#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
423#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it."
424#endif
425#endif
426
427/* POSIX.1-1990 */
428
429__BEGIN_DECLS
430void _exit(int) __dead2;
431int access(const char *, int);
432unsigned int
433 alarm(unsigned int);
434int chdir(const char *);
435int chown(const char *, uid_t, gid_t);
436
437int close(int) __DARWIN_ALIAS_C(close);
438
439int dup(int);
440int dup2(int, int);
441int execl(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
442int execle(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
443int execlp(const char * __file, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
444int execv(const char * __path, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
445int execve(const char * __file, char * const * __argv, char * const * __envp) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
446int execvp(const char * __file, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
447pid_t fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
448long fpathconf(int, int);
449char *getcwd(char *, size_t);
450gid_t getegid(void);
451uid_t geteuid(void);
452gid_t getgid(void);
453#if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE)
454int getgroups(int, gid_t []) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(getgroups));
455#else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */
456int getgroups(int, gid_t []);
457#endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */
458char *getlogin(void);
459pid_t getpgrp(void);
460pid_t getpid(void);
461pid_t getppid(void);
462uid_t getuid(void);
463int isatty(int);
464int link(const char *, const char *);
465off_t lseek(int, off_t, int);
466long pathconf(const char *, int);
467
468int pause(void) __DARWIN_ALIAS_C(pause);
469
470int pipe(int [2]);
471
472ssize_t read(int, void *, size_t) __DARWIN_ALIAS_C(read);
473
474int rmdir(const char *);
475int setgid(gid_t);
476int setpgid(pid_t, pid_t);
477pid_t setsid(void);
478int setuid(uid_t);
479
480unsigned int
481 sleep(unsigned int) __DARWIN_ALIAS_C(sleep);
482
483long sysconf(int);
484pid_t tcgetpgrp(int);
485int tcsetpgrp(int, pid_t);
486char *ttyname(int);
487
488#if __DARWIN_UNIX03
489int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r);
490#else /* !__DARWIN_UNIX03 */
491char *ttyname_r(int, char *, size_t);
492#endif /* __DARWIN_UNIX03 */
493
494int unlink(const char *);
495
496ssize_t write(int __fd, const void * __buf, size_t __nbyte) __DARWIN_ALIAS_C(write);
497__END_DECLS
498
499
500
501/* Additional functionality provided by:
502 * POSIX.2-1992 C Language Binding Option
503 */
504
505#if __DARWIN_C_LEVEL >= 199209L
506__BEGIN_DECLS
507size_t confstr(int, char *, size_t) __DARWIN_ALIAS(confstr);
508
509int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt);
510
511extern char *optarg; /* getopt(3) external variables */
512extern int optind, opterr, optopt;
513__END_DECLS
514#endif /* __DARWIN_C_LEVEL >= 199209L */
515
516
517
518/* Additional functionality provided by:
519 * POSIX.1c-1995,
520 * POSIX.1i-1995,
521 * and the omnibus ISO/IEC 9945-1: 1996
522 */
523
524#if __DARWIN_C_LEVEL >= 199506L
525#include <_ctermid.h>
526 /* These F_* are really XSI or Issue 6 */
527#define F_ULOCK 0 /* unlock locked section */
528#define F_LOCK 1 /* lock a section for exclusive use */
529#define F_TLOCK 2 /* test and lock a section for exclusive use */
530#define F_TEST 3 /* test a section for locks by other procs */
531
532 __BEGIN_DECLS
533
534/* Begin XSI */
535/* Removed in Issue 6 */
536#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
537#if !defined(_POSIX_C_SOURCE)
538__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
539#endif
540void *brk(const void *);
541int chroot(const char *) __POSIX_C_DEPRECATED(199506L);
542#endif
543
544char *crypt(const char *, const char *);
545#if __DARWIN_UNIX03
546void encrypt(char *, int) __DARWIN_ALIAS(encrypt);
547#else /* !__DARWIN_UNIX03 */
548int encrypt(char *, int);
549#endif /* __DARWIN_UNIX03 */
550int fchdir(int);
551long gethostid(void);
552pid_t getpgid(pid_t);
553pid_t getsid(pid_t);
554
555/* Removed in Issue 6 */
556#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
557int getdtablesize(void) __POSIX_C_DEPRECATED(199506L);
558int getpagesize(void) __pure2 __POSIX_C_DEPRECATED(199506L);
559char *getpass(const char *) __POSIX_C_DEPRECATED(199506L);
560#endif
561
562/* Removed in Issue 7 */
563#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
564char *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */
565#endif
566
567int lchown(const char *, uid_t, gid_t) __DARWIN_ALIAS(lchown);
568
569int lockf(int, int, off_t) __DARWIN_ALIAS_C(lockf);
570
571int nice(int) __DARWIN_ALIAS(nice);
572
573ssize_t pread(int __fd, void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pread);
574
575ssize_t pwrite(int __fd, const void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pwrite);
576
577/* Removed in Issue 6 */
578#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
579/* Note that Issue 5 changed the argument as intprt_t,
580 * but we keep it as int for binary compatability. */
581#if !defined(_POSIX_C_SOURCE)
582__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
583#endif
584void *sbrk(int);
585#endif
586
587#if __DARWIN_UNIX03
588pid_t setpgrp(void) __DARWIN_ALIAS(setpgrp);
589#else /* !__DARWIN_UNIX03 */
590int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
591#endif /* __DARWIN_UNIX03 */
592
593int setregid(gid_t, gid_t) __DARWIN_ALIAS(setregid);
594
595int setreuid(uid_t, uid_t) __DARWIN_ALIAS(setreuid);
596
597void swab(const void * __restrict, void * __restrict, ssize_t);
598void sync(void);
599int truncate(const char *, off_t);
600useconds_t ualarm(useconds_t, useconds_t);
601int usleep(useconds_t) __DARWIN_ALIAS_C(usleep);
602
603#if !defined(_POSIX_C_SOURCE)
604__deprecated_msg("Use posix_spawn or fork")
605#endif
606pid_t vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
607/* End XSI */
608
609int fsync(int) __DARWIN_ALIAS_C(fsync);
610
611int ftruncate(int, off_t);
612int getlogin_r(char *, size_t);
613__END_DECLS
614#endif /* __DARWIN_C_LEVEL >= 199506L */
615
616
617
618/* Additional functionality provided by:
619 * POSIX.1-2001
620 * ISO C99
621 */
622
623#if __DARWIN_C_LEVEL >= 200112L
624__BEGIN_DECLS
625int fchown(int, uid_t, gid_t);
626int gethostname(char *, size_t);
627ssize_t readlink(const char * __restrict, char * __restrict, size_t);
628int setegid(gid_t);
629int seteuid(uid_t);
630int symlink(const char *, const char *);
631__END_DECLS
632#endif /* __DARWIN_C_LEVEL >= 200112L */
633
634
635
636/* Darwin extensions */
637
638#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
639#include <sys/select.h>
640
641#include <sys/_types/_dev_t.h>
642#include <sys/_types/_mode_t.h>
643#include <sys/_types/_uuid_t.h>
644
645__BEGIN_DECLS
646void _Exit(int) __dead2;
647int accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t);
648int acct(const char *);
649int add_profil(char *, size_t, unsigned long, unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
650void endusershell(void);
651int execvP(const char * __file, const char * __searchpath, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
652char *fflagstostr(unsigned long);
653int getdomainname(char *, int);
654int getgrouplist(const char *, int, int *, int *);
655#if defined(__has_include)
656#if __has_include(<gethostuuid_private.h>)
657#include <gethostuuid_private.h>
658#else
659#include <gethostuuid.h>
660#endif
661#else
662#include <gethostuuid.h>
663#endif
664mode_t getmode(const void *, mode_t);
665int getpeereid(int, uid_t *, gid_t *);
666int getsgroups_np(int *, uuid_t);
667char *getusershell(void);
668int getwgroups_np(int *, uuid_t);
669int initgroups(const char *, int);
670int issetugid(void);
671char *mkdtemp(char *);
672int mknod(const char *, mode_t, dev_t);
673int mkpath_np(const char *path, mode_t omode) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); /* returns errno */
674int mkpathat_np(int dfd, const char *path, mode_t omode) /* returns errno */
675 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
676 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
677int mkstemp(char *);
678int mkstemps(char *, int);
679char *mktemp(char *);
680int mkostemp(char *path, int oflags)
681 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
682 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
683int mkostemps(char *path, int slen, int oflags)
684 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
685 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
686/* Non-portable mkstemp that uses open_dprotected_np */
687int mkstemp_dprotected_np(char *path, int dpclass, int dpflags)
688 __OSX_UNAVAILABLE __IOS_AVAILABLE(10.0)
689 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
690char *mkdtempat_np(int dfd, char *path)
691 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
692 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
693int mkstempsat_np(int dfd, char *path, int slen)
694 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
695 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
696int mkostempsat_np(int dfd, char *path, int slen, int oflags)
697 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
698 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
699int nfssvc(int, void *);
700int profil(char *, size_t, unsigned long, unsigned int);
701
702__deprecated_msg("Use of per-thread security contexts is error-prone and discouraged.")
703int pthread_setugid_np(uid_t, gid_t);
704int pthread_getugid_np( uid_t *, gid_t *);
705
706int reboot(int);
707int revoke(const char *);
708
709__deprecated int rcmd(char **, int, const char *, const char *, const char *, int *);
710__deprecated int rcmd_af(char **, int, const char *, const char *, const char *, int *,
711 int);
712__deprecated int rresvport(int *);
713__deprecated int rresvport_af(int *, int);
714__deprecated int iruserok(unsigned long, int, const char *, const char *);
715__deprecated int iruserok_sa(const void *, int, int, const char *, const char *);
716__deprecated int ruserok(const char *, int, const char *, const char *);
717
718int setdomainname(const char *, int);
719int setgroups(int, const gid_t *);
720void sethostid(long);
721int sethostname(const char *, int);
722#if __DARWIN_UNIX03
723void setkey(const char *) __DARWIN_ALIAS(setkey);
724#else /* !__DARWIN_UNIX03 */
725int setkey(const char *);
726#endif /* __DARWIN_UNIX03 */
727int setlogin(const char *);
728void *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(setmode));
729int setrgid(gid_t);
730int setruid(uid_t);
731int setsgroups_np(int, const uuid_t);
732void setusershell(void);
733int setwgroups_np(int, const uuid_t);
734int strtofflags(char **, unsigned long *, unsigned long *);
735int swapon(const char *);
736int ttyslot(void);
737int undelete(const char *);
738int unwhiteout(const char *);
739void *valloc(size_t);
740
741__WATCHOS_PROHIBITED __TVOS_PROHIBITED
742__OS_AVAILABILITY_MSG(ios,deprecated=10.0,"syscall(2) is unsupported; "
743 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
744__OS_AVAILABILITY_MSG(macosx,deprecated=10.12,"syscall(2) is unsupported; "
745 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
746int syscall(int, ...);
747
748extern char *suboptarg; /* getsubopt(3) external variable */
749int getsubopt(char **, char * const *, char **);
750
751/* HFS & HFS Plus semantics system calls go here */
752#ifdef __LP64__
753int fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
754int fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
755int getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist);
756int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist);
757int exchangedata(const char*,const char*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
758int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
759
760#else /* __LP64__ */
761int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
762int fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
763int getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist);
764int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist);
765int exchangedata(const char*,const char*,unsigned long)
766 __OSX_DEPRECATED(10.0, 10.13, "use renamex_np with the RENAME_SWAP flag")
767 __IOS_DEPRECATED(2.0, 11.0, "use renamex_np with the RENAME_SWAP flag")
768 __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
769int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
770
771#endif /* __LP64__ */
772
773struct fssearchblock;
774struct searchstate;
775
776int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
777int fsctl(const char *,unsigned long,void*,unsigned int);
778int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
779
780#define SYNC_VOLUME_FULLSYNC 0x01 /* Flush data and metadata to platter, not just to disk cache */
781#define SYNC_VOLUME_WAIT 0x02 /* Wait for sync to complete */
782
783int fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
784int sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
785
786extern int optreset;
787
788__END_DECLS
789#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
790
791#endif /* _UNISTD_H_ */
\ No newline at end of file
lib/libc/include/any-macos.12-any/xpc/availability.h created+130
......@@ -0,0 +1,130 @@
1#ifndef __XPC_AVAILABILITY_H__
2#define __XPC_AVAILABILITY_H__
3
4#include <Availability.h>
5
6// Certain parts of the project use all the project's headers but have to build
7// against newer OSX SDKs than ebuild uses -- liblaunch_host being the example.
8// So we need to define these.
9#ifndef __MAC_10_16
10#define __MAC_10_16 101600
11#endif // __MAC_10_16
12
13#ifndef __MAC_10_15
14#define __MAC_10_15 101500
15#define __AVAILABILITY_INTERNAL__MAC_10_15 \
16__attribute__((availability(macosx, introduced=10.15)))
17#endif // __MAC_10_15
18
19#ifndef __MAC_10_14
20#define __MAC_10_14 101400
21#define __AVAILABILITY_INTERNAL__MAC_10_14 \
22__attribute__((availability(macosx, introduced=10.14)))
23#endif // __MAC_10_14
24
25#ifndef __MAC_10_13
26#define __MAC_10_13 101300
27#define __AVAILABILITY_INTERNAL__MAC_10_13 \
28 __attribute__((availability(macosx, introduced=10.13)))
29#endif // __MAC_10_13
30
31#ifndef __MAC_10_12
32#define __MAC_10_12 101200
33#define __AVAILABILITY_INTERNAL__MAC_10_12 \
34 __attribute__((availability(macosx, introduced=10.12)))
35#endif // __MAC_10_12
36
37#ifndef __MAC_10_11
38#define __MAC_10_11 101100
39#define __AVAILABILITY_INTERNAL__MAC_10_11 \
40 __attribute__((availability(macosx, introduced=10.11)))
41#endif // __MAC_10_11
42
43#ifndef __MAC_12_0
44#define __MAC_12_0 120000
45#define __AVAILABILITY_INTERNAL__MAC_12_0 \
46 __attribute__((availability(macosx, introduced=12.0)))
47#endif // __MAC_12_0
48
49#ifndef __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
50#define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
51#endif // __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
52
53#ifndef __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
54#define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
55#endif // __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
56
57#ifndef __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
58#define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
59#endif // __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
60
61#ifndef __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
62#define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
63#endif // __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
64
65#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
66#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
67#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
68
69#ifndef __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
70#define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
71#endif // __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
72
73#ifndef __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
74#define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
75#endif // __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
76
77#ifndef __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
78#define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
79#endif // __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
80
81#ifndef __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
82#define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
83#endif // __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
84
85#ifndef __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
86#define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
87#endif // __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
88
89#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
90#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
91#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
92
93#if __has_include(<simulator_host.h>)
94#include <simulator_host.h>
95#else // __has_include(<simulator_host.h>)
96#ifndef IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED
97#define IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED 999999
98#endif // IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED
99#endif // __has_include(<simulator_host.h>)
100
101#ifndef __WATCHOS_UNAVAILABLE
102#define __WATCHOS_UNAVAILABLE
103#endif
104
105#ifndef __TVOS_UNAVAILABLE
106#define __TVOS_UNAVAILABLE
107#endif
108
109// simulator host-side bits build against SDKs not having __*_AVAILABLE() yet
110#ifndef __OSX_AVAILABLE
111#define __OSX_AVAILABLE(...)
112#endif
113
114#ifndef __IOS_AVAILABLE
115#define __IOS_AVAILABLE(...)
116#endif
117
118#ifndef __TVOS_AVAILABLE
119#define __TVOS_AVAILABLE(...)
120#endif
121
122#ifndef __WATCHOS_AVAILABLE
123#define __WATCHOS_AVAILABLE(...)
124#endif
125
126#ifndef __API_AVAILABLE
127#define __API_AVAILABLE(...)
128#endif
129
130#endif // __XPC_AVAILABILITY_H__
\ No newline at end of file
lib/libc/include/any-macos.13-any/AvailabilityInternal.h+5-5
......@@ -55,7 +55,7 @@
5555 #ifdef __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
5656 /* compiler sets __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ when -mtvos-version-min is used */
5757 #define __TV_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
58 #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_16_2
58 #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_16_4
5959 /* for compatibility with existing code. New code should use platform specific checks */
6060 #define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
6161 #endif
......@@ -65,7 +65,7 @@
6565 #ifdef __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__
6666 /* compiler sets __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ when -mwatchos-version-min is used */
6767 #define __WATCH_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__
68 #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_9_2
68 #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_9_4
6969 /* for compatibility with existing code. New code should use platform specific checks */
7070 #define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
7171 #endif
......@@ -75,7 +75,7 @@
7575 #ifdef __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__
7676
7777 #define __BRIDGE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__
78 #define __BRIDGE_OS_VERSION_MAX_ALLOWED 70100
78 #define __BRIDGE_OS_VERSION_MAX_ALLOWED 70300
7979 /* for compatibility with existing code. New code should use platform specific checks */
8080 #define __IPHONE_OS_VERSION_MIN_REQUIRED 110000
8181 #endif
......@@ -90,14 +90,14 @@
9090#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
9191 /* make sure a default max version is set */
9292 #ifndef __MAC_OS_X_VERSION_MAX_ALLOWED
93 #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_13_1
93 #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_13_3
9494 #endif
9595#endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */
9696
9797#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
9898 /* make sure a default max version is set */
9999 #ifndef __IPHONE_OS_VERSION_MAX_ALLOWED
100 #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_16_2
100 #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_16_4
101101 #endif
102102 /* make sure a valid min is set */
103103 #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0
lib/libc/include/any-macos.13-any/AvailabilityMacros.h+3-2
......@@ -123,6 +123,7 @@
123123#define MAC_OS_VERSION_12_0 120000
124124#define MAC_OS_VERSION_13_0 130000
125125#define MAC_OS_VERSION_13_1 130100
126#define MAC_OS_VERSION_13_3 130300
126127
127128/*
128129 * If min OS not specified, assume 10.4 for intel
......@@ -149,10 +150,10 @@
149150 * if max OS not specified, assume larger of (10.15, min)
150151 */
151152#ifndef MAC_OS_X_VERSION_MAX_ALLOWED
152 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_13_1
153 #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_13_3
153154 #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED
154155 #else
155 #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_13_1
156 #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_13_3
156157 #endif
157158#endif
158159
lib/libc/include/any-macos.13-any/AvailabilityVersions.h+8
......@@ -69,6 +69,8 @@
6969#define __MAC_12_3 120300
7070#define __MAC_13_0 130000
7171#define __MAC_13_1 130100
72#define __MAC_13_2 130200
73#define __MAC_13_3 130300
7274/* __MAC_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */
7375
7476#define __IPHONE_2_0 20000
......@@ -134,6 +136,8 @@
134136#define __IPHONE_16_0 160000
135137#define __IPHONE_16_1 160100
136138#define __IPHONE_16_2 160200
139#define __IPHONE_16_3 160300
140#define __IPHONE_16_4 160400
137141/* __IPHONE_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */
138142
139143#define __TVOS_9_0 90000
......@@ -172,6 +176,8 @@
172176#define __TVOS_16_0 160000
173177#define __TVOS_16_1 160100
174178#define __TVOS_16_2 160200
179#define __TVOS_16_3 160300
180#define __TVOS_16_4 160400
175181
176182#define __WATCHOS_1_0 10000
177183#define __WATCHOS_2_0 20000
......@@ -207,6 +213,8 @@
207213#define __WATCHOS_9_0 90000
208214#define __WATCHOS_9_1 90100
209215#define __WATCHOS_9_2 90200
216#define __WATCHOS_9_3 90300
217#define __WATCHOS_9_4 90400
210218
211219/*
212220 * Set up standard Mac OS X versions
lib/libc/include/any-macos.13-any/Block.h+7-2
......@@ -18,7 +18,12 @@
1818# endif
1919#endif
2020
21#if __has_include(<Availability.h>)
2122#include <Availability.h>
23#else
24#define __OSX_AVAILABLE_STARTING(m,i)
25#endif
26
2227#include <TargetConditionals.h>
2328#include <sys/cdefs.h>
2429
......@@ -58,8 +63,8 @@ BLOCK_EXPORT void * _NSConcreteStackBlock[32]
5863
5964// Type correct macros
6065
61#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
62#define Block_release(...) _Block_release((const void *)(__VA_ARGS__))
66#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy(__unsafe_forge_single(const void *, (const void *)(__VA_ARGS__))))
67#define Block_release(...) _Block_release(__unsafe_forge_single(const void *, (const void *)(__VA_ARGS__)))
6368
6469
6570#endif
\ No newline at end of file
lib/libc/include/any-macos.13-any/libkern/OSKextLib.h created+572
......@@ -0,0 +1,572 @@
1/*
2 * Copyright (c) 2008 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#ifndef _LIBKERN_OSKEXTLIB_H
30#define _LIBKERN_OSKEXTLIB_H
31
32#include <sys/cdefs.h>
33__BEGIN_DECLS
34
35#include <stdint.h>
36#include <mach/kmod.h>
37#include <mach/vm_types.h>
38#include <uuid/uuid.h>
39
40#include <libkern/OSReturn.h>
41
42/*!
43 * @header
44 *
45 * Declares functions, basic return values, and other constants
46 * related to kernel extensions (kexts).
47 */
48
49#if PRAGMA_MARK
50#pragma mark -
51/********************************************************************/
52#pragma mark OSReturn Values for Kernel Extensions
53/********************************************************************/
54#endif
55/*!
56 * @group OSReturn Values for Kernel Extensions
57 * Many kext-related functions return these values,
58 * as well as those defined under
59 * <code>@link //apple_ref/c/tdef/OSReturn OSReturn@/link</code>
60 * and other variants of <code>kern_return_t</code>.
61 */
62
63
64#define sub_libkern_kext err_sub(2)
65#define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code))
66
67
68/*!
69 * @define kOSKextReturnInternalError
70 * @abstract An internal error in the kext library.
71 * Contrast with <code>@link //apple_ref/c/econst/OSReturnError
72 * OSReturnError@/link</code>.
73 */
74#define kOSKextReturnInternalError libkern_kext_err(0x1)
75
76/*!
77 * @define kOSKextReturnNoMemory
78 * @abstract Memory allocation failed.
79 */
80#define kOSKextReturnNoMemory libkern_kext_err(0x2)
81
82/*!
83 * @define kOSKextReturnNoResources
84 * @abstract Some resource other than memory (such as available load tags)
85 * is exhausted.
86 */
87#define kOSKextReturnNoResources libkern_kext_err(0x3)
88
89/*!
90 * @define kOSKextReturnNotPrivileged
91 * @abstract The caller lacks privileges to perform the requested operation.
92 */
93#define kOSKextReturnNotPrivileged libkern_kext_err(0x4)
94
95/*!
96 * @define kOSKextReturnInvalidArgument
97 * @abstract Invalid argument.
98 */
99#define kOSKextReturnInvalidArgument libkern_kext_err(0x5)
100
101/*!
102 * @define kOSKextReturnNotFound
103 * @abstract Search item not found.
104 */
105#define kOSKextReturnNotFound libkern_kext_err(0x6)
106
107/*!
108 * @define kOSKextReturnBadData
109 * @abstract Malformed data (not used for XML).
110 */
111#define kOSKextReturnBadData libkern_kext_err(0x7)
112
113/*!
114 * @define kOSKextReturnSerialization
115 * @abstract Error converting or (un)serializing URL, string, or XML.
116 */
117#define kOSKextReturnSerialization libkern_kext_err(0x8)
118
119/*!
120 * @define kOSKextReturnUnsupported
121 * @abstract Operation is no longer or not yet supported.
122 */
123#define kOSKextReturnUnsupported libkern_kext_err(0x9)
124
125/*!
126 * @define kOSKextReturnDisabled
127 * @abstract Operation is currently disabled.
128 */
129#define kOSKextReturnDisabled libkern_kext_err(0xa)
130
131/*!
132 * @define kOSKextReturnNotAKext
133 * @abstract Bundle is not a kernel extension.
134 */
135#define kOSKextReturnNotAKext libkern_kext_err(0xb)
136
137/*!
138 * @define kOSKextReturnValidation
139 * @abstract Validation failures encountered; check diagnostics for details.
140 */
141#define kOSKextReturnValidation libkern_kext_err(0xc)
142
143/*!
144 * @define kOSKextReturnAuthentication
145 * @abstract Authetication failures encountered; check diagnostics for details.
146 */
147#define kOSKextReturnAuthentication libkern_kext_err(0xd)
148
149/*!
150 * @define kOSKextReturnDependencies
151 * @abstract Dependency resolution failures encountered; check diagnostics for details.
152 */
153#define kOSKextReturnDependencies libkern_kext_err(0xe)
154
155/*!
156 * @define kOSKextReturnArchNotFound
157 * @abstract Kext does not contain code for the requested architecture.
158 */
159#define kOSKextReturnArchNotFound libkern_kext_err(0xf)
160
161/*!
162 * @define kOSKextReturnCache
163 * @abstract An error occurred processing a system kext cache.
164 */
165#define kOSKextReturnCache libkern_kext_err(0x10)
166
167/*!
168 * @define kOSKextReturnDeferred
169 * @abstract Operation has been posted asynchronously to user space (kernel only).
170 */
171#define kOSKextReturnDeferred libkern_kext_err(0x11)
172
173/*!
174 * @define kOSKextReturnBootLevel
175 * @abstract Kext not loadable or operation not allowed at current boot level.
176 */
177#define kOSKextReturnBootLevel libkern_kext_err(0x12)
178
179/*!
180 * @define kOSKextReturnNotLoadable
181 * @abstract Kext cannot be loaded; check diagnostics for details.
182 */
183#define kOSKextReturnNotLoadable libkern_kext_err(0x13)
184
185/*!
186 * @define kOSKextReturnLoadedVersionDiffers
187 * @abstract A different version (or executable UUID, or executable by checksum)
188 * of the requested kext is already loaded.
189 */
190#define kOSKextReturnLoadedVersionDiffers libkern_kext_err(0x14)
191
192/*!
193 * @define kOSKextReturnDependencyLoadError
194 * @abstract A load error occurred on a dependency of the kext being loaded.
195 */
196#define kOSKextReturnDependencyLoadError libkern_kext_err(0x15)
197
198/*!
199 * @define kOSKextReturnLinkError
200 * @abstract A link failure occured with this kext or a dependency.
201 */
202#define kOSKextReturnLinkError libkern_kext_err(0x16)
203
204/*!
205 * @define kOSKextReturnStartStopError
206 * @abstract The kext start or stop routine returned an error.
207 */
208#define kOSKextReturnStartStopError libkern_kext_err(0x17)
209
210/*!
211 * @define kOSKextReturnInUse
212 * @abstract The kext is currently in use or has outstanding references,
213 * and cannot be unloaded.
214 */
215#define kOSKextReturnInUse libkern_kext_err(0x18)
216
217/*!
218 * @define kOSKextReturnTimeout
219 * @abstract A kext request has timed out.
220 */
221#define kOSKextReturnTimeout libkern_kext_err(0x19)
222
223/*!
224 * @define kOSKextReturnStopping
225 * @abstract The kext is in the process of stopping; requests cannot be made.
226 */
227#define kOSKextReturnStopping libkern_kext_err(0x1a)
228
229/*!
230 * @define kOSKextReturnSystemPolicy
231 * @abstract The kext was prevented from loading due to system policy.
232 */
233#define kOSKextReturnSystemPolicy libkern_kext_err(0x1b)
234
235/*!
236 * @define kOSKextReturnKCLoadFailure
237 * @abstract Loading of the System KC failed
238 */
239#define kOSKextReturnKCLoadFailure libkern_kext_err(0x1c)
240
241/*!
242 * @define kOSKextReturnKCLoadFailureSystemKC
243 * @abstract Loading of the System KC failed
244 *
245 * This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
246 * with: kOSKextReturnKCLoadFailureAuxKC
247 *
248 * If both the System and Aux KCs fail to load, then the error code will be:
249 * libkern_kext_err(0x1f)
250 */
251#define kOSKextReturnKCLoadFailureSystemKC libkern_kext_err(0x1d)
252
253/*!
254 * @define kOSKextReturnKCLoadFailureAuxKC
255 * @abstract Loading of the Aux KC failed
256 *
257 * This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
258 * with: kOSKextReturnKCLoadFailureSystemKC
259 *
260 * If both the System and Aux KCs fail to load, then the error code will be:
261 * libkern_kext_err(0x1f)
262 */
263#define kOSKextReturnKCLoadFailureAuxKC libkern_kext_err(0x1e)
264
265/* next available error is: libkern_kext_err(0x20) */
266
267#if PRAGMA_MARK
268#pragma mark -
269/********************************************************************/
270#pragma mark Kext/OSBundle Property List Keys
271/********************************************************************/
272#endif
273/*!
274 * @group Kext Property List Keys
275 * These constants cover CFBundle properties defined for kernel extensions.
276 * Because they are used in the kernel, if you want to use one with
277 * CFBundle APIs you'll need to wrap it in a <code>CFSTR()</code> macro.
278 */
279
280
281/*!
282 * @define kOSBundleCompatibleVersionKey
283 * @abstract A string giving the backwards-compatible version of a library kext
284 * in extended Mac OS 'vers' format (####.##.##s{1-255} where 's'
285 * is a build stage 'd', 'a', 'b', 'f' or 'fc').
286 */
287#define kOSBundleCompatibleVersionKey "OSBundleCompatibleVersion"
288
289/*!
290 * @define kOSBundleEnableKextLoggingKey
291 * @abstract Set to true to have the kernel kext logging spec applied
292 * to the kext.
293 * See <code>@link //apple_ref/c/econst/OSKextLogSpec
294 * OSKextLogSpec@/link</code>.
295 */
296#define kOSBundleEnableKextLoggingKey "OSBundleEnableKextLogging"
297
298/*!
299 * @define kOSBundleIsInterfaceKey
300 * @abstract A boolean value indicating whether the kext executable
301 * contains only symbol references.
302 */
303#define kOSBundleIsInterfaceKey "OSBundleIsInterface"
304
305/*!
306 * @define kOSBundleLibrariesKey
307 * @abstract A dictionary listing link dependencies for this kext.
308 * Keys are bundle identifiers, values are version strings.
309 */
310#define kOSBundleLibrariesKey "OSBundleLibraries"
311
312/*!
313 * @define kOSBundleRequiredKey
314 * @abstract A string indicating in which kinds of startup this kext
315 * may need to load during early startup (before
316 * <code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>).
317 * @discussion
318 * The value is one of:
319 * <ul>
320 * <li>@link kOSBundleRequiredRoot "OSBundleRequiredRoot"@/link</li>
321 * <li>@link kOSBundleRequiredLocalRoot "OSBundleRequiredLocalRoot"@/link</li>
322 * <li>@link kOSBundleRequiredNetworkRoot "OSBundleRequiredNetworkRoot"@/link</li>
323 * <li>@link kOSBundleRequiredSafeBoot "OSBundleRequiredSafeBoot"@/link</li>
324 * <li>@link kOSBundleRequiredConsole "OSBundleRequiredConsole"@/link</li>
325 * </ul>
326 *
327 * Use this property judiciously.
328 * Every kext that declares a value other than "OSBundleRequiredSafeBoot"
329 * increases startup time, as the booter must read it into memory,
330 * or startup kext caches must include it.
331 */
332#define kOSBundleRequiredKey "OSBundleRequired"
333
334/*!
335 * @define kOSBundleRequireExplicitLoadKey
336 * @abstract A boolean value indicating whether the kext requires an
337 * explicit kextload in order to start/match.
338 */
339#define kOSBundleRequireExplicitLoadKey "OSBundleRequireExplicitLoad"
340
341/*!
342 * @define kOSBundleAllowUserLoadKey
343 * @abstract A boolean value indicating whether
344 * <code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>
345 * will honor a non-root process's request to load a kext.
346 * @discussion
347 * See <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithURL
348 * KextManagerLoadKextWithURL@/link</code>
349 * and <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithIdentifier
350 * KextManagerLoadKextWithIdentifier@/link</code>.
351 */
352#define kOSBundleAllowUserLoadKey "OSBundleAllowUserLoad"
353
354/*!
355 * @define kOSBundleAllowUserTerminateKey
356 * @abstract A boolean value indicating whether the kextunload tool
357 * is allowed to issue IOService terminate to classes defined in this kext.
358 * @discussion A boolean value indicating whether the kextunload tool
359 * is allowed to issue IOService terminate to classes defined in this kext.
360 */
361#define kOSBundleAllowUserTerminateKey "OSBundleAllowUserTerminate"
362
363/*!
364 * @define kOSKernelResourceKey
365 * @abstract A boolean value indicating whether the kext represents a built-in
366 * component of the kernel.
367 */
368#define kOSKernelResourceKey "OSKernelResource"
369
370/*!
371 * @define kOSKextVariantOverrideKey
372 * @abstract A dictionary with target names as key and a target-specific variant
373 * name as value.
374 */
375#define kOSKextVariantOverrideKey "OSKextVariantOverride"
376
377/*!
378 * @define kIOKitPersonalitiesKey
379 * @abstract A dictionary of dictionaries used in matching for I/O Kit drivers.
380 */
381#define kIOKitPersonalitiesKey "IOKitPersonalities"
382
383/*
384 * @define kIOPersonalityPublisherKey
385 * @abstract Used in personalities sent to the I/O Kit,
386 * contains the CFBundleIdentifier of the kext
387 * that the personality originated in.
388 */
389#define kIOPersonalityPublisherKey "IOPersonalityPublisher"
390
391#if CONFIG_KEC_FIPS
392/*
393 * @define kAppleTextHashesKey
394 * @abstract A dictionary conataining hashes for corecrypto kext.
395 */
396#define kAppleTextHashesKey "AppleTextHashes"
397#endif
398
399/*!
400 * @define kOSMutableSegmentCopy
401 * @abstract A boolean value indicating whether the kext requires a copy of
402 * its mutable segments to be kept in memory, and then reset when the kext
403 * unloads. This should be used with caution as it will increase the
404 * amount of memory used by the kext.
405 */
406#define kOSMutableSegmentCopy "OSMutableSegmentCopy"
407
408
409#if PRAGMA_MARK
410/********************************************************************/
411#pragma mark Kext/OSBundle Property Deprecated Keys
412/********************************************************************/
413#endif
414/*
415 * @define kOSBundleDebugLevelKey
416 * @abstract
417 * Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard).
418 * Value is an integer from 1-6, corresponding to the verbose levels
419 * of kext tools on those releases.
420 * On 10.6 Snow Leopard, use <code>@link OSKextEnableKextLogging
421 * OSKextEnableKextLogging@/link</code>.
422 */
423#define kOSBundleDebugLevelKey "OSBundleDebugLevel"
424
425/*!
426 * @define kOSBundleSharedExecutableIdentifierKey
427 * @abstract Deprecated (used on some releases of Mac OS X
428 * prior to 10.6 Snow Leopard).
429 * Value is the bundle identifier of the pseudokext
430 * that contains an executable shared by this kext.
431 */
432#define kOSBundleSharedExecutableIdentifierKey "OSBundleSharedExecutableIdentifier"
433
434
435#if PRAGMA_MARK
436/********************************************************************/
437#pragma mark Kext/OSBundle Property List Values
438/********************************************************************/
439#endif
440
441/*!
442 * @group Kext Property List Values
443 * These constants encompass established values
444 * for kernel extension bundle properties.
445 */
446
447/*!
448 * @define kOSKextKernelIdentifier
449 * @abstract
450 * This is the CFBundleIdentifier user for the kernel itself.
451 */
452#define kOSKextKernelIdentifier "__kernel__"
453
454
455/*!
456 * @define kOSKextBundlePackageTypeKext
457 * @abstract
458 * The bundle type value for Kernel Extensions.
459 */
460#define kOSKextBundlePackageTypeKext "KEXT"
461
462/*!
463 * @define kOSKextBundlePackageTypeDriverKit
464 * @abstract
465 * The bundle type value for Driver Extensions.
466 */
467#define kOSKextBundlePackageTypeDriverKit "DEXT"
468
469/*!
470 * @define kOSBundleRequiredRoot
471 * @abstract
472 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
473 * value indicates that the kext may be needed to mount the root filesystem
474 * whether starting from a local or a network volume.
475 */
476#define kOSBundleRequiredRoot "Root"
477
478/*!
479 * @define kOSBundleRequiredLocalRoot
480 * @abstract
481 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
482 * value indicates that the kext may be needed to mount the root filesystem
483 * when starting from a local disk.
484 */
485#define kOSBundleRequiredLocalRoot "Local-Root"
486
487/*!
488 * @define kOSBundleRequiredNetworkRoot
489 * @abstract
490 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
491 * value indicates that the kext may be needed to mount the root filesystem
492 * when starting over a network connection.
493 */
494#define kOSBundleRequiredNetworkRoot "Network-Root"
495
496/*!
497 * @define kOSBundleRequiredSafeBoot
498 * @abstract
499 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
500 * value indicates that the kext can be loaded during a safe startup.
501 * This value does not normally cause the kext to be read by the booter
502 * or included in startup kext caches.
503 */
504#define kOSBundleRequiredSafeBoot "Safe Boot"
505
506/*!
507 * @define kOSBundleRequiredConsole
508 * @abstract
509 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
510 * value indicates that the kext may be needed for console access
511 * (specifically in a single-user startup when
512 * <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code>.
513 * does not run)
514 * and should be loaded during early startup.
515 */
516#define kOSBundleRequiredConsole "Console"
517
518/*!
519 * @define kOSBundleRequiredDriverKit
520 * @abstract
521 * This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
522 * value indicates that the driver extension's (DriverKit driver's)
523 * personalities must be present in the kernel at early boot (specifically
524 * before <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code> starts)
525 * in order to compete with kexts built into the prelinkedkernel. Note that
526 * kextd is still required to launch the user space driver binary. The IOKit
527 * matching will happen during early boot, and the actual driver launch
528 * will happen after kextd starts.
529 */
530#define kOSBundleRequiredDriverKit "DriverKit"
531
532#if PRAGMA_MARK
533#pragma mark -
534/********************************************************************/
535#pragma mark Kext Information
536/********************************************************************/
537#endif
538/*!
539 * @group Kext Information
540 * Types, constants, and macros providing a kext with information
541 * about itself.
542 */
543
544/*!
545 * @typedef OSKextLoadTag
546 *
547 * @abstract
548 * A unique identifier assigned to a loaded instanace of a kext.
549 *
550 * @discussion
551 * If a kext is unloaded and later reloaded, the new instance
552 * has a different load tag.
553 *
554 * A kext can get its own load tag in the <code>kmod_info_t</code>
555 * structure passed into its module start routine, as the
556 * <code>id</code> field (cast to this type).
557 */
558typedef uint32_t OSKextLoadTag;
559
560/*!
561 * @define kOSKextInvalidLoadTag
562 *
563 * @abstract
564 * A load tag value that will never be used for a loaded kext;
565 * indicates kext not found.
566 */
567#define kOSKextInvalidLoadTag ((OSKextLoadTag)(-1))
568
569
570__END_DECLS
571
572#endif /* _LIBKERN_OSKEXTLIB_H */
\ No newline at end of file
lib/libc/include/any-macos.13-any/mach-o/arm64/reloc.h created+254
......@@ -0,0 +1,254 @@
1/*
2 * Copyright (c) 2010 Apple Computer, 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
24#ifndef _MACHO_ARM64_RELOC_H_
25#define _MACHO_ARM64_RELOC_H_
26
27/*
28 * Relocations for arm64 are a bit different than for other architectures in
29 * Mach-O: Scattered relocations are not used. Almost all relocations produced
30 * by the compiler are external relocations. An external relocation has the
31 * r_extern bit set to 1 and the r_symbolnum field contains the symbol table
32 * index of the target label.
33 *
34 * When the assembler is generating relocations, if the target label is a local
35 * label (begins with 'L'), then the previous non-local label in the same
36 * section is used as the target of the external relocation. An addend is used
37 * with the distance from that non-local label to the target label. Only when
38 * there is no previous non-local label in the section is an internal
39 * relocation used.
40 *
41 * The addend (i.e. the 4 in _foo+4) is encoded either in the instruction or
42 * in the r_symbolnum of ARM64_RELOC_ADDEND.
43 * For ARM64_RELOC_UNSIGNED and ARM64_RELOC_AUTHENTICATED_POINTER, the addend
44 * is stored in the instruction. ARM64_RELOC_PAGE21, ARM64_RELOC_PAGEOFF12 and
45 * ARM64_RELOC_BRANCH26 must be preceded by an ARM64_RELOC_ADDEND if they need
46 * an addend. No other relocations support addends.
47 *
48 * The relocation types are:
49 *
50 * ARM64_RELOC_UNSIGNED // For pointer sized fixups
51 * ARM64_RELOC_SUBTRACTOR // must be followed by a ARM64_RELOC_UNSIGNED
52 * ARM64_RELOC_BRANCH26 // a BL instruction with pc-relative +-128MB displacement
53 * ARM64_RELOC_PAGE21 // pc-rel distance to page of target
54 * ARM64_RELOC_PAGEOFF12 // offset within page, scaled by r_length
55 * ARM64_RELOC_GOT_LOAD_PAGE21 // load with a pc-rel distance to page of a GOT entry
56 * ARM64_RELOC_GOT_LOAD_PAGEOFF12 // load with an offset within page, scaled by r_length, of GOT entry
57 * ARM64_RELOC_POINTER_TO_GOT // 32-bit pc-rel (or 64-bit absolute) offset to a GOT entry
58 * ARM64_RELOC_TLVP_LOAD_PAGE21 // tlv load with a pc-rel distance to page of a GOT entry
59 * ARM64_RELOC_TLVP_LOAD_PAGEOFF12 // tlv load with an offset within page, scaled by r_length, of GOT entry
60 * ARM64_RELOC_ADDEND // must be followed by ARM64_RELOC_BRANCH26/ARM64_RELOC_PAGE21/ARM64_RELOC_PAGEOFF12
61 * ARM64_RELOC_AUTHENTICATED_POINTER // 64-bit pointer with authentication
62 *
63 * The following are sample assembly instructions, followed by the relocation
64 * and section content they generate in an object file:
65 *
66 * (arm64_32 only)
67 * .long _foo
68 * r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
69 * 00 00 00 00
70 *
71 * (arm64_32 only)
72 * .long _foo + 4
73 * r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
74 * 04 00 00 00
75 *
76 * .quad _foo
77 * r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
78 * 00 00 00 00 00 00 00 00
79 *
80 * .quad _foo + 16
81 * r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
82 * 10 00 00 00 00 00 00 00
83 *
84 * .quad L1
85 * r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
86 * 10 00 00 00 00 00 00 00
87 * // assumes _prev is the first non-local label 0x10 bytes before L1
88 * 10 00 00 00 00 00 00 00
89 *
90 * (arm64_32 only)
91 * .long _foo - _bar
92 * r_type=ARM64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_bar
93 * r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
94 * 00 00 00 00
95 *
96 * (arm64_32 only)
97 * .long _foo - _bar + 4
98 * r_type=ARM64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_bar
99 * r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
100 * 04 00 00 00
101 *
102 * .quad _foo - _bar
103 * r_type=ARM64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_bar
104 * r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
105 * 00 00 00 00 00 00 00 00
106 *
107 * .quad _foo - _bar + 4
108 * r_type=ARM64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_bar
109 * r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
110 * 04 00 00 00 00 00 00 00
111 *
112 * .long _foo - .
113 * r_type=ARM64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_prev
114 * r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
115 * f8 ff ff ff
116 * // assumes _prev is the first non-local label 0x8 bytes before this
117 * // .quad
118 *
119 * .long _foo - L1
120 * r_type=ARM64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_prev
121 * r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
122 * f8 ff ff ff
123 * // assumes _prev is the first non-local label 0x8 bytes before L1
124 *
125 * .quad _foo - .
126 * r_type=ARM64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
127 * r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
128 * f8 ff ff ff ff ff ff ff
129 * // assumes _prev is the first non-local label 0x8 bytes before this
130 * // .quad
131 *
132 * .quad _foo - L1
133 * r_type=ARM64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
134 * r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
135 * f8 ff ff ff ff ff ff ff
136 * // assumes _prev is the first non-local label 0x8 bytes before L1
137 *
138 * .long L1 - _prev
139 * // No relocations. This is an assembly time constant.
140 * 12 00 00 00 00 00 00 00
141 * // assumes _prev is the first non-local label 0x12 bytes before L1
142 *
143 * .quad L1 - _prev
144 * // No relocations. This is an assembly time constant.
145 * 12 00 00 00 00 00 00 00
146 * // assumes _prev is the first non-local label 0x12 bytes before L1
147 *
148 * bl _foo
149 * r_type=ARM64_RELOC_BRANCH26, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
150 * 0x14000000
151 *
152 * bl _foo + 4
153 * r_type=ARM64_RELOC_ADDEND, r_length=2, r_extern=0, r_pcrel=0, r_symbolnum=0x000004
154 * r_type=ARM64_RELOC_BRANCH26, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
155 * 0x14000000
156 *
157 * adrp x0, _foo@PAGE
158 * r_type=ARM64_RELOC_PAGE21, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
159 * 0x90000000
160 *
161 * ldr x0, [x0, _foo@PAGEOFF]
162 * r_type=ARM64_RELOC_PAGEOFF12, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
163 * 0xf9400000
164 *
165 * adrp x0, _foo@PAGE + 0x24
166 * r_type=ARM64_RELOC_ADDEND, r_length=2, r_extern=0, r_pcrel=0, r_symbolnum=0x000024
167 * r_type=ARM64_RELOC_PAGE21, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
168 * 0x90000000
169 *
170 * ldr x0, [x0, _foo@PAGEOFF + 0x24]
171 * r_type=ARM64_RELOC_ADDEND, r_length=2, r_extern=0, r_pcrel=0, r_symbolnum=0x000024
172 * r_type=ARM64_RELOC_PAGEOFF12, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
173 * 0xf9400000
174 *
175 * adrp x0, _foo@GOTPAGE
176 * r_type=ARM64_RELOC_GOT_LOAD_PAGE21, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
177 * 0x90000000
178 *
179 * ldr x0, [x0, _foo@GOTPAGEOFF]
180 * r_type=ARM64_RELOC_GOT_LOAD_PAGEOFF12, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
181 * 0xf9400000
182 *
183 * adrp x0, _foo@TLVPPAGE
184 * r_type=ARM64_RELOC_TLVP_LOAD_PAGE21, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
185 * 0x90000000
186 *
187 * ldr x0, [x0, _foo@TLVPPAGEOFF]
188 * r_type=ARM64_RELOC_TLVP_LOAD_PAGEOFF12, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
189 * 0xf9400000
190 *
191 * .long _foo@GOT - .
192 * r_type=ARM64_RELOC_POINTER_TO_GOT, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
193 * 00 00 00 00
194 *
195 * (arm64_32 only)
196 * .long _foo@GOT
197 * r_type=ARM64_RELOC_POINTER_TO_GOT, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
198 * 00 00 00 00
199 *
200 * .quad _foo@GOT
201 * r_type=ARM64_RELOC_POINTER_TO_GOT, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
202 * 00 00 00 00 00 00 00 00
203 *
204 * (arm64e only)
205 * .quad _foo@AUTH(da,5,addr)
206 * r_type=ARM64_RELOC_AUTHENTICATED_POINTER, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
207 * 00 00 00 00 05 00 05 80
208 *
209 * (arm64e only)
210 * .quad (_foo + 0x10)@AUTH(da,5,addr)
211 * r_type=ARM64_RELOC_AUTHENTICATED_POINTER, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
212 * 10 00 00 00 05 00 05 80
213 *
214 *
215 */
216enum reloc_type_arm64
217{
218 ARM64_RELOC_UNSIGNED, // for pointers
219 ARM64_RELOC_SUBTRACTOR, // must be followed by a ARM64_RELOC_UNSIGNED
220 ARM64_RELOC_BRANCH26, // a B/BL instruction with 26-bit displacement
221 ARM64_RELOC_PAGE21, // pc-rel distance to page of target
222 ARM64_RELOC_PAGEOFF12, // offset within page, scaled by r_length
223 ARM64_RELOC_GOT_LOAD_PAGE21, // pc-rel distance to page of GOT slot
224 ARM64_RELOC_GOT_LOAD_PAGEOFF12, // offset within page of GOT slot,
225 // scaled by r_length
226 ARM64_RELOC_POINTER_TO_GOT, // for pointers to GOT slots
227 ARM64_RELOC_TLVP_LOAD_PAGE21, // pc-rel distance to page of TLVP slot
228 ARM64_RELOC_TLVP_LOAD_PAGEOFF12, // offset within page of TLVP slot,
229 // scaled by r_length
230 ARM64_RELOC_ADDEND, // must be followed by PAGE21 or PAGEOFF12
231
232 // An arm64e authenticated pointer.
233 //
234 // Represents a pointer to a symbol (like ARM64_RELOC_UNSIGNED).
235 // Additionally, the resulting pointer is signed. The signature is
236 // specified in the target location: the addend is restricted to the lower
237 // 32 bits (instead of the full 64 bits for ARM64_RELOC_UNSIGNED):
238 //
239 // |63|62|61-51|50-49| 48 |47 - 32|31 - 0|
240 // | 1| 0| 0 | key | addr | discriminator | addend |
241 //
242 // The key is one of:
243 // IA: 00 IB: 01
244 // DA: 10 DB: 11
245 //
246 // The discriminator field is used as extra signature diversification.
247 //
248 // The addr field indicates whether the target address should be blended
249 // into the discriminator.
250 //
251 ARM64_RELOC_AUTHENTICATED_POINTER,
252};
253
254#endif /* #ifndef _MACHO_ARM64_RELOC_H_ */
\ No newline at end of file
lib/libc/include/any-macos.13-any/mach-o/compact_unwind_encoding.h created+532
......@@ -0,0 +1,532 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//
8// Darwin's alternative to DWARF based unwind encodings.
9//
10//===----------------------------------------------------------------------===//
11
12
13#ifndef __COMPACT_UNWIND_ENCODING__
14#define __COMPACT_UNWIND_ENCODING__
15
16#include <stdint.h>
17
18//
19// Compilers can emit standard DWARF FDEs in the __TEXT,__eh_frame section
20// of object files. Or compilers can emit compact unwind information in
21// the __LD,__compact_unwind section.
22//
23// When the linker creates a final linked image, it will create a
24// __TEXT,__unwind_info section. This section is a small and fast way for the
25// runtime to access unwind info for any given function. If the compiler
26// emitted compact unwind info for the function, that compact unwind info will
27// be encoded in the __TEXT,__unwind_info section. If the compiler emitted
28// DWARF unwind info, the __TEXT,__unwind_info section will contain the offset
29// of the FDE in the __TEXT,__eh_frame section in the final linked image.
30//
31// Note: Previously, the linker would transform some DWARF unwind infos into
32// compact unwind info. But that is fragile and no longer done.
33
34
35//
36// The compact unwind endoding is a 32-bit value which encoded in an
37// architecture specific way, which registers to restore from where, and how
38// to unwind out of the function.
39//
40typedef uint32_t compact_unwind_encoding_t;
41
42
43// architecture independent bits
44enum {
45 UNWIND_IS_NOT_FUNCTION_START = 0x80000000,
46 UNWIND_HAS_LSDA = 0x40000000,
47 UNWIND_PERSONALITY_MASK = 0x30000000,
48};
49
50
51
52
53//
54// x86
55//
56// 1-bit: start
57// 1-bit: has lsda
58// 2-bit: personality index
59//
60// 4-bits: 0=old, 1=ebp based, 2=stack-imm, 3=stack-ind, 4=DWARF
61// ebp based:
62// 15-bits (5*3-bits per reg) register permutation
63// 8-bits for stack offset
64// frameless:
65// 8-bits stack size
66// 3-bits stack adjust
67// 3-bits register count
68// 10-bits register permutation
69//
70enum {
71 UNWIND_X86_MODE_MASK = 0x0F000000,
72 UNWIND_X86_MODE_EBP_FRAME = 0x01000000,
73 UNWIND_X86_MODE_STACK_IMMD = 0x02000000,
74 UNWIND_X86_MODE_STACK_IND = 0x03000000,
75 UNWIND_X86_MODE_DWARF = 0x04000000,
76
77 UNWIND_X86_EBP_FRAME_REGISTERS = 0x00007FFF,
78 UNWIND_X86_EBP_FRAME_OFFSET = 0x00FF0000,
79
80 UNWIND_X86_FRAMELESS_STACK_SIZE = 0x00FF0000,
81 UNWIND_X86_FRAMELESS_STACK_ADJUST = 0x0000E000,
82 UNWIND_X86_FRAMELESS_STACK_REG_COUNT = 0x00001C00,
83 UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF,
84
85 UNWIND_X86_DWARF_SECTION_OFFSET = 0x00FFFFFF,
86};
87
88enum {
89 UNWIND_X86_REG_NONE = 0,
90 UNWIND_X86_REG_EBX = 1,
91 UNWIND_X86_REG_ECX = 2,
92 UNWIND_X86_REG_EDX = 3,
93 UNWIND_X86_REG_EDI = 4,
94 UNWIND_X86_REG_ESI = 5,
95 UNWIND_X86_REG_EBP = 6,
96};
97
98//
99// For x86 there are four modes for the compact unwind encoding:
100// UNWIND_X86_MODE_EBP_FRAME:
101// EBP based frame where EBP is push on stack immediately after return address,
102// then ESP is moved to EBP. Thus, to unwind ESP is restored with the current
103// EPB value, then EBP is restored by popping off the stack, and the return
104// is done by popping the stack once more into the pc.
105// All non-volatile registers that need to be restored must have been saved
106// in a small range in the stack that starts EBP-4 to EBP-1020. The offset/4
107// is encoded in the UNWIND_X86_EBP_FRAME_OFFSET bits. The registers saved
108// are encoded in the UNWIND_X86_EBP_FRAME_REGISTERS bits as five 3-bit entries.
109// Each entry contains which register to restore.
110// UNWIND_X86_MODE_STACK_IMMD:
111// A "frameless" (EBP not used as frame pointer) function with a small
112// constant stack size. To return, a constant (encoded in the compact
113// unwind encoding) is added to the ESP. Then the return is done by
114// popping the stack into the pc.
115// All non-volatile registers that need to be restored must have been saved
116// on the stack immediately after the return address. The stack_size/4 is
117// encoded in the UNWIND_X86_FRAMELESS_STACK_SIZE (max stack size is 1024).
118// The number of registers saved is encoded in UNWIND_X86_FRAMELESS_STACK_REG_COUNT.
119// UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION constains which registers were
120// saved and their order.
121// UNWIND_X86_MODE_STACK_IND:
122// A "frameless" (EBP not used as frame pointer) function large constant
123// stack size. This case is like the previous, except the stack size is too
124// large to encode in the compact unwind encoding. Instead it requires that
125// the function contains "subl $nnnnnnnn,ESP" in its prolog. The compact
126// encoding contains the offset to the nnnnnnnn value in the function in
127// UNWIND_X86_FRAMELESS_STACK_SIZE.
128// UNWIND_X86_MODE_DWARF:
129// No compact unwind encoding is available. Instead the low 24-bits of the
130// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
131// This mode is never used in object files. It is only generated by the
132// linker in final linked images which have only DWARF unwind info for a
133// function.
134//
135// The permutation encoding is a Lehmer code sequence encoded into a
136// single variable-base number so we can encode the ordering of up to
137// six registers in a 10-bit space.
138//
139// The following is the algorithm used to create the permutation encoding used
140// with frameless stacks. It is passed the number of registers to be saved and
141// an array of the register numbers saved.
142//
143//uint32_t permute_encode(uint32_t registerCount, const uint32_t registers[6])
144//{
145// uint32_t renumregs[6];
146// for (int i=6-registerCount; i < 6; ++i) {
147// int countless = 0;
148// for (int j=6-registerCount; j < i; ++j) {
149// if ( registers[j] < registers[i] )
150// ++countless;
151// }
152// renumregs[i] = registers[i] - countless -1;
153// }
154// uint32_t permutationEncoding = 0;
155// switch ( registerCount ) {
156// case 6:
157// permutationEncoding |= (120*renumregs[0] + 24*renumregs[1]
158// + 6*renumregs[2] + 2*renumregs[3]
159// + renumregs[4]);
160// break;
161// case 5:
162// permutationEncoding |= (120*renumregs[1] + 24*renumregs[2]
163// + 6*renumregs[3] + 2*renumregs[4]
164// + renumregs[5]);
165// break;
166// case 4:
167// permutationEncoding |= (60*renumregs[2] + 12*renumregs[3]
168// + 3*renumregs[4] + renumregs[5]);
169// break;
170// case 3:
171// permutationEncoding |= (20*renumregs[3] + 4*renumregs[4]
172// + renumregs[5]);
173// break;
174// case 2:
175// permutationEncoding |= (5*renumregs[4] + renumregs[5]);
176// break;
177// case 1:
178// permutationEncoding |= (renumregs[5]);
179// break;
180// }
181// return permutationEncoding;
182//}
183//
184
185
186
187
188//
189// x86_64
190//
191// 1-bit: start
192// 1-bit: has lsda
193// 2-bit: personality index
194//
195// 4-bits: 0=old, 1=rbp based, 2=stack-imm, 3=stack-ind, 4=DWARF
196// rbp based:
197// 15-bits (5*3-bits per reg) register permutation
198// 8-bits for stack offset
199// frameless:
200// 8-bits stack size
201// 3-bits stack adjust
202// 3-bits register count
203// 10-bits register permutation
204//
205enum {
206 UNWIND_X86_64_MODE_MASK = 0x0F000000,
207 UNWIND_X86_64_MODE_RBP_FRAME = 0x01000000,
208 UNWIND_X86_64_MODE_STACK_IMMD = 0x02000000,
209 UNWIND_X86_64_MODE_STACK_IND = 0x03000000,
210 UNWIND_X86_64_MODE_DWARF = 0x04000000,
211
212 UNWIND_X86_64_RBP_FRAME_REGISTERS = 0x00007FFF,
213 UNWIND_X86_64_RBP_FRAME_OFFSET = 0x00FF0000,
214
215 UNWIND_X86_64_FRAMELESS_STACK_SIZE = 0x00FF0000,
216 UNWIND_X86_64_FRAMELESS_STACK_ADJUST = 0x0000E000,
217 UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT = 0x00001C00,
218 UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF,
219
220 UNWIND_X86_64_DWARF_SECTION_OFFSET = 0x00FFFFFF,
221};
222
223enum {
224 UNWIND_X86_64_REG_NONE = 0,
225 UNWIND_X86_64_REG_RBX = 1,
226 UNWIND_X86_64_REG_R12 = 2,
227 UNWIND_X86_64_REG_R13 = 3,
228 UNWIND_X86_64_REG_R14 = 4,
229 UNWIND_X86_64_REG_R15 = 5,
230 UNWIND_X86_64_REG_RBP = 6,
231};
232//
233// For x86_64 there are four modes for the compact unwind encoding:
234// UNWIND_X86_64_MODE_RBP_FRAME:
235// RBP based frame where RBP is push on stack immediately after return address,
236// then RSP is moved to RBP. Thus, to unwind RSP is restored with the current
237// EPB value, then RBP is restored by popping off the stack, and the return
238// is done by popping the stack once more into the pc.
239// All non-volatile registers that need to be restored must have been saved
240// in a small range in the stack that starts RBP-8 to RBP-2040. The offset/8
241// is encoded in the UNWIND_X86_64_RBP_FRAME_OFFSET bits. The registers saved
242// are encoded in the UNWIND_X86_64_RBP_FRAME_REGISTERS bits as five 3-bit entries.
243// Each entry contains which register to restore.
244// UNWIND_X86_64_MODE_STACK_IMMD:
245// A "frameless" (RBP not used as frame pointer) function with a small
246// constant stack size. To return, a constant (encoded in the compact
247// unwind encoding) is added to the RSP. Then the return is done by
248// popping the stack into the pc.
249// All non-volatile registers that need to be restored must have been saved
250// on the stack immediately after the return address. The stack_size/8 is
251// encoded in the UNWIND_X86_64_FRAMELESS_STACK_SIZE (max stack size is 2048).
252// The number of registers saved is encoded in UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT.
253// UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION constains which registers were
254// saved and their order.
255// UNWIND_X86_64_MODE_STACK_IND:
256// A "frameless" (RBP not used as frame pointer) function large constant
257// stack size. This case is like the previous, except the stack size is too
258// large to encode in the compact unwind encoding. Instead it requires that
259// the function contains "subq $nnnnnnnn,RSP" in its prolog. The compact
260// encoding contains the offset to the nnnnnnnn value in the function in
261// UNWIND_X86_64_FRAMELESS_STACK_SIZE.
262// UNWIND_X86_64_MODE_DWARF:
263// No compact unwind encoding is available. Instead the low 24-bits of the
264// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
265// This mode is never used in object files. It is only generated by the
266// linker in final linked images which have only DWARF unwind info for a
267// function.
268//
269
270
271// ARM64
272//
273// 1-bit: start
274// 1-bit: has lsda
275// 2-bit: personality index
276//
277// 4-bits: 4=frame-based, 3=DWARF, 2=frameless
278// frameless:
279// 12-bits of stack size
280// frame-based:
281// 4-bits D reg pairs saved
282// 5-bits X reg pairs saved
283// DWARF:
284// 24-bits offset of DWARF FDE in __eh_frame section
285//
286enum {
287 UNWIND_ARM64_MODE_MASK = 0x0F000000,
288 UNWIND_ARM64_MODE_FRAMELESS = 0x02000000,
289 UNWIND_ARM64_MODE_DWARF = 0x03000000,
290 UNWIND_ARM64_MODE_FRAME = 0x04000000,
291
292 UNWIND_ARM64_FRAME_X19_X20_PAIR = 0x00000001,
293 UNWIND_ARM64_FRAME_X21_X22_PAIR = 0x00000002,
294 UNWIND_ARM64_FRAME_X23_X24_PAIR = 0x00000004,
295 UNWIND_ARM64_FRAME_X25_X26_PAIR = 0x00000008,
296 UNWIND_ARM64_FRAME_X27_X28_PAIR = 0x00000010,
297 UNWIND_ARM64_FRAME_D8_D9_PAIR = 0x00000100,
298 UNWIND_ARM64_FRAME_D10_D11_PAIR = 0x00000200,
299 UNWIND_ARM64_FRAME_D12_D13_PAIR = 0x00000400,
300 UNWIND_ARM64_FRAME_D14_D15_PAIR = 0x00000800,
301
302 UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK = 0x00FFF000,
303 UNWIND_ARM64_DWARF_SECTION_OFFSET = 0x00FFFFFF,
304};
305// For arm64 there are three modes for the compact unwind encoding:
306// UNWIND_ARM64_MODE_FRAME:
307// This is a standard arm64 prolog where FP/LR are immediately pushed on the
308// stack, then SP is copied to FP. If there are any non-volatile registers
309// saved, then are copied into the stack frame in pairs in a contiguous
310// range right below the saved FP/LR pair. Any subset of the five X pairs
311// and four D pairs can be saved, but the memory layout must be in register
312// number order.
313// UNWIND_ARM64_MODE_FRAMELESS:
314// A "frameless" leaf function, where FP/LR are not saved. The return address
315// remains in LR throughout the function. If any non-volatile registers
316// are saved, they must be pushed onto the stack before any stack space is
317// allocated for local variables. The stack sized (including any saved
318// non-volatile registers) divided by 16 is encoded in the bits
319// UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK.
320// UNWIND_ARM64_MODE_DWARF:
321// No compact unwind encoding is available. Instead the low 24-bits of the
322// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
323// This mode is never used in object files. It is only generated by the
324// linker in final linked images which have only DWARF unwind info for a
325// function.
326//
327
328
329#ifndef __OPEN_SOURCE__
330//
331// armv7k
332//
333// 1-bit: start
334// 1-bit: has lsda
335// 2-bit: personality index
336//
337// 4-bits: 1=frame, 2=frame+dregs, 4=dwarf
338//
339enum {
340 UNWIND_ARM_MODE_MASK = 0x0F000000,
341 UNWIND_ARM_MODE_FRAME = 0x01000000,
342 UNWIND_ARM_MODE_FRAME_D = 0x02000000,
343 UNWIND_ARM_MODE_DWARF = 0x04000000,
344
345 UNWIND_ARM_FRAME_STACK_ADJUST_MASK = 0x00C00000,
346
347 UNWIND_ARM_FRAME_FIRST_PUSH_R4 = 0x00000001,
348 UNWIND_ARM_FRAME_FIRST_PUSH_R5 = 0x00000002,
349 UNWIND_ARM_FRAME_FIRST_PUSH_R6 = 0x00000004,
350
351 UNWIND_ARM_FRAME_SECOND_PUSH_R8 = 0x00000008,
352 UNWIND_ARM_FRAME_SECOND_PUSH_R9 = 0x00000010,
353 UNWIND_ARM_FRAME_SECOND_PUSH_R10 = 0x00000020,
354 UNWIND_ARM_FRAME_SECOND_PUSH_R11 = 0x00000040,
355 UNWIND_ARM_FRAME_SECOND_PUSH_R12 = 0x00000080,
356
357 UNWIND_ARM_FRAME_D_REG_COUNT_MASK = 0x00000700,
358
359 UNWIND_ARM_DWARF_SECTION_OFFSET = 0x00FFFFFF,
360};
361// For armv7k there are three modes for the compact unwind encoding:
362// UNWIND_ARM_MODE_FRAME:
363// This is a standard arm prolog where lr/r7 are immediately pushed on the
364// stack. As part of that first push r4, r5, or r6 can be also pushed
365// and if so the FIRST_PUSH bit is set in the compact unwind. Additionally
366// there can be a second push multiple which can save r8 through r12.
367// If that is used, the registers saved is recorded with a SECOND_PUSH bit.
368// Lastly, for var-args support, the prolog may save r1, r2, r3 to the
369// stack before the frame push. If that is done the STACK_ADJUST_MASK
370// records that the stack pointer must be adjust (e.g 0x00800000 means
371// the stack pointer was adjusted 8 bytes down and the unwinder would
372// need to add back 8 bytes to SP when unwinding through this function.
373// UNWIND_ARM_MODE_FRAME_D:
374// This is the same as UNWIND_ARM_MODE_FRAME, except that additionally
375// some D registers were saved. The D_REG_COUNT_MASK contains which
376// set if D registers were saved and where. There are currently 8 (0-7)
377// possible D register save patterns supported.
378// UNWIND_ARM_MODE_DWARF:
379// No compact unwind encoding is available. Instead the low 24-bits of the
380// compact encoding is the offset of the dwarf FDE in the __eh_frame section.
381// The offset only exists in final linked images. It is zero in object files.
382#endif
383
384
385
386
387
388////////////////////////////////////////////////////////////////////////////////
389//
390// Relocatable Object Files: __LD,__compact_unwind
391//
392////////////////////////////////////////////////////////////////////////////////
393
394//
395// A compiler can generated compact unwind information for a function by adding
396// a "row" to the __LD,__compact_unwind section. This section has the
397// S_ATTR_DEBUG bit set, so the section will be ignored by older linkers.
398// It is removed by the new linker, so never ends up in final executables.
399// This section is a table, initially with one row per function (that needs
400// unwind info). The table columns and some conceptual entries are:
401//
402// range-start pointer to start of function/range
403// range-length
404// compact-unwind-encoding 32-bit encoding
405// personality-function or zero if no personality function
406// lsda or zero if no LSDA data
407//
408// The length and encoding fields are 32-bits. The other are all pointer sized.
409//
410// In x86_64 assembly, these entry would look like:
411//
412// .section __LD,__compact_unwind,regular,debug
413//
414// #compact unwind for _foo
415// .quad _foo
416// .set L1,LfooEnd-_foo
417// .long L1
418// .long 0x01010001
419// .quad 0
420// .quad 0
421//
422// #compact unwind for _bar
423// .quad _bar
424// .set L2,LbarEnd-_bar
425// .long L2
426// .long 0x01020011
427// .quad __gxx_personality
428// .quad except_tab1
429//
430//
431// Notes: There is no need for any labels in the the __compact_unwind section.
432// The use of the .set directive is to force the evaluation of the
433// range-length at assembly time, instead of generating relocations.
434//
435// To support future compiler optimizations where which non-volatile registers
436// are saved changes within a function (e.g. delay saving non-volatiles until
437// necessary), there can by multiple lines in the __compact_unwind table for one
438// function, each with a different (non-overlapping) range and each with
439// different compact unwind encodings that correspond to the non-volatiles
440// saved at that range of the function.
441//
442// If a particular function is so wacky that there is no compact unwind way
443// to encode it, then the compiler can emit traditional DWARF unwind info.
444// The runtime will use which ever is available.
445//
446// Runtime support for compact unwind encodings are only available on 10.6
447// and later. So, the compiler should not generate it when targeting pre-10.6.
448
449
450
451
452////////////////////////////////////////////////////////////////////////////////
453//
454// Final Linked Images: __TEXT,__unwind_info
455//
456////////////////////////////////////////////////////////////////////////////////
457
458//
459// The __TEXT,__unwind_info section is laid out for an efficient two level lookup.
460// The header of the section contains a coarse index that maps function address
461// to the page (4096 byte block) containing the unwind info for that function.
462//
463
464#define UNWIND_SECTION_VERSION 1
465struct unwind_info_section_header
466{
467 uint32_t version; // UNWIND_SECTION_VERSION
468 uint32_t commonEncodingsArraySectionOffset;
469 uint32_t commonEncodingsArrayCount;
470 uint32_t personalityArraySectionOffset;
471 uint32_t personalityArrayCount;
472 uint32_t indexSectionOffset;
473 uint32_t indexCount;
474 // compact_unwind_encoding_t[]
475 // uint32_t personalities[]
476 // unwind_info_section_header_index_entry[]
477 // unwind_info_section_header_lsda_index_entry[]
478};
479
480struct unwind_info_section_header_index_entry
481{
482 uint32_t functionOffset;
483 uint32_t secondLevelPagesSectionOffset; // section offset to start of regular or compress page
484 uint32_t lsdaIndexArraySectionOffset; // section offset to start of lsda_index array for this range
485};
486
487struct unwind_info_section_header_lsda_index_entry
488{
489 uint32_t functionOffset;
490 uint32_t lsdaOffset;
491};
492
493//
494// There are two kinds of second level index pages: regular and compressed.
495// A compressed page can hold up to 1021 entries, but it cannot be used
496// if too many different encoding types are used. The regular page holds
497// 511 entries.
498//
499
500struct unwind_info_regular_second_level_entry
501{
502 uint32_t functionOffset;
503 compact_unwind_encoding_t encoding;
504};
505
506#define UNWIND_SECOND_LEVEL_REGULAR 2
507struct unwind_info_regular_second_level_page_header
508{
509 uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR
510 uint16_t entryPageOffset;
511 uint16_t entryCount;
512 // entry array
513};
514
515#define UNWIND_SECOND_LEVEL_COMPRESSED 3
516struct unwind_info_compressed_second_level_page_header
517{
518 uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED
519 uint16_t entryPageOffset;
520 uint16_t entryCount;
521 uint16_t encodingsPageOffset;
522 uint16_t encodingsCount;
523 // 32-bit entry array
524 // encodings array
525};
526
527#define UNWIND_INFO_COMPRESSED_ENTRY_FUNC_OFFSET(entry) (entry & 0x00FFFFFF)
528#define UNWIND_INFO_COMPRESSED_ENTRY_ENCODING_INDEX(entry) ((entry >> 24) & 0xFF)
529
530
531
532#endif
\ No newline at end of file
lib/libc/include/any-macos.13-any/mach-o/fat.h+7-4
......@@ -42,7 +42,10 @@
4242 * and contains the constants for the possible values of these types.
4343 */
4444#include <stdint.h>
45
46#if __has_include(<mach/machine.h>)
4547#include <mach/machine.h>
48#endif
4649
4750#if __has_include(<architecture/byte_order.h>)
4851#include <architecture/byte_order.h>
......@@ -57,8 +60,8 @@ struct fat_header {
5760};
5861
5962struct fat_arch {
60 cpu_type_t cputype; /* cpu specifier (int) */
61 cpu_subtype_t cpusubtype; /* machine specifier (int) */
63 int32_t cputype; /* cpu specifier (int) */
64 int32_t cpusubtype; /* machine specifier (int) */
6265 uint32_t offset; /* file offset to this object file */
6366 uint32_t size; /* size of this object file */
6467 uint32_t align; /* alignment as a power of 2 */
......@@ -75,8 +78,8 @@ struct fat_arch {
7578#define FAT_CIGAM_64 0xbfbafeca /* NXSwapLong(FAT_MAGIC_64) */
7679
7780struct fat_arch_64 {
78 cpu_type_t cputype; /* cpu specifier (int) */
79 cpu_subtype_t cpusubtype; /* machine specifier (int) */
81 int32_t cputype; /* cpu specifier (int) */
82 int32_t cpusubtype; /* machine specifier (int) */
8083 uint64_t offset; /* file offset to this object file */
8184 uint64_t size; /* size of this object file */
8285 uint32_t align; /* alignment as a power of 2 */
lib/libc/include/any-macos.13-any/mach/mach_host.h+2-2
......@@ -297,7 +297,7 @@ extern
297297#endif /* mig_external */
298298kern_return_t mach_zone_info
299299(
300 host_priv_t host,
300 mach_port_t host,
301301 mach_zone_name_array_t *names,
302302 mach_msg_type_number_t *namesCnt,
303303 mach_zone_info_array_t *info,
......@@ -385,7 +385,7 @@ extern
385385#endif /* mig_external */
386386kern_return_t mach_memory_info
387387(
388 host_priv_t host,
388 mach_port_t host,
389389 mach_zone_name_array_t *names,
390390 mach_msg_type_number_t *namesCnt,
391391 mach_zone_info_array_t *info,
lib/libc/include/any-macos.13-any/mach/mach_types.h+6-2
......@@ -217,8 +217,12 @@ typedef clock_ctrl_t clock_ctrl_port_t;
217217typedef exception_handler_t exception_port_t;
218218typedef exception_handler_array_t exception_port_arrary_t;
219219typedef char vfs_path_t[4096];
220typedef char nspace_path_t[1024]; /* 1024 == PATH_MAX */
221typedef char nspace_name_t[1024]; /* 1024 == PATH_MAX */
220/*
221 * 8K, c.f. FSGETPATH_MAXBUFLEN in bsd/vfs/vfs_syscalls.c.
222 * These types should NEVER be allocated on the stack.
223 */
224typedef char nspace_path_t[8192];
225typedef char nspace_name_t[8192];
222226
223227#define TASK_NULL ((task_t) 0)
224228#define TASK_NAME_NULL ((task_name_t) 0)
lib/libc/include/any-macos.13-any/mach/port.h+1
......@@ -400,6 +400,7 @@ enum mach_port_guard_exception_codes {
400400 kGUARD_EXC_MOD_REFS = 2,
401401 kGUARD_EXC_INVALID_OPTIONS = 3,
402402 kGUARD_EXC_SET_CONTEXT = 4,
403 kGUARD_EXC_THREAD_SET_STATE = 5,
403404 kGUARD_EXC_UNGUARDED = 1u << 3,
404405 kGUARD_EXC_INCORRECT_GUARD = 1u << 4,
405406 kGUARD_EXC_IMMOVABLE = 1u << 5,
lib/libc/include/any-macos.13-any/mach/vm_statistics.h+4-1
......@@ -284,11 +284,12 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
284284#define VM_FLAGS_RETURN_4K_DATA_ADDR 0x00800000 /* Return 4K aligned address of target data */
285285#define VM_FLAGS_ALIAS_MASK 0xFF000000
286286#define VM_GET_FLAGS_ALIAS(flags, alias) \
287 (alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24
287 (alias) = (((flags) >> 24) & 0xff)
288288#define VM_SET_FLAGS_ALIAS(flags, alias) \
289289 (flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) | \
290290 (((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
291291
292
292293/* These are the flags that we accept from user-space */
293294#define VM_FLAGS_USER_ALLOCATE (VM_FLAGS_FIXED | \
294295 VM_FLAGS_ANYWHERE | \
......@@ -301,9 +302,11 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
301302 VM_FLAGS_SUPERPAGE_MASK | \
302303 VM_FLAGS_TPRO | \
303304 VM_FLAGS_ALIAS_MASK)
305
304306#define VM_FLAGS_USER_MAP (VM_FLAGS_USER_ALLOCATE | \
305307 VM_FLAGS_RETURN_4K_DATA_ADDR | \
306308 VM_FLAGS_RETURN_DATA_ADDR)
309
307310#define VM_FLAGS_USER_REMAP (VM_FLAGS_FIXED | \
308311 VM_FLAGS_ANYWHERE | \
309312 VM_FLAGS_RANDOM_ADDR | \
lib/libc/include/any-macos.13-any/mach/vm_types.h+1-1
......@@ -66,7 +66,7 @@ typedef uint32_t reg64_t;
6666 * addresses (that are page aligned) as 32-bit page numbers.
6767 * This limits the physical address space to 16TB of RAM.
6868 */
69typedef uint32_t ppnum_t; /* Physical page number */
69typedef uint32_t ppnum_t __kernel_ptr_semantics; /* Physical page number */
7070#define PPNUM_MAX UINT32_MAX
7171
7272
lib/libc/include/any-macos.13-any/net/if_var.h+1
......@@ -75,6 +75,7 @@
7575#endif
7676
7777
78
7879#ifdef __APPLE__
7980#define APPLE_IF_FAM_LOOPBACK 1
8081#define APPLE_IF_FAM_ETHERNET 2
lib/libc/include/any-macos.13-any/objc/NSObject.h created+115
......@@ -0,0 +1,115 @@
1/* NSObject.h
2 Copyright (c) 1994-2012, Apple Inc. All rights reserved.
3*/
4
5#ifndef _OBJC_NSOBJECT_H_
6#define _OBJC_NSOBJECT_H_
7
8#if __OBJC__
9
10#include <objc/objc.h>
11#include <objc/NSObjCRuntime.h>
12
13@class NSString, NSMethodSignature, NSInvocation;
14
15@protocol NSObject
16
17- (BOOL)isEqual:(id)object;
18@property (readonly) NSUInteger hash;
19
20@property (readonly) Class superclass;
21- (Class)class OBJC_SWIFT_UNAVAILABLE("use 'type(of: anObject)' instead");
22- (instancetype)self;
23
24- (id)performSelector:(SEL)aSelector;
25- (id)performSelector:(SEL)aSelector withObject:(id)object;
26- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
27
28- (BOOL)isProxy;
29
30- (BOOL)isKindOfClass:(Class)aClass;
31- (BOOL)isMemberOfClass:(Class)aClass;
32- (BOOL)conformsToProtocol:(Protocol *)aProtocol;
33
34- (BOOL)respondsToSelector:(SEL)aSelector;
35
36- (instancetype)retain OBJC_ARC_UNAVAILABLE;
37- (oneway void)release OBJC_ARC_UNAVAILABLE;
38- (instancetype)autorelease OBJC_ARC_UNAVAILABLE;
39- (NSUInteger)retainCount OBJC_ARC_UNAVAILABLE;
40
41- (struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
42
43@property (readonly, copy) NSString *description;
44@optional
45@property (readonly, copy) NSString *debugDescription;
46
47@end
48
49
50OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
51OBJC_ROOT_CLASS
52OBJC_EXPORT
53@interface NSObject <NSObject> {
54#pragma clang diagnostic push
55#pragma clang diagnostic ignored "-Wobjc-interface-ivars"
56 Class isa OBJC_ISA_AVAILABILITY;
57#pragma clang diagnostic pop
58}
59
60#pragma clang diagnostic push
61#pragma clang diagnostic ignored "-Wobjc-load-method"
62+ (void)load;
63#pragma clang diagnostic pop
64
65+ (void)initialize;
66- (instancetype)init
67#if NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER
68 NS_DESIGNATED_INITIALIZER
69#endif
70 ;
71
72+ (instancetype)new OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
73+ (instancetype)allocWithZone:(struct _NSZone *)zone OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
74+ (instancetype)alloc OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
75- (void)dealloc OBJC_SWIFT_UNAVAILABLE("use 'deinit' to define a de-initializer");
76
77- (void)finalize OBJC_DEPRECATED("Objective-C garbage collection is no longer supported");
78
79- (id)copy;
80- (id)mutableCopy;
81
82+ (id)copyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
83+ (id)mutableCopyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
84
85+ (BOOL)instancesRespondToSelector:(SEL)aSelector;
86+ (BOOL)conformsToProtocol:(Protocol *)protocol;
87- (IMP)methodForSelector:(SEL)aSelector;
88+ (IMP)instanceMethodForSelector:(SEL)aSelector;
89- (void)doesNotRecognizeSelector:(SEL)aSelector;
90
91- (id)forwardingTargetForSelector:(SEL)aSelector OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
92- (void)forwardInvocation:(NSInvocation *)anInvocation OBJC_SWIFT_UNAVAILABLE("");
93- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE("");
94
95+ (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE("");
96
97- (BOOL)allowsWeakReference UNAVAILABLE_ATTRIBUTE;
98- (BOOL)retainWeakReference UNAVAILABLE_ATTRIBUTE;
99
100+ (BOOL)isSubclassOfClass:(Class)aClass;
101
102+ (BOOL)resolveClassMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
103+ (BOOL)resolveInstanceMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
104
105+ (NSUInteger)hash;
106+ (Class)superclass;
107+ (Class)class OBJC_SWIFT_UNAVAILABLE("use 'aClass.self' instead");
108+ (NSString *)description;
109+ (NSString *)debugDescription;
110
111@end
112
113#endif
114
115#endif
\ No newline at end of file
lib/libc/include/any-macos.13-any/objc/runtime.h+12-10
......@@ -542,7 +542,7 @@ class_getInstanceMethod(Class _Nullable cls, SEL _Nonnull name)
542542 *
543543 * @return A pointer to the \c Method data structure that corresponds to the implementation of the
544544 * selector specified by aSelector for the class specified by aClass, or NULL if the specified
545 * class or its superclasses do not contain an instance method with the specified selector.
545 * class or its superclasses do not contain a class method with the specified selector.
546546 *
547547 * @note Note that this function searches superclasses for implementations,
548548 * whereas \c class_copyMethodList does not.
......@@ -1898,6 +1898,17 @@ _objc_realizeClassFromSwift(Class _Nullable cls, void * _Nullable previously)
18981898
18991899struct objc_method_list;
19001900
1901/* Used for testing only */
1902
1903OBJC_EXPORT void
1904_objc_flush_caches(Class _Nullable cls)
1905 __OSX_DEPRECATED(10.0, 10.5, "not recommended")
1906 __IOS_DEPRECATED(2.0, 2.0, "not recommended")
1907 __TVOS_DEPRECATED(9.0, 9.0, "not recommended")
1908 __WATCHOS_DEPRECATED(1.0, 1.0, "not recommended")
1909
1910;
1911
19011912/* Obsolete functions */
19021913
19031914#if !0
......@@ -1919,15 +1930,6 @@ class_respondsToMethod(Class _Nullable cls, SEL _Nonnull sel)
19191930
19201931;
19211932
1922OBJC_EXPORT void
1923_objc_flush_caches(Class _Nullable cls)
1924 __OSX_DEPRECATED(10.0, 10.5, "not recommended")
1925 __IOS_DEPRECATED(2.0, 2.0, "not recommended")
1926 __TVOS_DEPRECATED(9.0, 9.0, "not recommended")
1927 __WATCHOS_DEPRECATED(1.0, 1.0, "not recommended")
1928
1929;
1930
19311933OBJC_EXPORT id _Nullable
19321934object_copyFromZone(id _Nullable anObject, size_t nBytes, void * _Nullable z)
19331935 OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE(10.0, 10.5, "use object_copy instead");
lib/libc/include/any-macos.13-any/simd/simd.h created+30
......@@ -0,0 +1,30 @@
1/* Copyright (c) 2014 Apple, Inc. All rights reserved.
2 *
3 * This header provides small vector (simd) and matrix types, and basic
4 * arithmetic and mathematical functions for them. The vast majority of these
5 * operations are implemented as header inlines, as they can be performed
6 * using just a few instructions on most processors.
7 *
8 * These functions are broken into two groups; vector and matrix. This header
9 * includes all of them, but these may also be included separately. Consult
10 * these two headers for detailed documentation of what types and operations
11 * are available.
12 */
13
14#ifndef __SIMD_HEADER__
15#define __SIMD_HEADER__
16
17#if __has_include(<realtime_safety/realtime_safety.h>)
18#include <realtime_safety/realtime_safety.h>
19REALTIME_SAFE_BEGIN
20#endif
21
22#include <simd/vector.h>
23#include <simd/matrix.h>
24#include <simd/quaternion.h>
25
26#if __has_include(<realtime_safety/realtime_safety.h>)
27REALTIME_SAFE_END
28#endif
29
30#endif
\ No newline at end of file
lib/libc/include/any-macos.13-any/sys/_symbol_aliasing.h+24
......@@ -389,6 +389,18 @@
389389#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_2(x)
390390#endif
391391
392#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 160300
393#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_3(x) x
394#else
395#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_3(x)
396#endif
397
398#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 160400
399#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_4(x) x
400#else
401#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_4(x)
402#endif
403
392404#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1000
393405#define __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x) x
394406#else
......@@ -645,4 +657,16 @@
645657#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_1(x) x
646658#else
647659#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_1(x)
660#endif
661
662#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 130200
663#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_2(x) x
664#else
665#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_2(x)
666#endif
667
668#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 130300
669#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_3(x) x
670#else
671#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_3(x)
648672#endif
\ No newline at end of file
lib/libc/include/any-macos.13-any/sys/attr.h created+594
......@@ -0,0 +1,594 @@
1/*
2 * Copyright (c) 2000-2018 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/*
30 * attr.h - attribute data structures and interfaces
31 *
32 * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved.
33 */
34
35#ifndef _SYS_ATTR_H_
36#define _SYS_ATTR_H_
37
38#include <sys/appleapiopts.h>
39
40#ifdef __APPLE_API_UNSTABLE
41#include <sys/types.h>
42#include <sys/ucred.h>
43#include <sys/time.h>
44#include <sys/cdefs.h>
45
46#define FSOPT_NOFOLLOW 0x00000001
47#define FSOPT_NOINMEMUPDATE 0x00000002
48#define FSOPT_REPORT_FULLSIZE 0x00000004
49/* The following option only valid when requesting ATTR_CMN_RETURNED_ATTRS */
50#define FSOPT_PACK_INVAL_ATTRS 0x00000008
51
52
53#define FSOPT_ATTR_CMN_EXTENDED 0x00000020
54#define FSOPT_RETURN_REALDEV 0x00000200
55#define FSOPT_NOFOLLOW_ANY 0x00000800
56
57/* we currently aren't anywhere near this amount for a valid
58 * fssearchblock.sizeofsearchparams1 or fssearchblock.sizeofsearchparams2
59 * but we put a sanity check in to avoid abuse of the value passed in from
60 * user land.
61 */
62#define SEARCHFS_MAX_SEARCHPARMS 4096
63
64typedef u_int32_t text_encoding_t;
65
66typedef u_int32_t fsobj_type_t;
67
68typedef u_int32_t fsobj_tag_t;
69
70typedef u_int32_t fsfile_type_t;
71
72typedef u_int32_t fsvolid_t;
73
74#include <sys/_types/_fsobj_id_t.h> /* file object id type */
75
76typedef u_int32_t attrgroup_t;
77
78struct attrlist {
79 u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */
80 u_int16_t reserved; /* (to maintain 4-byte alignment) */
81 attrgroup_t commonattr; /* common attribute group */
82 attrgroup_t volattr; /* Volume attribute group */
83 attrgroup_t dirattr; /* directory attribute group */
84 attrgroup_t fileattr; /* file attribute group */
85 attrgroup_t forkattr; /* fork attribute group */
86};
87
88#define ATTR_BIT_MAP_COUNT 5
89
90typedef struct attribute_set {
91 attrgroup_t commonattr; /* common attribute group */
92 attrgroup_t volattr; /* Volume attribute group */
93 attrgroup_t dirattr; /* directory attribute group */
94 attrgroup_t fileattr; /* file attribute group */
95 attrgroup_t forkattr; /* fork attribute group */
96} attribute_set_t;
97
98#define ATTRIBUTE_SET_INIT(a) do {(a)->commonattr = (a)->volattr = (a)->dirattr = (a)->fileattr = (a)->forkattr = 0; } while(0)
99
100
101typedef struct attrreference {
102 int32_t attr_dataoffset;
103 u_int32_t attr_length;
104} attrreference_t;
105
106/* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */
107
108struct diskextent {
109 u_int32_t startblock; /* first block allocated */
110 u_int32_t blockcount; /* number of blocks allocated */
111};
112
113typedef struct diskextent extentrecord[8];
114
115typedef u_int32_t vol_capabilities_set_t[4];
116
117#define VOL_CAPABILITIES_FORMAT 0
118#define VOL_CAPABILITIES_INTERFACES 1
119#define VOL_CAPABILITIES_RESERVED1 2
120#define VOL_CAPABILITIES_RESERVED2 3
121
122typedef struct vol_capabilities_attr {
123 vol_capabilities_set_t capabilities;
124 vol_capabilities_set_t valid;
125} vol_capabilities_attr_t;
126
127/*
128 * XXX this value needs to be raised - 3893388
129 */
130#define ATTR_MAX_BUFFER 8192
131
132/*
133 * VOL_CAP_FMT_PERSISTENTOBJECTIDS: When set, the volume has object IDs
134 * that are persistent (retain their values even when the volume is
135 * unmounted and remounted), and a file or directory can be looked up
136 * by ID. Volumes that support VolFS and can support Carbon File ID
137 * references should set this bit.
138 *
139 * VOL_CAP_FMT_SYMBOLICLINKS: When set, the volume supports symbolic
140 * links. The symlink(), readlink(), and lstat() calls all use this
141 * symbolic link.
142 *
143 * VOL_CAP_FMT_HARDLINKS: When set, the volume supports hard links.
144 * The link() call creates hard links.
145 *
146 * VOL_CAP_FMT_JOURNAL: When set, the volume is capable of supporting
147 * a journal used to speed recovery in case of unplanned shutdown
148 * (such as a power outage or crash). This bit does not necessarily
149 * mean the volume is actively using a journal for recovery.
150 *
151 * VOL_CAP_FMT_JOURNAL_ACTIVE: When set, the volume is currently using
152 * a journal for use in speeding recovery after an unplanned shutdown.
153 * This bit can be set only if VOL_CAP_FMT_JOURNAL is also set.
154 *
155 * VOL_CAP_FMT_NO_ROOT_TIMES: When set, the volume format does not
156 * store reliable times for the root directory, so you should not
157 * depend on them to detect changes, etc.
158 *
159 * VOL_CAP_FMT_SPARSE_FILES: When set, the volume supports sparse files.
160 * That is, files which can have "holes" that have never been written
161 * to, and are not allocated on disk. Sparse files may have an
162 * allocated size that is less than the file's logical length.
163 *
164 * VOL_CAP_FMT_ZERO_RUNS: For security reasons, parts of a file (runs)
165 * that have never been written to must appear to contain zeroes. When
166 * this bit is set, the volume keeps track of allocated but unwritten
167 * runs of a file so that it can substitute zeroes without actually
168 * writing zeroes to the media. This provides performance similar to
169 * sparse files, but not the space savings.
170 *
171 * VOL_CAP_FMT_CASE_SENSITIVE: When set, file and directory names are
172 * case sensitive (upper and lower case are different). When clear,
173 * an upper case character is equivalent to a lower case character,
174 * and you can't have two names that differ solely in the case of
175 * the characters.
176 *
177 * VOL_CAP_FMT_CASE_PRESERVING: When set, file and directory names
178 * preserve the difference between upper and lower case. If clear,
179 * the volume may change the case of some characters (typically
180 * making them all upper or all lower case). A volume that sets
181 * VOL_CAP_FMT_CASE_SENSITIVE should also set VOL_CAP_FMT_CASE_PRESERVING.
182 *
183 * VOL_CAP_FMT_FAST_STATFS: This bit is used as a hint to upper layers
184 * (especially Carbon) that statfs() is fast enough that its results
185 * need not be cached by those upper layers. A volume that caches
186 * the statfs information in its in-memory structures should set this bit.
187 * A volume that must always read from disk or always perform a network
188 * transaction should not set this bit.
189 *
190 * VOL_CAP_FMT_2TB_FILESIZE: If this bit is set the volume format supports
191 * file sizes larger than 4GB, and potentially up to 2TB; it does not
192 * indicate whether the filesystem supports files larger than that.
193 *
194 * VOL_CAP_FMT_OPENDENYMODES: When set, the volume supports open deny
195 * modes (e.g. "open for read write, deny write"; effectively, mandatory
196 * file locking based on open modes).
197 *
198 * VOL_CAP_FMT_HIDDEN_FILES: When set, the volume supports the UF_HIDDEN
199 * file flag, and the UF_HIDDEN flag is mapped to that volume's native
200 * "hidden" or "invisible" bit (which may be the invisible bit from the
201 * Finder Info extended attribute).
202 *
203 * VOL_CAP_FMT_PATH_FROM_ID: When set, the volume supports the ability
204 * to derive a pathname to the root of the file system given only the
205 * id of an object. This also implies that object ids on this file
206 * system are persistent and not recycled. This is a very specialized
207 * capability and it is assumed that most file systems will not support
208 * it. Its use is for legacy non-posix APIs like ResolveFileIDRef.
209 *
210 * VOL_CAP_FMT_NO_VOLUME_SIZES: When set, the volume does not support
211 * returning values for total data blocks, available blocks, or free blocks
212 * (as in f_blocks, f_bavail, or f_bfree in "struct statfs"). Historically,
213 * those values were set to 0xFFFFFFFF for volumes that did not support them.
214 *
215 * VOL_CAP_FMT_DECMPFS_COMPRESSION: When set, the volume supports transparent
216 * decompression of compressed files using decmpfs.
217 *
218 * VOL_CAP_FMT_64BIT_OBJECT_IDS: When set, the volume uses object IDs that
219 * are 64-bit. This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the
220 * only legitimate attributes for obtaining object IDs from this volume and the
221 * 32-bit fid_objno fields of the fsobj_id_t returned by ATTR_CMN_OBJID,
222 * ATTR_CMN_OBJPERMID, and ATTR_CMN_PAROBJID are undefined.
223 *
224 * VOL_CAP_FMT_DIR_HARDLINKS: When set, the volume supports directory
225 * hard links.
226 *
227 * VOL_CAP_FMT_DOCUMENT_ID: When set, the volume supports document IDs
228 * (an ID which persists across object ID changes) for document revisions.
229 *
230 * VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write
231 * generation counts (a count of how many times an object has been modified)
232 *
233 * VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support
234 * setting the UF_IMMUTABLE flag.
235 *
236 * VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting
237 * permissions.
238 *
239 * VOL_CAP_FMT_SHARED_SPACE: When set, the volume supports sharing space with
240 * other filesystems i.e. multiple logical filesystems can exist in the same
241 * "partition". An implication of this is that the filesystem which sets
242 * this capability treats waitfor arguments to VFS_SYNC as bit flags.
243 *
244 * VOL_CAP_FMT_VOL_GROUPS: When set, this volume is part of a volume-group
245 * that implies multiple volumes must be mounted in order to boot and root the
246 * operating system. Typically, this means a read-only system volume and a
247 * writable data volume.
248 *
249 * VOL_CAP_FMT_SEALED: When set, this volume is cryptographically sealed.
250 * Any modifications to volume data or metadata will be detected and may
251 * render the volume unusable.
252 */
253#define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001
254#define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002
255#define VOL_CAP_FMT_HARDLINKS 0x00000004
256#define VOL_CAP_FMT_JOURNAL 0x00000008
257#define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010
258#define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020
259#define VOL_CAP_FMT_SPARSE_FILES 0x00000040
260#define VOL_CAP_FMT_ZERO_RUNS 0x00000080
261#define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100
262#define VOL_CAP_FMT_CASE_PRESERVING 0x00000200
263#define VOL_CAP_FMT_FAST_STATFS 0x00000400
264#define VOL_CAP_FMT_2TB_FILESIZE 0x00000800
265#define VOL_CAP_FMT_OPENDENYMODES 0x00001000
266#define VOL_CAP_FMT_HIDDEN_FILES 0x00002000
267#define VOL_CAP_FMT_PATH_FROM_ID 0x00004000
268#define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000
269#define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000
270#define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000
271#define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000
272#define VOL_CAP_FMT_DOCUMENT_ID 0x00080000
273#define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000
274#define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000
275#define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000
276#define VOL_CAP_FMT_SHARED_SPACE 0x00800000
277#define VOL_CAP_FMT_VOL_GROUPS 0x01000000
278#define VOL_CAP_FMT_SEALED 0x02000000
279
280/*
281 * VOL_CAP_INT_SEARCHFS: When set, the volume implements the
282 * searchfs() system call (the vnop_searchfs vnode operation).
283 *
284 * VOL_CAP_INT_ATTRLIST: When set, the volume implements the
285 * getattrlist() and setattrlist() system calls (vnop_getattrlist
286 * and vnop_setattrlist vnode operations) for the volume, files,
287 * and directories. The volume may or may not implement the
288 * readdirattr() system call. XXX Is there any minimum set
289 * of attributes that should be supported? To determine the
290 * set of supported attributes, get the ATTR_VOL_ATTRIBUTES
291 * attribute of the volume.
292 *
293 * VOL_CAP_INT_NFSEXPORT: When set, the volume implements exporting
294 * of NFS volumes.
295 *
296 * VOL_CAP_INT_READDIRATTR: When set, the volume implements the
297 * readdirattr() system call (vnop_readdirattr vnode operation).
298 *
299 * VOL_CAP_INT_EXCHANGEDATA: When set, the volume implements the
300 * exchangedata() system call (VNOP_EXCHANGE vnode operation).
301 *
302 * VOL_CAP_INT_COPYFILE: When set, the volume implements the
303 * VOP_COPYFILE vnode operation. (XXX There should be a copyfile()
304 * system call in <unistd.h>.)
305 *
306 * VOL_CAP_INT_ALLOCATE: When set, the volume implements the
307 * VNOP_ALLOCATE vnode operation, which means it implements the
308 * F_PREALLOCATE selector of fcntl(2).
309 *
310 * VOL_CAP_INT_VOL_RENAME: When set, the volume implements the
311 * ATTR_VOL_NAME attribute for both getattrlist() and setattrlist().
312 * The volume can be renamed by setting ATTR_VOL_NAME with setattrlist().
313 *
314 * VOL_CAP_INT_ADVLOCK: When set, the volume implements POSIX style
315 * byte range locks via vnop_advlock (accessible from fcntl(2)).
316 *
317 * VOL_CAP_INT_FLOCK: When set, the volume implements whole-file flock(2)
318 * style locks via vnop_advlock. This includes the O_EXLOCK and O_SHLOCK
319 * flags of the open(2) call.
320 *
321 * VOL_CAP_INT_EXTENDED_SECURITY: When set, the volume implements
322 * extended security (ACLs).
323 *
324 * VOL_CAP_INT_USERACCESS: When set, the volume supports the
325 * ATTR_CMN_USERACCESS attribute (used to get the user's access
326 * mode to the file).
327 *
328 * VOL_CAP_INT_MANLOCK: When set, the volume supports AFP-style
329 * mandatory byte range locks via an ioctl().
330 *
331 * VOL_CAP_INT_EXTENDED_ATTR: When set, the volume implements
332 * native extended attribues.
333 *
334 * VOL_CAP_INT_NAMEDSTREAMS: When set, the volume supports
335 * native named streams.
336 *
337 * VOL_CAP_INT_CLONE: When set, the volume supports clones.
338 *
339 * VOL_CAP_INT_SNAPSHOT: When set, the volume supports snapshots.
340 *
341 * VOL_CAP_INT_RENAME_SWAP: When set, the volume supports swapping
342 * file system objects.
343 *
344 * VOL_CAP_INT_RENAME_EXCL: When set, the volume supports an
345 * exclusive rename operation.
346 *
347 * VOL_CAP_INT_RENAME_OPENFAIL: When set, the volume may fail rename
348 * operations on files that are open.
349 */
350#define VOL_CAP_INT_SEARCHFS 0x00000001
351#define VOL_CAP_INT_ATTRLIST 0x00000002
352#define VOL_CAP_INT_NFSEXPORT 0x00000004
353#define VOL_CAP_INT_READDIRATTR 0x00000008
354#define VOL_CAP_INT_EXCHANGEDATA 0x00000010
355#define VOL_CAP_INT_COPYFILE 0x00000020
356#define VOL_CAP_INT_ALLOCATE 0x00000040
357#define VOL_CAP_INT_VOL_RENAME 0x00000080
358#define VOL_CAP_INT_ADVLOCK 0x00000100
359#define VOL_CAP_INT_FLOCK 0x00000200
360#define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400
361#define VOL_CAP_INT_USERACCESS 0x00000800
362#define VOL_CAP_INT_MANLOCK 0x00001000
363#define VOL_CAP_INT_NAMEDSTREAMS 0x00002000
364#define VOL_CAP_INT_EXTENDED_ATTR 0x00004000
365#define VOL_CAP_INT_CLONE 0x00010000
366#define VOL_CAP_INT_SNAPSHOT 0x00020000
367#define VOL_CAP_INT_RENAME_SWAP 0x00040000
368#define VOL_CAP_INT_RENAME_EXCL 0x00080000
369#define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000
370
371typedef struct vol_attributes_attr {
372 attribute_set_t validattr;
373 attribute_set_t nativeattr;
374} vol_attributes_attr_t;
375
376#define ATTR_CMN_NAME 0x00000001
377#define ATTR_CMN_DEVID 0x00000002
378#define ATTR_CMN_FSID 0x00000004
379#define ATTR_CMN_OBJTYPE 0x00000008
380#define ATTR_CMN_OBJTAG 0x00000010
381#define ATTR_CMN_OBJID 0x00000020
382#define ATTR_CMN_OBJPERMANENTID 0x00000040
383#define ATTR_CMN_PAROBJID 0x00000080
384#define ATTR_CMN_SCRIPT 0x00000100
385#define ATTR_CMN_CRTIME 0x00000200
386#define ATTR_CMN_MODTIME 0x00000400
387#define ATTR_CMN_CHGTIME 0x00000800
388#define ATTR_CMN_ACCTIME 0x00001000
389#define ATTR_CMN_BKUPTIME 0x00002000
390#define ATTR_CMN_FNDRINFO 0x00004000
391#define ATTR_CMN_OWNERID 0x00008000
392#define ATTR_CMN_GRPID 0x00010000
393#define ATTR_CMN_ACCESSMASK 0x00020000
394#define ATTR_CMN_FLAGS 0x00040000
395
396/* The following were defined as: */
397/* #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 */
398/* #define ATTR_CMN_NAMEDATTRLIST 0x00100000 */
399/* These bits have been salvaged for use as: */
400/* #define ATTR_CMN_GEN_COUNT 0x00080000 */
401/* #define ATTR_CMN_DOCUMENT_ID 0x00100000 */
402/* They can only be used with the FSOPT_ATTR_CMN_EXTENDED */
403/* option flag. */
404
405#define ATTR_CMN_GEN_COUNT 0x00080000
406#define ATTR_CMN_DOCUMENT_ID 0x00100000
407
408#define ATTR_CMN_USERACCESS 0x00200000
409#define ATTR_CMN_EXTENDED_SECURITY 0x00400000
410#define ATTR_CMN_UUID 0x00800000
411#define ATTR_CMN_GRPUUID 0x01000000
412#define ATTR_CMN_FILEID 0x02000000
413#define ATTR_CMN_PARENTID 0x04000000
414#define ATTR_CMN_FULLPATH 0x08000000
415#define ATTR_CMN_ADDEDTIME 0x10000000
416#define ATTR_CMN_ERROR 0x20000000
417#define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000
418
419/*
420 * ATTR_CMN_RETURNED_ATTRS is only valid with getattrlist(2) and
421 * getattrlistbulk(2). It is always the first attribute in the return buffer.
422 */
423#define ATTR_CMN_RETURNED_ATTRS 0x80000000
424
425#define ATTR_CMN_VALIDMASK 0xFFFFFFFF
426/*
427 * The settable ATTR_CMN_* attributes include the following:
428 * ATTR_CMN_SCRIPT
429 * ATTR_CMN_CRTIME
430 * ATTR_CMN_MODTIME
431 * ATTR_CMN_CHGTIME
432 *
433 * ATTR_CMN_ACCTIME
434 * ATTR_CMN_BKUPTIME
435 * ATTR_CMN_FNDRINFO
436 * ATTR_CMN_OWNERID
437 *
438 * ATTR_CMN_GRPID
439 * ATTR_CMN_ACCESSMASK
440 * ATTR_CMN_FLAGS
441 *
442 * ATTR_CMN_EXTENDED_SECURITY
443 * ATTR_CMN_UUID
444 *
445 * ATTR_CMN_GRPUUID
446 *
447 * ATTR_CMN_DATA_PROTECT_FLAGS
448 */
449#define ATTR_CMN_SETMASK 0x51C7FF00
450#define ATTR_CMN_VOLSETMASK 0x00006700
451
452#define ATTR_VOL_FSTYPE 0x00000001
453#define ATTR_VOL_SIGNATURE 0x00000002
454#define ATTR_VOL_SIZE 0x00000004
455#define ATTR_VOL_SPACEFREE 0x00000008
456#define ATTR_VOL_SPACEAVAIL 0x00000010
457#define ATTR_VOL_MINALLOCATION 0x00000020
458#define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
459#define ATTR_VOL_IOBLOCKSIZE 0x00000080
460#define ATTR_VOL_OBJCOUNT 0x00000100
461#define ATTR_VOL_FILECOUNT 0x00000200
462#define ATTR_VOL_DIRCOUNT 0x00000400
463#define ATTR_VOL_MAXOBJCOUNT 0x00000800
464#define ATTR_VOL_MOUNTPOINT 0x00001000
465#define ATTR_VOL_NAME 0x00002000
466#define ATTR_VOL_MOUNTFLAGS 0x00004000
467#define ATTR_VOL_MOUNTEDDEVICE 0x00008000
468#define ATTR_VOL_ENCODINGSUSED 0x00010000
469#define ATTR_VOL_CAPABILITIES 0x00020000
470#define ATTR_VOL_UUID 0x00040000
471#define ATTR_VOL_FSTYPENAME 0x00100000
472#define ATTR_VOL_FSSUBTYPE 0x00200000
473#define ATTR_VOL_SPACEUSED 0x00800000
474#define ATTR_VOL_QUOTA_SIZE 0x10000000
475#define ATTR_VOL_RESERVED_SIZE 0x20000000
476#define ATTR_VOL_ATTRIBUTES 0x40000000
477#define ATTR_VOL_INFO 0x80000000
478
479#define ATTR_VOL_VALIDMASK 0xF0B7FFFF
480
481/*
482 * The list of settable ATTR_VOL_* attributes include the following:
483 * ATTR_VOL_NAME
484 * ATTR_VOL_INFO
485 */
486#define ATTR_VOL_SETMASK 0x80002000
487
488
489/* File/directory attributes: */
490#define ATTR_DIR_LINKCOUNT 0x00000001
491#define ATTR_DIR_ENTRYCOUNT 0x00000002
492#define ATTR_DIR_MOUNTSTATUS 0x00000004
493#define ATTR_DIR_ALLOCSIZE 0x00000008
494#define ATTR_DIR_IOBLOCKSIZE 0x00000010
495#define ATTR_DIR_DATALENGTH 0x00000020
496
497/* ATTR_DIR_MOUNTSTATUS Flags: */
498#define DIR_MNTSTATUS_MNTPOINT 0x00000001
499#define DIR_MNTSTATUS_TRIGGER 0x00000002
500
501#define ATTR_DIR_VALIDMASK 0x0000003f
502#define ATTR_DIR_SETMASK 0x00000000
503
504#define ATTR_FILE_LINKCOUNT 0x00000001
505#define ATTR_FILE_TOTALSIZE 0x00000002
506#define ATTR_FILE_ALLOCSIZE 0x00000004
507#define ATTR_FILE_IOBLOCKSIZE 0x00000008
508#define ATTR_FILE_DEVTYPE 0x00000020
509#define ATTR_FILE_FORKCOUNT 0x00000080
510#define ATTR_FILE_FORKLIST 0x00000100
511#define ATTR_FILE_DATALENGTH 0x00000200
512#define ATTR_FILE_DATAALLOCSIZE 0x00000400
513#define ATTR_FILE_RSRCLENGTH 0x00001000
514#define ATTR_FILE_RSRCALLOCSIZE 0x00002000
515
516#define ATTR_FILE_VALIDMASK 0x000037FF
517/*
518 * Settable ATTR_FILE_* attributes include:
519 * ATTR_FILE_DEVTYPE
520 */
521#define ATTR_FILE_SETMASK 0x00000020
522
523/* CMNEXT attributes extend the common attributes, but in the forkattr field */
524#define ATTR_CMNEXT_RELPATH 0x00000004
525#define ATTR_CMNEXT_PRIVATESIZE 0x00000008
526#define ATTR_CMNEXT_LINKID 0x00000010
527#define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020
528#define ATTR_CMNEXT_REALDEVID 0x00000040
529#define ATTR_CMNEXT_REALFSID 0x00000080
530#define ATTR_CMNEXT_CLONEID 0x00000100
531#define ATTR_CMNEXT_EXT_FLAGS 0x00000200
532#define ATTR_CMNEXT_RECURSIVE_GENCOUNT 0x00000400
533
534#define ATTR_CMNEXT_VALIDMASK 0x000007fc
535#define ATTR_CMNEXT_SETMASK 0x00000000
536
537/* Deprecated fork attributes */
538#define ATTR_FORK_TOTALSIZE 0x00000001
539#define ATTR_FORK_ALLOCSIZE 0x00000002
540#define ATTR_FORK_RESERVED 0xffffffff
541
542#define ATTR_FORK_VALIDMASK 0x00000003
543#define ATTR_FORK_SETMASK 0x00000000
544
545/* Obsolete, implemented, not supported */
546#define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
547#define ATTR_CMN_NAMEDATTRLIST 0x00100000
548#define ATTR_FILE_CLUMPSIZE 0x00000010 /* obsolete */
549#define ATTR_FILE_FILETYPE 0x00000040 /* always zero */
550#define ATTR_FILE_DATAEXTENTS 0x00000800 /* obsolete, HFS-specific */
551#define ATTR_FILE_RSRCEXTENTS 0x00004000 /* obsolete, HFS-specific */
552
553/* Required attributes for getattrlistbulk(2) */
554#define ATTR_BULK_REQUIRED (ATTR_CMN_NAME | ATTR_CMN_RETURNED_ATTRS)
555
556/*
557 * Searchfs
558 */
559#define SRCHFS_START 0x00000001
560#define SRCHFS_MATCHPARTIALNAMES 0x00000002
561#define SRCHFS_MATCHDIRS 0x00000004
562#define SRCHFS_MATCHFILES 0x00000008
563#define SRCHFS_SKIPLINKS 0x00000010
564#define SRCHFS_SKIPINVISIBLE 0x00000020
565#define SRCHFS_SKIPPACKAGES 0x00000040
566#define SRCHFS_SKIPINAPPROPRIATE 0x00000080
567
568#define SRCHFS_NEGATEPARAMS 0x80000000
569#define SRCHFS_VALIDOPTIONSMASK 0x800000FF
570
571struct fssearchblock {
572 struct attrlist *returnattrs;
573 void *returnbuffer;
574 size_t returnbuffersize;
575 u_long maxmatches;
576 struct timeval timelimit;
577 void *searchparams1;
578 size_t sizeofsearchparams1;
579 void *searchparams2;
580 size_t sizeofsearchparams2;
581 struct attrlist searchattrs;
582};
583
584
585struct searchstate {
586 uint32_t ss_union_flags; // for SRCHFS_START
587 uint32_t ss_union_layer; // 0 = top
588 u_char ss_fsstate[548]; // fs private
589} __attribute__((packed));
590
591#define FST_EOF (-1) /* end-of-file offset */
592
593#endif /* __APPLE_API_UNSTABLE */
594#endif /* !_SYS_ATTR_H_ */
\ No newline at end of file
lib/libc/include/any-macos.13-any/sys/mman.h created+265
......@@ -0,0 +1,265 @@
1/*
2 * Copyright (c) 2000-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/* 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 * @(#)mman.h 8.1 (Berkeley) 6/2/93
62 */
63
64/*
65 * Currently unsupported:
66 *
67 * [TYM] POSIX_TYPED_MEM_ALLOCATE
68 * [TYM] POSIX_TYPED_MEM_ALLOCATE_CONTIG
69 * [TYM] POSIX_TYPED_MEM_MAP_ALLOCATABLE
70 * [TYM] struct posix_typed_mem_info
71 * [TYM] posix_mem_offset()
72 * [TYM] posix_typed_mem_get_info()
73 * [TYM] posix_typed_mem_open()
74 */
75
76#ifndef _SYS_MMAN_H_
77#define _SYS_MMAN_H_
78
79#include <sys/appleapiopts.h>
80#include <sys/cdefs.h>
81
82#include <sys/_types.h>
83
84/*
85 * [various] The mode_t, off_t, and size_t types shall be defined as
86 * described in <sys/types.h>
87 */
88#include <sys/_types/_mode_t.h>
89#include <sys/_types/_off_t.h>
90#include <sys/_types/_size_t.h>
91
92#if __DARWIN_C_LEVEL >= 200809L
93#include <Availability.h>
94#endif /* __DARWIN_C_LEVEL */
95
96/*
97 * Protections are chosen from these bits, or-ed together
98 */
99#define PROT_NONE 0x00 /* [MC2] no permissions */
100#define PROT_READ 0x01 /* [MC2] pages can be read */
101#define PROT_WRITE 0x02 /* [MC2] pages can be written */
102#define PROT_EXEC 0x04 /* [MC2] pages can be executed */
103
104/*
105 * Flags contain sharing type and options.
106 * Sharing types; choose one.
107 */
108#define MAP_SHARED 0x0001 /* [MF|SHM] share changes */
109#define MAP_PRIVATE 0x0002 /* [MF|SHM] changes are private */
110#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
111#define MAP_COPY MAP_PRIVATE /* Obsolete */
112#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
113
114/*
115 * Other flags
116 */
117#define MAP_FIXED 0x0010 /* [MF|SHM] interpret addr exactly */
118#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
119#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */
120#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */
121#define MAP_RESERVED0080 0x0080 /* previously unimplemented MAP_INHERIT */
122#define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */
123#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
124#define MAP_NOCACHE 0x0400 /* don't cache pages for this mapping */
125#define MAP_JIT 0x0800 /* Allocate a region that will be used for JIT purposes */
126
127/*
128 * Mapping type
129 */
130#define MAP_FILE 0x0000 /* map from file (default) */
131#define MAP_ANON 0x1000 /* allocated from memory, swap space */
132#define MAP_ANONYMOUS MAP_ANON
133
134/*
135 * The MAP_RESILIENT_* flags can be used when the caller wants to map some
136 * possibly unreliable memory and be able to access it safely, possibly
137 * getting the wrong contents rather than raising any exception.
138 * For safety reasons, such mappings have to be read-only (PROT_READ access
139 * only).
140 *
141 * MAP_RESILIENT_CODESIGN:
142 * accessing this mapping will not generate code-signing violations,
143 * even if the contents are tainted.
144 * MAP_RESILIENT_MEDIA:
145 * accessing this mapping will not generate an exception if the contents
146 * are not available (unreachable removable or remote media, access beyond
147 * end-of-file, ...). Missing contents will be replaced with zeroes.
148 */
149#define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */
150#define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */
151
152#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
153#define MAP_32BIT 0x8000 /* Return virtual addresses <4G only */
154#endif /* defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 */
155
156
157/*
158 * Flags used to support translated processes.
159 */
160#define MAP_TRANSLATED_ALLOW_EXECUTE 0x20000 /* allow execute in translated processes */
161
162#define MAP_UNIX03 0x40000 /* UNIX03 compliance */
163
164#define MAP_TPRO 0x80000 /* Allocate a region that will be protected by TPRO */
165
166#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
167
168/*
169 * Process memory locking
170 */
171#define MCL_CURRENT 0x0001 /* [ML] Lock only current memory */
172#define MCL_FUTURE 0x0002 /* [ML] Lock all future memory as well */
173
174/*
175 * Error return from mmap()
176 */
177#define MAP_FAILED ((void *)-1) /* [MF|SHM] mmap failed */
178
179/*
180 * msync() flags
181 */
182#define MS_ASYNC 0x0001 /* [MF|SIO] return immediately */
183#define MS_INVALIDATE 0x0002 /* [MF|SIO] invalidate all cached data */
184#define MS_SYNC 0x0010 /* [MF|SIO] msync synchronously */
185
186#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
187#define MS_KILLPAGES 0x0004 /* invalidate pages, leave mapped */
188#define MS_DEACTIVATE 0x0008 /* deactivate pages, leave mapped */
189
190#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
191
192
193/*
194 * Advice to madvise
195 */
196#define POSIX_MADV_NORMAL 0 /* [MC1] no further special treatment */
197#define POSIX_MADV_RANDOM 1 /* [MC1] expect random page refs */
198#define POSIX_MADV_SEQUENTIAL 2 /* [MC1] expect sequential page refs */
199#define POSIX_MADV_WILLNEED 3 /* [MC1] will need these pages */
200#define POSIX_MADV_DONTNEED 4 /* [MC1] dont need these pages */
201
202#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
203#define MADV_NORMAL POSIX_MADV_NORMAL
204#define MADV_RANDOM POSIX_MADV_RANDOM
205#define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
206#define MADV_WILLNEED POSIX_MADV_WILLNEED
207#define MADV_DONTNEED POSIX_MADV_DONTNEED
208#define MADV_FREE 5 /* pages unneeded, discard contents */
209#define MADV_ZERO_WIRED_PAGES 6 /* zero the wired pages that have not been unwired before the entry is deleted */
210#define MADV_FREE_REUSABLE 7 /* pages can be reused (by anyone) */
211#define MADV_FREE_REUSE 8 /* caller wants to reuse those pages */
212#define MADV_CAN_REUSE 9
213#define MADV_PAGEOUT 10 /* page out now (internal only) */
214
215/*
216 * Return bits from mincore
217 */
218#define MINCORE_INCORE 0x1 /* Page is incore */
219#define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */
220#define MINCORE_MODIFIED 0x4 /* Page has been modified by us */
221#define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */
222#define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */
223#define MINCORE_PAGED_OUT 0x20 /* Page has been paged out */
224#define MINCORE_COPIED 0x40 /* Page has been copied */
225#define MINCORE_ANONYMOUS 0x80 /* Page belongs to an anonymous object */
226#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
227
228
229
230
231__BEGIN_DECLS
232/* [ML] */
233int mlockall(int);
234int munlockall(void);
235/* [MR] */
236int mlock(const void *, size_t);
237#ifndef _MMAP
238#define _MMAP
239/* [MC3]*/
240void * mmap(void *, size_t, int, int, int, off_t) __DARWIN_ALIAS(mmap);
241#endif
242/* [MPR] */
243int mprotect(void *, size_t, int) __DARWIN_ALIAS(mprotect);
244/* [MF|SIO] */
245int msync(void *, size_t, int) __DARWIN_ALIAS_C(msync);
246/* [MR] */
247int munlock(const void *, size_t);
248/* [MC3]*/
249int munmap(void *, size_t) __DARWIN_ALIAS(munmap);
250/* [SHM] */
251int shm_open(const char *, int, ...);
252int shm_unlink(const char *);
253/* [ADV] */
254int posix_madvise(void *, size_t, int);
255
256#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
257int madvise(void *, size_t, int);
258int mincore(const void *, size_t, char *);
259int minherit(void *, size_t, int);
260#endif
261
262
263__END_DECLS
264
265#endif /* !_SYS_MMAN_H_ */
\ No newline at end of file
lib/libc/include/any-macos.13-any/sys/mount.h+18-3
......@@ -404,12 +404,27 @@ struct fhandle {
404404};
405405typedef struct fhandle fhandle_t;
406406
407/*
408 * Cryptex authentication
409 * Note: these 2 enums are used in conjunction, graftdmg_type is used for authentication while grafting
410 * cryptexes and cryptex_auth_type is currently used for authentication while mounting generic
411 * cryptexes. We need to make sure we do not use the reserved values in each for a new authentication type.
412 */
413
407414OS_ENUM(graftdmg_type, uint32_t,
408415 GRAFTDMG_CRYPTEX_BOOT = 1,
409416 GRAFTDMG_CRYPTEX_PREBOOT = 2,
410 GRAFTDMG_CRYPTEX_DOWNLEVEL = 3);
411
412
417 GRAFTDMG_CRYPTEX_DOWNLEVEL = 3
418 // Reserved: CRYPTEX1_AUTH_ENV_GENERIC = 4,
419 // Reserved: CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL = 5
420 );
421
422OS_ENUM(cryptex_auth_type, uint32_t,
423 // Reserved: GRAFTDMG_CRYPTEX_BOOT = 1,
424 // Reserved: GRAFTDMG_CRYPTEX_PREBOOT = 2,
425 // Reserved: GRAFTDMG_CRYPTEX_DOWNLEVEL = 3,
426 CRYPTEX1_AUTH_ENV_GENERIC = 4,
427 CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL = 5);
413428
414429
415430__BEGIN_DECLS
lib/libc/include/any-macos.13-any/tgmath.h created+1381
......@@ -0,0 +1,1381 @@
1/*
2 * Copyright (c) 2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#ifndef __TGMATH_H
24#define __TGMATH_H
25
26/* C99 7.22 Type-generic math <tgmath.h>. */
27#include <math.h>
28
29/* C++ handles type genericity with overloading in math.h. */
30#ifndef __cplusplus
31#include <complex.h>
32
33#if __has_include(<realtime_safety/realtime_safety.h>)
34#include <realtime_safety/realtime_safety.h>
35REALTIME_SAFE_BEGIN
36#endif
37
38#define _TG_ATTRSp __attribute__((__overloadable__))
39#define _TG_ATTRS __attribute__((__overloadable__, __always_inline__))
40
41// promotion
42
43typedef void _Argument_type_is_not_arithmetic;
44static _Argument_type_is_not_arithmetic __tg_promote(...)
45 __attribute__((__unavailable__,__overloadable__));
46static double _TG_ATTRSp __tg_promote(int);
47static double _TG_ATTRSp __tg_promote(unsigned int);
48static double _TG_ATTRSp __tg_promote(long);
49static double _TG_ATTRSp __tg_promote(unsigned long);
50static double _TG_ATTRSp __tg_promote(long long);
51static double _TG_ATTRSp __tg_promote(unsigned long long);
52static float _TG_ATTRSp __tg_promote(float);
53static double _TG_ATTRSp __tg_promote(double);
54static long double _TG_ATTRSp __tg_promote(long double);
55static float _Complex _TG_ATTRSp __tg_promote(float _Complex);
56static double _Complex _TG_ATTRSp __tg_promote(double _Complex);
57static long double _Complex _TG_ATTRSp __tg_promote(long double _Complex);
58
59#define __tg_promote1(__x) (__typeof__(__tg_promote(__x)))
60#define __tg_promote2(__x, __y) (__typeof__(__tg_promote(__x) + \
61 __tg_promote(__y)))
62#define __tg_promote3(__x, __y, __z) (__typeof__(__tg_promote(__x) + \
63 __tg_promote(__y) + \
64 __tg_promote(__z)))
65
66// acos
67
68static float
69 _TG_ATTRS
70 __tg_acos(float __x) {return acosf(__x);}
71
72static double
73 _TG_ATTRS
74 __tg_acos(double __x) {return acos(__x);}
75
76static long double
77 _TG_ATTRS
78 __tg_acos(long double __x) {return acosl(__x);}
79
80static float _Complex
81 _TG_ATTRS
82 __tg_acos(float _Complex __x) {return cacosf(__x);}
83
84static double _Complex
85 _TG_ATTRS
86 __tg_acos(double _Complex __x) {return cacos(__x);}
87
88static long double _Complex
89 _TG_ATTRS
90 __tg_acos(long double _Complex __x) {return cacosl(__x);}
91
92#undef acos
93#define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
94
95// asin
96
97static float
98 _TG_ATTRS
99 __tg_asin(float __x) {return asinf(__x);}
100
101static double
102 _TG_ATTRS
103 __tg_asin(double __x) {return asin(__x);}
104
105static long double
106 _TG_ATTRS
107 __tg_asin(long double __x) {return asinl(__x);}
108
109static float _Complex
110 _TG_ATTRS
111 __tg_asin(float _Complex __x) {return casinf(__x);}
112
113static double _Complex
114 _TG_ATTRS
115 __tg_asin(double _Complex __x) {return casin(__x);}
116
117static long double _Complex
118 _TG_ATTRS
119 __tg_asin(long double _Complex __x) {return casinl(__x);}
120
121#undef asin
122#define asin(__x) __tg_asin(__tg_promote1((__x))(__x))
123
124// atan
125
126static float
127 _TG_ATTRS
128 __tg_atan(float __x) {return atanf(__x);}
129
130static double
131 _TG_ATTRS
132 __tg_atan(double __x) {return atan(__x);}
133
134static long double
135 _TG_ATTRS
136 __tg_atan(long double __x) {return atanl(__x);}
137
138static float _Complex
139 _TG_ATTRS
140 __tg_atan(float _Complex __x) {return catanf(__x);}
141
142static double _Complex
143 _TG_ATTRS
144 __tg_atan(double _Complex __x) {return catan(__x);}
145
146static long double _Complex
147 _TG_ATTRS
148 __tg_atan(long double _Complex __x) {return catanl(__x);}
149
150#undef atan
151#define atan(__x) __tg_atan(__tg_promote1((__x))(__x))
152
153// acosh
154
155static float
156 _TG_ATTRS
157 __tg_acosh(float __x) {return acoshf(__x);}
158
159static double
160 _TG_ATTRS
161 __tg_acosh(double __x) {return acosh(__x);}
162
163static long double
164 _TG_ATTRS
165 __tg_acosh(long double __x) {return acoshl(__x);}
166
167static float _Complex
168 _TG_ATTRS
169 __tg_acosh(float _Complex __x) {return cacoshf(__x);}
170
171static double _Complex
172 _TG_ATTRS
173 __tg_acosh(double _Complex __x) {return cacosh(__x);}
174
175static long double _Complex
176 _TG_ATTRS
177 __tg_acosh(long double _Complex __x) {return cacoshl(__x);}
178
179#undef acosh
180#define acosh(__x) __tg_acosh(__tg_promote1((__x))(__x))
181
182// asinh
183
184static float
185 _TG_ATTRS
186 __tg_asinh(float __x) {return asinhf(__x);}
187
188static double
189 _TG_ATTRS
190 __tg_asinh(double __x) {return asinh(__x);}
191
192static long double
193 _TG_ATTRS
194 __tg_asinh(long double __x) {return asinhl(__x);}
195
196static float _Complex
197 _TG_ATTRS
198 __tg_asinh(float _Complex __x) {return casinhf(__x);}
199
200static double _Complex
201 _TG_ATTRS
202 __tg_asinh(double _Complex __x) {return casinh(__x);}
203
204static long double _Complex
205 _TG_ATTRS
206 __tg_asinh(long double _Complex __x) {return casinhl(__x);}
207
208#undef asinh
209#define asinh(__x) __tg_asinh(__tg_promote1((__x))(__x))
210
211// atanh
212
213static float
214 _TG_ATTRS
215 __tg_atanh(float __x) {return atanhf(__x);}
216
217static double
218 _TG_ATTRS
219 __tg_atanh(double __x) {return atanh(__x);}
220
221static long double
222 _TG_ATTRS
223 __tg_atanh(long double __x) {return atanhl(__x);}
224
225static float _Complex
226 _TG_ATTRS
227 __tg_atanh(float _Complex __x) {return catanhf(__x);}
228
229static double _Complex
230 _TG_ATTRS
231 __tg_atanh(double _Complex __x) {return catanh(__x);}
232
233static long double _Complex
234 _TG_ATTRS
235 __tg_atanh(long double _Complex __x) {return catanhl(__x);}
236
237#undef atanh
238#define atanh(__x) __tg_atanh(__tg_promote1((__x))(__x))
239
240// cos
241
242static float
243 _TG_ATTRS
244 __tg_cos(float __x) {return cosf(__x);}
245
246static double
247 _TG_ATTRS
248 __tg_cos(double __x) {return cos(__x);}
249
250static long double
251 _TG_ATTRS
252 __tg_cos(long double __x) {return cosl(__x);}
253
254static float _Complex
255 _TG_ATTRS
256 __tg_cos(float _Complex __x) {return ccosf(__x);}
257
258static double _Complex
259 _TG_ATTRS
260 __tg_cos(double _Complex __x) {return ccos(__x);}
261
262static long double _Complex
263 _TG_ATTRS
264 __tg_cos(long double _Complex __x) {return ccosl(__x);}
265
266#undef cos
267#define cos(__x) __tg_cos(__tg_promote1((__x))(__x))
268
269// sin
270
271static float
272 _TG_ATTRS
273 __tg_sin(float __x) {return sinf(__x);}
274
275static double
276 _TG_ATTRS
277 __tg_sin(double __x) {return sin(__x);}
278
279static long double
280 _TG_ATTRS
281 __tg_sin(long double __x) {return sinl(__x);}
282
283static float _Complex
284 _TG_ATTRS
285 __tg_sin(float _Complex __x) {return csinf(__x);}
286
287static double _Complex
288 _TG_ATTRS
289 __tg_sin(double _Complex __x) {return csin(__x);}
290
291static long double _Complex
292 _TG_ATTRS
293 __tg_sin(long double _Complex __x) {return csinl(__x);}
294
295#undef sin
296#define sin(__x) __tg_sin(__tg_promote1((__x))(__x))
297
298// tan
299
300static float
301 _TG_ATTRS
302 __tg_tan(float __x) {return tanf(__x);}
303
304static double
305 _TG_ATTRS
306 __tg_tan(double __x) {return tan(__x);}
307
308static long double
309 _TG_ATTRS
310 __tg_tan(long double __x) {return tanl(__x);}
311
312static float _Complex
313 _TG_ATTRS
314 __tg_tan(float _Complex __x) {return ctanf(__x);}
315
316static double _Complex
317 _TG_ATTRS
318 __tg_tan(double _Complex __x) {return ctan(__x);}
319
320static long double _Complex
321 _TG_ATTRS
322 __tg_tan(long double _Complex __x) {return ctanl(__x);}
323
324#undef tan
325#define tan(__x) __tg_tan(__tg_promote1((__x))(__x))
326
327// cosh
328
329static float
330 _TG_ATTRS
331 __tg_cosh(float __x) {return coshf(__x);}
332
333static double
334 _TG_ATTRS
335 __tg_cosh(double __x) {return cosh(__x);}
336
337static long double
338 _TG_ATTRS
339 __tg_cosh(long double __x) {return coshl(__x);}
340
341static float _Complex
342 _TG_ATTRS
343 __tg_cosh(float _Complex __x) {return ccoshf(__x);}
344
345static double _Complex
346 _TG_ATTRS
347 __tg_cosh(double _Complex __x) {return ccosh(__x);}
348
349static long double _Complex
350 _TG_ATTRS
351 __tg_cosh(long double _Complex __x) {return ccoshl(__x);}
352
353#undef cosh
354#define cosh(__x) __tg_cosh(__tg_promote1((__x))(__x))
355
356// sinh
357
358static float
359 _TG_ATTRS
360 __tg_sinh(float __x) {return sinhf(__x);}
361
362static double
363 _TG_ATTRS
364 __tg_sinh(double __x) {return sinh(__x);}
365
366static long double
367 _TG_ATTRS
368 __tg_sinh(long double __x) {return sinhl(__x);}
369
370static float _Complex
371 _TG_ATTRS
372 __tg_sinh(float _Complex __x) {return csinhf(__x);}
373
374static double _Complex
375 _TG_ATTRS
376 __tg_sinh(double _Complex __x) {return csinh(__x);}
377
378static long double _Complex
379 _TG_ATTRS
380 __tg_sinh(long double _Complex __x) {return csinhl(__x);}
381
382#undef sinh
383#define sinh(__x) __tg_sinh(__tg_promote1((__x))(__x))
384
385// tanh
386
387static float
388 _TG_ATTRS
389 __tg_tanh(float __x) {return tanhf(__x);}
390
391static double
392 _TG_ATTRS
393 __tg_tanh(double __x) {return tanh(__x);}
394
395static long double
396 _TG_ATTRS
397 __tg_tanh(long double __x) {return tanhl(__x);}
398
399static float _Complex
400 _TG_ATTRS
401 __tg_tanh(float _Complex __x) {return ctanhf(__x);}
402
403static double _Complex
404 _TG_ATTRS
405 __tg_tanh(double _Complex __x) {return ctanh(__x);}
406
407static long double _Complex
408 _TG_ATTRS
409 __tg_tanh(long double _Complex __x) {return ctanhl(__x);}
410
411#undef tanh
412#define tanh(__x) __tg_tanh(__tg_promote1((__x))(__x))
413
414// exp
415
416static float
417 _TG_ATTRS
418 __tg_exp(float __x) {return expf(__x);}
419
420static double
421 _TG_ATTRS
422 __tg_exp(double __x) {return exp(__x);}
423
424static long double
425 _TG_ATTRS
426 __tg_exp(long double __x) {return expl(__x);}
427
428static float _Complex
429 _TG_ATTRS
430 __tg_exp(float _Complex __x) {return cexpf(__x);}
431
432static double _Complex
433 _TG_ATTRS
434 __tg_exp(double _Complex __x) {return cexp(__x);}
435
436static long double _Complex
437 _TG_ATTRS
438 __tg_exp(long double _Complex __x) {return cexpl(__x);}
439
440#undef exp
441#define exp(__x) __tg_exp(__tg_promote1((__x))(__x))
442
443// log
444
445static float
446 _TG_ATTRS
447 __tg_log(float __x) {return logf(__x);}
448
449static double
450 _TG_ATTRS
451 __tg_log(double __x) {return log(__x);}
452
453static long double
454 _TG_ATTRS
455 __tg_log(long double __x) {return logl(__x);}
456
457static float _Complex
458 _TG_ATTRS
459 __tg_log(float _Complex __x) {return clogf(__x);}
460
461static double _Complex
462 _TG_ATTRS
463 __tg_log(double _Complex __x) {return clog(__x);}
464
465static long double _Complex
466 _TG_ATTRS
467 __tg_log(long double _Complex __x) {return clogl(__x);}
468
469#undef log
470#define log(__x) __tg_log(__tg_promote1((__x))(__x))
471
472// pow
473
474static float
475 _TG_ATTRS
476 __tg_pow(float __x, float __y) {return powf(__x, __y);}
477
478static double
479 _TG_ATTRS
480 __tg_pow(double __x, double __y) {return pow(__x, __y);}
481
482static long double
483 _TG_ATTRS
484 __tg_pow(long double __x, long double __y) {return powl(__x, __y);}
485
486static float _Complex
487 _TG_ATTRS
488 __tg_pow(float _Complex __x, float _Complex __y) {return cpowf(__x, __y);}
489
490static double _Complex
491 _TG_ATTRS
492 __tg_pow(double _Complex __x, double _Complex __y) {return cpow(__x, __y);}
493
494static long double _Complex
495 _TG_ATTRS
496 __tg_pow(long double _Complex __x, long double _Complex __y)
497 {return cpowl(__x, __y);}
498
499#undef pow
500#define pow(__x, __y) __tg_pow(__tg_promote2((__x), (__y))(__x), \
501 __tg_promote2((__x), (__y))(__y))
502
503// sqrt
504
505static float
506 _TG_ATTRS
507 __tg_sqrt(float __x) {return sqrtf(__x);}
508
509static double
510 _TG_ATTRS
511 __tg_sqrt(double __x) {return sqrt(__x);}
512
513static long double
514 _TG_ATTRS
515 __tg_sqrt(long double __x) {return sqrtl(__x);}
516
517static float _Complex
518 _TG_ATTRS
519 __tg_sqrt(float _Complex __x) {return csqrtf(__x);}
520
521static double _Complex
522 _TG_ATTRS
523 __tg_sqrt(double _Complex __x) {return csqrt(__x);}
524
525static long double _Complex
526 _TG_ATTRS
527 __tg_sqrt(long double _Complex __x) {return csqrtl(__x);}
528
529#undef sqrt
530#define sqrt(__x) __tg_sqrt(__tg_promote1((__x))(__x))
531
532// fabs
533
534static float
535 _TG_ATTRS
536 __tg_fabs(float __x) {return fabsf(__x);}
537
538static double
539 _TG_ATTRS
540 __tg_fabs(double __x) {return fabs(__x);}
541
542static long double
543 _TG_ATTRS
544 __tg_fabs(long double __x) {return fabsl(__x);}
545
546static float
547 _TG_ATTRS
548 __tg_fabs(float _Complex __x) {return cabsf(__x);}
549
550static double
551 _TG_ATTRS
552 __tg_fabs(double _Complex __x) {return cabs(__x);}
553
554static long double
555 _TG_ATTRS
556 __tg_fabs(long double _Complex __x) {return cabsl(__x);}
557
558#undef fabs
559#define fabs(__x) __tg_fabs(__tg_promote1((__x))(__x))
560
561// atan2
562
563static float
564 _TG_ATTRS
565 __tg_atan2(float __x, float __y) {return atan2f(__x, __y);}
566
567static double
568 _TG_ATTRS
569 __tg_atan2(double __x, double __y) {return atan2(__x, __y);}
570
571static long double
572 _TG_ATTRS
573 __tg_atan2(long double __x, long double __y) {return atan2l(__x, __y);}
574
575#undef atan2
576#define atan2(__x, __y) __tg_atan2(__tg_promote2((__x), (__y))(__x), \
577 __tg_promote2((__x), (__y))(__y))
578
579// cbrt
580
581static float
582 _TG_ATTRS
583 __tg_cbrt(float __x) {return cbrtf(__x);}
584
585static double
586 _TG_ATTRS
587 __tg_cbrt(double __x) {return cbrt(__x);}
588
589static long double
590 _TG_ATTRS
591 __tg_cbrt(long double __x) {return cbrtl(__x);}
592
593#undef cbrt
594#define cbrt(__x) __tg_cbrt(__tg_promote1((__x))(__x))
595
596// ceil
597
598static float
599 _TG_ATTRS
600 __tg_ceil(float __x) {return ceilf(__x);}
601
602static double
603 _TG_ATTRS
604 __tg_ceil(double __x) {return ceil(__x);}
605
606static long double
607 _TG_ATTRS
608 __tg_ceil(long double __x) {return ceill(__x);}
609
610#undef ceil
611#define ceil(__x) __tg_ceil(__tg_promote1((__x))(__x))
612
613// copysign
614
615static float
616 _TG_ATTRS
617 __tg_copysign(float __x, float __y) {return copysignf(__x, __y);}
618
619static double
620 _TG_ATTRS
621 __tg_copysign(double __x, double __y) {return copysign(__x, __y);}
622
623static long double
624 _TG_ATTRS
625 __tg_copysign(long double __x, long double __y) {return copysignl(__x, __y);}
626
627#undef copysign
628#define copysign(__x, __y) __tg_copysign(__tg_promote2((__x), (__y))(__x), \
629 __tg_promote2((__x), (__y))(__y))
630
631// erf
632
633static float
634 _TG_ATTRS
635 __tg_erf(float __x) {return erff(__x);}
636
637static double
638 _TG_ATTRS
639 __tg_erf(double __x) {return erf(__x);}
640
641static long double
642 _TG_ATTRS
643 __tg_erf(long double __x) {return erfl(__x);}
644
645#undef erf
646#define erf(__x) __tg_erf(__tg_promote1((__x))(__x))
647
648// erfc
649
650static float
651 _TG_ATTRS
652 __tg_erfc(float __x) {return erfcf(__x);}
653
654static double
655 _TG_ATTRS
656 __tg_erfc(double __x) {return erfc(__x);}
657
658static long double
659 _TG_ATTRS
660 __tg_erfc(long double __x) {return erfcl(__x);}
661
662#undef erfc
663#define erfc(__x) __tg_erfc(__tg_promote1((__x))(__x))
664
665// exp2
666
667static float
668 _TG_ATTRS
669 __tg_exp2(float __x) {return exp2f(__x);}
670
671static double
672 _TG_ATTRS
673 __tg_exp2(double __x) {return exp2(__x);}
674
675static long double
676 _TG_ATTRS
677 __tg_exp2(long double __x) {return exp2l(__x);}
678
679#undef exp2
680#define exp2(__x) __tg_exp2(__tg_promote1((__x))(__x))
681
682// expm1
683
684static float
685 _TG_ATTRS
686 __tg_expm1(float __x) {return expm1f(__x);}
687
688static double
689 _TG_ATTRS
690 __tg_expm1(double __x) {return expm1(__x);}
691
692static long double
693 _TG_ATTRS
694 __tg_expm1(long double __x) {return expm1l(__x);}
695
696#undef expm1
697#define expm1(__x) __tg_expm1(__tg_promote1((__x))(__x))
698
699// fdim
700
701static float
702 _TG_ATTRS
703 __tg_fdim(float __x, float __y) {return fdimf(__x, __y);}
704
705static double
706 _TG_ATTRS
707 __tg_fdim(double __x, double __y) {return fdim(__x, __y);}
708
709static long double
710 _TG_ATTRS
711 __tg_fdim(long double __x, long double __y) {return fdiml(__x, __y);}
712
713#undef fdim
714#define fdim(__x, __y) __tg_fdim(__tg_promote2((__x), (__y))(__x), \
715 __tg_promote2((__x), (__y))(__y))
716
717// floor
718
719static float
720 _TG_ATTRS
721 __tg_floor(float __x) {return floorf(__x);}
722
723static double
724 _TG_ATTRS
725 __tg_floor(double __x) {return floor(__x);}
726
727static long double
728 _TG_ATTRS
729 __tg_floor(long double __x) {return floorl(__x);}
730
731#undef floor
732#define floor(__x) __tg_floor(__tg_promote1((__x))(__x))
733
734// fma
735
736static float
737 _TG_ATTRS
738 __tg_fma(float __x, float __y, float __z)
739 {return fmaf(__x, __y, __z);}
740
741static double
742 _TG_ATTRS
743 __tg_fma(double __x, double __y, double __z)
744 {return fma(__x, __y, __z);}
745
746static long double
747 _TG_ATTRS
748 __tg_fma(long double __x,long double __y, long double __z)
749 {return fmal(__x, __y, __z);}
750
751#undef fma
752#define fma(__x, __y, __z) \
753 __tg_fma(__tg_promote3((__x), (__y), (__z))(__x), \
754 __tg_promote3((__x), (__y), (__z))(__y), \
755 __tg_promote3((__x), (__y), (__z))(__z))
756
757// fmax
758
759static float
760 _TG_ATTRS
761 __tg_fmax(float __x, float __y) {return fmaxf(__x, __y);}
762
763static double
764 _TG_ATTRS
765 __tg_fmax(double __x, double __y) {return fmax(__x, __y);}
766
767static long double
768 _TG_ATTRS
769 __tg_fmax(long double __x, long double __y) {return fmaxl(__x, __y);}
770
771#undef fmax
772#define fmax(__x, __y) __tg_fmax(__tg_promote2((__x), (__y))(__x), \
773 __tg_promote2((__x), (__y))(__y))
774
775// fmin
776
777static float
778 _TG_ATTRS
779 __tg_fmin(float __x, float __y) {return fminf(__x, __y);}
780
781static double
782 _TG_ATTRS
783 __tg_fmin(double __x, double __y) {return fmin(__x, __y);}
784
785static long double
786 _TG_ATTRS
787 __tg_fmin(long double __x, long double __y) {return fminl(__x, __y);}
788
789#undef fmin
790#define fmin(__x, __y) __tg_fmin(__tg_promote2((__x), (__y))(__x), \
791 __tg_promote2((__x), (__y))(__y))
792
793// fmod
794
795static float
796 _TG_ATTRS
797 __tg_fmod(float __x, float __y) {return fmodf(__x, __y);}
798
799static double
800 _TG_ATTRS
801 __tg_fmod(double __x, double __y) {return fmod(__x, __y);}
802
803static long double
804 _TG_ATTRS
805 __tg_fmod(long double __x, long double __y) {return fmodl(__x, __y);}
806
807#undef fmod
808#define fmod(__x, __y) __tg_fmod(__tg_promote2((__x), (__y))(__x), \
809 __tg_promote2((__x), (__y))(__y))
810
811// frexp
812
813static float
814 _TG_ATTRS
815 __tg_frexp(float __x, int* __y) {return frexpf(__x, __y);}
816
817static double
818 _TG_ATTRS
819 __tg_frexp(double __x, int* __y) {return frexp(__x, __y);}
820
821static long double
822 _TG_ATTRS
823 __tg_frexp(long double __x, int* __y) {return frexpl(__x, __y);}
824
825#undef frexp
826#define frexp(__x, __y) __tg_frexp(__tg_promote1((__x))(__x), __y)
827
828// hypot
829
830static float
831 _TG_ATTRS
832 __tg_hypot(float __x, float __y) {return hypotf(__x, __y);}
833
834static double
835 _TG_ATTRS
836 __tg_hypot(double __x, double __y) {return hypot(__x, __y);}
837
838static long double
839 _TG_ATTRS
840 __tg_hypot(long double __x, long double __y) {return hypotl(__x, __y);}
841
842#undef hypot
843#define hypot(__x, __y) __tg_hypot(__tg_promote2((__x), (__y))(__x), \
844 __tg_promote2((__x), (__y))(__y))
845
846// ilogb
847
848static int
849 _TG_ATTRS
850 __tg_ilogb(float __x) {return ilogbf(__x);}
851
852static int
853 _TG_ATTRS
854 __tg_ilogb(double __x) {return ilogb(__x);}
855
856static int
857 _TG_ATTRS
858 __tg_ilogb(long double __x) {return ilogbl(__x);}
859
860#undef ilogb
861#define ilogb(__x) __tg_ilogb(__tg_promote1((__x))(__x))
862
863// ldexp
864
865static float
866 _TG_ATTRS
867 __tg_ldexp(float __x, int __y) {return ldexpf(__x, __y);}
868
869static double
870 _TG_ATTRS
871 __tg_ldexp(double __x, int __y) {return ldexp(__x, __y);}
872
873static long double
874 _TG_ATTRS
875 __tg_ldexp(long double __x, int __y) {return ldexpl(__x, __y);}
876
877#undef ldexp
878#define ldexp(__x, __y) __tg_ldexp(__tg_promote1((__x))(__x), __y)
879
880// lgamma
881
882static float
883 _TG_ATTRS
884 __tg_lgamma(float __x) {return lgammaf(__x);}
885
886static double
887 _TG_ATTRS
888 __tg_lgamma(double __x) {return lgamma(__x);}
889
890static long double
891 _TG_ATTRS
892 __tg_lgamma(long double __x) {return lgammal(__x);}
893
894#undef lgamma
895#define lgamma(__x) __tg_lgamma(__tg_promote1((__x))(__x))
896
897// llrint
898
899static long long
900 _TG_ATTRS
901 __tg_llrint(float __x) {return llrintf(__x);}
902
903static long long
904 _TG_ATTRS
905 __tg_llrint(double __x) {return llrint(__x);}
906
907static long long
908 _TG_ATTRS
909 __tg_llrint(long double __x) {return llrintl(__x);}
910
911#undef llrint
912#define llrint(__x) __tg_llrint(__tg_promote1((__x))(__x))
913
914// llround
915
916static long long
917 _TG_ATTRS
918 __tg_llround(float __x) {return llroundf(__x);}
919
920static long long
921 _TG_ATTRS
922 __tg_llround(double __x) {return llround(__x);}
923
924static long long
925 _TG_ATTRS
926 __tg_llround(long double __x) {return llroundl(__x);}
927
928#undef llround
929#define llround(__x) __tg_llround(__tg_promote1((__x))(__x))
930
931// log10
932
933static float
934 _TG_ATTRS
935 __tg_log10(float __x) {return log10f(__x);}
936
937static double
938 _TG_ATTRS
939 __tg_log10(double __x) {return log10(__x);}
940
941static long double
942 _TG_ATTRS
943 __tg_log10(long double __x) {return log10l(__x);}
944
945#undef log10
946#define log10(__x) __tg_log10(__tg_promote1((__x))(__x))
947
948// log1p
949
950static float
951 _TG_ATTRS
952 __tg_log1p(float __x) {return log1pf(__x);}
953
954static double
955 _TG_ATTRS
956 __tg_log1p(double __x) {return log1p(__x);}
957
958static long double
959 _TG_ATTRS
960 __tg_log1p(long double __x) {return log1pl(__x);}
961
962#undef log1p
963#define log1p(__x) __tg_log1p(__tg_promote1((__x))(__x))
964
965// log2
966
967static float
968 _TG_ATTRS
969 __tg_log2(float __x) {return log2f(__x);}
970
971static double
972 _TG_ATTRS
973 __tg_log2(double __x) {return log2(__x);}
974
975static long double
976 _TG_ATTRS
977 __tg_log2(long double __x) {return log2l(__x);}
978
979#undef log2
980#define log2(__x) __tg_log2(__tg_promote1((__x))(__x))
981
982// logb
983
984static float
985 _TG_ATTRS
986 __tg_logb(float __x) {return logbf(__x);}
987
988static double
989 _TG_ATTRS
990 __tg_logb(double __x) {return logb(__x);}
991
992static long double
993 _TG_ATTRS
994 __tg_logb(long double __x) {return logbl(__x);}
995
996#undef logb
997#define logb(__x) __tg_logb(__tg_promote1((__x))(__x))
998
999// lrint
1000
1001static long
1002 _TG_ATTRS
1003 __tg_lrint(float __x) {return lrintf(__x);}
1004
1005static long
1006 _TG_ATTRS
1007 __tg_lrint(double __x) {return lrint(__x);}
1008
1009static long
1010 _TG_ATTRS
1011 __tg_lrint(long double __x) {return lrintl(__x);}
1012
1013#undef lrint
1014#define lrint(__x) __tg_lrint(__tg_promote1((__x))(__x))
1015
1016// lround
1017
1018static long
1019 _TG_ATTRS
1020 __tg_lround(float __x) {return lroundf(__x);}
1021
1022static long
1023 _TG_ATTRS
1024 __tg_lround(double __x) {return lround(__x);}
1025
1026static long
1027 _TG_ATTRS
1028 __tg_lround(long double __x) {return lroundl(__x);}
1029
1030#undef lround
1031#define lround(__x) __tg_lround(__tg_promote1((__x))(__x))
1032
1033// nearbyint
1034
1035static float
1036 _TG_ATTRS
1037 __tg_nearbyint(float __x) {return nearbyintf(__x);}
1038
1039static double
1040 _TG_ATTRS
1041 __tg_nearbyint(double __x) {return nearbyint(__x);}
1042
1043static long double
1044 _TG_ATTRS
1045 __tg_nearbyint(long double __x) {return nearbyintl(__x);}
1046
1047#undef nearbyint
1048#define nearbyint(__x) __tg_nearbyint(__tg_promote1((__x))(__x))
1049
1050// nextafter
1051
1052static float
1053 _TG_ATTRS
1054 __tg_nextafter(float __x, float __y) {return nextafterf(__x, __y);}
1055
1056static double
1057 _TG_ATTRS
1058 __tg_nextafter(double __x, double __y) {return nextafter(__x, __y);}
1059
1060static long double
1061 _TG_ATTRS
1062 __tg_nextafter(long double __x, long double __y) {return nextafterl(__x, __y);}
1063
1064#undef nextafter
1065#define nextafter(__x, __y) __tg_nextafter(__tg_promote2((__x), (__y))(__x), \
1066 __tg_promote2((__x), (__y))(__y))
1067
1068// nexttoward
1069
1070static float
1071 _TG_ATTRS
1072 __tg_nexttoward(float __x, long double __y) {return nexttowardf(__x, __y);}
1073
1074static double
1075 _TG_ATTRS
1076 __tg_nexttoward(double __x, long double __y) {return nexttoward(__x, __y);}
1077
1078static long double
1079 _TG_ATTRS
1080 __tg_nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);}
1081
1082#undef nexttoward
1083#define nexttoward(__x, __y) __tg_nexttoward(__tg_promote1((__x))(__x), (__y))
1084
1085// remainder
1086
1087static float
1088 _TG_ATTRS
1089 __tg_remainder(float __x, float __y) {return remainderf(__x, __y);}
1090
1091static double
1092 _TG_ATTRS
1093 __tg_remainder(double __x, double __y) {return remainder(__x, __y);}
1094
1095static long double
1096 _TG_ATTRS
1097 __tg_remainder(long double __x, long double __y) {return remainderl(__x, __y);}
1098
1099#undef remainder
1100#define remainder(__x, __y) __tg_remainder(__tg_promote2((__x), (__y))(__x), \
1101 __tg_promote2((__x), (__y))(__y))
1102
1103// remquo
1104
1105static float
1106 _TG_ATTRS
1107 __tg_remquo(float __x, float __y, int* __z)
1108 {return remquof(__x, __y, __z);}
1109
1110static double
1111 _TG_ATTRS
1112 __tg_remquo(double __x, double __y, int* __z)
1113 {return remquo(__x, __y, __z);}
1114
1115static long double
1116 _TG_ATTRS
1117 __tg_remquo(long double __x,long double __y, int* __z)
1118 {return remquol(__x, __y, __z);}
1119
1120#undef remquo
1121#define remquo(__x, __y, __z) \
1122 __tg_remquo(__tg_promote2((__x), (__y))(__x), \
1123 __tg_promote2((__x), (__y))(__y), \
1124 (__z))
1125
1126// rint
1127
1128static float
1129 _TG_ATTRS
1130 __tg_rint(float __x) {return rintf(__x);}
1131
1132static double
1133 _TG_ATTRS
1134 __tg_rint(double __x) {return rint(__x);}
1135
1136static long double
1137 _TG_ATTRS
1138 __tg_rint(long double __x) {return rintl(__x);}
1139
1140#undef rint
1141#define rint(__x) __tg_rint(__tg_promote1((__x))(__x))
1142
1143// round
1144
1145static float
1146 _TG_ATTRS
1147 __tg_round(float __x) {return roundf(__x);}
1148
1149static double
1150 _TG_ATTRS
1151 __tg_round(double __x) {return round(__x);}
1152
1153static long double
1154 _TG_ATTRS
1155 __tg_round(long double __x) {return roundl(__x);}
1156
1157#undef round
1158#define round(__x) __tg_round(__tg_promote1((__x))(__x))
1159
1160// scalbn
1161
1162static float
1163 _TG_ATTRS
1164 __tg_scalbn(float __x, int __y) {return scalbnf(__x, __y);}
1165
1166static double
1167 _TG_ATTRS
1168 __tg_scalbn(double __x, int __y) {return scalbn(__x, __y);}
1169
1170static long double
1171 _TG_ATTRS
1172 __tg_scalbn(long double __x, int __y) {return scalbnl(__x, __y);}
1173
1174#undef scalbn
1175#define scalbn(__x, __y) __tg_scalbn(__tg_promote1((__x))(__x), __y)
1176
1177// scalbln
1178
1179static float
1180 _TG_ATTRS
1181 __tg_scalbln(float __x, long __y) {return scalblnf(__x, __y);}
1182
1183static double
1184 _TG_ATTRS
1185 __tg_scalbln(double __x, long __y) {return scalbln(__x, __y);}
1186
1187static long double
1188 _TG_ATTRS
1189 __tg_scalbln(long double __x, long __y) {return scalblnl(__x, __y);}
1190
1191#undef scalbln
1192#define scalbln(__x, __y) __tg_scalbln(__tg_promote1((__x))(__x), __y)
1193
1194// tgamma
1195
1196static float
1197 _TG_ATTRS
1198 __tg_tgamma(float __x) {return tgammaf(__x);}
1199
1200static double
1201 _TG_ATTRS
1202 __tg_tgamma(double __x) {return tgamma(__x);}
1203
1204static long double
1205 _TG_ATTRS
1206 __tg_tgamma(long double __x) {return tgammal(__x);}
1207
1208#undef tgamma
1209#define tgamma(__x) __tg_tgamma(__tg_promote1((__x))(__x))
1210
1211// trunc
1212
1213static float
1214 _TG_ATTRS
1215 __tg_trunc(float __x) {return truncf(__x);}
1216
1217static double
1218 _TG_ATTRS
1219 __tg_trunc(double __x) {return trunc(__x);}
1220
1221static long double
1222 _TG_ATTRS
1223 __tg_trunc(long double __x) {return truncl(__x);}
1224
1225#undef trunc
1226#define trunc(__x) __tg_trunc(__tg_promote1((__x))(__x))
1227
1228// carg
1229
1230static float
1231 _TG_ATTRS
1232 __tg_carg(float __x) {return atan2f(0.F, __x);}
1233
1234static double
1235 _TG_ATTRS
1236 __tg_carg(double __x) {return atan2(0., __x);}
1237
1238static long double
1239 _TG_ATTRS
1240 __tg_carg(long double __x) {return atan2l(0.L, __x);}
1241
1242static float
1243 _TG_ATTRS
1244 __tg_carg(float _Complex __x) {return cargf(__x);}
1245
1246static double
1247 _TG_ATTRS
1248 __tg_carg(double _Complex __x) {return carg(__x);}
1249
1250static long double
1251 _TG_ATTRS
1252 __tg_carg(long double _Complex __x) {return cargl(__x);}
1253
1254#undef carg
1255#define carg(__x) __tg_carg(__tg_promote1((__x))(__x))
1256
1257// cimag
1258
1259static float
1260 _TG_ATTRS
1261 __tg_cimag(float __x) {return 0;}
1262
1263static double
1264 _TG_ATTRS
1265 __tg_cimag(double __x) {return 0;}
1266
1267static long double
1268 _TG_ATTRS
1269 __tg_cimag(long double __x) {return 0;}
1270
1271static float
1272 _TG_ATTRS
1273 __tg_cimag(float _Complex __x) {return cimagf(__x);}
1274
1275static double
1276 _TG_ATTRS
1277 __tg_cimag(double _Complex __x) {return cimag(__x);}
1278
1279static long double
1280 _TG_ATTRS
1281 __tg_cimag(long double _Complex __x) {return cimagl(__x);}
1282
1283#undef cimag
1284#define cimag(__x) __tg_cimag(__tg_promote1((__x))(__x))
1285
1286// conj
1287
1288static float _Complex
1289 _TG_ATTRS
1290 __tg_conj(float __x) {return __x;}
1291
1292static double _Complex
1293 _TG_ATTRS
1294 __tg_conj(double __x) {return __x;}
1295
1296static long double _Complex
1297 _TG_ATTRS
1298 __tg_conj(long double __x) {return __x;}
1299
1300static float _Complex
1301 _TG_ATTRS
1302 __tg_conj(float _Complex __x) {return conjf(__x);}
1303
1304static double _Complex
1305 _TG_ATTRS
1306 __tg_conj(double _Complex __x) {return conj(__x);}
1307
1308static long double _Complex
1309 _TG_ATTRS
1310 __tg_conj(long double _Complex __x) {return conjl(__x);}
1311
1312#undef conj
1313#define conj(__x) __tg_conj(__tg_promote1((__x))(__x))
1314
1315// cproj
1316
1317static float _Complex
1318 _TG_ATTRS
1319 __tg_cproj(float __x) {return cprojf(__x);}
1320
1321static double _Complex
1322 _TG_ATTRS
1323 __tg_cproj(double __x) {return cproj(__x);}
1324
1325static long double _Complex
1326 _TG_ATTRS
1327 __tg_cproj(long double __x) {return cprojl(__x);}
1328
1329static float _Complex
1330 _TG_ATTRS
1331 __tg_cproj(float _Complex __x) {return cprojf(__x);}
1332
1333static double _Complex
1334 _TG_ATTRS
1335 __tg_cproj(double _Complex __x) {return cproj(__x);}
1336
1337static long double _Complex
1338 _TG_ATTRS
1339 __tg_cproj(long double _Complex __x) {return cprojl(__x);}
1340
1341#undef cproj
1342#define cproj(__x) __tg_cproj(__tg_promote1((__x))(__x))
1343
1344// creal
1345
1346static float
1347 _TG_ATTRS
1348 __tg_creal(float __x) {return __x;}
1349
1350static double
1351 _TG_ATTRS
1352 __tg_creal(double __x) {return __x;}
1353
1354static long double
1355 _TG_ATTRS
1356 __tg_creal(long double __x) {return __x;}
1357
1358static float
1359 _TG_ATTRS
1360 __tg_creal(float _Complex __x) {return crealf(__x);}
1361
1362static double
1363 _TG_ATTRS
1364 __tg_creal(double _Complex __x) {return creal(__x);}
1365
1366static long double
1367 _TG_ATTRS
1368 __tg_creal(long double _Complex __x) {return creall(__x);}
1369
1370#undef creal
1371#define creal(__x) __tg_creal(__tg_promote1((__x))(__x))
1372
1373#undef _TG_ATTRSp
1374#undef _TG_ATTRS
1375
1376#if __has_include(<realtime_safety/realtime_safety.h>)
1377REALTIME_SAFE_END
1378#endif
1379
1380#endif /* __cplusplus */
1381#endif /* __TGMATH_H */
\ No newline at end of file
lib/libc/include/any-macos.13-any/unistd.h created+791
......@@ -0,0 +1,791 @@
1/*
2 * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 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/*-
24 * Copyright (c) 1998-1999 Apple Computer, Inc. All Rights Reserved
25 * Copyright (c) 1991, 1993, 1994
26 * The Regents of the University of California. All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. All advertising materials mentioning features or use of this software
37 * must display the following acknowledgement:
38 * This product includes software developed by the University of
39 * California, Berkeley and its contributors.
40 * 4. Neither the name of the University nor the names of its contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
43 *
44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * SUCH DAMAGE.
55 *
56 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
57 *
58 * Copyright (c) 1998 Apple Compter, Inc.
59 * All Rights Reserved
60 */
61
62/* History:
63 7/14/99 EKN at Apple fixed getdirentriesattr from getdirentryattr
64 3/26/98 CHW at Apple added real interface to searchfs call
65 3/5/98 CHW at Apple added hfs semantic system calls headers
66*/
67
68#ifndef _UNISTD_H_
69#define _UNISTD_H_
70
71#include <_types.h>
72#include <sys/unistd.h>
73#include <Availability.h>
74#include <sys/_types/_gid_t.h>
75#include <sys/_types/_intptr_t.h>
76#include <sys/_types/_off_t.h>
77#include <sys/_types/_pid_t.h>
78/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
79 * _GCC_SIZE_T */
80#include <sys/_types/_size_t.h>
81#include <sys/_types/_ssize_t.h>
82#include <sys/_types/_uid_t.h>
83#include <sys/_types/_useconds_t.h>
84#include <sys/_types/_null.h>
85
86#define STDIN_FILENO 0 /* standard input file descriptor */
87#define STDOUT_FILENO 1 /* standard output file descriptor */
88#define STDERR_FILENO 2 /* standard error file descriptor */
89
90
91/* Version test macros */
92/* _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h */
93#define _XOPEN_VERSION 600 /* [XSI] */
94#define _XOPEN_XCU_VERSION 4 /* Older standard */
95
96
97/* Please keep this list in the same order as the applicable standard */
98#define _POSIX_ADVISORY_INFO (-1) /* [ADV] */
99#define _POSIX_ASYNCHRONOUS_IO (-1) /* [AIO] */
100#define _POSIX_BARRIERS (-1) /* [BAR] */
101#define _POSIX_CHOWN_RESTRICTED 200112L
102#define _POSIX_CLOCK_SELECTION (-1) /* [CS] */
103#define _POSIX_CPUTIME (-1) /* [CPT] */
104#define _POSIX_FSYNC 200112L /* [FSC] */
105#define _POSIX_IPV6 200112L
106#define _POSIX_JOB_CONTROL 200112L
107#define _POSIX_MAPPED_FILES 200112L /* [MF] */
108#define _POSIX_MEMLOCK (-1) /* [ML] */
109#define _POSIX_MEMLOCK_RANGE (-1) /* [MR] */
110#define _POSIX_MEMORY_PROTECTION 200112L /* [MPR] */
111#define _POSIX_MESSAGE_PASSING (-1) /* [MSG] */
112#define _POSIX_MONOTONIC_CLOCK (-1) /* [MON] */
113#define _POSIX_NO_TRUNC 200112L
114#define _POSIX_PRIORITIZED_IO (-1) /* [PIO] */
115#define _POSIX_PRIORITY_SCHEDULING (-1) /* [PS] */
116#define _POSIX_RAW_SOCKETS (-1) /* [RS] */
117#define _POSIX_READER_WRITER_LOCKS 200112L /* [THR] */
118#define _POSIX_REALTIME_SIGNALS (-1) /* [RTS] */
119#define _POSIX_REGEXP 200112L
120#define _POSIX_SAVED_IDS 200112L /* XXX required */
121#define _POSIX_SEMAPHORES (-1) /* [SEM] */
122#define _POSIX_SHARED_MEMORY_OBJECTS (-1) /* [SHM] */
123#define _POSIX_SHELL 200112L
124#define _POSIX_SPAWN 200112L /* [SPN] */
125#define _POSIX_SPIN_LOCKS (-1) /* [SPI] */
126#define _POSIX_SPORADIC_SERVER (-1) /* [SS] */
127#define _POSIX_SYNCHRONIZED_IO (-1) /* [SIO] */
128#define _POSIX_THREAD_ATTR_STACKADDR 200112L /* [TSA] */
129#define _POSIX_THREAD_ATTR_STACKSIZE 200112L /* [TSS] */
130#define _POSIX_THREAD_CPUTIME (-1) /* [TCT] */
131#define _POSIX_THREAD_PRIO_INHERIT (-1) /* [TPI] */
132#define _POSIX_THREAD_PRIO_PROTECT (-1) /* [TPP] */
133#define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* [TPS] */
134#define _POSIX_THREAD_PROCESS_SHARED 200112L /* [TSH] */
135#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L /* [TSF] */
136#define _POSIX_THREAD_SPORADIC_SERVER (-1) /* [TSP] */
137#define _POSIX_THREADS 200112L /* [THR] */
138#define _POSIX_TIMEOUTS (-1) /* [TMO] */
139#define _POSIX_TIMERS (-1) /* [TMR] */
140#define _POSIX_TRACE (-1) /* [TRC] */
141#define _POSIX_TRACE_EVENT_FILTER (-1) /* [TEF] */
142#define _POSIX_TRACE_INHERIT (-1) /* [TRI] */
143#define _POSIX_TRACE_LOG (-1) /* [TRL] */
144#define _POSIX_TYPED_MEMORY_OBJECTS (-1) /* [TYM] */
145#ifndef _POSIX_VDISABLE
146#define _POSIX_VDISABLE 0xff /* same as sys/termios.h */
147#endif /* _POSIX_VDISABLE */
148
149#if __DARWIN_C_LEVEL >= 199209L
150#define _POSIX2_C_BIND 200112L
151#define _POSIX2_C_DEV 200112L /* c99 command */
152#define _POSIX2_CHAR_TERM 200112L
153#define _POSIX2_FORT_DEV (-1) /* fort77 command */
154#define _POSIX2_FORT_RUN 200112L
155#define _POSIX2_LOCALEDEF 200112L /* localedef command */
156#define _POSIX2_PBS (-1)
157#define _POSIX2_PBS_ACCOUNTING (-1)
158#define _POSIX2_PBS_CHECKPOINT (-1)
159#define _POSIX2_PBS_LOCATE (-1)
160#define _POSIX2_PBS_MESSAGE (-1)
161#define _POSIX2_PBS_TRACK (-1)
162#define _POSIX2_SW_DEV 200112L
163#define _POSIX2_UPE 200112L /* XXXX no fc, newgrp, tabs */
164#endif /* __DARWIN_C_LEVEL */
165
166#define __ILP32_OFF32 (-1)
167#define __ILP32_OFFBIG (-1)
168
169#define __LP64_OFF64 (1)
170#define __LPBIG_OFFBIG (1)
171
172#if __DARWIN_C_LEVEL >= 200112L
173#define _POSIX_V6_ILP32_OFF32 __ILP32_OFF32
174#define _POSIX_V6_ILP32_OFFBIG __ILP32_OFFBIG
175#define _POSIX_V6_LP64_OFF64 __LP64_OFF64
176#define _POSIX_V6_LPBIG_OFFBIG __LPBIG_OFFBIG
177#endif /* __DARWIN_C_LEVEL >= 200112L */
178
179#if __DARWIN_C_LEVEL >= 200809L
180#define _POSIX_V7_ILP32_OFF32 __ILP32_OFF32
181#define _POSIX_V7_ILP32_OFFBIG __ILP32_OFFBIG
182#define _POSIX_V7_LP64_OFF64 __LP64_OFF64
183#define _POSIX_V7_LPBIG_OFFBIG __LPBIG_OFFBIG
184#endif /* __DARWIN_C_LEVEL >= 200809L */
185
186#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
187#define _V6_ILP32_OFF32 __ILP32_OFF32
188#define _V6_ILP32_OFFBIG __ILP32_OFFBIG
189#define _V6_LP64_OFF64 __LP64_OFF64
190#define _V6_LPBIG_OFFBIG __LPBIG_OFFBIG
191#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
192
193#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
194/* Removed in Issue 7 */
195#define _XBS5_ILP32_OFF32 __ILP32_OFF32
196#define _XBS5_ILP32_OFFBIG __ILP32_OFFBIG
197#define _XBS5_LP64_OFF64 __LP64_OFF64
198#define _XBS5_LPBIG_OFFBIG __LPBIG_OFFBIG
199#endif /* __DARWIN_C_LEVEL < 200809L */
200
201#if __DARWIN_C_LEVEL >= 199506L /* This really should be XSI */
202#define _XOPEN_CRYPT (1)
203#define _XOPEN_ENH_I18N (1) /* XXX required */
204#define _XOPEN_LEGACY (-1) /* no ftime gcvt, wcswcs */
205#define _XOPEN_REALTIME (-1) /* no q'ed signals, mq_* */
206#define _XOPEN_REALTIME_THREADS (-1) /* no posix_spawn, et. al. */
207#define _XOPEN_SHM (1)
208#define _XOPEN_STREAMS (-1) /* Issue 6 */
209#define _XOPEN_UNIX (1)
210#endif /* XSI */
211
212/* configurable system variables */
213#define _SC_ARG_MAX 1
214#define _SC_CHILD_MAX 2
215#define _SC_CLK_TCK 3
216#define _SC_NGROUPS_MAX 4
217#define _SC_OPEN_MAX 5
218#define _SC_JOB_CONTROL 6
219#define _SC_SAVED_IDS 7
220#define _SC_VERSION 8
221#define _SC_BC_BASE_MAX 9
222#define _SC_BC_DIM_MAX 10
223#define _SC_BC_SCALE_MAX 11
224#define _SC_BC_STRING_MAX 12
225#define _SC_COLL_WEIGHTS_MAX 13
226#define _SC_EXPR_NEST_MAX 14
227#define _SC_LINE_MAX 15
228#define _SC_RE_DUP_MAX 16
229#define _SC_2_VERSION 17
230#define _SC_2_C_BIND 18
231#define _SC_2_C_DEV 19
232#define _SC_2_CHAR_TERM 20
233#define _SC_2_FORT_DEV 21
234#define _SC_2_FORT_RUN 22
235#define _SC_2_LOCALEDEF 23
236#define _SC_2_SW_DEV 24
237#define _SC_2_UPE 25
238#define _SC_STREAM_MAX 26
239#define _SC_TZNAME_MAX 27
240
241#if __DARWIN_C_LEVEL >= 199309L
242#define _SC_ASYNCHRONOUS_IO 28
243#define _SC_PAGESIZE 29
244#define _SC_MEMLOCK 30
245#define _SC_MEMLOCK_RANGE 31
246#define _SC_MEMORY_PROTECTION 32
247#define _SC_MESSAGE_PASSING 33
248#define _SC_PRIORITIZED_IO 34
249#define _SC_PRIORITY_SCHEDULING 35
250#define _SC_REALTIME_SIGNALS 36
251#define _SC_SEMAPHORES 37
252#define _SC_FSYNC 38
253#define _SC_SHARED_MEMORY_OBJECTS 39
254#define _SC_SYNCHRONIZED_IO 40
255#define _SC_TIMERS 41
256#define _SC_AIO_LISTIO_MAX 42
257#define _SC_AIO_MAX 43
258#define _SC_AIO_PRIO_DELTA_MAX 44
259#define _SC_DELAYTIMER_MAX 45
260#define _SC_MQ_OPEN_MAX 46
261#define _SC_MAPPED_FILES 47 /* swap _SC_PAGESIZE vs. BSD */
262#define _SC_RTSIG_MAX 48
263#define _SC_SEM_NSEMS_MAX 49
264#define _SC_SEM_VALUE_MAX 50
265#define _SC_SIGQUEUE_MAX 51
266#define _SC_TIMER_MAX 52
267#endif /* __DARWIN_C_LEVEL >= 199309L */
268
269#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
270#define _SC_NPROCESSORS_CONF 57
271#define _SC_NPROCESSORS_ONLN 58
272#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
273
274#if __DARWIN_C_LEVEL >= 200112L
275#define _SC_2_PBS 59
276#define _SC_2_PBS_ACCOUNTING 60
277#define _SC_2_PBS_CHECKPOINT 61
278#define _SC_2_PBS_LOCATE 62
279#define _SC_2_PBS_MESSAGE 63
280#define _SC_2_PBS_TRACK 64
281#define _SC_ADVISORY_INFO 65
282#define _SC_BARRIERS 66
283#define _SC_CLOCK_SELECTION 67
284#define _SC_CPUTIME 68
285#define _SC_FILE_LOCKING 69
286#define _SC_GETGR_R_SIZE_MAX 70
287#define _SC_GETPW_R_SIZE_MAX 71
288#define _SC_HOST_NAME_MAX 72
289#define _SC_LOGIN_NAME_MAX 73
290#define _SC_MONOTONIC_CLOCK 74
291#define _SC_MQ_PRIO_MAX 75
292#define _SC_READER_WRITER_LOCKS 76
293#define _SC_REGEXP 77
294#define _SC_SHELL 78
295#define _SC_SPAWN 79
296#define _SC_SPIN_LOCKS 80
297#define _SC_SPORADIC_SERVER 81
298#define _SC_THREAD_ATTR_STACKADDR 82
299#define _SC_THREAD_ATTR_STACKSIZE 83
300#define _SC_THREAD_CPUTIME 84
301#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85
302#define _SC_THREAD_KEYS_MAX 86
303#define _SC_THREAD_PRIO_INHERIT 87
304#define _SC_THREAD_PRIO_PROTECT 88
305#define _SC_THREAD_PRIORITY_SCHEDULING 89
306#define _SC_THREAD_PROCESS_SHARED 90
307#define _SC_THREAD_SAFE_FUNCTIONS 91
308#define _SC_THREAD_SPORADIC_SERVER 92
309#define _SC_THREAD_STACK_MIN 93
310#define _SC_THREAD_THREADS_MAX 94
311#define _SC_TIMEOUTS 95
312#define _SC_THREADS 96
313#define _SC_TRACE 97
314#define _SC_TRACE_EVENT_FILTER 98
315#define _SC_TRACE_INHERIT 99
316#define _SC_TRACE_LOG 100
317#define _SC_TTY_NAME_MAX 101
318#define _SC_TYPED_MEMORY_OBJECTS 102
319#define _SC_V6_ILP32_OFF32 103
320#define _SC_V6_ILP32_OFFBIG 104
321#define _SC_V6_LP64_OFF64 105
322#define _SC_V6_LPBIG_OFFBIG 106
323#define _SC_IPV6 118
324#define _SC_RAW_SOCKETS 119
325#define _SC_SYMLOOP_MAX 120
326#endif /* __DARWIN_C_LEVEL >= 200112L */
327
328#if __DARWIN_C_LEVEL >= 199506L /* Really XSI */
329#define _SC_ATEXIT_MAX 107
330#define _SC_IOV_MAX 56
331#define _SC_PAGE_SIZE _SC_PAGESIZE
332#define _SC_XOPEN_CRYPT 108
333#define _SC_XOPEN_ENH_I18N 109
334#define _SC_XOPEN_LEGACY 110 /* Issue 6 */
335#define _SC_XOPEN_REALTIME 111 /* Issue 6 */
336#define _SC_XOPEN_REALTIME_THREADS 112 /* Issue 6 */
337#define _SC_XOPEN_SHM 113
338#define _SC_XOPEN_STREAMS 114 /* Issue 6 */
339#define _SC_XOPEN_UNIX 115
340#define _SC_XOPEN_VERSION 116
341#define _SC_XOPEN_XCU_VERSION 121
342#endif /* XSI */
343
344#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
345/* Removed in Issue 7 */
346#define _SC_XBS5_ILP32_OFF32 122
347#define _SC_XBS5_ILP32_OFFBIG 123
348#define _SC_XBS5_LP64_OFF64 124
349#define _SC_XBS5_LPBIG_OFFBIG 125
350#endif /* __DARWIN_C_LEVEL <= 200809L */
351
352#if __DARWIN_C_LEVEL >= 200112L
353#define _SC_SS_REPL_MAX 126
354#define _SC_TRACE_EVENT_NAME_MAX 127
355#define _SC_TRACE_NAME_MAX 128
356#define _SC_TRACE_SYS_MAX 129
357#define _SC_TRACE_USER_EVENT_MAX 130
358#endif
359
360#if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
361/* Removed in Issue 6 */
362#define _SC_PASS_MAX 131
363#endif
364
365/* 132-199 available for future use */
366#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
367#define _SC_PHYS_PAGES 200
368#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
369
370#if __DARWIN_C_LEVEL >= 199209L
371#ifndef _CS_PATH /* Defined in <sys/unistd.h> */
372#define _CS_PATH 1
373#endif
374#endif
375
376#if __DARWIN_C_LEVEL >= 200112
377#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
378#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
379#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
380#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
381#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
382#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
383#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
384#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
385#define _CS_POSIX_V6_LP64_OFF64_LIBS 10
386#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
387#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
388#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
389#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
390#endif
391
392#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
393/* Removed in Issue 7 */
394#define _CS_XBS5_ILP32_OFF32_CFLAGS 20
395#define _CS_XBS5_ILP32_OFF32_LDFLAGS 21
396#define _CS_XBS5_ILP32_OFF32_LIBS 22
397#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 23
398#define _CS_XBS5_ILP32_OFFBIG_CFLAGS 24
399#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 25
400#define _CS_XBS5_ILP32_OFFBIG_LIBS 26
401#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 27
402#define _CS_XBS5_LP64_OFF64_CFLAGS 28
403#define _CS_XBS5_LP64_OFF64_LDFLAGS 29
404#define _CS_XBS5_LP64_OFF64_LIBS 30
405#define _CS_XBS5_LP64_OFF64_LINTFLAGS 31
406#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 32
407#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 33
408#define _CS_XBS5_LPBIG_OFFBIG_LIBS 34
409#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 35
410#endif
411
412#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
413#define _CS_DARWIN_USER_DIR 65536
414#define _CS_DARWIN_USER_TEMP_DIR 65537
415#define _CS_DARWIN_USER_CACHE_DIR 65538
416#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
417
418
419#ifdef _DARWIN_UNLIMITED_GETGROUPS
420#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
421#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it."
422#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
423#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it."
424#endif
425#endif
426
427/* POSIX.1-1990 */
428
429__BEGIN_DECLS
430void _exit(int) __dead2;
431int access(const char *, int);
432unsigned int
433 alarm(unsigned int);
434int chdir(const char *);
435int chown(const char *, uid_t, gid_t);
436
437int close(int) __DARWIN_ALIAS_C(close);
438
439int dup(int);
440int dup2(int, int);
441int execl(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
442int execle(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
443int execlp(const char * __file, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
444int execv(const char * __path, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
445int execve(const char * __file, char * const * __argv, char * const * __envp) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
446int execvp(const char * __file, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
447pid_t fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
448long fpathconf(int, int);
449char *getcwd(char *, size_t);
450gid_t getegid(void);
451uid_t geteuid(void);
452gid_t getgid(void);
453#if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE)
454int getgroups(int, gid_t []) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(getgroups));
455#else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */
456int getgroups(int, gid_t []);
457#endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */
458char *getlogin(void);
459pid_t getpgrp(void);
460pid_t getpid(void);
461pid_t getppid(void);
462uid_t getuid(void);
463int isatty(int);
464int link(const char *, const char *);
465off_t lseek(int, off_t, int);
466long pathconf(const char *, int);
467
468int pause(void) __DARWIN_ALIAS_C(pause);
469
470int pipe(int [2]);
471
472ssize_t read(int, void *, size_t) __DARWIN_ALIAS_C(read);
473
474int rmdir(const char *);
475int setgid(gid_t);
476int setpgid(pid_t, pid_t);
477pid_t setsid(void);
478int setuid(uid_t);
479
480unsigned int
481 sleep(unsigned int) __DARWIN_ALIAS_C(sleep);
482
483long sysconf(int);
484pid_t tcgetpgrp(int);
485int tcsetpgrp(int, pid_t);
486char *ttyname(int);
487
488#if __DARWIN_UNIX03
489int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r);
490#else /* !__DARWIN_UNIX03 */
491char *ttyname_r(int, char *, size_t);
492#endif /* __DARWIN_UNIX03 */
493
494int unlink(const char *);
495
496ssize_t write(int __fd, const void * __buf, size_t __nbyte) __DARWIN_ALIAS_C(write);
497__END_DECLS
498
499
500
501/* Additional functionality provided by:
502 * POSIX.2-1992 C Language Binding Option
503 */
504
505#if __DARWIN_C_LEVEL >= 199209L
506__BEGIN_DECLS
507size_t confstr(int, char *, size_t) __DARWIN_ALIAS(confstr);
508
509int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt);
510
511extern char *optarg; /* getopt(3) external variables */
512extern int optind, opterr, optopt;
513__END_DECLS
514#endif /* __DARWIN_C_LEVEL >= 199209L */
515
516
517
518/* Additional functionality provided by:
519 * POSIX.1c-1995,
520 * POSIX.1i-1995,
521 * and the omnibus ISO/IEC 9945-1: 1996
522 */
523
524#if __DARWIN_C_LEVEL >= 199506L
525#include <_ctermid.h>
526 /* These F_* are really XSI or Issue 6 */
527#define F_ULOCK 0 /* unlock locked section */
528#define F_LOCK 1 /* lock a section for exclusive use */
529#define F_TLOCK 2 /* test and lock a section for exclusive use */
530#define F_TEST 3 /* test a section for locks by other procs */
531
532 __BEGIN_DECLS
533
534/* Begin XSI */
535/* Removed in Issue 6 */
536#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
537#if !defined(_POSIX_C_SOURCE)
538__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
539#endif
540void *brk(const void *);
541int chroot(const char *) __POSIX_C_DEPRECATED(199506L);
542#endif
543
544char *crypt(const char *, const char *);
545#if __DARWIN_UNIX03
546void encrypt(char *, int) __DARWIN_ALIAS(encrypt);
547#else /* !__DARWIN_UNIX03 */
548int encrypt(char *, int);
549#endif /* __DARWIN_UNIX03 */
550int fchdir(int);
551long gethostid(void);
552pid_t getpgid(pid_t);
553pid_t getsid(pid_t);
554
555/* Removed in Issue 6 */
556#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
557int getdtablesize(void) __POSIX_C_DEPRECATED(199506L);
558int getpagesize(void) __pure2 __POSIX_C_DEPRECATED(199506L);
559char *getpass(const char *) __POSIX_C_DEPRECATED(199506L);
560#endif
561
562/* Removed in Issue 7 */
563#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
564char *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */
565#endif
566
567int lchown(const char *, uid_t, gid_t) __DARWIN_ALIAS(lchown);
568
569int lockf(int, int, off_t) __DARWIN_ALIAS_C(lockf);
570
571int nice(int) __DARWIN_ALIAS(nice);
572
573ssize_t pread(int __fd, void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pread);
574
575ssize_t pwrite(int __fd, const void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pwrite);
576
577/* Removed in Issue 6 */
578#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
579/* Note that Issue 5 changed the argument as intprt_t,
580 * but we keep it as int for binary compatability. */
581#if !defined(_POSIX_C_SOURCE)
582__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
583#endif
584void *sbrk(int);
585#endif
586
587#if __DARWIN_UNIX03
588pid_t setpgrp(void) __DARWIN_ALIAS(setpgrp);
589#else /* !__DARWIN_UNIX03 */
590int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
591#endif /* __DARWIN_UNIX03 */
592
593int setregid(gid_t, gid_t) __DARWIN_ALIAS(setregid);
594
595int setreuid(uid_t, uid_t) __DARWIN_ALIAS(setreuid);
596
597void swab(const void * __restrict, void * __restrict, ssize_t);
598void sync(void);
599int truncate(const char *, off_t);
600useconds_t ualarm(useconds_t, useconds_t);
601int usleep(useconds_t) __DARWIN_ALIAS_C(usleep);
602
603#if !defined(_POSIX_C_SOURCE)
604__deprecated_msg("Use posix_spawn or fork")
605#endif
606pid_t vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
607/* End XSI */
608
609int fsync(int) __DARWIN_ALIAS_C(fsync);
610
611int ftruncate(int, off_t);
612int getlogin_r(char *, size_t);
613__END_DECLS
614#endif /* __DARWIN_C_LEVEL >= 199506L */
615
616
617
618/* Additional functionality provided by:
619 * POSIX.1-2001
620 * ISO C99
621 */
622
623#if __DARWIN_C_LEVEL >= 200112L
624__BEGIN_DECLS
625int fchown(int, uid_t, gid_t);
626int gethostname(char *, size_t);
627ssize_t readlink(const char * __restrict, char * __restrict, size_t);
628int setegid(gid_t);
629int seteuid(uid_t);
630int symlink(const char *, const char *);
631__END_DECLS
632#endif /* __DARWIN_C_LEVEL >= 200112L */
633
634
635
636/* Darwin extensions */
637
638#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
639#include <sys/select.h>
640
641#include <sys/_types/_dev_t.h>
642#include <sys/_types/_mode_t.h>
643#include <sys/_types/_uuid_t.h>
644
645__BEGIN_DECLS
646void _Exit(int) __dead2;
647int accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t);
648int acct(const char *);
649int add_profil(char *, size_t, unsigned long, unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
650void endusershell(void);
651int execvP(const char * __file, const char * __searchpath, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
652char *fflagstostr(unsigned long);
653int getdomainname(char *, int);
654int getgrouplist(const char *, int, int *, int *);
655#if defined(__has_include)
656#if __has_include(<gethostuuid_private.h>)
657#include <gethostuuid_private.h>
658#else
659#include <gethostuuid.h>
660#endif
661#else
662#include <gethostuuid.h>
663#endif
664mode_t getmode(const void *, mode_t);
665int getpeereid(int, uid_t *, gid_t *);
666int getsgroups_np(int *, uuid_t);
667char *getusershell(void);
668int getwgroups_np(int *, uuid_t);
669int initgroups(const char *, int);
670int issetugid(void);
671char *mkdtemp(char *);
672int mknod(const char *, mode_t, dev_t);
673int mkpath_np(const char *path, mode_t omode) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); /* returns errno */
674int mkpathat_np(int dfd, const char *path, mode_t omode) /* returns errno */
675 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
676 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
677int mkstemp(char *);
678int mkstemps(char *, int);
679char *mktemp(char *);
680int mkostemp(char *path, int oflags)
681 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
682 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
683int mkostemps(char *path, int slen, int oflags)
684 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
685 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
686/* Non-portable mkstemp that uses open_dprotected_np */
687int mkstemp_dprotected_np(char *path, int dpclass, int dpflags)
688 __OSX_UNAVAILABLE __IOS_AVAILABLE(10.0)
689 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
690char *mkdtempat_np(int dfd, char *path)
691 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
692 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
693int mkstempsat_np(int dfd, char *path, int slen)
694 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
695 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
696int mkostempsat_np(int dfd, char *path, int slen, int oflags)
697 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
698 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
699int nfssvc(int, void *);
700int profil(char *, size_t, unsigned long, unsigned int);
701
702__deprecated_msg("Use of per-thread security contexts is error-prone and discouraged.")
703int pthread_setugid_np(uid_t, gid_t);
704int pthread_getugid_np( uid_t *, gid_t *);
705
706int reboot(int);
707int revoke(const char *);
708
709__deprecated int rcmd(char **, int, const char *, const char *, const char *, int *);
710__deprecated int rcmd_af(char **, int, const char *, const char *, const char *, int *,
711 int);
712__deprecated int rresvport(int *);
713__deprecated int rresvport_af(int *, int);
714__deprecated int iruserok(unsigned long, int, const char *, const char *);
715__deprecated int iruserok_sa(const void *, int, int, const char *, const char *);
716__deprecated int ruserok(const char *, int, const char *, const char *);
717
718int setdomainname(const char *, int);
719int setgroups(int, const gid_t *);
720void sethostid(long);
721int sethostname(const char *, int);
722#if __DARWIN_UNIX03
723void setkey(const char *) __DARWIN_ALIAS(setkey);
724#else /* !__DARWIN_UNIX03 */
725int setkey(const char *);
726#endif /* __DARWIN_UNIX03 */
727int setlogin(const char *);
728void *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(setmode));
729int setrgid(gid_t);
730int setruid(uid_t);
731int setsgroups_np(int, const uuid_t);
732void setusershell(void);
733int setwgroups_np(int, const uuid_t);
734int strtofflags(char **, unsigned long *, unsigned long *);
735int swapon(const char *);
736int ttyslot(void);
737int undelete(const char *);
738int unwhiteout(const char *);
739void *valloc(size_t);
740
741__WATCHOS_PROHIBITED __TVOS_PROHIBITED
742__OS_AVAILABILITY_MSG(ios,deprecated=10.0,"syscall(2) is unsupported; "
743 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
744__OS_AVAILABILITY_MSG(macosx,deprecated=10.12,"syscall(2) is unsupported; "
745 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
746int syscall(int, ...);
747
748extern char *suboptarg; /* getsubopt(3) external variable */
749int getsubopt(char **, char * const *, char **);
750
751/* HFS & HFS Plus semantics system calls go here */
752#ifdef __LP64__
753int fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
754int fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
755int getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist);
756int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist);
757int exchangedata(const char*,const char*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
758int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
759
760#else /* __LP64__ */
761int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
762int fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
763int getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist);
764int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist);
765int exchangedata(const char*,const char*,unsigned long)
766 __OSX_DEPRECATED(10.0, 10.13, "use renamex_np with the RENAME_SWAP flag")
767 __IOS_DEPRECATED(2.0, 11.0, "use renamex_np with the RENAME_SWAP flag")
768 __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
769int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
770
771#endif /* __LP64__ */
772
773struct fssearchblock;
774struct searchstate;
775
776int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
777int fsctl(const char *,unsigned long,void*,unsigned int);
778int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
779
780#define SYNC_VOLUME_FULLSYNC 0x01 /* Flush data and metadata to platter, not just to disk cache */
781#define SYNC_VOLUME_WAIT 0x02 /* Wait for sync to complete */
782
783int fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
784int sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
785
786extern int optreset;
787
788__END_DECLS
789#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
790
791#endif /* _UNISTD_H_ */
\ No newline at end of file
lib/libc/include/any-macos.13-any/xpc/availability.h created+134
......@@ -0,0 +1,134 @@
1#ifndef __XPC_AVAILABILITY_H__
2#define __XPC_AVAILABILITY_H__
3
4#include <Availability.h>
5
6// Certain parts of the project use all the project's headers but have to build
7// against newer OSX SDKs than ebuild uses -- liblaunch_host being the example.
8// So we need to define these.
9#ifndef __MAC_10_16
10#define __MAC_10_16 101600
11#endif // __MAC_10_16
12
13#ifndef __MAC_10_15
14#define __MAC_10_15 101500
15#define __AVAILABILITY_INTERNAL__MAC_10_15 \
16__attribute__((availability(macosx, introduced=10.15)))
17#endif // __MAC_10_15
18
19#ifndef __MAC_10_14
20#define __MAC_10_14 101400
21#define __AVAILABILITY_INTERNAL__MAC_10_14 \
22__attribute__((availability(macosx, introduced=10.14)))
23#endif // __MAC_10_14
24
25#ifndef __MAC_10_13
26#define __MAC_10_13 101300
27#define __AVAILABILITY_INTERNAL__MAC_10_13 \
28 __attribute__((availability(macosx, introduced=10.13)))
29#endif // __MAC_10_13
30
31#ifndef __MAC_10_12
32#define __MAC_10_12 101200
33#define __AVAILABILITY_INTERNAL__MAC_10_12 \
34 __attribute__((availability(macosx, introduced=10.12)))
35#endif // __MAC_10_12
36
37#ifndef __MAC_10_11
38#define __MAC_10_11 101100
39#define __AVAILABILITY_INTERNAL__MAC_10_11 \
40 __attribute__((availability(macosx, introduced=10.11)))
41#endif // __MAC_10_11
42
43#ifndef __MAC_12_0
44#define __MAC_12_0 120000
45#define __AVAILABILITY_INTERNAL__MAC_12_0 \
46 __attribute__((availability(macosx, introduced=12.0)))
47#endif // __MAC_12_0
48
49#ifndef __MAC_13_3
50#define __MAC_13_3 130300
51#endif // __MAC_13_3
52
53#ifndef __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
54#define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
55#endif // __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
56
57#ifndef __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
58#define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
59#endif // __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
60
61#ifndef __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
62#define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
63#endif // __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
64
65#ifndef __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
66#define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
67#endif // __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
68
69#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
70#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
71#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
72
73#ifndef __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
74#define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
75#endif // __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
76
77#ifndef __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
78#define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
79#endif // __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
80
81#ifndef __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
82#define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
83#endif // __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
84
85#ifndef __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
86#define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
87#endif // __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
88
89#ifndef __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
90#define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
91#endif // __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
92
93#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
94#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
95#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
96
97#if __has_include(<simulator_host.h>)
98#include <simulator_host.h>
99#else // __has_include(<simulator_host.h>)
100#ifndef IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED
101#define IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED 999999
102#endif // IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED
103#endif // __has_include(<simulator_host.h>)
104
105#ifndef __WATCHOS_UNAVAILABLE
106#define __WATCHOS_UNAVAILABLE
107#endif
108
109#ifndef __TVOS_UNAVAILABLE
110#define __TVOS_UNAVAILABLE
111#endif
112
113// simulator host-side bits build against SDKs not having __*_AVAILABLE() yet
114#ifndef __OSX_AVAILABLE
115#define __OSX_AVAILABLE(...)
116#endif
117
118#ifndef __IOS_AVAILABLE
119#define __IOS_AVAILABLE(...)
120#endif
121
122#ifndef __TVOS_AVAILABLE
123#define __TVOS_AVAILABLE(...)
124#endif
125
126#ifndef __WATCHOS_AVAILABLE
127#define __WATCHOS_AVAILABLE(...)
128#endif
129
130#ifndef __API_AVAILABLE
131#define __API_AVAILABLE(...)
132#endif
133
134#endif // __XPC_AVAILABILITY_H__
\ No newline at end of file
lib/libc/include/x86_64-macos.13-none/mach/i386/thread_status.h+6
......@@ -132,6 +132,12 @@
132132 */
133133#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
134134
135#define FLAVOR_MODIFIES_CORE_CPU_REGISTERS(x) \
136((x == x86_THREAD_STATE) || \
137 (x == x86_THREAD_STATE32) || \
138 (x == x86_THREAD_STATE64) || \
139 (x == x86_THREAD_FULL_STATE64))
140
135141/*
136142 * VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
137143 * an exception flavor will return if that is a defined flavor for that