# 1 "" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #if 0 /* expanded by -frewrite-includes */ #include "internal.h" #endif /* expanded by -frewrite-includes */ # 21 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_INTERNAL__ #define __DISPATCH_INTERNAL__ #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/.build/config/config_ac.h" 1 /* Define if building pthread work queues from source */ #define DISPATCH_USE_INTERNAL_WORKQUEUE 1 /* Enable usage of thread local storage via _Thread_local */ #define DISPATCH_USE_THREAD_LOCAL_STORAGE 1 /* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if you don't. */ #define HAVE_DECL_CLOCK_MONOTONIC 1 /* Define to 1 if you have the declaration of `CLOCK_REALTIME', and to 0 if you don't. */ #define HAVE_DECL_CLOCK_REALTIME 1 /* Define to 1 if you have the declaration of `CLOCK_UPTIME', and to 0 if you don't. */ #define HAVE_DECL_CLOCK_UPTIME 1 /* Define to 1 if you have the declaration of `CLOCK_UPTIME_FAST', and to 0 if you don't. */ #define HAVE_DECL_CLOCK_UPTIME_FAST 1 /* Define to 1 if you have the declaration of `CLOCK_MONOTONIC_COARSE', and to 0 if you don't. */ #define HAVE_CLOCK_MONOTONIC_COARSE 0 /* Define to 1 if you have the declaration of `FD_COPY', and to 0 if you don't. */ #define HAVE_DECL_FD_COPY 1 /* Define to 1 if you have the declaration of `NOTE_LOWAT', and to 0 if you don't. */ #define HAVE_DECL_NOTE_LOWAT 1 /* Define to 1 if you have the declaration of `NOTE_NONE', and to 0 if you don't. */ #define HAVE_DECL_NOTE_NONE 0 /* Define to 1 if you have the declaration of `NOTE_REAP', and to 0 if you don't. */ #define HAVE_DECL_NOTE_REAP 0 /* Define to 1 if you have the declaration of `NOTE_REVOKE', and to 0 if you don't. */ #define HAVE_DECL_NOTE_REVOKE 1 /* Define to 1 if you have the declaration of `NOTE_SIGNAL', and to 0 if you don't. */ #define HAVE_DECL_NOTE_SIGNAL 0 /* Define to 1 if you have the declaration of `POSIX_SPAWN_START_SUSPENDED', and to 0 if you don't. */ #define HAVE_DECL_POSIX_SPAWN_START_SUSPENDED 0 /* Define to 1 if you have the declaration of `program_invocation_short_name', and to 0 if you don't. */ #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 0 /* Define to 1 if you have the declaration of `SIGEMT', and to 0 if you don't. */ #define HAVE_DECL_SIGEMT 1 /* Define to 1 if you have the declaration of `VQ_DESIRED_DISK', and to 0 if you don't. */ #define HAVE_DECL_VQ_DESIRED_DISK 0 /* Define to 1 if you have the declaration of `VQ_NEARLOWDISK', and to 0 if you don't. */ #define HAVE_DECL_VQ_NEARLOWDISK 0 /* Define to 1 if you have the declaration of `VQ_QUOTA', and to 0 if you don't. */ #define HAVE_DECL_VQ_QUOTA 0 /* Define to 1 if you have the declaration of `VQ_UPDATE', and to 0 if you don't. */ #define HAVE_DECL_VQ_UPDATE 0 /* Define to 1 if you have the declaration of `VQ_VERYLOWDISK', and to 0 if you don't. */ #define HAVE_DECL_VQ_VERYLOWDISK 0 /* Define to 1 if you have the declaration of `VQ_FREE_SPACE_CHANGE', and to 0 if you don't. */ #define HAVE_DECL_VQ_FREE_SPACE_CHANGE 0 /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `getprogname' function. */ #define HAVE_GETPROGNAME 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define if Apple leaks program is present */ /* #undef HAVE_LEAKS */ /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBKERN_OSATOMIC_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBKERN_OSCROSSENDIAN_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBPROC_INTERNAL_H */ /* Define if mach is present */ /* #undef HAVE_MACH */ /* Define to 1 if you have the `mach_absolute_time' function. */ /* #undef HAVE_MACH_ABSOLUTE_TIME */ /* Define to 1 if you have the `mach_approximate_time' function. */ /* #undef HAVE_MACH_APPROXIMATE_TIME */ /* Define to 1 if you have the `mach_port_construct' function. */ /* #undef HAVE_MACH_PORT_CONSTRUCT */ /* Define to 1 if you have the `malloc_create_zone' function. */ /* #undef HAVE_MALLOC_CREATE_ZONE */ /* Define to 1 if you have the header file. */ /* #undef HAVE_MALLOC_MALLOC_H */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define if __builtin_trap marked noreturn */ #define HAVE_NORETURN_BUILTIN_TRAP 1 /* Define if you have the Objective-C runtime */ /* #undef HAVE_OBJC */ /* Define to 1 if you have the `posix_fadvise' function. */ #define HAVE_POSIX_FADVISE /* Define to 1 if you have the `posix_spawnp' function. */ #define HAVE_POSIX_SPAWNP /* Define to 1 if you have the `pthread_key_init_np' function. */ /* #undef HAVE_PTHREAD_KEY_INIT_NP */ /* Define to 1 if you have the `pthread_attr_setcpupercent_np' function. */ /* #undef HAVE_PTHREAD_ATTR_SETCPUPERCENT_NP */ /* Define to 1 if you have the header file. */ /* #undef HAVE_PTHREAD_MACHDEP_H */ /* Define to 1 if you have the `pthread_main_np' function. */ #define HAVE_PTHREAD_MAIN_NP 1 /* Define to 1 if you have the `pthread_yield_np' function. */ #define HAVE_PTHREAD_YIELD_NP 0 /* Define to 1 if you have the header file. */ #define HAVE_PTHREAD_NP_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_PTHREAD_QOS_H */ /* Define if pthread work queues are present */ #define HAVE_PTHREAD_WORKQUEUES 0 /* Define to 1 if you have the header file. */ /* #undef HAVE_PTHREAD_WORKQUEUE_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_PTHREAD_WORKQUEUE_PRIVATE_H */ /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 /* Define if building for Swift */ #undef HAVE_SWIFT /* Define to 1 if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_GUARDED_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_TARGETCONDITIONALS_H */ /* Define to 1 if you have the `_pthread_workqueue_init' function. */ /* #undef HAVE__PTHREAD_WORKQUEUE_INIT */ /* Define to use non-portable pthread TSD optimizations for Mac OS X) */ /* #undef USE_APPLE_TSD_OPTIMIZATIONS */ /* Define to tag libdispatch_init as a constructor */ #define USE_LIBDISPATCH_INIT_CONSTRUCTOR 1 /* Define to use Mach semaphores */ /* #undef USE_MACH_SEM */ /* Define to use POSIX semaphores */ #define USE_POSIX_SEM 1 /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE #define _ALL_SOURCE 0 #endif # 227 "/wrkdirs/usr/ports/devel/libdispatch/work/.build/config/config_ac.h" /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE /* #undef _GNU_SOURCE */ #endif # 231 "/wrkdirs/usr/ports/devel/libdispatch/work/.build/config/config_ac.h" /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS 0 #endif # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/.build/config/config_ac.h" /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE #define _TANDEM_SOURCE 0 #endif # 239 "/wrkdirs/usr/ports/devel/libdispatch/work/.build/config/config_ac.h" /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 0 #endif # 243 "/wrkdirs/usr/ports/devel/libdispatch/work/.build/config/config_ac.h" /* Version number of package */ #define VERSION "1.3" /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define if using Darwin $NOCANCEL */ /* #undef __DARWIN_NON_CANCELABLE */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #else # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define __DISPATCH_BUILDING_DISPATCH__ #define __DISPATCH_INDIRECT__ #ifdef __APPLE__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // __APPLE__ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(DISPATCH_MACH_SPI) && TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_MACH_SPI 1 #endif # 49 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(OS_VOUCHER_CREATION_SPI) && TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define OS_VOUCHER_CREATION_SPI 1 #endif # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(OS_VOUCHER_ACTIVITY_SPI) && TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 53 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define OS_VOUCHER_ACTIVITY_SPI 1 #endif # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(OS_VOUCHER_ACTIVITY_GENERATE_SWAPS) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 56 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define OS_VOUCHER_ACTIVITY_GENERATE_SWAPS 0 #endif # 58 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(OS_FIREHOSE_SPI) && TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 59 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define OS_FIREHOSE_SPI 1 #endif # 61 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(DISPATCH_LAYOUT_SPI) && TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_LAYOUT_SPI 1 #endif # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 67 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(HAVE_DYLD_IS_MEMORY_IMMUTABLE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if defined(DYLD_MACOSX_VERSION_10_12) || defined(DYLD_IOS_VERSION_10_0) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_DYLD_IS_MEMORY_IMMUTABLE 1 #else # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_DYLD_IS_MEMORY_IMMUTABLE 0 #endif # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(HAVE_DYLD_IS_MEMORY_IMMUTABLE) # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // __has_include() # 75 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(USE_OBJC) && HAVE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define USE_OBJC 1 #endif # 79 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 81 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define OS_OBJECT_HAVE_OBJC_SUPPORT 1 #if 0 /* disabled by -frewrite-includes */ #if defined(__OBJC__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 83 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define OS_OBJECT_USE_OBJC 1 // Force internal Objective-C sources to use class-visible headers // even when not compiling in Swift. #define OS_OBJECT_SWIFT3 1 #else # 88 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define OS_OBJECT_USE_OBJC 0 #endif // __OBJC__ # 90 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #else # 91 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #endif // USE_OBJC # 93 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 94 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_PUBLIC__ #define __DISPATCH_PUBLIC__ #ifdef __APPLE__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 29 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__unix__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" 1 /* * This source file is part of the Swift.org open source project * * Copyright (c) 2015 Apple Inc. and the Swift project authors * * Licensed under Apache License v2.0 with Runtime Library Exception * * See https://swift.org/LICENSE.txt for license information * See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors * */ #ifndef __OS_GENERIC_UNIX_BASE__ #define __OS_GENERIC_UNIX_BASE__ #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 17 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 17 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # 18 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #endif # 19 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__FreeBSD__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 21 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 21 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # 1 "/usr/include/libutil.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1996 Peter Wemm . * All rights reserved. * Copyright (c) 2002 Networks Associates Technology, Inc. * All rights reserved. * * Portions of this software were developed for the FreeBSD Project by * ThinkSec AS and NAI Labs, the Security Research Division of Network * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 * ("CBOSS"), as part of the DARPA CHATS research program. * * Redistribution and use in source and binary forms, with or without * modification, is permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LIBUTIL_H_ #define _LIBUTIL_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/libutil.h" 3 4 # 1 "/usr/include/sys/cdefs.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Berkeley Software Design, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 * $FreeBSD$ */ #ifndef _SYS_CDEFS_H_ #define _SYS_CDEFS_H_ #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) && defined(_STANDALONE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 42 "/usr/include/sys/cdefs.h" 3 4 #error "_KERNEL and _STANDALONE are mutually exclusive" #endif # 44 "/usr/include/sys/cdefs.h" 3 4 /* * Testing against Clang-specific extensions. */ #ifndef __has_attribute #define __has_attribute(x) 0 #endif # 51 "/usr/include/sys/cdefs.h" 3 4 #ifndef __has_extension #define __has_extension __has_feature #endif # 54 "/usr/include/sys/cdefs.h" 3 4 #ifndef __has_feature #define __has_feature(x) 0 #endif # 57 "/usr/include/sys/cdefs.h" 3 4 #ifndef __has_include #define __has_include(x) 0 #endif # 60 "/usr/include/sys/cdefs.h" 3 4 #ifndef __has_builtin #define __has_builtin(x) 0 #endif # 63 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 65 "/usr/include/sys/cdefs.h" 3 4 #define __BEGIN_DECLS extern "C" { #define __END_DECLS } #else # 68 "/usr/include/sys/cdefs.h" 3 4 #define __BEGIN_DECLS #define __END_DECLS #endif # 71 "/usr/include/sys/cdefs.h" 3 4 /* * This code has been put in place to help reduce the addition of * compiler specific defines in FreeBSD code. It helps to aid in * having a compiler-agnostic source tree. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__GNUC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 79 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ >= 3 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 81 "/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_ASM 3 #define __GNUCLIKE_MATH_BUILTIN_CONSTANTS #else # 84 "/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_ASM 2 #endif # 86 "/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE___TYPEOF 1 #define __GNUCLIKE___SECTION 1 #define __GNUCLIKE_CTOR_SECTION_HANDLING 1 #define __GNUCLIKE_BUILTIN_CONSTANT_P 1 #if 0 /* disabled by -frewrite-includes */ #if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 94 "/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_BUILTIN_VARARGS 1 #define __GNUCLIKE_BUILTIN_STDARG 1 #define __GNUCLIKE_BUILTIN_VAALIST 1 #endif # 98 "/usr/include/sys/cdefs.h" 3 4 #define __GNUC_VA_LIST_COMPATIBILITY 1 /* * Compiler memory barriers, specific to gcc and clang. */ #define __compiler_membar() __asm __volatile(" " : : : "memory") #define __GNUCLIKE_BUILTIN_NEXT_ARG 1 #define __GNUCLIKE_MATH_BUILTIN_RELOPS #define __GNUCLIKE_BUILTIN_MEMCPY 1 /* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */ #define __CC_SUPPORTS_INLINE 1 #define __CC_SUPPORTS___INLINE 1 #define __CC_SUPPORTS___INLINE__ 1 #define __CC_SUPPORTS___FUNC__ 1 #define __CC_SUPPORTS_WARNING 1 #define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */ #define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1 #endif /* __GNUC__ */ # 124 "/usr/include/sys/cdefs.h" 3 4 /* * Macro to test if we're using a specific version of gcc or later. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__GNUC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 129 "/usr/include/sys/cdefs.h" 3 4 #define __GNUC_PREREQ__(ma, mi) \ (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) #else # 132 "/usr/include/sys/cdefs.h" 3 4 #define __GNUC_PREREQ__(ma, mi) 0 #endif # 134 "/usr/include/sys/cdefs.h" 3 4 /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI * mode -- there must be no spaces between its arguments, and for nested * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also * concatenate double-quoted strings produced by the __STRING macro, but * this only works with ANSI C. * * __XSTRING is like __STRING, but it expands any macros in its argument * first. It is only available with ANSI C. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__STDC__) || defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 148 "/usr/include/sys/cdefs.h" 3 4 #define __P(protos) protos /* full-blown ANSI C */ #define __CONCAT1(x,y) x ## y #define __CONCAT(x,y) __CONCAT1(x,y) #define __STRING(x) #x /* stringify without expanding x */ #define __XSTRING(x) __STRING(x) /* expand x, then stringify */ #define __const const /* define reserved names to standard */ #define __signed signed #define __volatile volatile #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 158 "/usr/include/sys/cdefs.h" 3 4 #define __inline inline /* convert to C++ keyword */ #else # 160 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !(defined(__CC_SUPPORTS___INLINE)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 161 "/usr/include/sys/cdefs.h" 3 4 #define __inline /* delete GCC keyword */ #endif /* ! __CC_SUPPORTS___INLINE */ # 163 "/usr/include/sys/cdefs.h" 3 4 #endif /* !__cplusplus */ # 164 "/usr/include/sys/cdefs.h" 3 4 #else /* !(__STDC__ || __cplusplus) */ # 166 "/usr/include/sys/cdefs.h" 3 4 #define __P(protos) () /* traditional C preprocessor */ #define __CONCAT(x,y) x/**/y #define __STRING(x) "x" #if 0 /* disabled by -frewrite-includes */ #if !defined(__CC_SUPPORTS___INLINE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 171 "/usr/include/sys/cdefs.h" 3 4 #define __const /* delete pseudo-ANSI C keywords */ #define __inline #define __signed #define __volatile /* * In non-ANSI C environments, new programs will want ANSI-only C keywords * deleted from the program and old programs will want them left alone. * When using a compiler other than gcc, programs using the ANSI C keywords * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. * When using "gcc -traditional", we assume that this is the intent; if * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. */ #ifndef NO_ANSI_KEYWORDS #define const /* delete ANSI C keywords */ #define inline #define signed #define volatile #endif /* !NO_ANSI_KEYWORDS */ # 189 "/usr/include/sys/cdefs.h" 3 4 #endif /* !__CC_SUPPORTS___INLINE */ # 190 "/usr/include/sys/cdefs.h" 3 4 #endif /* !(__STDC__ || __cplusplus) */ # 191 "/usr/include/sys/cdefs.h" 3 4 /* * Compiler-dependent macros to help declare dead (non-returning) and * pure (no side effects) functions, and unused variables. They are * null except for versions of gcc that are known to support the features * properly (old versions of gcc-2 supported the dead and pure features * in a different (wrong) way). If we do not provide an implementation * for a given compiler, let the compile fail if it is told to use * a feature that we cannot live without. */ #define __weak_symbol __attribute__((__weak__)) #if 0 /* disabled by -frewrite-includes */ #if !__GNUC_PREREQ__(2, 5) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 203 "/usr/include/sys/cdefs.h" 3 4 #define __dead2 #define __pure2 #define __unused #endif # 207 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 208 "/usr/include/sys/cdefs.h" 3 4 #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused /* XXX Find out what to do for __packed, __aligned and __section */ #endif # 213 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(2, 7) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 214 "/usr/include/sys/cdefs.h" 3 4 #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) #define __used __attribute__((__used__)) #define __packed __attribute__((__packed__)) #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif # 222 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 223 "/usr/include/sys/cdefs.h" 3 4 #define __alloc_size(x) __attribute__((__alloc_size__(x))) #define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x))) #else # 226 "/usr/include/sys/cdefs.h" 3 4 #define __alloc_size(x) #define __alloc_size2(n, x) #endif # 229 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 230 "/usr/include/sys/cdefs.h" 3 4 #define __alloc_align(x) __attribute__((__alloc_align__(x))) #else # 232 "/usr/include/sys/cdefs.h" 3 4 #define __alloc_align(x) #endif # 234 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !__GNUC_PREREQ__(2, 95) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 236 "/usr/include/sys/cdefs.h" 3 4 #define __alignof(x) __offsetof(struct { char __a; x __b; }, __b) #endif # 238 "/usr/include/sys/cdefs.h" 3 4 /* * Keywords added in C11. */ #if 0 /* disabled by -frewrite-includes */ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 244 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !__has_extension(c_alignas) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 246 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_alignas) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 248 "/usr/include/sys/cdefs.h" 3 4 #define _Alignas(x) alignas(x) #else # 250 "/usr/include/sys/cdefs.h" 3 4 /* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */ #define _Alignas(x) __aligned(x) #endif # 253 "/usr/include/sys/cdefs.h" 3 4 #endif # 254 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) && __cplusplus >= 201103L #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 256 "/usr/include/sys/cdefs.h" 3 4 #define _Alignof(x) alignof(x) #else # 258 "/usr/include/sys/cdefs.h" 3 4 #define _Alignof(x) __alignof(x) #endif # 260 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !defined(__cplusplus) && !__has_extension(c_atomic) && \ !__has_extension(cxx_atomic) && !__GNUC_PREREQ__(4, 7) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 263 "/usr/include/sys/cdefs.h" 3 4 /* * No native support for _Atomic(). Place object in structure to prevent * most forms of direct non-atomic access. */ #define _Atomic(T) struct { T volatile __val; } #endif # 269 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) && __cplusplus >= 201103L #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 271 "/usr/include/sys/cdefs.h" 3 4 #define _Noreturn [[noreturn]] #else # 273 "/usr/include/sys/cdefs.h" 3 4 #define _Noreturn __dead2 #endif # 275 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !__has_extension(c_static_assert) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 277 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_static_assert) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 279 "/usr/include/sys/cdefs.h" 3 4 #define _Static_assert(x, y) static_assert(x, y) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 281 "/usr/include/sys/cdefs.h" 3 4 /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__COUNTER__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 283 "/usr/include/sys/cdefs.h" 3 4 #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) #define __Static_assert(x, y) ___Static_assert(x, y) #define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \ __unused #else # 288 "/usr/include/sys/cdefs.h" 3 4 #define _Static_assert(x, y) struct __hack #endif # 290 "/usr/include/sys/cdefs.h" 3 4 #endif # 291 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !__has_extension(c_thread_local) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 293 "/usr/include/sys/cdefs.h" 3 4 /* * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode * without actually supporting the thread_local keyword. Don't check for * the presence of C++11 when defining _Thread_local. */ #if 0 /* disabled by -frewrite-includes */ #if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \ __has_extension(cxx_thread_local) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 300 "/usr/include/sys/cdefs.h" 3 4 #define _Thread_local thread_local #else # 302 "/usr/include/sys/cdefs.h" 3 4 #define _Thread_local __thread #endif # 304 "/usr/include/sys/cdefs.h" 3 4 #endif # 305 "/usr/include/sys/cdefs.h" 3 4 #endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */ # 307 "/usr/include/sys/cdefs.h" 3 4 /* * Emulation of C11 _Generic(). Unlike the previously defined C11 * keywords, it is not possible to implement this using exactly the same * syntax. Therefore implement something similar under the name * __generic(). Unlike _Generic(), this macro can only distinguish * between a single type, so it requires nested invocations to * distinguish multiple cases. */ #if 0 /* disabled by -frewrite-includes */ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ __has_extension(c_generic_selections) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 319 "/usr/include/sys/cdefs.h" 3 4 #define __generic(expr, t, yes, no) \ _Generic(expr, t: yes, default: no) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 322 "/usr/include/sys/cdefs.h" 3 4 #define __generic(expr, t, yes, no) \ __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof(expr), t), yes, no) #endif # 326 "/usr/include/sys/cdefs.h" 3 4 /* * C99 Static array indices in function parameter declarations. Syntax such as: * void bar(int myArray[static 10]); * is allowed in C99 but not in C++. Define __min_size appropriately so * headers using it can be compiled in either language. Use like this: * void bar(int myArray[__min_size(10)]); */ #if 0 /* disabled by -frewrite-includes */ #if !defined(__cplusplus) && \ (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \ (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901)) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 337 "/usr/include/sys/cdefs.h" 3 4 #define __min_size(x) static (x) #else # 339 "/usr/include/sys/cdefs.h" 3 4 #define __min_size(x) (x) #endif # 341 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(2, 96) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 343 "/usr/include/sys/cdefs.h" 3 4 #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) #else # 346 "/usr/include/sys/cdefs.h" 3 4 #define __malloc_like #define __pure #endif # 349 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(3, 1) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 351 "/usr/include/sys/cdefs.h" 3 4 #define __always_inline __attribute__((__always_inline__)) #else # 353 "/usr/include/sys/cdefs.h" 3 4 #define __always_inline #endif # 355 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(3, 1) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 357 "/usr/include/sys/cdefs.h" 3 4 #define __noinline __attribute__ ((__noinline__)) #else # 359 "/usr/include/sys/cdefs.h" 3 4 #define __noinline #endif # 361 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(3, 4) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 363 "/usr/include/sys/cdefs.h" 3 4 #define __fastcall __attribute__((__fastcall__)) #define __result_use_check __attribute__((__warn_unused_result__)) #else # 366 "/usr/include/sys/cdefs.h" 3 4 #define __fastcall #define __result_use_check #endif # 369 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(4, 1) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 371 "/usr/include/sys/cdefs.h" 3 4 #define __returns_twice __attribute__((__returns_twice__)) #else # 373 "/usr/include/sys/cdefs.h" 3 4 #define __returns_twice #endif # 375 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 377 "/usr/include/sys/cdefs.h" 3 4 #define __unreachable() __builtin_unreachable() #else # 379 "/usr/include/sys/cdefs.h" 3 4 #define __unreachable() ((void)0) #endif # 381 "/usr/include/sys/cdefs.h" 3 4 /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ #if 0 /* disabled by -frewrite-includes */ #if !__GNUC_PREREQ__(2, 7) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 384 "/usr/include/sys/cdefs.h" 3 4 #define __func__ NULL #endif # 386 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if (defined(__GNUC__) && __GNUC__ >= 2) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 388 "/usr/include/sys/cdefs.h" 3 4 #define __LONG_LONG_SUPPORTED #endif # 390 "/usr/include/sys/cdefs.h" 3 4 /* C++11 exposes a load of C99 stuff */ #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) && __cplusplus >= 201103L #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 393 "/usr/include/sys/cdefs.h" 3 4 #define __LONG_LONG_SUPPORTED #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS #endif # 397 "/usr/include/sys/cdefs.h" 3 4 #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif # 400 "/usr/include/sys/cdefs.h" 3 4 #endif # 401 "/usr/include/sys/cdefs.h" 3 4 /* * GCC 2.95 provides `__restrict' as an extension to C90 to support the * C99-specific `restrict' type qualifier. We happen to use `__restrict' as * a way to define the `restrict' type qualifier without disturbing older * software that is unaware of C99 keywords. */ #if 0 /* disabled by -frewrite-includes */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 409 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 410 "/usr/include/sys/cdefs.h" 3 4 #define __restrict #else # 412 "/usr/include/sys/cdefs.h" 3 4 #define __restrict restrict #endif # 414 "/usr/include/sys/cdefs.h" 3 4 #endif # 415 "/usr/include/sys/cdefs.h" 3 4 /* * GNU C version 2.96 adds explicit branch prediction so that * the CPU back-end can hint the processor and also so that * code blocks can be reordered such that the predicted path * sees a more linear flow, thus improving cache behavior, etc. * * The following two macros provide us with a way to utilize this * compiler feature. Use __predict_true() if you expect the expression * to evaluate to true, and __predict_false() if you expect the * expression to evaluate to false. * * A few notes about usage: * * * Generally, __predict_false() error condition checks (unless * you have some _strong_ reason to do otherwise, in which case * document it), and/or __predict_true() `no-error' condition * checks, assuming you want to optimize for the no-error case. * * * Other than that, if you don't know the likelihood of a test * succeeding from empirical or other `hard' evidence, don't * make predictions. * * * These are meant to be used in places that are run `a lot'. * It is wasteful to make predictions in code that is run * seldomly (e.g. at subsystem initialization time) as the * basic block reordering that this affects can often generate * larger code. */ #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(2, 96) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 445 "/usr/include/sys/cdefs.h" 3 4 #define __predict_true(exp) __builtin_expect((exp), 1) #define __predict_false(exp) __builtin_expect((exp), 0) #else # 448 "/usr/include/sys/cdefs.h" 3 4 #define __predict_true(exp) (exp) #define __predict_false(exp) (exp) #endif # 451 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(4, 0) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 453 "/usr/include/sys/cdefs.h" 3 4 #define __null_sentinel __attribute__((__sentinel__)) #define __exported __attribute__((__visibility__("default"))) #define __hidden __attribute__((__visibility__("hidden"))) #else # 457 "/usr/include/sys/cdefs.h" 3 4 #define __null_sentinel #define __exported #define __hidden #endif # 461 "/usr/include/sys/cdefs.h" 3 4 /* * We define this here since , , and * require it. */ #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(4, 1) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 467 "/usr/include/sys/cdefs.h" 3 4 #define __offsetof(type, field) __builtin_offsetof(type, field) #else # 469 "/usr/include/sys/cdefs.h" 3 4 #ifndef __cplusplus #define __offsetof(type, field) \ ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) #else # 473 "/usr/include/sys/cdefs.h" 3 4 #define __offsetof(type, field) \ (__offsetof__ (reinterpret_cast <__size_t> \ (&reinterpret_cast \ (static_cast (0)->field)))) #endif # 478 "/usr/include/sys/cdefs.h" 3 4 #endif # 479 "/usr/include/sys/cdefs.h" 3 4 #define __rangeof(type, start, end) \ (__offsetof(type, end) - __offsetof(type, start)) /* * Given the pointer x to the member m of the struct s, return * a pointer to the containing structure. When using GCC, we first * assign pointer x to a local variable, to check that its type is * compatible with member m. */ #if 0 /* disabled by -frewrite-includes */ #if __GNUC_PREREQ__(3, 1) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 489 "/usr/include/sys/cdefs.h" 3 4 #define __containerof(x, s, m) ({ \ const volatile __typeof(((s *)0)->m) *__x = (x); \ __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\ }) #else # 494 "/usr/include/sys/cdefs.h" 3 4 #define __containerof(x, s, m) \ __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) #endif # 497 "/usr/include/sys/cdefs.h" 3 4 /* * Compiler-dependent macros to declare that functions take printf-like * or scanf-like arguments. They are null except for versions of gcc * that are known to support the features properly (old versions of gcc-2 * didn't permit keeping the keywords out of the application namespace). */ #if 0 /* disabled by -frewrite-includes */ #if !__GNUC_PREREQ__(2, 7) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 505 "/usr/include/sys/cdefs.h" 3 4 #define __printflike(fmtarg, firstvararg) #define __scanflike(fmtarg, firstvararg) #define __format_arg(fmtarg) #define __strfmonlike(fmtarg, firstvararg) #define __strftimelike(fmtarg, firstvararg) #else # 511 "/usr/include/sys/cdefs.h" 3 4 #define __printflike(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) #define __scanflike(fmtarg, firstvararg) \ __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) #define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg))) #define __strfmonlike(fmtarg, firstvararg) \ __attribute__((__format__ (__strfmon__, fmtarg, firstvararg))) #define __strftimelike(fmtarg, firstvararg) \ __attribute__((__format__ (__strftime__, fmtarg, firstvararg))) #endif # 521 "/usr/include/sys/cdefs.h" 3 4 /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \ defined(__GNUC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 525 "/usr/include/sys/cdefs.h" 3 4 #define __printf0like(fmtarg, firstvararg) \ __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) #else # 528 "/usr/include/sys/cdefs.h" 3 4 #define __printf0like(fmtarg, firstvararg) #endif # 530 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(__GNUC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 532 "/usr/include/sys/cdefs.h" 3 4 #define __strong_reference(sym,aliassym) \ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) #ifdef __STDC__ #define __weak_reference(sym,alias) \ __asm__(".weak " #alias); \ __asm__(".equ " #alias ", " #sym) #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning." #sym); \ __asm__(".asciz \"" msg "\""); \ __asm__(".previous") #define __sym_compat(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@" #verid) #define __sym_default(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@@@" #verid) #else # 547 "/usr/include/sys/cdefs.h" 3 4 #define __weak_reference(sym,alias) \ __asm__(".weak alias"); \ __asm__(".equ alias, sym") #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning.sym"); \ __asm__(".asciz \"msg\""); \ __asm__(".previous") #define __sym_compat(sym,impl,verid) \ __asm__(".symver impl, sym@verid") #define __sym_default(impl,sym,verid) \ __asm__(".symver impl, sym@@@verid") #endif /* __STDC__ */ # 559 "/usr/include/sys/cdefs.h" 3 4 #endif /* __GNUC__ */ # 560 "/usr/include/sys/cdefs.h" 3 4 #define __GLOBL(sym) __asm__(".globl " __XSTRING(sym)) #define __WEAK(sym) __asm__(".weak " __XSTRING(sym)) #if 0 /* disabled by -frewrite-includes */ #if defined(__GNUC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 565 "/usr/include/sys/cdefs.h" 3 4 #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") #else # 567 "/usr/include/sys/cdefs.h" 3 4 /* * The following definition might not work well if used in header files, * but it should be better than nothing. If you want a "do nothing" * version, then it should generate some harmless declaration, such as: * #define __IDSTRING(name,string) struct __hack */ #define __IDSTRING(name,string) static const char name[] __unused = string #endif # 575 "/usr/include/sys/cdefs.h" 3 4 /* * Embed the rcs id of a source file in the resulting library. Note that in * more recent ELF binutils, we use .ident allowing the ID to be stripped. * Usage: * __FBSDID("$FreeBSD$"); */ #ifndef __FBSDID #if 0 /* disabled by -frewrite-includes */ #if !defined(STRIP_FBSDID) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 584 "/usr/include/sys/cdefs.h" 3 4 #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else # 586 "/usr/include/sys/cdefs.h" 3 4 #define __FBSDID(s) struct __hack #endif # 588 "/usr/include/sys/cdefs.h" 3 4 #endif # 589 "/usr/include/sys/cdefs.h" 3 4 #ifndef __RCSID #ifndef NO__RCSID #define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else # 594 "/usr/include/sys/cdefs.h" 3 4 #define __RCSID(s) struct __hack #endif # 596 "/usr/include/sys/cdefs.h" 3 4 #endif # 597 "/usr/include/sys/cdefs.h" 3 4 #ifndef __RCSID_SOURCE #ifndef NO__RCSID_SOURCE #define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s) #else # 602 "/usr/include/sys/cdefs.h" 3 4 #define __RCSID_SOURCE(s) struct __hack #endif # 604 "/usr/include/sys/cdefs.h" 3 4 #endif # 605 "/usr/include/sys/cdefs.h" 3 4 #ifndef __SCCSID #ifndef NO__SCCSID #define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s) #else # 610 "/usr/include/sys/cdefs.h" 3 4 #define __SCCSID(s) struct __hack #endif # 612 "/usr/include/sys/cdefs.h" 3 4 #endif # 613 "/usr/include/sys/cdefs.h" 3 4 #ifndef __COPYRIGHT #ifndef NO__COPYRIGHT #define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s) #else # 618 "/usr/include/sys/cdefs.h" 3 4 #define __COPYRIGHT(s) struct __hack #endif # 620 "/usr/include/sys/cdefs.h" 3 4 #endif # 621 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DECONST #define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) #endif # 625 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DEVOLATILE #define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var)) #endif # 629 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DEQUALIFY #define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var)) #endif # 633 "/usr/include/sys/cdefs.h" 3 4 /*- * The following definitions are an extension of the behavior originally * implemented in , but with a different level of granularity. * POSIX.1 requires that the macros we test be defined before any standard * header file is included. * * Here's a quick run-down of the versions (and some informal names) * defined(_POSIX_SOURCE) 1003.1-1988 * encoded as 198808 below * _POSIX_C_SOURCE == 1 1003.1-1990 * encoded as 199009 below * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option * encoded as 199209 below * _POSIX_C_SOURCE == 199309 1003.1b-1993 * (1003.1 Issue 4, Single Unix Spec v1, Unix 93) * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, * and the omnibus ISO/IEC 9945-1: 1996 * (1003.1 Issue 5, Single Unix Spec v2, Unix 95) * _POSIX_C_SOURCE == 200112 1003.1-2001 (1003.1 Issue 6, Unix 03) * _POSIX_C_SOURCE == 200809 1003.1-2008 (1003.1 Issue 7) * IEEE Std 1003.1-2017 (Rev of 1003.1-2008) is * 1003.1-2008 with two TCs applied with * _POSIX_C_SOURCE=200809 and _XOPEN_SOURCE=700 * * In addition, the X/Open Portability Guide, which is now the Single UNIX * Specification, defines a feature-test macro which indicates the version of * that specification, and which subsumes _POSIX_C_SOURCE. * * Our macros begin with two underscores to avoid namespace screwage. */ /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ #if 0 /* disabled by -frewrite-includes */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 667 "/usr/include/sys/cdefs.h" 3 4 #undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ #define _POSIX_C_SOURCE 199009 #endif # 670 "/usr/include/sys/cdefs.h" 3 4 /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ #if 0 /* disabled by -frewrite-includes */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 673 "/usr/include/sys/cdefs.h" 3 4 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199209 #endif # 676 "/usr/include/sys/cdefs.h" 3 4 /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ #ifdef _XOPEN_SOURCE #if 0 /* disabled by -frewrite-includes */ #if _XOPEN_SOURCE - 0 >= 700 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 680 "/usr/include/sys/cdefs.h" 3 4 #define __XSI_VISIBLE 700 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _XOPEN_SOURCE - 0 >= 600 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 684 "/usr/include/sys/cdefs.h" 3 4 #define __XSI_VISIBLE 600 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _XOPEN_SOURCE - 0 >= 500 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 688 "/usr/include/sys/cdefs.h" 3 4 #define __XSI_VISIBLE 500 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199506 #endif # 692 "/usr/include/sys/cdefs.h" 3 4 #endif # 693 "/usr/include/sys/cdefs.h" 3 4 /* * Deal with all versions of POSIX. The ordering relative to the tests above is * important. */ #if 0 /* disabled by -frewrite-includes */ #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 699 "/usr/include/sys/cdefs.h" 3 4 #define _POSIX_C_SOURCE 198808 #endif # 701 "/usr/include/sys/cdefs.h" 3 4 #ifdef _POSIX_C_SOURCE #if 0 /* disabled by -frewrite-includes */ #if _POSIX_C_SOURCE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 703 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 200809 #define __ISO_C_VISIBLE 1999 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _POSIX_C_SOURCE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 706 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 200112 #define __ISO_C_VISIBLE 1999 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _POSIX_C_SOURCE >= 199506 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 709 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199506 #define __ISO_C_VISIBLE 1990 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _POSIX_C_SOURCE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 712 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199309 #define __ISO_C_VISIBLE 1990 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _POSIX_C_SOURCE >= 199209 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 715 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199209 #define __ISO_C_VISIBLE 1990 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _POSIX_C_SOURCE >= 199009 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 718 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199009 #define __ISO_C_VISIBLE 1990 #else # 721 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 198808 #define __ISO_C_VISIBLE 0 #endif /* _POSIX_C_SOURCE */ # 724 "/usr/include/sys/cdefs.h" 3 4 /* * Both glibc and OpenBSD enable c11 features when _ISOC11_SOURCE is defined, or * when compiling with -stdc=c11. A strict reading of the standard would suggest * doing it only for the former. However, a strict reading also requires C99 * mode only, so building with C11 is already undefined. Follow glibc's and * OpenBSD's lead for this non-standard configuration for maximum compatibility. */ #if 0 /* disabled by -frewrite-includes */ #if _ISOC11_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 732 "/usr/include/sys/cdefs.h" 3 4 #undef __ISO_C_VISIBLE #define __ISO_C_VISIBLE 2011 #endif # 735 "/usr/include/sys/cdefs.h" 3 4 #else # 736 "/usr/include/sys/cdefs.h" 3 4 /*- * Deal with _ANSI_SOURCE: * If it is defined, and no other compilation environment is explicitly * requested, then define our internal feature-test macros to zero. This * makes no difference to the preprocessor (undefined symbols in preprocessing * expressions are defined to have value zero), but makes it more convenient for * a test program to print out the values. * * If a program mistakenly defines _ANSI_SOURCE and some other macro such as * _POSIX_C_SOURCE, we will assume that it wants the broader compilation * environment (and in fact we will never get here). */ #if 0 /* disabled by -frewrite-includes */ #if defined(_ANSI_SOURCE) /* Hide almost everything. */ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 749 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1990 #define __EXT1_VISIBLE 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 755 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1999 #define __EXT1_VISIBLE 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */ #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 761 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 2011 #define __EXT1_VISIBLE 0 #else /* Default environment: show everything. */ # 767 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 200809 #define __XSI_VISIBLE 700 #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 #define __EXT1_VISIBLE 1 #endif # 773 "/usr/include/sys/cdefs.h" 3 4 #endif # 774 "/usr/include/sys/cdefs.h" 3 4 /* User override __EXT1_VISIBLE */ #if 0 /* disabled by -frewrite-includes */ #if defined(__STDC_WANT_LIB_EXT1__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 777 "/usr/include/sys/cdefs.h" 3 4 #undef __EXT1_VISIBLE #if 0 /* disabled by -frewrite-includes */ #if __STDC_WANT_LIB_EXT1__ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 779 "/usr/include/sys/cdefs.h" 3 4 #define __EXT1_VISIBLE 1 #else # 781 "/usr/include/sys/cdefs.h" 3 4 #define __EXT1_VISIBLE 0 #endif # 783 "/usr/include/sys/cdefs.h" 3 4 #endif /* __STDC_WANT_LIB_EXT1__ */ # 784 "/usr/include/sys/cdefs.h" 3 4 /* * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__arm__) && !defined(__ARM_ARCH) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 790 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 790 "/usr/include/sys/cdefs.h" 3 4 # 791 "/usr/include/sys/cdefs.h" 3 4 #endif # 792 "/usr/include/sys/cdefs.h" 3 4 /* * Nullability qualifiers: currently only supported by Clang. */ #if 0 /* disabled by -frewrite-includes */ #if !(defined(__clang__) && __has_feature(nullability)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 797 "/usr/include/sys/cdefs.h" 3 4 #define _Nonnull #define _Nullable #define _Null_unspecified #define __NULLABILITY_PRAGMA_PUSH #define __NULLABILITY_PRAGMA_POP #else # 803 "/usr/include/sys/cdefs.h" 3 4 #define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") #define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop") #endif # 807 "/usr/include/sys/cdefs.h" 3 4 /* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety * properties that cannot be enforced by the C type system. */ #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(__argument_with_type_tag__) && \ __has_attribute(__type_tag_for_datatype__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 817 "/usr/include/sys/cdefs.h" 3 4 #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \ __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx))) #define __datatype_type_tag(kind, type) \ __attribute__((__type_tag_for_datatype__(kind, type))) #else # 822 "/usr/include/sys/cdefs.h" 3 4 #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) #define __datatype_type_tag(kind, type) #endif # 825 "/usr/include/sys/cdefs.h" 3 4 /* * Lock annotations. * * Clang provides support for doing basic thread-safety tests at * compile-time, by marking which locks will/should be held when * entering/leaving a functions. * * Furthermore, it is also possible to annotate variables and structure * members to enforce that they are only accessed when certain locks are * held. */ #if 0 /* disabled by -frewrite-includes */ #if __has_extension(c_thread_safety_attributes) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 839 "/usr/include/sys/cdefs.h" 3 4 #define __lock_annotate(x) __attribute__((x)) #else # 841 "/usr/include/sys/cdefs.h" 3 4 #define __lock_annotate(x) #endif # 843 "/usr/include/sys/cdefs.h" 3 4 /* Structure implements a lock. */ #define __lockable __lock_annotate(lockable) /* Function acquires an exclusive or shared lock. */ #define __locks_exclusive(...) \ __lock_annotate(exclusive_lock_function(__VA_ARGS__)) #define __locks_shared(...) \ __lock_annotate(shared_lock_function(__VA_ARGS__)) /* Function attempts to acquire an exclusive or shared lock. */ #define __trylocks_exclusive(...) \ __lock_annotate(exclusive_trylock_function(__VA_ARGS__)) #define __trylocks_shared(...) \ __lock_annotate(shared_trylock_function(__VA_ARGS__)) /* Function releases a lock. */ #define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__)) /* Function asserts that an exclusive or shared lock is held. */ #define __asserts_exclusive(...) \ __lock_annotate(assert_exclusive_lock(__VA_ARGS__)) #define __asserts_shared(...) \ __lock_annotate(assert_shared_lock(__VA_ARGS__)) /* Function requires that an exclusive or shared lock is or is not held. */ #define __requires_exclusive(...) \ __lock_annotate(exclusive_locks_required(__VA_ARGS__)) #define __requires_shared(...) \ __lock_annotate(shared_locks_required(__VA_ARGS__)) #define __requires_unlocked(...) \ __lock_annotate(locks_excluded(__VA_ARGS__)) /* Function should not be analyzed. */ #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) /* * Function or variable should not be sanitized, e.g., by AddressSanitizer. * GCC has the nosanitize attribute, but as a function attribute only, and * warns on use as a variable attribute. */ #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(no_sanitize) && defined(__clang__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 885 "/usr/include/sys/cdefs.h" 3 4 #ifdef _KERNEL #define __nosanitizeaddress __attribute__((no_sanitize("kernel-address"))) #define __nosanitizememory __attribute__((no_sanitize("kernel-memory"))) #else # 889 "/usr/include/sys/cdefs.h" 3 4 #define __nosanitizeaddress __attribute__((no_sanitize("address"))) #define __nosanitizememory __attribute__((no_sanitize("memory"))) #endif # 892 "/usr/include/sys/cdefs.h" 3 4 #define __nosanitizethread __attribute__((no_sanitize("thread"))) #else # 894 "/usr/include/sys/cdefs.h" 3 4 #define __nosanitizeaddress #define __nosanitizememory #define __nosanitizethread #endif # 898 "/usr/include/sys/cdefs.h" 3 4 /* * Make it possible to opt out of stack smashing protection. */ #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(no_stack_protector) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 903 "/usr/include/sys/cdefs.h" 3 4 #define __nostackprotector __attribute__((no_stack_protector)) #else # 905 "/usr/include/sys/cdefs.h" 3 4 #define __nostackprotector \ __attribute__((__optimize__("-fno-stack-protector"))) #endif # 908 "/usr/include/sys/cdefs.h" 3 4 /* Guard variables and structure members by lock. */ #define __guarded_by(x) __lock_annotate(guarded_by(x)) #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) /* Alignment builtins for better type checking and improved code generation. */ /* Provide fallback versions for other compilers (GCC/Clang < 10): */ #if 0 /* disabled by -frewrite-includes */ #if !__has_builtin(__builtin_is_aligned) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 916 "/usr/include/sys/cdefs.h" 3 4 #define __builtin_is_aligned(x, align) \ (((__uintptr_t)x & ((align) - 1)) == 0) #endif # 919 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !__has_builtin(__builtin_align_up) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 920 "/usr/include/sys/cdefs.h" 3 4 #define __builtin_align_up(x, align) \ ((__typeof__(x))(((__uintptr_t)(x)+((align)-1))&(~((align)-1)))) #endif # 923 "/usr/include/sys/cdefs.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !__has_builtin(__builtin_align_down) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 924 "/usr/include/sys/cdefs.h" 3 4 #define __builtin_align_down(x, align) \ ((__typeof__(x))((x)&(~((align)-1)))) #endif # 927 "/usr/include/sys/cdefs.h" 3 4 #define __align_up(x, y) __builtin_align_up(x, y) #define __align_down(x, y) __builtin_align_down(x, y) #define __is_aligned(x, y) __builtin_is_aligned(x, y) #endif /* !_SYS_CDEFS_H_ */ # 933 "/usr/include/sys/cdefs.h" 3 4 # 45 "/usr/include/libutil.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/libutil.h" 3 4 # 1 "/usr/include/sys/_types.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__TYPES_H_ #define _SYS__TYPES_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/include/sys/_types.h" 3 4 # 35 "/usr/include/sys/_types.h" 3 4 /* * Basic types upon which most other types are built. * * Note: It would be nice to simply use the compiler-provided __FOO_TYPE__ * macros. However, in order to do so we have to check that those match the * previous typedefs exactly (not just that they have the same size) since any * change would be an ABI break. For example, changing `long` to `long long` * results in different C++ name mangling. */ typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; #if 0 /* disabled by -frewrite-includes */ #if __SIZEOF_LONG__ == 8 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 52 "/usr/include/sys/_types.h" 3 4 typedef long __int64_t; typedef unsigned long __uint64_t; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __SIZEOF_LONG__ == 4 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 55 "/usr/include/sys/_types.h" 3 4 __extension__ typedef long long __int64_t; __extension__ typedef unsigned long long __uint64_t; #else # 60 "/usr/include/sys/_types.h" 3 4 #error unsupported long size #endif # 62 "/usr/include/sys/_types.h" 3 4 typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; typedef __int64_t __intmax_t; typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint64_t __uintmax_t; #if 0 /* disabled by -frewrite-includes */ #if __SIZEOF_POINTER__ == 8 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 75 "/usr/include/sys/_types.h" 3 4 typedef __int64_t __intptr_t; typedef __int64_t __intfptr_t; typedef __uint64_t __uintptr_t; typedef __uint64_t __uintfptr_t; typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_size_t; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __SIZEOF_POINTER__ == 4 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 82 "/usr/include/sys/_types.h" 3 4 typedef __int32_t __intptr_t; typedef __int32_t __intfptr_t; typedef __uint32_t __uintptr_t; typedef __uint32_t __uintfptr_t; typedef __uint32_t __vm_offset_t; typedef __uint32_t __vm_size_t; #else # 89 "/usr/include/sys/_types.h" 3 4 #error unsupported pointer size #endif # 91 "/usr/include/sys/_types.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __SIZEOF_SIZE_T__ == 8 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 93 "/usr/include/sys/_types.h" 3 4 typedef __uint64_t __size_t; /* sizeof() */ typedef __int64_t __ssize_t; /* byte count or error */ #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __SIZEOF_SIZE_T__ == 4 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 96 "/usr/include/sys/_types.h" 3 4 typedef __uint32_t __size_t; /* sizeof() */ typedef __int32_t __ssize_t; /* byte count or error */ #else # 99 "/usr/include/sys/_types.h" 3 4 #error unsupported size_t size #endif # 101 "/usr/include/sys/_types.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __SIZEOF_PTRDIFF_T__ == 8 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 103 "/usr/include/sys/_types.h" 3 4 typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __SIZEOF_PTRDIFF_T__ == 4 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 105 "/usr/include/sys/_types.h" 3 4 typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ #else # 107 "/usr/include/sys/_types.h" 3 4 #error unsupported ptrdiff_t size #endif # 109 "/usr/include/sys/_types.h" 3 4 /* * Target-dependent type definitions. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 113 "/usr/include/sys/_types.h" 3 4 # 1 "/usr/include/machine/_types.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_types.h" 3 4 # 1 "/usr/include/x86/_types.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 2002 Mike Barcroft * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 * From: @(#)types.h 8.3 (Berkeley) 1/5/94 * $FreeBSD$ */ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ #ifndef _SYS__TYPES_H_ #error do not include this header, use sys/_types.h #endif # 47 "/usr/include/x86/_types.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 48 "/usr/include/x86/_types.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_limits.h" 3 4 # 1 "/usr/include/x86/_limits.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)limits.h 8.3 (Berkeley) 1/4/94 * $FreeBSD$ */ #ifndef _MACHINE__LIMITS_H_ #define _MACHINE__LIMITS_H_ /* * According to ANSI (section 2.2.4.2), the values below must be usable by * #if preprocessing directives. Additionally, the expression must have the * same type as would an expression that is an object of the corresponding * type converted according to the integral promotions. The subtraction for * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). */ #define __CHAR_BIT 8 /* number of bits in a char */ #define __SCHAR_MAX 0x7f /* max value for a signed char */ #define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ #define __UCHAR_MAX 0xff /* max value for an unsigned char */ #define __USHRT_MAX 0xffff /* max value for an unsigned short */ #define __SHRT_MAX 0x7fff /* max value for a short */ #define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ #define __UINT_MAX 0xffffffff /* max value for an unsigned int */ #define __INT_MAX 0x7fffffff /* max value for an int */ #define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ #ifdef __LP64__ #define __ULONG_MAX 0xffffffffffffffff /* max for an unsigned long */ #define __LONG_MAX 0x7fffffffffffffff /* max for a long */ #define __LONG_MIN (-0x7fffffffffffffff - 1) /* min for a long */ #else # 67 "/usr/include/x86/_limits.h" 3 4 #define __ULONG_MAX 0xffffffffUL #define __LONG_MAX 0x7fffffffL #define __LONG_MIN (-0x7fffffffL - 1) #endif # 71 "/usr/include/x86/_limits.h" 3 4 /* max value for an unsigned long long */ #define __ULLONG_MAX 0xffffffffffffffffULL #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ #define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ #ifdef __LP64__ #define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ #define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ #define __OFF_MAX __LONG_MAX /* max value for an off_t */ #define __OFF_MIN __LONG_MIN /* min value for an off_t */ /* Quads and longs are the same on the amd64. Ensure they stay in sync. */ #define __UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */ #define __QUAD_MAX __LONG_MAX /* max value for a quad_t */ #define __QUAD_MIN __LONG_MIN /* min value for a quad_t */ #define __LONG_BIT 64 #else # 88 "/usr/include/x86/_limits.h" 3 4 #define __SSIZE_MAX __INT_MAX #define __SIZE_T_MAX __UINT_MAX #define __OFF_MAX __LLONG_MAX #define __OFF_MIN __LLONG_MIN #define __UQUAD_MAX __ULLONG_MAX #define __QUAD_MAX __LLONG_MAX #define __QUAD_MIN __LLONG_MIN #define __LONG_BIT 32 #endif # 97 "/usr/include/x86/_limits.h" 3 4 #define __WORD_BIT 32 /* Minimum signal stack size. */ #define __MINSIGSTKSZ (512 * 4) #endif /* !_MACHINE__LIMITS_H_ */ # 104 "/usr/include/x86/_limits.h" 3 4 # 7 "/usr/include/machine/_limits.h" 2 3 4 # 49 "/usr/include/x86/_types.h" 2 3 4 #define __NO_STRICT_ALIGNMENT /* * Standard type definitions. */ #ifdef __LP64__ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; #ifndef _STANDALONE typedef double __double_t; typedef float __float_t; #endif # 62 "/usr/include/x86/_types.h" 3 4 #else # 63 "/usr/include/x86/_types.h" 3 4 typedef unsigned long __clock_t; typedef __int32_t __critical_t; #ifndef _STANDALONE typedef long double __double_t; typedef long double __float_t; #endif # 69 "/usr/include/x86/_types.h" 3 4 #endif # 70 "/usr/include/x86/_types.h" 3 4 typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; #ifdef __LP64__ typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ typedef __int64_t __time_t; /* time()... */ #else # 79 "/usr/include/x86/_types.h" 3 4 typedef __int32_t __register_t; typedef __int32_t __segsz_t; typedef __int32_t __time_t; #endif # 83 "/usr/include/x86/_types.h" 3 4 typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; #ifdef __LP64__ typedef __uint64_t __u_register_t; typedef __uint64_t __vm_paddr_t; #else # 91 "/usr/include/x86/_types.h" 3 4 typedef __uint32_t __u_register_t; typedef __uint64_t __vm_paddr_t; #endif # 94 "/usr/include/x86/_types.h" 3 4 typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ #define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ #endif /* !_MACHINE__TYPES_H_ */ # 100 "/usr/include/x86/_types.h" 3 4 # 7 "/usr/include/machine/_types.h" 2 3 4 # 114 "/usr/include/sys/_types.h" 2 3 4 /* * Standard type definitions. */ typedef __int32_t __blksize_t; /* file block size */ typedef __int64_t __blkcnt_t; /* file block count */ typedef __int32_t __clockid_t; /* clock_gettime()... */ typedef __uint32_t __fflags_t; /* file flags */ typedef __uint64_t __fsblkcnt_t; typedef __uint64_t __fsfilcnt_t; typedef __uint32_t __gid_t; typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ typedef __uint64_t __ino_t; /* inode number */ typedef long __key_t; /* IPC key (for Sys V IPC) */ typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */ typedef __uint16_t __mode_t; /* permissions */ typedef int __accmode_t; /* access permissions */ typedef int __nl_item; typedef __uint64_t __nlink_t; /* link count */ typedef __int64_t __off_t; /* file offset */ typedef __int64_t __off64_t; /* file offset (alias) */ typedef __int32_t __pid_t; /* process [group] */ typedef __int64_t __sbintime_t; typedef __int64_t __rlim_t; /* resource limit - intentionally */ /* signed, because of legacy code */ /* that uses -1 for RLIM_INFINITY */ typedef __uint8_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef struct __timer *__timer_t; /* timer_gettime()... */ typedef struct __mq *__mqd_t; /* mq_open()... */ typedef __uint32_t __uid_t; typedef unsigned int __useconds_t; /* microseconds (unsigned) */ typedef int __cpuwhich_t; /* which parameter for cpuset. */ typedef int __cpulevel_t; /* level parameter for cpuset. */ typedef int __cpusetid_t; /* cpuset identifier. */ typedef __int64_t __daddr_t; /* bwrite(3), FIOBMAP2, etc */ /* * Unusual type definitions. */ /* * rune_t is declared to be an ``int'' instead of the more natural * ``unsigned long'' or ``long''. Two things are happening here. It is not * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, * it looks like 10646 will be a 31 bit standard. This means that if your * ints cannot hold 32 bits, you will be in trouble. The reason an int was * chosen over a long is that the is*() and to*() routines take ints (says * ANSI C), but they use __ct_rune_t instead of int. * * NOTE: rune_t is not covered by ANSI nor other standards, and should not * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and * rune_t must be the same type. Also, wint_t should be able to hold all * members of the largest character set plus one extra value (WEOF), and * must be at least 16 bits. */ typedef int __ct_rune_t; /* arg type for ctype funcs */ typedef __ct_rune_t __rune_t; /* rune_t (see above) */ typedef __ct_rune_t __wint_t; /* wint_t (see above) */ /* Clang already provides these types as built-ins, but only in C++ mode. */ #if 0 /* disabled by -frewrite-includes */ #if !defined(__clang__) || !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 176 "/usr/include/sys/_types.h" 3 4 typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; #endif # 179 "/usr/include/sys/_types.h" 3 4 /* In C++11, char16_t and char32_t are built-in types. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) && __cplusplus >= 201103L #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 181 "/usr/include/sys/_types.h" 3 4 #define _CHAR16_T_DECLARED #define _CHAR32_T_DECLARED #endif # 184 "/usr/include/sys/_types.h" 3 4 typedef struct { long long __max_align1 __aligned(_Alignof(long long)); #ifndef _STANDALONE long double __max_align2 __aligned(_Alignof(long double)); #endif # 190 "/usr/include/sys/_types.h" 3 4 } __max_align_t; typedef __uint64_t __dev_t; /* device number */ typedef __uint32_t __fixpt_t; /* fixed point number */ /* * mbstate_t is an opaque object to keep conversion state during multibyte * stream conversions. */ typedef union { char __mbstate8[128]; __int64_t _mbstateL; /* for alignment */ } __mbstate_t; typedef __uintmax_t __rman_res_t; /* * Types for varargs. These are all provided by builtin types these * days, so centralize their definition. */ typedef __builtin_va_list __va_list; /* internally known to gcc */ #if 0 /* disabled by -frewrite-includes */ #if !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 213 "/usr/include/sys/_types.h" 3 4 #define __GNUC_VA_LIST typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ #endif # 216 "/usr/include/sys/_types.h" 3 4 /* * When the following macro is defined, the system uses 64-bit inode numbers. * Programs can use this to avoid including , with its associated * namespace pollution. */ #define __INO64 #endif /* !_SYS__TYPES_H_ */ # 225 "/usr/include/sys/_types.h" 3 4 # 46 "/usr/include/libutil.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 46 "/usr/include/libutil.h" 3 4 # 1 "/usr/include/sys/_stdint.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 David E. O'Brien * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__STDINT_H_ #define _SYS__STDINT_H_ #ifndef _INT8_T_DECLARED typedef __int8_t int8_t; #define _INT8_T_DECLARED #endif # 39 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INT16_T_DECLARED typedef __int16_t int16_t; #define _INT16_T_DECLARED #endif # 44 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INT32_T_DECLARED typedef __int32_t int32_t; #define _INT32_T_DECLARED #endif # 49 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INT64_T_DECLARED typedef __int64_t int64_t; #define _INT64_T_DECLARED #endif # 54 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT8_T_DECLARED typedef __uint8_t uint8_t; #define _UINT8_T_DECLARED #endif # 59 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT16_T_DECLARED typedef __uint16_t uint16_t; #define _UINT16_T_DECLARED #endif # 64 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT32_T_DECLARED typedef __uint32_t uint32_t; #define _UINT32_T_DECLARED #endif # 69 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT64_T_DECLARED typedef __uint64_t uint64_t; #define _UINT64_T_DECLARED #endif # 74 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INTPTR_T_DECLARED typedef __intptr_t intptr_t; #define _INTPTR_T_DECLARED #endif # 79 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINTPTR_T_DECLARED typedef __uintptr_t uintptr_t; #define _UINTPTR_T_DECLARED #endif # 83 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INTMAX_T_DECLARED typedef __intmax_t intmax_t; #define _INTMAX_T_DECLARED #endif # 87 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINTMAX_T_DECLARED typedef __uintmax_t uintmax_t; #define _UINTMAX_T_DECLARED #endif # 91 "/usr/include/sys/_stdint.h" 3 4 #endif /* !_SYS__STDINT_H_ */ # 93 "/usr/include/sys/_stdint.h" 3 4 # 47 "/usr/include/libutil.h" 2 3 4 #ifndef _GID_T_DECLARED typedef __gid_t gid_t; #define _GID_T_DECLARED #endif # 52 "/usr/include/libutil.h" 3 4 #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; #define _MODE_T_DECLARED #endif # 57 "/usr/include/libutil.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif # 62 "/usr/include/libutil.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 67 "/usr/include/libutil.h" 3 4 #ifndef _UID_T_DECLARED typedef __uid_t uid_t; #define _UID_T_DECLARED #endif # 72 "/usr/include/libutil.h" 3 4 #define PROPERTY_MAX_NAME 64 #define PROPERTY_MAX_VALUE 512 /* For properties.c. */ typedef struct _property { struct _property *next; char *name; char *value; } *properties; /* Avoid pulling in all the include files for no need. */ struct in_addr; struct pidfh; struct sockaddr; struct termios; struct winsize; __BEGIN_DECLS char *auth_getval(const char *_name); void clean_environment(const char * const *_white, const char * const *_more_white); int expand_number(const char *_buf, uint64_t *_num); int extattr_namespace_to_string(int _attrnamespace, char **_string); int extattr_string_to_namespace(const char *_string, int *_attrnamespace); int flopen(const char *_path, int _flags, ...); int flopenat(int _dirfd, const char *_path, int _flags, ...); int forkpty(int *_amaster, char *_name, struct termios *_termp, struct winsize *_winp); const char * getlocalbase(void); void hexdump(const void *_ptr, int _length, const char *_hdr, int _flags); int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); struct kinfo_file * kinfo_getfile(pid_t _pid, int *_cntp); struct kinfo_vmentry * kinfo_getvmmap(pid_t _pid, int *_cntp); struct kinfo_vmobject * kinfo_getvmobject(int *_cntp); struct kinfo_vmobject * kinfo_getswapvmobject(int *_cntp); struct kinfo_proc * kinfo_getallproc(int *_cntp); struct kinfo_proc * kinfo_getproc(pid_t _pid); int kld_isloaded(const char *_name); int kld_load(const char *_name); int login_tty(int _fd); int openpty(int *_amaster, int *_aslave, char *_name, struct termios *_termp, struct winsize *_winp); int pidfile_close(struct pidfh *_pfh); int pidfile_fileno(const struct pidfh *_pfh); int pidfile_signal(const char *pathp, int sig, pid_t *pidptr); struct pidfh * pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); int pidfile_remove(struct pidfh *_pfh); int pidfile_write(struct pidfh *_pfh); void properties_free(properties _list); char *property_find(properties _list, const char *_name); properties properties_read(int _fd); int realhostname(char *_host, size_t _hsize, const struct in_addr *_ip); int realhostname_sa(char *_host, size_t _hsize, struct sockaddr *_addr, int _addrlen); int _secure_path(const char *_path, uid_t _uid, gid_t _gid); void trimdomain(char *_fullhost, int _hostsize); const char * uu_lockerr(int _uu_lockresult); int uu_lock(const char *_ttyname); int uu_unlock(const char *_ttyname); int uu_lock_txfr(const char *_ttyname, pid_t _pid); /* * Conditionally prototype the following functions if the include * files upon which they depend have been included. */ #ifdef _STDIO_H_ char *fparseln(FILE *_fp, size_t *_len, size_t *_lineno, const char _delim[3], int _flags); #endif # 153 "/usr/include/libutil.h" 3 4 #ifdef _PWD_H_ int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct passwd *_old_pw); struct passwd *pw_dup(const struct passwd *_pw); int pw_edit(int _notsetuid); int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); void pw_fini(void); int pw_init(const char *_dir, const char *_master); void pw_initpwd(struct passwd *_pw); char *pw_make(const struct passwd *_pw); char *pw_make_v7(const struct passwd *_pw); int pw_mkdb(const char *_user); int pw_lock(void); struct passwd * pw_scan(const char *_line, int _flags); const char * pw_tempname(void); int pw_tmp(int _mfd); #endif # 174 "/usr/include/libutil.h" 3 4 #ifdef _GRP_H_ int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct group *_old_gr); struct group * gr_dup(const struct group *_gr); struct group * gr_add(const struct group *_gr, const char *_newmember); int gr_equal(const struct group *_gr1, const struct group *_gr2); void gr_fini(void); int gr_init(const char *_dir, const char *_master); int gr_lock(void); char *gr_make(const struct group *_gr); int gr_mkdb(void); struct group * gr_scan(const char *_line); int gr_tmp(int _mdf); #endif # 192 "/usr/include/libutil.h" 3 4 #ifdef _UFS_UFS_QUOTA_H_ struct fstab; struct quotafile; int quota_check_path(const struct quotafile *_qf, const char *_path); void quota_close(struct quotafile *_qf); int quota_convert(struct quotafile *_qf, int _wordsize); const char * quota_fsname(const struct quotafile *_qf); int quota_maxid(struct quotafile *_qf); int quota_off(struct quotafile *_qf); int quota_on(struct quotafile *_qf); struct quotafile * quota_open(struct fstab *_fs, int _quotatype, int _openflags); const char * quota_qfname(const struct quotafile *_qf); int quota_read(struct quotafile *_qf, struct dqblk *_dqb, int _id); int quota_write_limits(struct quotafile *_qf, struct dqblk *_dqb, int _id); int quota_write_usage(struct quotafile *_qf, struct dqblk *_dqb, int _id); #endif # 212 "/usr/include/libutil.h" 3 4 __END_DECLS /* fparseln(3) */ #define FPARSELN_UNESCESC 0x01 #define FPARSELN_UNESCCONT 0x02 #define FPARSELN_UNESCCOMM 0x04 #define FPARSELN_UNESCREST 0x08 #define FPARSELN_UNESCALL 0x0f /* Flags for hexdump(3). */ #define HD_COLUMN_MASK 0xff #define HD_DELIM_MASK 0xff00 #define HD_OMIT_COUNT (1 << 16) #define HD_OMIT_HEX (1 << 17) #define HD_OMIT_CHARS (1 << 18) /* Values for humanize_number(3)'s flags parameter. */ #define HN_DECIMAL 0x01 #define HN_NOSPACE 0x02 #define HN_B 0x04 #define HN_DIVISOR_1000 0x08 #define HN_IEC_PREFIXES 0x10 /* Values for humanize_number(3)'s scale parameter. */ #define HN_GETSCALE 0x10 #define HN_AUTOSCALE 0x20 /* Return values from realhostname(). */ #define HOSTNAME_FOUND 0 #define HOSTNAME_INCORRECTNAME 1 #define HOSTNAME_INVALIDADDR 2 #define HOSTNAME_INVALIDNAME 3 /* Flags for pw_scan(). */ #define PWSCAN_MASTER 0x01 #define PWSCAN_WARN 0x02 /* Return values from uu_lock(). */ #define UU_LOCK_INUSE 1 #define UU_LOCK_OK 0 #define UU_LOCK_OPEN_ERR (-1) #define UU_LOCK_READ_ERR (-2) #define UU_LOCK_CREAT_ERR (-3) #define UU_LOCK_WRITE_ERR (-4) #define UU_LOCK_LINK_ERR (-5) #define UU_LOCK_TRY_ERR (-6) #define UU_LOCK_OWNER_ERR (-7) #endif /* !_LIBUTIL_H_ */ # 262 "/usr/include/libutil.h" 3 4 # 22 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 22 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # 1 "/usr/include/fcntl.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1983, 1990, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)fcntl.h 8.3 (Berkeley) 1/21/94 * $FreeBSD$ */ #ifndef _SYS_FCNTL_H_ #define _SYS_FCNTL_H_ /* * This file includes the definitions for open and fcntl * described by POSIX for ; it also includes * related kernel definitions. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 49 "/usr/include/fcntl.h" 3 4 # 50 "/usr/include/fcntl.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 50 "/usr/include/fcntl.h" 3 4 # 51 "/usr/include/fcntl.h" 3 4 #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; #define _MODE_T_DECLARED #endif # 56 "/usr/include/fcntl.h" 3 4 #ifndef _OFF_T_DECLARED typedef __off_t off_t; #define _OFF_T_DECLARED #endif # 61 "/usr/include/fcntl.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif # 66 "/usr/include/fcntl.h" 3 4 /* * File status flags: these are used by open(2), fcntl(2). * They are also used (indirectly) in the kernel file structure f_flags, * which is a superset of the open/fcntl flags. Open flags and f_flags * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags). * Open/fcntl flags begin with O_; kernel-internal flags begin with F. */ /* open-only flags */ #define O_RDONLY 0x0000 /* open for reading only */ #define O_WRONLY 0x0001 /* open for writing only */ #define O_RDWR 0x0002 /* open for reading and writing */ #define O_ACCMODE 0x0003 /* mask for above modes */ /* * Kernel encoding of open mode; separate read and write bits that are * independently testable: 1 greater than the above. * * XXX * FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH, * which was documented to use FREAD/FWRITE, continues to work. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 89 "/usr/include/fcntl.h" 3 4 #define FREAD 0x0001 #define FWRITE 0x0002 #endif # 92 "/usr/include/fcntl.h" 3 4 #define O_NONBLOCK 0x0004 /* no delay */ #define O_APPEND 0x0008 /* set append mode */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 95 "/usr/include/fcntl.h" 3 4 #define O_SHLOCK 0x0010 /* open with shared file lock */ #define O_EXLOCK 0x0020 /* open with exclusive file lock */ #define O_ASYNC 0x0040 /* signal pgrp when data ready */ #define O_FSYNC 0x0080 /* synchronous writes */ #endif # 100 "/usr/include/fcntl.h" 3 4 #define O_SYNC 0x0080 /* POSIX synonym for O_FSYNC */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 102 "/usr/include/fcntl.h" 3 4 #define O_NOFOLLOW 0x0100 /* don't follow symlinks */ #endif # 104 "/usr/include/fcntl.h" 3 4 #define O_CREAT 0x0200 /* create if nonexistent */ #define O_TRUNC 0x0400 /* truncate to zero length */ #define O_EXCL 0x0800 /* error if already exists */ #ifdef _KERNEL #define FHASLOCK 0x4000 /* descriptor holds advisory lock */ #endif # 110 "/usr/include/fcntl.h" 3 4 /* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */ #define O_NOCTTY 0x8000 /* don't assign controlling terminal */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 115 "/usr/include/fcntl.h" 3 4 /* Attempt to bypass buffer cache */ #define O_DIRECT 0x00010000 #endif # 118 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 120 "/usr/include/fcntl.h" 3 4 #define O_DIRECTORY 0x00020000 /* Fail if not directory */ #define O_EXEC 0x00040000 /* Open for execute only */ #define O_SEARCH O_EXEC #endif # 124 "/usr/include/fcntl.h" 3 4 #ifdef _KERNEL #define FEXEC O_EXEC #define FSEARCH O_SEARCH #endif # 128 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 130 "/usr/include/fcntl.h" 3 4 /* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */ #define O_TTY_INIT 0x00080000 /* Restore default termios attributes */ #define O_CLOEXEC 0x00100000 #endif # 135 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 137 "/usr/include/fcntl.h" 3 4 #define O_VERIFY 0x00200000 /* open only after verification */ #define O_PATH 0x00400000 /* fd is only a path */ #define O_RESOLVE_BENEATH 0x00800000 /* Do not allow name resolution to walk out of cwd */ #endif # 142 "/usr/include/fcntl.h" 3 4 #define O_DSYNC 0x01000000 /* POSIX data sync */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 145 "/usr/include/fcntl.h" 3 4 #define O_EMPTY_PATH 0x02000000 #endif # 147 "/usr/include/fcntl.h" 3 4 /* * XXX missing O_RSYNC. */ #ifdef _KERNEL /* Only for devfs d_close() flags. */ #define FLASTCLOSE O_DIRECTORY #define FREVOKE O_VERIFY /* Only for fo_close() from half-succeeded open */ #define FOPENFAILED O_TTY_INIT /* Only for O_PATH files which passed ACCESS FREAD check on open */ #define FKQALLOWED O_RESOLVE_BENEATH /* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */ #define FFLAGS(oflags) ((oflags) & O_EXEC ? (oflags) : (oflags) + 1) #define OFLAGS(fflags) \ (((fflags) & (O_EXEC | O_PATH)) != 0 ? (fflags) : (fflags) - 1) /* bits to save after open */ #define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FDSYNC|FNONBLOCK| \ O_DIRECT|FEXEC|O_PATH) /* bits settable by fcntl(F_SETFL, ...) */ #define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FDSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT) #if 0 /* disabled by -frewrite-includes */ #if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \ defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 175 "/usr/include/fcntl.h" 3 4 /* * Set by shm_open(3) in older libc's to get automatic MAP_ASYNC * behavior for POSIX shared memory objects (which are otherwise * implemented as plain files). */ #define FPOSIXSHM O_NOFOLLOW #undef FCNTLFLAGS #define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \ O_DIRECT) #endif # 185 "/usr/include/fcntl.h" 3 4 #endif # 186 "/usr/include/fcntl.h" 3 4 /* * The O_* flags used to have only F* names, which were used in the kernel * and by fcntl. We retain the F* names for the kernel f_flag field * and for backward compatibility for fcntl. These flags are deprecated. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 193 "/usr/include/fcntl.h" 3 4 #define FAPPEND O_APPEND /* kernel/compat */ #define FASYNC O_ASYNC /* kernel/compat */ #define FFSYNC O_FSYNC /* kernel */ #define FDSYNC O_DSYNC /* kernel */ #define FNONBLOCK O_NONBLOCK /* kernel */ #define FNDELAY O_NONBLOCK /* compat */ #define O_NDELAY O_NONBLOCK /* compat */ #endif # 201 "/usr/include/fcntl.h" 3 4 /* * Historically, we ran out of bits in f_flag (which was once a short). * However, the flag bits not set in FMASK are only meaningful in the * initial open syscall. Those bits were thus given a * different meaning for fcntl(2). */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 209 "/usr/include/fcntl.h" 3 4 /* Read ahead */ #define FRDAHEAD O_CREAT #endif # 212 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 214 "/usr/include/fcntl.h" 3 4 /* * Magic value that specify the use of the current working directory * to determine the target of relative file paths in the openat() and * similar syscalls. */ #define AT_FDCWD -100 /* * Miscellaneous flags for the *at() syscalls. */ #define AT_EACCESS 0x0100 /* Check access using effective user and group ID */ #define AT_SYMLINK_NOFOLLOW 0x0200 /* Do not follow symbolic links */ #define AT_SYMLINK_FOLLOW 0x0400 /* Follow symbolic link */ #define AT_REMOVEDIR 0x0800 /* Remove directory instead of file */ #endif /* __POSIX_VISIBLE >= 200809 */ # 230 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 231 "/usr/include/fcntl.h" 3 4 /* #define AT_UNUSED1 0x1000 *//* Was AT_BENEATH */ #define AT_RESOLVE_BENEATH 0x2000 /* Do not allow name resolution to walk out of dirfd */ #define AT_EMPTY_PATH 0x4000 /* Operate on dirfd if path is empty */ #endif /* __BSD_VISIBLE */ # 236 "/usr/include/fcntl.h" 3 4 /* * Constants used for fcntl(2) */ /* command values */ #define F_DUPFD 0 /* duplicate file descriptor */ #define F_GETFD 1 /* get file descriptor flags */ #define F_SETFD 2 /* set file descriptor flags */ #define F_GETFL 3 /* get file status flags */ #define F_SETFL 4 /* set file status flags */ #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 248 "/usr/include/fcntl.h" 3 4 #define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ #define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ #endif # 251 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 252 "/usr/include/fcntl.h" 3 4 #define F_OGETLK 7 /* get record locking information */ #define F_OSETLK 8 /* set record locking information */ #define F_OSETLKW 9 /* F_SETLK; wait if blocked */ #define F_DUP2FD 10 /* duplicate file descriptor to arg */ #endif # 257 "/usr/include/fcntl.h" 3 4 #define F_GETLK 11 /* get record locking information */ #define F_SETLK 12 /* set record locking information */ #define F_SETLKW 13 /* F_SETLK; wait if blocked */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 261 "/usr/include/fcntl.h" 3 4 #define F_SETLK_REMOTE 14 /* debugging support for remote locks */ #define F_READAHEAD 15 /* read ahead */ #define F_RDAHEAD 16 /* Darwin compatible read ahead */ #endif # 265 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 266 "/usr/include/fcntl.h" 3 4 #define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ #endif # 268 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 269 "/usr/include/fcntl.h" 3 4 #define F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */ #define F_ADD_SEALS 19 #define F_GET_SEALS 20 #define F_ISUNIONSTACK 21 /* Kludge for libc, don't use it. */ #define F_KINFO 22 /* Return kinfo_file for this fd */ /* Seals (F_ADD_SEALS, F_GET_SEALS). */ #define F_SEAL_SEAL 0x0001 /* Prevent adding sealings */ #define F_SEAL_SHRINK 0x0002 /* May not shrink */ #define F_SEAL_GROW 0x0004 /* May not grow */ #define F_SEAL_WRITE 0x0008 /* May not write */ #endif /* __BSD_VISIBLE */ # 281 "/usr/include/fcntl.h" 3 4 /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */ /* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ #define F_RDLCK 1 /* shared or read lock */ #define F_UNLCK 2 /* unlock */ #define F_WRLCK 3 /* exclusive or write lock */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 290 "/usr/include/fcntl.h" 3 4 #define F_UNLCKSYS 4 /* purge locks for a given system ID */ #define F_CANCEL 5 /* cancel an async lock request */ #endif # 293 "/usr/include/fcntl.h" 3 4 #ifdef _KERNEL #define F_WAIT 0x010 /* Wait until lock is granted */ #define F_FLOCK 0x020 /* Use flock(2) semantics for lock */ #define F_POSIX 0x040 /* Use POSIX semantics for lock */ #define F_REMOTE 0x080 /* Lock owner is remote NFS client */ #define F_NOINTR 0x100 /* Ignore signals when waiting */ #define F_FIRSTOPEN 0x200 /* First right to advlock file */ #endif # 301 "/usr/include/fcntl.h" 3 4 /* * Advisory file segment locking data type - * information passed to system by user */ struct flock { off_t l_start; /* starting offset */ off_t l_len; /* len = 0 means until end of file */ pid_t l_pid; /* lock owner */ short l_type; /* lock type: read/write, etc. */ short l_whence; /* type of l_start */ int l_sysid; /* remote system id or zero for local */ }; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 316 "/usr/include/fcntl.h" 3 4 /* * Old advisory file segment locking data type, * before adding l_sysid. */ struct __oflock { off_t l_start; /* starting offset */ off_t l_len; /* len = 0 means until end of file */ pid_t l_pid; /* lock owner */ short l_type; /* lock type: read/write, etc. */ short l_whence; /* type of l_start */ }; /* * Space control offset/length description */ struct spacectl_range { off_t r_offset; /* starting offset */ off_t r_len; /* length */ }; #endif # 336 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 338 "/usr/include/fcntl.h" 3 4 /* lock operations for flock(2) */ #define LOCK_SH 0x01 /* shared file lock */ #define LOCK_EX 0x02 /* exclusive file lock */ #define LOCK_NB 0x04 /* don't block when locking */ #define LOCK_UN 0x08 /* unlock file */ #endif # 344 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 346 "/usr/include/fcntl.h" 3 4 /* * Advice to posix_fadvise */ #define POSIX_FADV_NORMAL 0 /* no special treatment */ #define POSIX_FADV_RANDOM 1 /* expect random page references */ #define POSIX_FADV_SEQUENTIAL 2 /* expect sequential page references */ #define POSIX_FADV_WILLNEED 3 /* will need these pages */ #define POSIX_FADV_DONTNEED 4 /* dont need these pages */ #define POSIX_FADV_NOREUSE 5 /* access data only once */ #endif # 356 "/usr/include/fcntl.h" 3 4 #ifdef __BSD_VISIBLE /* * Magic value that specify that corresponding file descriptor to filename * is unknown and sanitary check should be omitted in the funlinkat() and * similar syscalls. */ #define FD_NONE -200 /* * Commands for fspacectl(2) */ #define SPACECTL_DEALLOC 1 /* deallocate space */ /* * fspacectl(2) flags */ #define SPACECTL_F_SUPPORTED 0 #endif # 375 "/usr/include/fcntl.h" 3 4 #ifndef _KERNEL __BEGIN_DECLS int open(const char *, int, ...); int creat(const char *, mode_t); int fcntl(int, int, ...); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 382 "/usr/include/fcntl.h" 3 4 int flock(int, int); int fspacectl(int, int, const struct spacectl_range *, int, struct spacectl_range *); #endif # 386 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 387 "/usr/include/fcntl.h" 3 4 int openat(int, const char *, int, ...); #endif # 389 "/usr/include/fcntl.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 390 "/usr/include/fcntl.h" 3 4 int posix_fadvise(int, off_t, off_t, int); int posix_fallocate(int, off_t, off_t); #endif # 393 "/usr/include/fcntl.h" 3 4 __END_DECLS #endif # 395 "/usr/include/fcntl.h" 3 4 #endif /* !_SYS_FCNTL_H_ */ # 397 "/usr/include/fcntl.h" 3 4 # 23 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" 2 #endif # 24 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 24 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # 1 "/usr/include/sys/param.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)param.h 8.3 (Berkeley) 4/4/95 * $FreeBSD$ */ #ifndef _SYS_PARAM_H_ #define _SYS_PARAM_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/sys/param.h" 3 4 # 1 "/usr/include/sys/_null.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef NULL #if 0 /* disabled by -frewrite-includes */ #if !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 34 "/usr/include/sys/_null.h" 3 4 #define NULL ((void *)0) #else # 36 "/usr/include/sys/_null.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __cplusplus >= 201103L #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 37 "/usr/include/sys/_null.h" 3 4 #define NULL nullptr #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 39 "/usr/include/sys/_null.h" 3 4 #define NULL __null #else # 41 "/usr/include/sys/_null.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(__LP64__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 42 "/usr/include/sys/_null.h" 3 4 #define NULL (0L) #else # 44 "/usr/include/sys/_null.h" 3 4 #define NULL 0 #endif /* __LP64__ */ # 46 "/usr/include/sys/_null.h" 3 4 #endif /* __GNUG__ */ # 47 "/usr/include/sys/_null.h" 3 4 #endif /* !__cplusplus */ # 48 "/usr/include/sys/_null.h" 3 4 #endif # 50 "/usr/include/sys/_null.h" 3 4 # 44 "/usr/include/sys/param.h" 2 3 4 #define BSD 199506 /* System version (year & month). */ #define BSD4_3 1 #define BSD4_4 1 /* * __FreeBSD_version numbers are documented in the Porter's Handbook. * If you bump the version for any reason, you should update the documentation * there. * Currently this lives here in the doc/ repository: * * documentation/content/en/books/porters-handbook/versions/_index.adoc * * Encoding: Rxx * 'R' is in the range 0 to 4 if this is a release branch or * X.0-CURRENT before releng/X.0 is created, otherwise 'R' is * in the range 5 to 9. * Short hand: MMmmXXX * * __FreeBSD_version is bumped every time there's a change in the base system * that's noteworthy. A noteworthy change is any change which changes the * kernel's KBI in -CURRENT, one that changes some detail about the system that * external software (or the ports system) would want to know about, one that * adds a system call, one that adds or deletes a shipped library, a security * fix, or similar change not specifically noted here. Bumps should be limited * to one per day / a couple per week except for security fixes. * * The approved way to obtain this from a shell script is: * awk '/^\#define[[:space:]]*__FreeBSD_version/ {print $3}' * Other methods to parse this file may work, but are not guaranteed against * future changes. The above script works back to FreeBSD 3.x when this macro * was introduced. This number is propagated to other places needing it that * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version #define __FreeBSD_version 1400073 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, * which by definition is always true on FreeBSD. This macro is also defined * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD. * * It is tempting to use this macro in userland code when we want to enable * kernel-specific routines, and in fact it's fine to do this in code that * is part of FreeBSD itself. However, be aware that as presence of this * macro is still not widespread (e.g. older FreeBSD versions, 3rd party * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in * external applications without also checking for __FreeBSD__ as an * alternative. */ #undef __FreeBSD_kernel__ #define __FreeBSD_kernel__ #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(IN_RTLD) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 98 "/usr/include/sys/param.h" 3 4 #define P_OSREL_SIGWAIT 700000 #define P_OSREL_SIGSEGV 700004 #define P_OSREL_MAP_ANON 800104 #define P_OSREL_MAP_FSTRICT 1100036 #define P_OSREL_SHUTDOWN_ENOTCONN 1100077 #define P_OSREL_MAP_GUARD 1200035 #define P_OSREL_WRFSBASE 1200041 #define P_OSREL_CK_CYLGRP 1200046 #define P_OSREL_VMTOTAL64 1200054 #define P_OSREL_CK_SUPERBLOCK 1300000 #define P_OSREL_CK_INODE 1300005 #define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif # 113 "/usr/include/sys/param.h" 3 4 #ifndef LOCORE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 115 "/usr/include/sys/param.h" 3 4 # 1 "/usr/include/sys/types.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)types.h 8.6 (Berkeley) 2/19/95 * $FreeBSD$ */ #ifndef _SYS_TYPES_H_ #define _SYS_TYPES_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/sys/types.h" 3 4 # 44 "/usr/include/sys/types.h" 3 4 /* Machine type dependent parameters. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 46 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/machine/endian.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/endian.h" 3 4 # 1 "/usr/include/x86/endian.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1987, 1991 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)endian.h 7.8 (Berkeley) 4/3/91 * $FreeBSD$ */ #ifndef _MACHINE_ENDIAN_H_ #define _MACHINE_ENDIAN_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/x86/endian.h" 3 4 # 39 "/usr/include/x86/endian.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/x86/endian.h" 3 4 # 1 "/usr/include/sys/_endian.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1987, 1991 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _SYS__ENDIAN_H_ #define _SYS__ENDIAN_H_ #ifndef _MACHINE_ENDIAN_H_ #error "sys/_endian.h should not be included directly" #endif # 38 "/usr/include/sys/_endian.h" 3 4 /* BSD Compatiblity */ #define _BYTE_ORDER __BYTE_ORDER__ /* * Definitions for byte order, according to byte significance from low * address to high. */ #define _LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ /* LSB first: 1234 */ #define _BIG_ENDIAN __ORDER_BIG_ENDIAN__ /* MSB first: 4321 */ #define _PDP_ENDIAN __ORDER_PDP_ENDIAN__ /* LSB first in word, * MSW first in long: 3412 */ /* * Define the order of 32-bit words in 64-bit words. */ #if 0 /* disabled by -frewrite-includes */ #if _BYTE_ORDER == _LITTLE_ENDIAN #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 55 "/usr/include/sys/_endian.h" 3 4 #define _QUAD_HIGHWORD 1 #define _QUAD_LOWWORD 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _BYTE_ORDER == _BIG_ENDIAN #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 58 "/usr/include/sys/_endian.h" 3 4 #define _QUAD_HIGHWORD 0 #define _QUAD_LOWWORD 1 #else # 61 "/usr/include/sys/_endian.h" 3 4 #error "Unsupported endian" #endif # 63 "/usr/include/sys/_endian.h" 3 4 /* * Deprecated variants that don't have enough underscores to be useful in more * strict namespaces. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 69 "/usr/include/sys/_endian.h" 3 4 #define LITTLE_ENDIAN _LITTLE_ENDIAN #define BIG_ENDIAN _BIG_ENDIAN #define PDP_ENDIAN _PDP_ENDIAN #define BYTE_ORDER _BYTE_ORDER #endif # 74 "/usr/include/sys/_endian.h" 3 4 /* bswap primitives, based on compiler builtins */ #define __bswap16(x) __builtin_bswap16(x) #define __bswap32(x) __builtin_bswap32(x) #define __bswap64(x) __builtin_bswap64(x) #if 0 /* disabled by -frewrite-includes */ #if _BYTE_ORDER == _LITTLE_ENDIAN #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 81 "/usr/include/sys/_endian.h" 3 4 #define __ntohl(x) (__bswap32(x)) #define __ntohs(x) (__bswap16(x)) #define __htonl(x) (__bswap32(x)) #define __htons(x) (__bswap16(x)) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _BYTE_ORDER == _BIG_ENDIAN #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 86 "/usr/include/sys/_endian.h" 3 4 #define __htonl(x) ((__uint32_t)(x)) #define __htons(x) ((__uint16_t)(x)) #define __ntohl(x) ((__uint32_t)(x)) #define __ntohs(x) ((__uint16_t)(x)) #endif # 91 "/usr/include/sys/_endian.h" 3 4 #endif /* _SYS__ENDIAN_H_ */ # 93 "/usr/include/sys/_endian.h" 3 4 # 40 "/usr/include/x86/endian.h" 2 3 4 #endif /* !_MACHINE_ENDIAN_H_ */ # 42 "/usr/include/x86/endian.h" 3 4 # 7 "/usr/include/machine/endian.h" 2 3 4 # 47 "/usr/include/sys/types.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/usr/include/sys/types.h" 3 4 # 48 "/usr/include/sys/types.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 49 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/sys/_pthreadtypes.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu * Copyright (c) 1995-1998 by John Birrell * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Chris Provenzano. * 4. The name of Chris Provenzano may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__PTHREADTYPES_H_ #define _SYS__PTHREADTYPES_H_ /* * Forward structure definitions. * * These are mostly opaque to the user. */ struct pthread; struct pthread_attr; struct pthread_cond; struct pthread_cond_attr; struct pthread_mutex; struct pthread_mutex_attr; struct pthread_once; struct pthread_rwlock; struct pthread_rwlockattr; struct pthread_barrier; struct pthread_barrier_attr; struct pthread_spinlock; /* * Primitive system data type definitions required by P1003.1c. * * Note that P1003.1c specifies that there are no defined comparison * or assignment operators for the types pthread_attr_t, pthread_cond_t, * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. */ #ifndef _PTHREAD_T_DECLARED typedef struct pthread *pthread_t; #define _PTHREAD_T_DECLARED #endif # 70 "/usr/include/sys/_pthreadtypes.h" 3 4 typedef struct pthread_attr *pthread_attr_t; typedef struct pthread_mutex *pthread_mutex_t; typedef struct pthread_mutex_attr *pthread_mutexattr_t; typedef struct pthread_cond *pthread_cond_t; typedef struct pthread_cond_attr *pthread_condattr_t; typedef int pthread_key_t; typedef struct pthread_once pthread_once_t; typedef struct pthread_rwlock *pthread_rwlock_t; typedef struct pthread_rwlockattr *pthread_rwlockattr_t; typedef struct pthread_barrier *pthread_barrier_t; typedef struct pthread_barrierattr *pthread_barrierattr_t; typedef struct pthread_spinlock *pthread_spinlock_t; /* * Additional type definitions: * * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for * use in header symbols. */ typedef void *pthread_addr_t; typedef void *(*pthread_startroutine_t)(void *); /* * Once definitions. */ struct pthread_once { int state; pthread_mutex_t mutex; }; #endif /* ! _SYS__PTHREADTYPES_H_ */ # 101 "/usr/include/sys/_pthreadtypes.h" 3 4 # 50 "/usr/include/sys/types.h" 2 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 52 "/usr/include/sys/types.h" 3 4 typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; #ifndef _KERNEL typedef unsigned short ushort; /* Sys V compatibility */ typedef unsigned int uint; /* Sys V compatibility */ #endif # 60 "/usr/include/sys/types.h" 3 4 #endif # 61 "/usr/include/sys/types.h" 3 4 /* * XXX POSIX sized integrals that should appear only in . */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 65 "/usr/include/sys/types.h" 3 4 # 66 "/usr/include/sys/types.h" 3 4 typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */ typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; typedef __uint64_t u_quad_t; /* quads (deprecated) */ typedef __int64_t quad_t; typedef quad_t * qaddr_t; typedef char * caddr_t; /* core address */ typedef const char * c_caddr_t; /* core address, pointer to const */ #ifndef _BLKSIZE_T_DECLARED typedef __blksize_t blksize_t; #define _BLKSIZE_T_DECLARED #endif # 83 "/usr/include/sys/types.h" 3 4 typedef __cpuwhich_t cpuwhich_t; typedef __cpulevel_t cpulevel_t; typedef __cpusetid_t cpusetid_t; #ifndef _BLKCNT_T_DECLARED typedef __blkcnt_t blkcnt_t; #define _BLKCNT_T_DECLARED #endif # 92 "/usr/include/sys/types.h" 3 4 #ifndef _CLOCK_T_DECLARED typedef __clock_t clock_t; #define _CLOCK_T_DECLARED #endif # 97 "/usr/include/sys/types.h" 3 4 #ifndef _CLOCKID_T_DECLARED typedef __clockid_t clockid_t; #define _CLOCKID_T_DECLARED #endif # 102 "/usr/include/sys/types.h" 3 4 typedef __critical_t critical_t; /* Critical section value */ typedef __daddr_t daddr_t; /* disk address */ #ifndef _DEV_T_DECLARED typedef __dev_t dev_t; /* device number or struct cdev */ #define _DEV_T_DECLARED #endif # 110 "/usr/include/sys/types.h" 3 4 #ifndef _FFLAGS_T_DECLARED typedef __fflags_t fflags_t; /* file flags */ #define _FFLAGS_T_DECLARED #endif # 115 "/usr/include/sys/types.h" 3 4 typedef __fixpt_t fixpt_t; /* fixed point number */ #ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */ typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; #define _FSBLKCNT_T_DECLARED #endif # 123 "/usr/include/sys/types.h" 3 4 #ifndef _GID_T_DECLARED typedef __gid_t gid_t; /* group id */ #define _GID_T_DECLARED #endif # 128 "/usr/include/sys/types.h" 3 4 #ifndef _IN_ADDR_T_DECLARED typedef __uint32_t in_addr_t; /* base type for internet address */ #define _IN_ADDR_T_DECLARED #endif # 133 "/usr/include/sys/types.h" 3 4 #ifndef _IN_PORT_T_DECLARED typedef __uint16_t in_port_t; #define _IN_PORT_T_DECLARED #endif # 138 "/usr/include/sys/types.h" 3 4 #ifndef _ID_T_DECLARED typedef __id_t id_t; /* can hold a uid_t or pid_t */ #define _ID_T_DECLARED #endif # 143 "/usr/include/sys/types.h" 3 4 #ifndef _INO_T_DECLARED typedef __ino_t ino_t; /* inode number */ #define _INO_T_DECLARED #endif # 148 "/usr/include/sys/types.h" 3 4 #ifndef _KEY_T_DECLARED typedef __key_t key_t; /* IPC key (for Sys V IPC) */ #define _KEY_T_DECLARED #endif # 153 "/usr/include/sys/types.h" 3 4 #ifndef _LWPID_T_DECLARED typedef __lwpid_t lwpid_t; /* Thread ID (a.k.a. LWP) */ #define _LWPID_T_DECLARED #endif # 158 "/usr/include/sys/types.h" 3 4 #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; /* permissions */ #define _MODE_T_DECLARED #endif # 163 "/usr/include/sys/types.h" 3 4 #ifndef _ACCMODE_T_DECLARED typedef __accmode_t accmode_t; /* access permissions */ #define _ACCMODE_T_DECLARED #endif # 168 "/usr/include/sys/types.h" 3 4 #ifndef _NLINK_T_DECLARED typedef __nlink_t nlink_t; /* link count */ #define _NLINK_T_DECLARED #endif # 173 "/usr/include/sys/types.h" 3 4 #ifndef _OFF_T_DECLARED typedef __off_t off_t; /* file offset */ #define _OFF_T_DECLARED #endif # 178 "/usr/include/sys/types.h" 3 4 #ifndef _OFF64_T_DECLARED typedef __off64_t off64_t; /* file offset (alias) */ #define _OFF64_T_DECLARED #endif # 183 "/usr/include/sys/types.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; /* process id */ #define _PID_T_DECLARED #endif # 188 "/usr/include/sys/types.h" 3 4 typedef __register_t register_t; #ifndef _RLIM_T_DECLARED typedef __rlim_t rlim_t; /* resource limit */ #define _RLIM_T_DECLARED #endif # 195 "/usr/include/sys/types.h" 3 4 typedef __sbintime_t sbintime_t; typedef __segsz_t segsz_t; /* segment size (in pages) */ #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 204 "/usr/include/sys/types.h" 3 4 #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif # 209 "/usr/include/sys/types.h" 3 4 #ifndef _SUSECONDS_T_DECLARED typedef __suseconds_t suseconds_t; /* microseconds (signed) */ #define _SUSECONDS_T_DECLARED #endif # 214 "/usr/include/sys/types.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 219 "/usr/include/sys/types.h" 3 4 #ifndef _TIMER_T_DECLARED typedef __timer_t timer_t; #define _TIMER_T_DECLARED #endif # 224 "/usr/include/sys/types.h" 3 4 #ifndef _MQD_T_DECLARED typedef __mqd_t mqd_t; #define _MQD_T_DECLARED #endif # 229 "/usr/include/sys/types.h" 3 4 typedef __u_register_t u_register_t; #ifndef _UID_T_DECLARED typedef __uid_t uid_t; /* user id */ #define _UID_T_DECLARED #endif # 236 "/usr/include/sys/types.h" 3 4 #ifndef _USECONDS_T_DECLARED typedef __useconds_t useconds_t; /* microseconds (unsigned) */ #define _USECONDS_T_DECLARED #endif # 241 "/usr/include/sys/types.h" 3 4 #ifndef _CAP_IOCTL_T_DECLARED #define _CAP_IOCTL_T_DECLARED typedef unsigned long cap_ioctl_t; #endif # 246 "/usr/include/sys/types.h" 3 4 #ifndef _CAP_RIGHTS_T_DECLARED #define _CAP_RIGHTS_T_DECLARED struct cap_rights; typedef struct cap_rights cap_rights_t; #endif # 253 "/usr/include/sys/types.h" 3 4 /* * Types suitable for exporting physical addresses, virtual addresses * (pointers), and memory object sizes from the kernel independent of native * word size. These should be used in place of vm_paddr_t, (u)intptr_t, and * size_t in structs which contain such types that are shared with userspace. */ typedef __uint64_t kpaddr_t; typedef __uint64_t kvaddr_t; typedef __uint64_t ksize_t; typedef __int64_t kssize_t; typedef __vm_offset_t vm_offset_t; typedef __uint64_t vm_ooffset_t; typedef __vm_paddr_t vm_paddr_t; typedef __uint64_t vm_pindex_t; typedef __vm_size_t vm_size_t; typedef __rman_res_t rman_res_t; typedef __register_t syscallarg_t; #ifdef _KERNEL typedef int boolean_t; typedef struct _device *device_t; typedef __intfptr_t intfptr_t; /* * XXX this is fixed width for historical reasons. It should have had type * __int_fast32_t. Fixed-width types should not be used unless binary * compatibility is essential. Least-width types should be used even less * since they provide smaller benefits. * * XXX should be MD. * * XXX this is bogus in -current, but still used for spl*(). */ typedef __uint32_t intrmask_t; /* Interrupt mask (spl, xxx_imask...) */ typedef __uintfptr_t uintfptr_t; typedef __uint64_t uoff_t; typedef char vm_memattr_t; /* memory attribute codes */ typedef struct vm_page *vm_page_t; #define offsetof(type, field) __offsetof(type, field) #endif /* _KERNEL */ # 299 "/usr/include/sys/types.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_STANDALONE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 301 "/usr/include/sys/types.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !defined(__bool_true_false_are_defined) && !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 302 "/usr/include/sys/types.h" 3 4 #define __bool_true_false_are_defined 1 #define false 0 #define true 1 typedef _Bool bool; #endif /* !__bool_true_false_are_defined && !__cplusplus */ # 307 "/usr/include/sys/types.h" 3 4 #endif /* KERNEL || _STANDALONE */ # 308 "/usr/include/sys/types.h" 3 4 /* * The following are all things that really shouldn't exist in this header, * since its purpose is to provide typedefs, not miscellaneous doodads. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 313 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/sys/bitcount.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)types.h 8.6 (Berkeley) 2/19/95 * $FreeBSD$ */ #ifndef _SYS_BITCOUNT_H_ #define _SYS_BITCOUNT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/sys/bitcount.h" 3 4 # 44 "/usr/include/sys/bitcount.h" 3 4 #ifdef __POPCNT__ #define __bitcount64(x) __builtin_popcountll((__uint64_t)(x)) #define __bitcount32(x) __builtin_popcount((__uint32_t)(x)) #define __bitcount16(x) __builtin_popcount((__uint16_t)(x)) #define __bitcountl(x) __builtin_popcountl((unsigned long)(x)) #define __bitcount(x) __builtin_popcount((unsigned int)(x)) #else # 52 "/usr/include/sys/bitcount.h" 3 4 /* * Population count algorithm using SWAR approach * - "SIMD Within A Register". */ static __inline __uint16_t __bitcount16(__uint16_t _x) { _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1); _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f; _x = (_x + (_x >> 8)) & 0x00ff; return (_x); } static __inline __uint32_t __bitcount32(__uint32_t _x) { _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1); _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f0f0f; _x = (_x + (_x >> 8)); _x = (_x + (_x >> 16)) & 0x000000ff; return (_x); } #ifdef __LP64__ static __inline __uint64_t __bitcount64(__uint64_t _x) { _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1); _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f; _x = (_x + (_x >> 8)); _x = (_x + (_x >> 16)); _x = (_x + (_x >> 32)) & 0x000000ff; return (_x); } #define __bitcountl(x) __bitcount64((unsigned long)(x)) #else # 95 "/usr/include/sys/bitcount.h" 3 4 static __inline __uint64_t __bitcount64(__uint64_t _x) { return (__bitcount32(_x >> 32) + __bitcount32(_x)); } #define __bitcountl(x) __bitcount32((unsigned long)(x)) #endif # 104 "/usr/include/sys/bitcount.h" 3 4 #define __bitcount(x) __bitcount32((unsigned int)(x)) #endif # 106 "/usr/include/sys/bitcount.h" 3 4 #endif /* !_SYS_BITCOUNT_H_ */ # 108 "/usr/include/sys/bitcount.h" 3 4 # 314 "/usr/include/sys/types.h" 2 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 316 "/usr/include/sys/types.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 317 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/sys/select.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_SELECT_H_ #define _SYS_SELECT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/sys/select.h" 3 4 # 38 "/usr/include/sys/select.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/select.h" 3 4 # 39 "/usr/include/sys/select.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/sys/_sigset.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)signal.h 8.4 (Berkeley) 5/4/95 * $FreeBSD$ */ #ifndef _SYS__SIGSET_H_ #define _SYS__SIGSET_H_ /* * sigset_t macros. */ #define _SIG_WORDS 4 #define _SIG_MAXSIG 128 #define _SIG_IDX(sig) ((sig) - 1) #define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5) #define _SIG_BIT(sig) (1U << (_SIG_IDX(sig) & 31)) #define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0) typedef struct __sigset { __uint32_t __bits[_SIG_WORDS]; } __sigset_t; #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) && defined(COMPAT_43) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 58 "/usr/include/sys/_sigset.h" 3 4 typedef unsigned int osigset_t; #endif # 60 "/usr/include/sys/_sigset.h" 3 4 #endif /* !_SYS__SIGSET_H_ */ # 62 "/usr/include/sys/_sigset.h" 3 4 # 41 "/usr/include/sys/select.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/sys/_timeval.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__TIMEVAL_H_ #define _SYS__TIMEVAL_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/include/sys/_timeval.h" 3 4 # 35 "/usr/include/sys/_timeval.h" 3 4 #ifndef _SUSECONDS_T_DECLARED typedef __suseconds_t suseconds_t; #define _SUSECONDS_T_DECLARED #endif # 40 "/usr/include/sys/_timeval.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 45 "/usr/include/sys/_timeval.h" 3 4 /* * Structure returned by gettimeofday(2) system call, and used in other calls. */ struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* and microseconds */ }; #endif /* !_SYS__TIMEVAL_H_ */ # 55 "/usr/include/sys/_timeval.h" 3 4 # 42 "/usr/include/sys/select.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/sys/timespec.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp * $FreeBSD$ */ #ifndef _SYS_TIMESPEC_H_ #define _SYS_TIMESPEC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/timespec.h" 3 4 # 40 "/usr/include/sys/timespec.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/sys/timespec.h" 3 4 # 1 "/usr/include/sys/_timespec.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp * $FreeBSD$ */ #ifndef _SYS__TIMESPEC_H_ #define _SYS__TIMESPEC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/_timespec.h" 3 4 # 40 "/usr/include/sys/_timespec.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 45 "/usr/include/sys/_timespec.h" 3 4 struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* and nanoseconds */ }; #endif /* !_SYS__TIMESPEC_H_ */ # 52 "/usr/include/sys/_timespec.h" 3 4 # 41 "/usr/include/sys/timespec.h" 2 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 43 "/usr/include/sys/timespec.h" 3 4 #define TIMEVAL_TO_TIMESPEC(tv, ts) \ do { \ (ts)->tv_sec = (tv)->tv_sec; \ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ } while (0) #define TIMESPEC_TO_TIMEVAL(tv, ts) \ do { \ (tv)->tv_sec = (ts)->tv_sec; \ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } while (0) #endif /* __BSD_VISIBLE */ # 55 "/usr/include/sys/timespec.h" 3 4 /* * Structure defined by POSIX.1b to be like a itimerval, but with * timespecs. Used in the timer_*() system calls. */ struct itimerspec { struct timespec it_interval; struct timespec it_value; }; #endif /* _SYS_TIMESPEC_H_ */ # 66 "/usr/include/sys/timespec.h" 3 4 # 43 "/usr/include/sys/select.h" 2 3 4 typedef unsigned long __fd_mask; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 46 "/usr/include/sys/select.h" 3 4 typedef __fd_mask fd_mask; #endif # 48 "/usr/include/sys/select.h" 3 4 #ifndef _SIGSET_T_DECLARED #define _SIGSET_T_DECLARED typedef __sigset_t sigset_t; #endif # 53 "/usr/include/sys/select.h" 3 4 /* * Select uses bit masks of file descriptors in longs. These macros * manipulate such bit fields (the filesystem macros use chars). * FD_SETSIZE may be defined by the user, but the default here should * be enough for most uses. */ #ifndef FD_SETSIZE #define FD_SETSIZE 1024 #endif # 63 "/usr/include/sys/select.h" 3 4 #define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 66 "/usr/include/sys/select.h" 3 4 #define NFDBITS _NFDBITS #endif # 68 "/usr/include/sys/select.h" 3 4 #ifndef _howmany #define _howmany(x, y) (((x) + ((y) - 1)) / (y)) #endif # 72 "/usr/include/sys/select.h" 3 4 typedef struct fd_set { __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; } fd_set; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 77 "/usr/include/sys/select.h" 3 4 #define fds_bits __fds_bits #endif # 79 "/usr/include/sys/select.h" 3 4 #define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS)) #define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 83 "/usr/include/sys/select.h" 3 4 #define FD_COPY(f, t) (void)(*(t) = *(f)) #endif # 85 "/usr/include/sys/select.h" 3 4 #define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) #define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) #define FD_ZERO(p) do { \ fd_set *_p; \ __size_t _n; \ \ _p = (p); \ _n = _howmany(FD_SETSIZE, _NFDBITS); \ while (_n > 0) \ _p->__fds_bits[--_n] = 0; \ } while (0) #ifndef _KERNEL __BEGIN_DECLS int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); #ifndef _SELECT_DECLARED #define _SELECT_DECLARED /* XXX missing restrict type-qualifier */ int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); #endif # 107 "/usr/include/sys/select.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 109 "/usr/include/sys/select.h" 3 4 #endif /* _SYS_SELECT_H_ */ # 111 "/usr/include/sys/select.h" 3 4 # 318 "/usr/include/sys/types.h" 2 3 4 /* * The major and minor numbers are encoded in dev_t as MMMmmmMm (where * letters correspond to bytes). The encoding of the lower 4 bytes is * constrained by compatibility with 16-bit and 32-bit dev_t's. The * encoding of of the upper 4 bytes is the least unnatural one consistent * with this and other constraints. Also, the decoding of the m bytes by * minor() is unnatural to maximize compatibility subject to not discarding * bits. The upper m byte is shifted into the position of the lower M byte * instead of shifting 3 upper m bytes to close the gap. Compatibility for * minor() is achieved iff the upper m byte is 0. */ #define major(d) __major(d) static __inline int __major(dev_t _d) { return (((_d >> 32) & 0xffffff00) | ((_d >> 8) & 0xff)); } #define minor(d) __minor(d) static __inline int __minor(dev_t _d) { return (((_d >> 24) & 0xff00) | (_d & 0xffff00ff)); } #define makedev(M, m) __makedev((M), (m)) static __inline dev_t __makedev(int _Major, int _Minor) { return (((dev_t)(_Major & 0xffffff00) << 32) | ((_Major & 0xff) << 8) | ((dev_t)(_Minor & 0xff00) << 24) | (_Minor & 0xffff00ff)); } /* * These declarations belong elsewhere, but are repeated here and in * to give broken programs a better chance of working with * 64-bit off_t's. */ #ifndef _KERNEL __BEGIN_DECLS #ifndef _FTRUNCATE_DECLARED #define _FTRUNCATE_DECLARED int ftruncate(int, off_t); #endif # 361 "/usr/include/sys/types.h" 3 4 #ifndef _LSEEK_DECLARED #define _LSEEK_DECLARED off_t lseek(int, off_t, int); #endif # 365 "/usr/include/sys/types.h" 3 4 #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void * mmap(void *, size_t, int, int, int, off_t); #endif # 369 "/usr/include/sys/types.h" 3 4 #ifndef _TRUNCATE_DECLARED #define _TRUNCATE_DECLARED int truncate(const char *, off_t); #endif # 373 "/usr/include/sys/types.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 375 "/usr/include/sys/types.h" 3 4 #endif /* __BSD_VISIBLE */ # 377 "/usr/include/sys/types.h" 3 4 #endif /* !_SYS_TYPES_H_ */ # 379 "/usr/include/sys/types.h" 3 4 # 116 "/usr/include/sys/param.h" 2 3 4 #endif # 117 "/usr/include/sys/param.h" 3 4 /* * Machine-independent constants (some used in following include files). * Redefined constants are from POSIX 1003.1 limits file. * * MAXCOMLEN should be >= sizeof(ac_comm) (see ) */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 124 "/usr/include/sys/param.h" 3 4 # 1 "/usr/include/sys/syslimits.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 * $FreeBSD$ */ #ifndef _SYS_SYSLIMITS_H_ #define _SYS_SYSLIMITS_H_ #if 0 /* disabled by -frewrite-includes */ #if !defined(_STANDALONE) && !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 39 "/usr/include/sys/syslimits.h" 3 4 #warning "No user-serviceable parts inside." #endif # 41 "/usr/include/sys/syslimits.h" 3 4 /* * Do not add any new variables here. (See the comment at the end of * the file for why.) */ #ifndef __ILP32__ #define ARG_MAX (2 * 256 * 1024) /* max bytes for an exec function */ #else # 49 "/usr/include/sys/syslimits.h" 3 4 #define ARG_MAX (256 * 1024) /* max bytes for KVA-starved archs */ #endif # 51 "/usr/include/sys/syslimits.h" 3 4 #ifndef CHILD_MAX #define CHILD_MAX 40 /* max simultaneous processes */ #endif # 54 "/usr/include/sys/syslimits.h" 3 4 #define MAX_CANON 255 /* max bytes in term canon input line */ #define MAX_INPUT 255 /* max bytes in terminal input */ #define NAME_MAX 255 /* max bytes in a file name */ #ifndef NGROUPS_MAX #define NGROUPS_MAX 1023 /* max supplemental group id's */ #endif # 60 "/usr/include/sys/syslimits.h" 3 4 #ifndef OPEN_MAX #define OPEN_MAX 64 /* max open files per process */ #endif # 63 "/usr/include/sys/syslimits.h" 3 4 #define PATH_MAX 1024 /* max bytes in pathname */ #define PIPE_BUF 512 /* max bytes for atomic pipe writes */ #define IOV_MAX 1024 /* max elements in i/o vector */ /* * We leave the following values undefined to force applications to either * assume conservative values or call sysconf() to get the current value. * * HOST_NAME_MAX * * (We should do this for most of the values currently defined here, * but many programs are not prepared to deal with this yet.) */ #endif # 77 "/usr/include/sys/syslimits.h" 3 4 # 125 "/usr/include/sys/param.h" 2 3 4 #define MAXCOMLEN 19 /* max command name remembered */ #define MAXINTERP PATH_MAX /* max interpreter file name length */ #define MAXLOGNAME 33 /* max login name length (incl. NUL) */ #define MAXUPRC CHILD_MAX /* max simultaneous processes */ #define NCARGS ARG_MAX /* max bytes for an exec function */ #define NGROUPS (NGROUPS_MAX+1) /* max number groups */ #define NOFILE OPEN_MAX /* max open files per process */ #define NOGROUP 65535 /* marker for empty group set member */ #define MAXHOSTNAMELEN 256 /* max hostname size */ #define SPECNAMELEN 255 /* max length of devicename */ /* More types and definitions used throughout the kernel. */ #ifdef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 139 "/usr/include/sys/param.h" 3 4 # 140 "/usr/include/sys/param.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 140 "/usr/include/sys/param.h" 3 4 # 141 "/usr/include/sys/param.h" 3 4 #ifndef LOCORE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 142 "/usr/include/sys/param.h" 3 4 # 143 "/usr/include/sys/param.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 143 "/usr/include/sys/param.h" 3 4 # 144 "/usr/include/sys/param.h" 3 4 #endif # 145 "/usr/include/sys/param.h" 3 4 #ifndef FALSE #define FALSE 0 #endif # 149 "/usr/include/sys/param.h" 3 4 #ifndef TRUE #define TRUE 1 #endif # 152 "/usr/include/sys/param.h" 3 4 #endif # 153 "/usr/include/sys/param.h" 3 4 #ifndef _KERNEL #ifndef LOCORE /* Signals. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 157 "/usr/include/sys/param.h" 3 4 # 1 "/usr/include/sys/signal.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)signal.h 8.4 (Berkeley) 5/4/95 * $FreeBSD$ */ #ifndef _SYS_SIGNAL_H_ #define _SYS_SIGNAL_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/sys/signal.h" 3 4 # 44 "/usr/include/sys/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/sys/signal.h" 3 4 # 45 "/usr/include/sys/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/sys/signal.h" 3 4 # 46 "/usr/include/sys/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include /* __MINSIGSTKSZ */ #endif /* expanded by -frewrite-includes */ # 47 "/usr/include/sys/signal.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_limits.h" 3 4 # 7 "/usr/include/machine/_limits.h" 3 4 # 48 "/usr/include/sys/signal.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include /* sig_atomic_t; trap codes; sigcontext */ #endif /* expanded by -frewrite-includes */ # 48 "/usr/include/sys/signal.h" 3 4 # 1 "/usr/include/machine/signal.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/signal.h" 3 4 # 1 "/usr/include/x86/signal.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * Copyright (c) 2003 Peter Wemm. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)signal.h 8.1 (Berkeley) 6/11/93 * $FreeBSD$ */ #ifndef _X86_SIGNAL_H #define _X86_SIGNAL_H 1 /* * Machine-dependent signal definitions */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/x86/signal.h" 3 4 # 44 "/usr/include/x86/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/x86/signal.h" 3 4 # 45 "/usr/include/x86/signal.h" 3 4 #ifdef __i386__ typedef int sig_atomic_t; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 50 "/usr/include/x86/signal.h" 3 4 struct sigcontext { struct __sigset sc_mask; /* signal mask to restore */ int sc_onstack; /* sigstack state to restore */ int sc_gs; /* machine state (struct trapframe) */ int sc_fs; int sc_es; int sc_ds; int sc_edi; int sc_esi; int sc_ebp; int sc_isp; int sc_ebx; int sc_edx; int sc_ecx; int sc_eax; int sc_trapno; int sc_err; int sc_eip; int sc_cs; int sc_efl; int sc_esp; int sc_ss; int sc_len; /* sizeof(mcontext_t) */ /* * See and for * the following fields. */ int sc_fpformat; int sc_ownedfp; int sc_flags; int sc_fpstate[128] __aligned(16); int sc_fsbase; int sc_gsbase; int sc_xfpustate; int sc_xfpustate_len; int sc_spare2[4]; }; #define sc_sp sc_esp #define sc_fp sc_ebp #define sc_pc sc_eip #define sc_ps sc_efl #define sc_eflags sc_efl #endif /* __BSD_VISIBLE */ # 98 "/usr/include/x86/signal.h" 3 4 #endif /* __i386__ */ # 99 "/usr/include/x86/signal.h" 3 4 #ifdef __amd64__ typedef long sig_atomic_t; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 104 "/usr/include/x86/signal.h" 3 4 /* * Information pushed on stack when a signal is delivered. * This is used by the kernel to restore state following * execution of the signal handler. It is also made available * to the handler to allow it to restore state properly if * a non-standard exit is performed. * * The sequence of the fields/registers after sc_mask in struct * sigcontext must match those in mcontext_t and struct trapframe. */ struct sigcontext { struct __sigset sc_mask; /* signal mask to restore */ long sc_onstack; /* sigstack state to restore */ long sc_rdi; /* machine state (struct trapframe) */ long sc_rsi; long sc_rdx; long sc_rcx; long sc_r8; long sc_r9; long sc_rax; long sc_rbx; long sc_rbp; long sc_r10; long sc_r11; long sc_r12; long sc_r13; long sc_r14; long sc_r15; int sc_trapno; short sc_fs; short sc_gs; long sc_addr; int sc_flags; short sc_es; short sc_ds; long sc_err; long sc_rip; long sc_cs; long sc_rflags; long sc_rsp; long sc_ss; long sc_len; /* sizeof(mcontext_t) */ /* * See and for the following * fields. */ long sc_fpformat; long sc_ownedfp; long sc_fpstate[64] __aligned(16); long sc_fsbase; long sc_gsbase; long sc_xfpustate; long sc_xfpustate_len; long sc_spare[4]; }; #endif /* __BSD_VISIBLE */ # 163 "/usr/include/x86/signal.h" 3 4 #endif /* __amd64__ */ # 164 "/usr/include/x86/signal.h" 3 4 #endif # 166 "/usr/include/x86/signal.h" 3 4 # 7 "/usr/include/machine/signal.h" 2 3 4 # 49 "/usr/include/sys/signal.h" 2 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 51 "/usr/include/sys/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 52 "/usr/include/sys/signal.h" 3 4 # 53 "/usr/include/sys/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 53 "/usr/include/sys/signal.h" 3 4 # 54 "/usr/include/sys/signal.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 59 "/usr/include/sys/signal.h" 3 4 #ifndef _UID_T_DECLARED typedef __uid_t uid_t; #define _UID_T_DECLARED #endif # 64 "/usr/include/sys/signal.h" 3 4 #endif /* __POSIX_VISIBLE >= 200809 */ # 66 "/usr/include/sys/signal.h" 3 4 /* * System defined signals. */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 71 "/usr/include/sys/signal.h" 3 4 #define SIGHUP 1 /* hangup */ #endif # 73 "/usr/include/sys/signal.h" 3 4 #define SIGINT 2 /* interrupt */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 75 "/usr/include/sys/signal.h" 3 4 #define SIGQUIT 3 /* quit */ #endif # 77 "/usr/include/sys/signal.h" 3 4 #define SIGILL 4 /* illegal instr. (not reset when caught) */ #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 79 "/usr/include/sys/signal.h" 3 4 #define SIGTRAP 5 /* trace trap (not reset when caught) */ #endif # 81 "/usr/include/sys/signal.h" 3 4 #define SIGABRT 6 /* abort() */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 83 "/usr/include/sys/signal.h" 3 4 #define SIGIOT SIGABRT /* compatibility */ #define SIGEMT 7 /* EMT instruction */ #endif # 86 "/usr/include/sys/signal.h" 3 4 #define SIGFPE 8 /* floating point exception */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 88 "/usr/include/sys/signal.h" 3 4 #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #endif # 90 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 91 "/usr/include/sys/signal.h" 3 4 #define SIGBUS 10 /* bus error */ #endif # 93 "/usr/include/sys/signal.h" 3 4 #define SIGSEGV 11 /* segmentation violation */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 95 "/usr/include/sys/signal.h" 3 4 #define SIGSYS 12 /* non-existent system call invoked */ #endif # 97 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 98 "/usr/include/sys/signal.h" 3 4 #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #endif # 101 "/usr/include/sys/signal.h" 3 4 #define SIGTERM 15 /* software termination signal from kill */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 103 "/usr/include/sys/signal.h" 3 4 #define SIGURG 16 /* urgent condition on IO channel */ #endif # 105 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 106 "/usr/include/sys/signal.h" 3 4 #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN if (tp->t_local<OSTOP) */ #endif # 113 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 114 "/usr/include/sys/signal.h" 3 4 #define SIGIO 23 /* input/output possible signal */ #endif # 116 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 117 "/usr/include/sys/signal.h" 3 4 #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGVTALRM 26 /* virtual time alarm */ #define SIGPROF 27 /* profiling time alarm */ #endif # 122 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 123 "/usr/include/sys/signal.h" 3 4 #define SIGWINCH 28 /* window size changes */ #define SIGINFO 29 /* information request */ #endif # 126 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 127 "/usr/include/sys/signal.h" 3 4 #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ #endif # 130 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 131 "/usr/include/sys/signal.h" 3 4 #define SIGTHR 32 /* reserved by thread library. */ #define SIGLWP SIGTHR #define SIGLIBRT 33 /* reserved by real-time library. */ #endif # 135 "/usr/include/sys/signal.h" 3 4 #define SIGRTMIN 65 #define SIGRTMAX 126 #define SIG_DFL ((__sighandler_t *)0) #define SIG_IGN ((__sighandler_t *)1) #define SIG_ERR ((__sighandler_t *)-1) /* #define SIG_CATCH ((__sighandler_t *)2) See signalvar.h */ #define SIG_HOLD ((__sighandler_t *)3) /* * Type of a signal handling function. * * Language spec sez signal handlers take exactly one arg, even though we * actually supply three. Ugh! * * We don't try to hide the difference by leaving out the args because * that would cause warnings about conformant programs. Nonconformant * programs can avoid the warnings by casting to (__sighandler_t *) or * sig_t before calling signal() or assigning to sa_handler or sv_handler. * * The kernel should reverse the cast before calling the function. It * has no way to do this, but on most machines 1-arg and 3-arg functions * have the same calling protocol so there is no problem in practice. * A bit in sa_flags could be used to specify the number of args. */ typedef void __sighandler_t(int); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 164 "/usr/include/sys/signal.h" 3 4 #ifndef _SIGSET_T_DECLARED #define _SIGSET_T_DECLARED typedef __sigset_t sigset_t; #endif # 168 "/usr/include/sys/signal.h" 3 4 #endif # 169 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE >= 500 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 171 "/usr/include/sys/signal.h" 3 4 union sigval { /* Members as suggested by Annex C of POSIX 1003.1b. */ int sival_int; void *sival_ptr; /* 6.0 compatibility */ int sigval_int; void *sigval_ptr; }; #if 0 /* disabled by -frewrite-includes */ #if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 181 "/usr/include/sys/signal.h" 3 4 union sigval32 { int sival_int; uint32_t sival_ptr; /* 6.0 compatibility */ int sigval_int; uint32_t sigval_ptr; }; #endif # 189 "/usr/include/sys/signal.h" 3 4 #endif # 190 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 192 "/usr/include/sys/signal.h" 3 4 struct pthread_attr; struct sigevent { int sigev_notify; /* Notification type */ int sigev_signo; /* Signal number */ union sigval sigev_value; /* Signal value */ union { __lwpid_t _threadid; struct { void (*_function)(union sigval); struct pthread_attr **_attribute; } _sigev_thread; unsigned short _kevent_flags; long __spare__[8]; } _sigev_un; }; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 211 "/usr/include/sys/signal.h" 3 4 #define sigev_notify_kqueue sigev_signo #define sigev_notify_kevent_flags _sigev_un._kevent_flags #define sigev_notify_thread_id _sigev_un._threadid #endif # 215 "/usr/include/sys/signal.h" 3 4 #define sigev_notify_function _sigev_un._sigev_thread._function #define sigev_notify_attributes _sigev_un._sigev_thread._attribute #define SIGEV_NONE 0 /* No async notification. */ #define SIGEV_SIGNAL 1 /* Generate a queued signal. */ #define SIGEV_THREAD 2 /* Call back from another pthread. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 222 "/usr/include/sys/signal.h" 3 4 #define SIGEV_KEVENT 3 /* Generate a kevent. */ #define SIGEV_THREAD_ID 4 /* Send signal to a kernel thread. */ #endif # 225 "/usr/include/sys/signal.h" 3 4 #endif /* __POSIX_VISIBLE >= 199309 */ # 227 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 229 "/usr/include/sys/signal.h" 3 4 typedef struct __siginfo { int si_signo; /* signal number */ int si_errno; /* errno association */ /* * Cause of signal, one of the SI_ macros or signal-specific * values, i.e. one of the FPE_... values for SIGFPE. This * value is equivalent to the second argument to an old-style * FreeBSD signal handler. */ int si_code; /* signal code */ __pid_t si_pid; /* sending process */ __uid_t si_uid; /* sender's ruid */ int si_status; /* exit value */ void *si_addr; /* faulting instruction */ union sigval si_value; /* signal value */ union { struct { int _trapno;/* machine specific trap code */ } _fault; struct { int _timerid; int _overrun; } _timer; struct { int _mqd; } _mesgq; struct { long _band; /* band event for SIGPOLL */ } _poll; /* was this ever used ? */ struct { int _syscall; /* Syscall number for signals * delivered as a result of * system calls denied by * Capsicum. */ } _capsicum; struct { long __spare1__; int __spare2__[7]; } __spare__; } _reason; } siginfo_t; #define si_trapno _reason._fault._trapno #define si_timerid _reason._timer._timerid #define si_overrun _reason._timer._overrun #define si_mqd _reason._mesgq._mqd #define si_band _reason._poll._band #define si_syscall _reason._capsicum._syscall #if 0 /* disabled by -frewrite-includes */ #if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 279 "/usr/include/sys/signal.h" 3 4 struct siginfo32 { int si_signo; /* signal number */ int si_errno; /* errno association */ int si_code; /* signal code */ __pid_t si_pid; /* sending process */ __uid_t si_uid; /* sender's ruid */ int si_status; /* exit value */ uint32_t si_addr; /* faulting instruction */ union sigval32 si_value; /* signal value */ union { struct { int _trapno;/* machine specific trap code */ } _fault; struct { int _timerid; int _overrun; } _timer; struct { int _mqd; } _mesgq; struct { int32_t _band; /* band event for SIGPOLL */ } _poll; /* was this ever used ? */ struct { int32_t __spare1__; int __spare2__[7]; } __spare__; } _reason; }; #endif # 309 "/usr/include/sys/signal.h" 3 4 /** si_code **/ /* codes for SIGILL */ #define ILL_ILLOPC 1 /* Illegal opcode. */ #define ILL_ILLOPN 2 /* Illegal operand. */ #define ILL_ILLADR 3 /* Illegal addressing mode. */ #define ILL_ILLTRP 4 /* Illegal trap. */ #define ILL_PRVOPC 5 /* Privileged opcode. */ #define ILL_PRVREG 6 /* Privileged register. */ #define ILL_COPROC 7 /* Coprocessor error. */ #define ILL_BADSTK 8 /* Internal stack error. */ /* codes for SIGBUS */ #define BUS_ADRALN 1 /* Invalid address alignment. */ #define BUS_ADRERR 2 /* Nonexistent physical address. */ #define BUS_OBJERR 3 /* Object-specific hardware error. */ #define BUS_OOMERR 100 /* Non-standard: No memory. */ /* codes for SIGSEGV */ #define SEGV_MAPERR 1 /* Address not mapped to object. */ #define SEGV_ACCERR 2 /* Invalid permissions for mapped */ /* object. */ #define SEGV_PKUERR 100 /* x86: PKU violation */ /* codes for SIGFPE */ #define FPE_INTOVF 1 /* Integer overflow. */ #define FPE_INTDIV 2 /* Integer divide by zero. */ #define FPE_FLTDIV 3 /* Floating point divide by zero. */ #define FPE_FLTOVF 4 /* Floating point overflow. */ #define FPE_FLTUND 5 /* Floating point underflow. */ #define FPE_FLTRES 6 /* Floating point inexact result. */ #define FPE_FLTINV 7 /* Invalid floating point operation. */ #define FPE_FLTSUB 8 /* Subscript out of range. */ #define FPE_FLTIDO 9 /* Input denormal operation */ /* codes for SIGTRAP */ #define TRAP_BRKPT 1 /* Process breakpoint. */ #define TRAP_TRACE 2 /* Process trace trap. */ #define TRAP_DTRACE 3 /* DTrace induced trap. */ #define TRAP_CAP 4 /* Capabilities protective trap. */ /* codes for SIGCHLD */ #define CLD_EXITED 1 /* Child has exited */ #define CLD_KILLED 2 /* Child has terminated abnormally but */ /* did not create a core file */ #define CLD_DUMPED 3 /* Child has terminated abnormally and */ /* created a core file */ #define CLD_TRAPPED 4 /* Traced child has trapped */ #define CLD_STOPPED 5 /* Child has stopped */ #define CLD_CONTINUED 6 /* Stopped child has continued */ /* codes for SIGPOLL */ #define POLL_IN 1 /* Data input available */ #define POLL_OUT 2 /* Output buffers available */ #define POLL_MSG 3 /* Input message available */ #define POLL_ERR 4 /* I/O Error */ #define POLL_PRI 5 /* High priority input available */ #define POLL_HUP 6 /* Device disconnected */ #endif # 369 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 371 "/usr/include/sys/signal.h" 3 4 struct __siginfo; /* * Signal vector "template" used in sigaction call. */ struct sigaction { union { void (*__sa_handler)(int); void (*__sa_sigaction)(int, struct __siginfo *, void *); } __sigaction_u; /* signal handler */ int sa_flags; /* see signal options below */ sigset_t sa_mask; /* signal mask to apply */ }; #define sa_handler __sigaction_u.__sa_handler #endif # 387 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 389 "/usr/include/sys/signal.h" 3 4 /* If SA_SIGINFO is set, sa_sigaction must be used instead of sa_handler. */ #define sa_sigaction __sigaction_u.__sa_sigaction #endif # 392 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 394 "/usr/include/sys/signal.h" 3 4 #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ #endif /* __POSIX_VISIBLE || __XSI_VISIBLE */ # 396 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 398 "/usr/include/sys/signal.h" 3 4 #define SA_ONSTACK 0x0001 /* take signal on signal stack */ #define SA_RESTART 0x0002 /* restart system call on signal return */ #define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */ #define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */ #define SA_NOCLDWAIT 0x0020 /* don't keep zombies around */ #define SA_SIGINFO 0x0040 /* signal handler with SA_SIGINFO args */ #endif # 405 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 407 "/usr/include/sys/signal.h" 3 4 #define NSIG 32 /* number of old signals (counting 0) */ #endif # 409 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 411 "/usr/include/sys/signal.h" 3 4 #define SI_NOINFO 0 /* No signal info besides si_signo. */ #define SI_USER 0x10001 /* Signal sent by kill(). */ #define SI_QUEUE 0x10002 /* Signal sent by the sigqueue(). */ #define SI_TIMER 0x10003 /* Signal generated by expiration of */ /* a timer set by timer_settime(). */ #define SI_ASYNCIO 0x10004 /* Signal generated by completion of */ /* an asynchronous I/O request.*/ #define SI_MESGQ 0x10005 /* Signal generated by arrival of a */ /* message on an empty message queue. */ #define SI_KERNEL 0x10006 #define SI_LWP 0x10007 /* Signal sent by thr_kill */ #endif # 423 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 424 "/usr/include/sys/signal.h" 3 4 #define SI_UNDEFINED 0 #endif # 426 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 428 "/usr/include/sys/signal.h" 3 4 typedef __sighandler_t *sig_t; /* type of pointer to a signal function */ typedef void __siginfohandler_t(int, struct __siginfo *, void *); #endif # 431 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 433 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 434 "/usr/include/sys/signal.h" 3 4 #define __stack_t sigaltstack #endif # 436 "/usr/include/sys/signal.h" 3 4 typedef struct __stack_t stack_t; #define SS_ONSTACK 0x0001 /* take signal on alternate stack */ #define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */ #define MINSIGSTKSZ __MINSIGSTKSZ /* minimum stack size */ #define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */ #endif # 443 "/usr/include/sys/signal.h" 3 4 /* * Structure used in sigaltstack call. Its definition is always * needed for __ucontext. If __BSD_VISIBLE is defined, the structure * tag is actually sigaltstack. */ struct __stack_t { void *ss_sp; /* signal stack base */ __size_t ss_size; /* signal stack length */ int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */ }; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 456 "/usr/include/sys/signal.h" 3 4 /* * 4.3 compatibility: * Signal vector "template" used in sigvec call. */ struct sigvec { __sighandler_t *sv_handler; /* signal handler */ int sv_mask; /* signal mask to apply */ int sv_flags; /* see signal options below */ }; #define SV_ONSTACK SA_ONSTACK #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ #define SV_RESETHAND SA_RESETHAND #define SV_NODEFER SA_NODEFER #define SV_NOCLDSTOP SA_NOCLDSTOP #define SV_SIGINFO SA_SIGINFO #define sv_onstack sv_flags /* isn't compatibility wonderful! */ #endif # 474 "/usr/include/sys/signal.h" 3 4 /* Keep this in one place only */ #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) && defined(COMPAT_43) && \ !defined(__i386__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 478 "/usr/include/sys/signal.h" 3 4 struct osigcontext { int _not_used; }; #endif # 482 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 484 "/usr/include/sys/signal.h" 3 4 /* * Structure used in sigstack call. */ struct sigstack { void *ss_sp; /* signal stack pointer */ int ss_onstack; /* current status */ }; #endif # 492 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE || __POSIX_VISIBLE > 0 && __POSIX_VISIBLE <= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 494 "/usr/include/sys/signal.h" 3 4 /* * Macro for converting signal number to a mask suitable for * sigblock(). */ #define sigmask(m) (1 << ((m)-1)) #endif # 500 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 502 "/usr/include/sys/signal.h" 3 4 #define BADSIG SIG_ERR #endif # 504 "/usr/include/sys/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 506 "/usr/include/sys/signal.h" 3 4 /* * Flags for sigprocmask: */ #define SIG_BLOCK 1 /* block specified signal set */ #define SIG_UNBLOCK 2 /* unblock specified signal set */ #define SIG_SETMASK 3 /* set specified signal set */ #endif # 513 "/usr/include/sys/signal.h" 3 4 /* * For historical reasons; programs expect signal's return value to be * defined by . */ __BEGIN_DECLS __sighandler_t *signal(int, __sighandler_t *); __END_DECLS #endif /* !_SYS_SIGNAL_H_ */ # 523 "/usr/include/sys/signal.h" 3 4 # 158 "/usr/include/sys/param.h" 2 3 4 #endif # 159 "/usr/include/sys/param.h" 3 4 #endif # 160 "/usr/include/sys/param.h" 3 4 /* Machine type dependent parameters. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 162 "/usr/include/sys/param.h" 3 4 # 1 "/usr/include/machine/param.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 2002 David E. O'Brien. All rights reserved. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department and Ralph Campbell. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)param.h 8.1 (Berkeley) 6/10/93 * $FreeBSD$ */ #ifndef _AMD64_INCLUDE_PARAM_H_ #define _AMD64_INCLUDE_PARAM_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/usr/include/machine/param.h" 3 4 # 1 "/usr/include/machine/_align.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_align.h" 3 4 # 1 "/usr/include/x86/_align.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 2001 David E. O'Brien * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * from: @(#)param.h 5.8 (Berkeley) 6/28/91 * $FreeBSD$ */ #ifndef _X86_INCLUDE__ALIGN_H_ #define _X86_INCLUDE__ALIGN_H_ /* * Round p (pointer or byte index) up to a correctly-aligned value * for all data types (int, long, ...). The result is unsigned int * and must be cast to any desired pointer type. */ #define _ALIGNBYTES (sizeof(__register_t) - 1) #define _ALIGN(p) (((__uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) #endif /* !_X86_INCLUDE__ALIGN_H_ */ # 55 "/usr/include/x86/_align.h" 3 4 # 7 "/usr/include/machine/_align.h" 2 3 4 # 48 "/usr/include/machine/param.h" 2 3 4 /* * Machine dependent constants for AMD64. */ #define __HAVE_ACPI #define __PCI_REROUTE_INTERRUPT #ifndef MACHINE #define MACHINE "amd64" #endif # 59 "/usr/include/machine/param.h" 3 4 #ifndef MACHINE_ARCH #define MACHINE_ARCH "amd64" #endif # 62 "/usr/include/machine/param.h" 3 4 #ifndef MACHINE_ARCH32 #define MACHINE_ARCH32 "i386" #endif # 65 "/usr/include/machine/param.h" 3 4 #ifdef SMP #ifndef MAXCPU #define MAXCPU 256 #endif # 70 "/usr/include/machine/param.h" 3 4 #else # 71 "/usr/include/machine/param.h" 3 4 #define MAXCPU 1 #endif # 73 "/usr/include/machine/param.h" 3 4 #ifndef MAXMEMDOM #define MAXMEMDOM 8 #endif # 77 "/usr/include/machine/param.h" 3 4 #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) /* * ALIGNED_POINTER is a boolean macro that checks whether an address * is valid to fetch data elements of type t from on this architecture. * This does not reflect the optimal alignment, just the possibility * (within reasonable limits). */ #define ALIGNED_POINTER(p, t) 1 /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ #define CACHE_LINE_SHIFT 6 #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) /* Size of the level 1 page table units */ #define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) #define NPTEPGSHIFT 9 /* LOG2(NPTEPG) */ #define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ #define PAGE_SIZE (1<> PAGE_SHIFT) #define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) #define amd64_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) #define amd64_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) #define INKERNEL(va) (((va) >= DMAP_MIN_ADDRESS && (va) < DMAP_MAX_ADDRESS) \ || ((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS)) #ifdef SMP #define SC_TABLESIZE 1024 /* Must be power of 2. */ #endif # 168 "/usr/include/machine/param.h" 3 4 #endif /* !_AMD64_INCLUDE_PARAM_H_ */ # 170 "/usr/include/machine/param.h" 3 4 # 163 "/usr/include/sys/param.h" 2 3 4 #ifndef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 164 "/usr/include/sys/param.h" 3 4 # 1 "/usr/include/sys/limits.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_LIMITS_H_ #define _SYS_LIMITS_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/sys/limits.h" 3 4 # 38 "/usr/include/sys/limits.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/limits.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_limits.h" 3 4 # 7 "/usr/include/machine/_limits.h" 3 4 # 39 "/usr/include/sys/limits.h" 2 3 4 #define CHAR_BIT __CHAR_BIT /* number of bits in a char */ #define SCHAR_MAX __SCHAR_MAX /* max value for a signed char */ #define SCHAR_MIN __SCHAR_MIN /* min value for a signed char */ #define UCHAR_MAX __UCHAR_MAX /* max value for an unsigned char */ #ifdef __CHAR_UNSIGNED__ #define CHAR_MAX UCHAR_MAX /* max value for a char */ #define CHAR_MIN 0 /* min value for a char */ #else # 51 "/usr/include/sys/limits.h" 3 4 #define CHAR_MAX SCHAR_MAX #define CHAR_MIN SCHAR_MIN #endif # 54 "/usr/include/sys/limits.h" 3 4 #define USHRT_MAX __USHRT_MAX /* max value for an unsigned short */ #define SHRT_MAX __SHRT_MAX /* max value for a short */ #define SHRT_MIN __SHRT_MIN /* min value for a short */ #define UINT_MAX __UINT_MAX /* max value for an unsigned int */ #define INT_MAX __INT_MAX /* max value for an int */ #define INT_MIN __INT_MIN /* min value for an int */ #define ULONG_MAX __ULONG_MAX /* max for an unsigned long */ #define LONG_MAX __LONG_MAX /* max for a long */ #define LONG_MIN __LONG_MIN /* min for a long */ #ifdef __LONG_LONG_SUPPORTED #define ULLONG_MAX __ULLONG_MAX /* max for an unsigned long long */ #define LLONG_MAX __LLONG_MAX /* max for a long long */ #define LLONG_MIN __LLONG_MIN /* min for a long long */ #endif # 72 "/usr/include/sys/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 74 "/usr/include/sys/limits.h" 3 4 #define SSIZE_MAX __SSIZE_MAX /* max value for an ssize_t */ #endif # 76 "/usr/include/sys/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 78 "/usr/include/sys/limits.h" 3 4 #define SIZE_T_MAX __SIZE_T_MAX /* max value for a size_t */ #define OFF_MAX __OFF_MAX /* max value for an off_t */ #define OFF_MIN __OFF_MIN /* min value for an off_t */ #endif # 83 "/usr/include/sys/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 85 "/usr/include/sys/limits.h" 3 4 #define GID_MAX UINT_MAX /* max value for a gid_t */ #define UID_MAX UINT_MAX /* max value for a uid_t */ #define UQUAD_MAX (__UQUAD_MAX) /* max value for a uquad_t */ #define QUAD_MAX (__QUAD_MAX) /* max value for a quad_t */ #define QUAD_MIN (__QUAD_MIN) /* min value for a quad_t */ #endif # 92 "/usr/include/sys/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 94 "/usr/include/sys/limits.h" 3 4 #define LONG_BIT __LONG_BIT #define WORD_BIT __WORD_BIT #endif # 97 "/usr/include/sys/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 99 "/usr/include/sys/limits.h" 3 4 #define MQ_PRIO_MAX 64 #endif # 101 "/usr/include/sys/limits.h" 3 4 #endif /* !_SYS_LIMITS_H_ */ # 103 "/usr/include/sys/limits.h" 3 4 # 165 "/usr/include/sys/param.h" 2 3 4 #endif # 166 "/usr/include/sys/param.h" 3 4 #ifndef DEV_BSHIFT #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #endif # 170 "/usr/include/sys/param.h" 3 4 #define DEV_BSIZE (1<>PAGE_SHIFT) #endif # 225 "/usr/include/sys/param.h" 3 4 /* * btodb() is messy and perhaps slow because `bytes' may be an off_t. We * want to shift an unsigned type to avoid sign extension and we don't * want to widen `bytes' unnecessarily. Assume that the result fits in * a daddr_t. */ #ifndef btodb #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ (sizeof (bytes) > sizeof(long) \ ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) #endif # 238 "/usr/include/sys/param.h" 3 4 #ifndef dbtob #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ ((off_t)(db) << DEV_BSHIFT) #endif # 243 "/usr/include/sys/param.h" 3 4 #define PRIMASK 0x0ff #define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ #define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */ #define PNOLOCK 0x400 /* OR'd with pri to allow sleeping w/o a lock */ #define PRILASTFLAG 0x400 /* Last flag defined above */ #define NZERO 0 /* default "nice" */ #define NBBY 8 /* number of bits in a byte */ #define NBPW sizeof(int) /* number of bytes per word (integer) */ #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ #define NODEV (dev_t)(-1) /* non-existent device */ /* * File system parameters and macros. * * MAXBSIZE - Filesystems are made out of blocks of at most MAXBSIZE bytes * per block. MAXBSIZE may be made larger without effecting * any existing filesystems as long as it does not exceed MAXPHYS, * and may be made smaller at the risk of not being able to use * filesystems which require a block size exceeding MAXBSIZE. * * MAXBCACHEBUF - Maximum size of a buffer in the buffer cache. This must * be >= MAXBSIZE and can be set differently for different * architectures by defining it in . * Making this larger allows NFS to do larger reads/writes. * * BKVASIZE - Nominal buffer space per buffer, in bytes. BKVASIZE is the * minimum KVM memory reservation the kernel is willing to make. * Filesystems can of course request smaller chunks. Actual * backing memory uses a chunk size of a page (PAGE_SIZE). * The default value here can be overridden on a per-architecture * basis by defining it in . * * If you make BKVASIZE too small you risk seriously fragmenting * the buffer KVM map which may slow things down a bit. If you * make it too big the kernel will not be able to optimally use * the KVM memory reserved for the buffer cache and will wind * up with too-few buffers. * * The default is 16384, roughly 2x the block size used by a * normal UFS filesystem. */ #define MAXBSIZE 65536 /* must be power of 2 */ #ifndef MAXBCACHEBUF #define MAXBCACHEBUF MAXBSIZE /* must be a power of 2 >= MAXBSIZE */ #endif # 293 "/usr/include/sys/param.h" 3 4 #ifndef BKVASIZE #define BKVASIZE 16384 /* must be power of 2 */ #endif # 296 "/usr/include/sys/param.h" 3 4 #define BKVAMASK (BKVASIZE-1) /* * MAXPATHLEN defines the longest permissible path length after expanding * symbolic links. It is used to allocate a temporary buffer from the buffer * pool in which to do the name expansion, hence should be a power of two, * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the * maximum number of symbolic links that may be expanded in a path name. * It should be set high enough to allow all legitimate uses, but halt * infinite loops reasonably quickly. */ #define MAXPATHLEN PATH_MAX #define MAXSYMLINKS 32 /* Bit map related macros. */ #define setbit(a,i) (((unsigned char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY)) #define clrbit(a,i) (((unsigned char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY))) #define isset(a,i) \ (((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) #define isclr(a,i) \ ((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0) /* Macros for counting and rounding. */ #ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) #endif # 322 "/usr/include/sys/param.h" 3 4 #define nitems(x) (sizeof((x)) / sizeof((x)[0])) #define rounddown(x, y) (((x)/(y))*(y)) #define rounddown2(x, y) __align_down(x, y) /* if y is power of two */ #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ #define roundup2(x, y) __align_up(x, y) /* if y is powers of two */ #define powerof2(x) ((((x)-1)&(x))==0) /* Macros for min/max. */ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #ifdef _KERNEL /* * Basic byte order function prototypes for non-inline functions. */ #ifndef LOCORE #ifndef _BYTEORDER_PROTOTYPED #define _BYTEORDER_PROTOTYPED __BEGIN_DECLS __uint32_t htonl(__uint32_t); __uint16_t htons(__uint16_t); __uint32_t ntohl(__uint32_t); __uint16_t ntohs(__uint16_t); __END_DECLS #endif # 347 "/usr/include/sys/param.h" 3 4 #endif # 348 "/usr/include/sys/param.h" 3 4 #ifndef _BYTEORDER_FUNC_DEFINED #define _BYTEORDER_FUNC_DEFINED #define htonl(x) __htonl(x) #define htons(x) __htons(x) #define ntohl(x) __ntohl(x) #define ntohs(x) __ntohs(x) #endif /* !_BYTEORDER_FUNC_DEFINED */ # 356 "/usr/include/sys/param.h" 3 4 #endif /* _KERNEL */ # 357 "/usr/include/sys/param.h" 3 4 /* * Scale factor for scaled integers used to count %cpu time and load avgs. * * The number of CPU `tick's that map to a unique `%age' can be expressed * by the formula (1 / (2 ^ (FSHIFT - 11))). Since the intermediate * calculation is done with 64-bit precision, the maximum load average that can * be calculated is approximately 2^32 / FSCALE. * * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', * FSHIFT must be at least 11. This gives a maximum load avg of 2 million. */ #define FSHIFT 11 /* bits to right of fixed binary point */ #define FSCALE (1<> (PAGE_SHIFT - DEV_BSHIFT)) #define ctodb(db) /* calculates pages to devblks */ \ ((db) << (PAGE_SHIFT - DEV_BSHIFT)) /* * Old spelling of __containerof(). */ #define member2struct(s, m, x) \ ((struct s *)(void *)((char *)(x) - offsetof(struct s, m))) /* * Access a variable length array that has been declared as a fixed * length array. */ #define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset]) #endif /* _SYS_PARAM_H_ */ # 391 "/usr/include/sys/param.h" 3 4 # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" 2 #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #endif # 29 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #ifndef API_AVAILABLE #define API_AVAILABLE(...) #endif # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #ifndef API_DEPRECATED #define API_DEPRECATED(...) #endif # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #ifndef API_UNAVAILABLE #define API_UNAVAILABLE(...) #endif # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #ifndef API_DEPRECATED_WITH_REPLACEMENT #define API_DEPRECATED_WITH_REPLACEMENT(...) #endif # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_EXPECT(x, v) __builtin_expect((x), (v)) #define OS_UNUSED __attribute__((__unused__)) #else # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_EXPECT(x, v) (x) #define OS_UNUSED #endif # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #ifndef os_likely #define os_likely(x) OS_EXPECT(!!(x), 1) #endif # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #ifndef os_unlikely #define os_unlikely(x) OS_EXPECT(!!(x), 0) #endif # 57 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(assume_nonnull) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 59 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") #define OS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") #else # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_ASSUME_NONNULL_BEGIN #define OS_ASSUME_NONNULL_END #endif # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_builtin(__builtin_assume) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 67 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_COMPILER_CAN_ASSUME(expr) __builtin_assume(expr) #else # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_COMPILER_CAN_ASSUME(expr) ((void)(expr)) #endif # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(attribute_availability_swift) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" // equivalent to __SWIFT_UNAVAILABLE from Availability.h #define OS_SWIFT_UNAVAILABLE(_msg) \ __attribute__((__availability__(swift, unavailable, message=_msg))) #else # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_SWIFT_UNAVAILABLE(_msg) #endif # 79 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(swift_private) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 81 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # define OS_REFINED_FOR_SWIFT __attribute__((__swift_private__)) #else # 83 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # define OS_REFINED_FOR_SWIFT #endif # 85 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(swift_name) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 87 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # define OS_SWIFT_NAME(_name) __attribute__((__swift_name__(#_name))) #else # 89 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # define OS_SWIFT_NAME(_name) #endif # 91 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define __OS_STRINGIFY(s) #s #define OS_STRINGIFY(s) __OS_STRINGIFY(s) #define __OS_CONCAT(x, y) x ## y #define OS_CONCAT(x, y) __OS_CONCAT(x, y) #if 0 /* disabled by -frewrite-includes */ #if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 98 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_ENUM(_name, _type, ...) \ typedef enum : _type { __VA_ARGS__ } _name##_t #else # 101 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_ENUM(_name, _type, ...) \ enum { __VA_ARGS__ }; typedef _type _name##_t #endif # 104 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" /* * Stub out misc linking and compilation attributes */ #ifdef OS_EXPORT #undef OS_EXPORT #endif # 112 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_EXPORT #ifdef OS_WARN_RESULT_NEEDS_RELEASE #undef OS_WARN_RESULT_NEEDS_RELEASE #endif # 117 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #ifdef OS_WARN_RESULT #undef OS_WARN_RESULT #endif # 121 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_WARN_RESULT #ifdef OS_NOTHROW #undef OS_NOTHROW #endif # 126 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" #define OS_NOTHROW #endif /* __OS_GENERIC_UNIX_BASE__ */ # 129 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/generic_unix_base.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" 2 #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 1 "/usr/include/stddef.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stddef.h 8.1 (Berkeley) 6/2/93 * * $FreeBSD$ */ #ifndef _STDDEF_H_ #define _STDDEF_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/stddef.h" 3 4 # 40 "/usr/include/stddef.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/stddef.h" 3 4 # 41 "/usr/include/stddef.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/stddef.h" 3 4 # 42 "/usr/include/stddef.h" 3 4 #ifndef _PTRDIFF_T_DECLARED typedef __ptrdiff_t ptrdiff_t; #define _PTRDIFF_T_DECLARED #endif # 47 "/usr/include/stddef.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 49 "/usr/include/stddef.h" 3 4 #ifndef _RUNE_T_DECLARED typedef __rune_t rune_t; #define _RUNE_T_DECLARED #endif # 53 "/usr/include/stddef.h" 3 4 #endif # 54 "/usr/include/stddef.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 59 "/usr/include/stddef.h" 3 4 #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 65 "/usr/include/stddef.h" 3 4 #endif # 66 "/usr/include/stddef.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 68 "/usr/include/stddef.h" 3 4 #ifndef __CLANG_MAX_ALIGN_T_DEFINED typedef __max_align_t max_align_t; #define __CLANG_MAX_ALIGN_T_DEFINED #define _GCC_MAX_ALIGN_T #endif # 73 "/usr/include/stddef.h" 3 4 #endif # 74 "/usr/include/stddef.h" 3 4 #define offsetof(type, field) __offsetof(type, field) #if 0 /* disabled by -frewrite-includes */ #if __EXT1_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 78 "/usr/include/stddef.h" 3 4 /* ISO/IEC 9899:2011 K.3.3.2 */ #ifndef _RSIZE_T_DEFINED #define _RSIZE_T_DEFINED typedef size_t rsize_t; #endif # 83 "/usr/include/stddef.h" 3 4 #endif /* __EXT1_VISIBLE */ # 84 "/usr/include/stddef.h" 3 4 #endif /* _STDDEF_H_ */ # 86 "/usr/include/stddef.h" 3 4 # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 1 "/usr/include/stdint.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_STDINT_H_ #define _SYS_STDINT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/include/stdint.h" 3 4 # 35 "/usr/include/stdint.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/stdint.h" 3 4 # 36 "/usr/include/stdint.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/stdint.h" 3 4 # 1 "/usr/include/machine/_stdint.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_stdint.h" 3 4 # 1 "/usr/include/x86/_stdint.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 2001, 2002 Mike Barcroft * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Klaus Klein. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _MACHINE__STDINT_H_ #define _MACHINE__STDINT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/x86/_stdint.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_limits.h" 3 4 # 7 "/usr/include/machine/_limits.h" 3 4 # 46 "/usr/include/x86/_stdint.h" 2 3 4 #if 0 /* disabled by -frewrite-includes */ #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 48 "/usr/include/x86/_stdint.h" 3 4 #define INT8_C(c) (c) #define INT16_C(c) (c) #define INT32_C(c) (c) #define UINT8_C(c) (c) #define UINT16_C(c) (c) #define UINT32_C(c) (c ## U) #ifdef __LP64__ #define INT64_C(c) (c ## L) #define UINT64_C(c) (c ## UL) #else # 61 "/usr/include/x86/_stdint.h" 3 4 #define INT64_C(c) (c ## LL) #define UINT64_C(c) (c ## ULL) #endif # 64 "/usr/include/x86/_stdint.h" 3 4 #define INTMAX_C(c) INT64_C(c) #define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ # 69 "/usr/include/x86/_stdint.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 71 "/usr/include/x86/_stdint.h" 3 4 /* * ISO/IEC 9899:1999 * 7.18.2.1 Limits of exact-width integer types */ #define INT8_MIN (-0x7f-1) #define INT16_MIN (-0x7fff-1) #define INT32_MIN (-0x7fffffff-1) #define INT8_MAX 0x7f #define INT16_MAX 0x7fff #define INT32_MAX 0x7fffffff #define UINT8_MAX 0xff #define UINT16_MAX 0xffff #define UINT32_MAX 0xffffffffU #ifdef __LP64__ #define INT64_MIN (-0x7fffffffffffffff-1) #define INT64_MAX 0x7fffffffffffffff #define UINT64_MAX 0xffffffffffffffff #else # 93 "/usr/include/x86/_stdint.h" 3 4 #define INT64_MIN (-0x7fffffffffffffffLL-1) #define INT64_MAX 0x7fffffffffffffffLL #define UINT64_MAX 0xffffffffffffffffULL #endif # 97 "/usr/include/x86/_stdint.h" 3 4 /* * ISO/IEC 9899:1999 * 7.18.2.2 Limits of minimum-width integer types */ /* Minimum values of minimum-width signed integer types. */ #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST16_MIN INT16_MIN #define INT_LEAST32_MIN INT32_MIN #define INT_LEAST64_MIN INT64_MIN /* Maximum values of minimum-width signed integer types. */ #define INT_LEAST8_MAX INT8_MAX #define INT_LEAST16_MAX INT16_MAX #define INT_LEAST32_MAX INT32_MAX #define INT_LEAST64_MAX INT64_MAX /* Maximum values of minimum-width unsigned integer types. */ #define UINT_LEAST8_MAX UINT8_MAX #define UINT_LEAST16_MAX UINT16_MAX #define UINT_LEAST32_MAX UINT32_MAX #define UINT_LEAST64_MAX UINT64_MAX /* * ISO/IEC 9899:1999 * 7.18.2.3 Limits of fastest minimum-width integer types */ /* Minimum values of fastest minimum-width signed integer types. */ #define INT_FAST8_MIN INT32_MIN #define INT_FAST16_MIN INT32_MIN #define INT_FAST32_MIN INT32_MIN #define INT_FAST64_MIN INT64_MIN /* Maximum values of fastest minimum-width signed integer types. */ #define INT_FAST8_MAX INT32_MAX #define INT_FAST16_MAX INT32_MAX #define INT_FAST32_MAX INT32_MAX #define INT_FAST64_MAX INT64_MAX /* Maximum values of fastest minimum-width unsigned integer types. */ #define UINT_FAST8_MAX UINT32_MAX #define UINT_FAST16_MAX UINT32_MAX #define UINT_FAST32_MAX UINT32_MAX #define UINT_FAST64_MAX UINT64_MAX /* * ISO/IEC 9899:1999 * 7.18.2.4 Limits of integer types capable of holding object pointers */ #ifdef __LP64__ #define INTPTR_MIN INT64_MIN #define INTPTR_MAX INT64_MAX #define UINTPTR_MAX UINT64_MAX #else # 151 "/usr/include/x86/_stdint.h" 3 4 #define INTPTR_MIN INT32_MIN #define INTPTR_MAX INT32_MAX #define UINTPTR_MAX UINT32_MAX #endif # 155 "/usr/include/x86/_stdint.h" 3 4 /* * ISO/IEC 9899:1999 * 7.18.2.5 Limits of greatest-width integer types */ #define INTMAX_MIN INT64_MIN #define INTMAX_MAX INT64_MAX #define UINTMAX_MAX UINT64_MAX /* * ISO/IEC 9899:1999 * 7.18.3 Limits of other integer types */ #ifdef __LP64__ /* Limits of ptrdiff_t. */ #define PTRDIFF_MIN INT64_MIN #define PTRDIFF_MAX INT64_MAX /* Limits of sig_atomic_t. */ #define SIG_ATOMIC_MIN __LONG_MIN #define SIG_ATOMIC_MAX __LONG_MAX /* Limit of size_t. */ #define SIZE_MAX UINT64_MAX #else # 180 "/usr/include/x86/_stdint.h" 3 4 #define PTRDIFF_MIN INT32_MIN #define PTRDIFF_MAX INT32_MAX #define SIG_ATOMIC_MIN INT32_MIN #define SIG_ATOMIC_MAX INT32_MAX #define SIZE_MAX UINT32_MAX #endif # 186 "/usr/include/x86/_stdint.h" 3 4 /* Limits of wint_t. */ #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ # 192 "/usr/include/x86/_stdint.h" 3 4 #endif /* !_MACHINE__STDINT_H_ */ # 194 "/usr/include/x86/_stdint.h" 3 4 # 7 "/usr/include/machine/_stdint.h" 2 3 4 # 38 "/usr/include/stdint.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/stdint.h" 3 4 # 39 "/usr/include/stdint.h" 3 4 typedef __int_least8_t int_least8_t; typedef __int_least16_t int_least16_t; typedef __int_least32_t int_least32_t; typedef __int_least64_t int_least64_t; typedef __uint_least8_t uint_least8_t; typedef __uint_least16_t uint_least16_t; typedef __uint_least32_t uint_least32_t; typedef __uint_least64_t uint_least64_t; typedef __int_fast8_t int_fast8_t; typedef __int_fast16_t int_fast16_t; typedef __int_fast32_t int_fast32_t; typedef __int_fast64_t int_fast64_t; typedef __uint_fast8_t uint_fast8_t; typedef __uint_fast16_t uint_fast16_t; typedef __uint_fast32_t uint_fast32_t; typedef __uint_fast64_t uint_fast64_t; /* GNU and Darwin define this and people seem to think it's portable */ #if 0 /* disabled by -frewrite-includes */ #if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 62 "/usr/include/stdint.h" 3 4 #define __WORDSIZE 64 #else # 64 "/usr/include/stdint.h" 3 4 #define __WORDSIZE 32 #endif # 66 "/usr/include/stdint.h" 3 4 /* Limits of wchar_t. */ #define WCHAR_MIN __WCHAR_MIN #define WCHAR_MAX __WCHAR_MAX #if 0 /* disabled by -frewrite-includes */ #if __EXT1_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 72 "/usr/include/stdint.h" 3 4 /* ISO/IEC 9899:2011 K.3.4.4 */ #ifndef RSIZE_MAX #define RSIZE_MAX (SIZE_MAX >> 1) #endif # 76 "/usr/include/stdint.h" 3 4 #endif /* __EXT1_VISIBLE */ # 77 "/usr/include/stdint.h" 3 4 #endif /* !_SYS_STDINT_H_ */ # 79 "/usr/include/stdint.h" 3 4 # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 1 "/usr/include/stdbool.h" 1 3 4 /* * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2000 Jeroen Ruigrok van der Werven * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef __bool_true_false_are_defined #define __bool_true_false_are_defined 1 #ifndef __cplusplus #define false 0 #define true 1 #define bool _Bool #endif /* !__cplusplus */ # 42 "/usr/include/stdbool.h" 3 4 #endif /* __bool_true_false_are_defined */ # 43 "/usr/include/stdbool.h" 3 4 # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 1 "/usr/include/stdarg.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/stdarg.h" 3 4 # 1 "/usr/include/x86/stdarg.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2017 Poul-Henning Kamp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _MACHINE_STDARG_H_ #define _MACHINE_STDARG_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/usr/include/x86/stdarg.h" 3 4 # 1 "/usr/include/sys/_stdarg.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2002 David E. O'Brien. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__STDARG_H_ #define _SYS__STDARG_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/sys/_stdarg.h" 3 4 # 37 "/usr/include/sys/_stdarg.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/sys/_stdarg.h" 3 4 # 38 "/usr/include/sys/_stdarg.h" 3 4 #ifndef _VA_LIST_DECLARED #define _VA_LIST_DECLARED typedef __va_list va_list; #endif # 43 "/usr/include/sys/_stdarg.h" 3 4 #define va_start(ap, last) __builtin_va_start((ap), (last)) #define va_arg(ap, type) __builtin_va_arg((ap), type) #define __va_copy(dest, src) __builtin_va_copy((dest), (src)) #if 0 /* disabled by -frewrite-includes */ #if __ISO_C_VISIBLE >= 1999 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 48 "/usr/include/sys/_stdarg.h" 3 4 #define va_copy(dest, src) __va_copy(dest, src) #endif # 50 "/usr/include/sys/_stdarg.h" 3 4 #define va_end(ap) __builtin_va_end(ap) #endif /* ! _SYS__STDARG_H_ */ # 53 "/usr/include/sys/_stdarg.h" 3 4 # 34 "/usr/include/x86/stdarg.h" 2 3 4 #ifndef va_start #error this file needs to be ported to your compiler #endif # 38 "/usr/include/x86/stdarg.h" 3 4 #endif /* !_MACHINE_STDARG_H_ */ # 40 "/usr/include/x86/stdarg.h" 3 4 # 7 "/usr/include/stdarg.h" 2 3 4 # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 1 "/usr/include/string.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)string.h 8.1 (Berkeley) 6/2/93 * $FreeBSD$ */ #ifndef _STRING_H_ #define _STRING_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/string.h" 3 4 # 39 "/usr/include/string.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/string.h" 3 4 # 40 "/usr/include/string.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/string.h" 3 4 # 41 "/usr/include/string.h" 3 4 /* * Prototype functions which were historically defined in , but * are required by POSIX to be prototyped in . */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 47 "/usr/include/string.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/usr/include/string.h" 3 4 # 1 "/usr/include/strings.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _STRINGS_H_ #define _STRINGS_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/include/strings.h" 3 4 # 35 "/usr/include/strings.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/strings.h" 3 4 # 36 "/usr/include/strings.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 41 "/usr/include/strings.h" 3 4 __BEGIN_DECLS #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 44 "/usr/include/strings.h" 3 4 int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ void bcopy(const void *, void *, size_t); /* LEGACY */ void bzero(void *, size_t); /* LEGACY */ #endif # 48 "/usr/include/strings.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 49 "/usr/include/strings.h" 3 4 void explicit_bzero(void *, size_t); #endif # 51 "/usr/include/strings.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 52 "/usr/include/strings.h" 3 4 int ffs(int) __pure2; #endif # 54 "/usr/include/strings.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 55 "/usr/include/strings.h" 3 4 int ffsl(long) __pure2; int ffsll(long long) __pure2; int fls(int) __pure2; int flsl(long) __pure2; int flsll(long long) __pure2; #endif # 61 "/usr/include/strings.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 62 "/usr/include/strings.h" 3 4 char *index(const char *, int) __pure; /* LEGACY */ char *rindex(const char *, int) __pure; /* LEGACY */ #endif # 65 "/usr/include/strings.h" 3 4 int strcasecmp(const char *, const char *) __pure; int strncasecmp(const char *, const char *, size_t) __pure; #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 69 "/usr/include/strings.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 69 "/usr/include/strings.h" 3 4 # 1 "/usr/include/xlocale/_strings.h" 1 3 4 /*- * Copyright (c) 2011, 2012 The FreeBSD Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 32 "/usr/include/xlocale/_strings.h" 3 4 /* * This file is included from both strings.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from string.h. */ #ifndef _XLOCALE_STRINGS1_H #define _XLOCALE_STRINGS1_H /* * POSIX2008 functions */ int strcasecmp_l(const char *, const char *, locale_t); int strncasecmp_l(const char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRINGS1_H */ # 48 "/usr/include/xlocale/_strings.h" 3 4 # 70 "/usr/include/strings.h" 2 3 4 #endif # 71 "/usr/include/strings.h" 3 4 __END_DECLS #endif /* _STRINGS_H_ */ # 74 "/usr/include/strings.h" 3 4 # 48 "/usr/include/string.h" 2 3 4 #endif # 49 "/usr/include/string.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 54 "/usr/include/string.h" 3 4 __BEGIN_DECLS #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE >= 600 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 57 "/usr/include/string.h" 3 4 void *memccpy(void * __restrict, const void * __restrict, int, size_t); #endif # 59 "/usr/include/string.h" 3 4 void *memchr(const void *, int, size_t) __pure; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 61 "/usr/include/string.h" 3 4 void *memrchr(const void *, int, size_t) __pure; #endif # 63 "/usr/include/string.h" 3 4 int memcmp(const void *, const void *, size_t) __pure; void *memcpy(void * __restrict, const void * __restrict, size_t); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 66 "/usr/include/string.h" 3 4 void *memmem(const void *, size_t, const void *, size_t) __pure; #endif # 68 "/usr/include/string.h" 3 4 void *memmove(void *, const void *, size_t); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 70 "/usr/include/string.h" 3 4 void *mempcpy(void * __restrict, const void * __restrict, size_t); #endif # 72 "/usr/include/string.h" 3 4 void *memset(void *, int, size_t); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 74 "/usr/include/string.h" 3 4 char *stpcpy(char * __restrict, const char * __restrict); char *stpncpy(char * __restrict, const char * __restrict, size_t); #endif # 77 "/usr/include/string.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 78 "/usr/include/string.h" 3 4 char *strcasestr(const char *, const char *) __pure; #endif # 80 "/usr/include/string.h" 3 4 char *strcat(char * __restrict, const char * __restrict); char *strchr(const char *, int) __pure; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 83 "/usr/include/string.h" 3 4 char *strchrnul(const char*, int) __pure; int strverscmp(const char *, const char *) __pure; #endif # 86 "/usr/include/string.h" 3 4 int strcmp(const char *, const char *) __pure; int strcoll(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); size_t strcspn(const char *, const char *) __pure; #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 91 "/usr/include/string.h" 3 4 char *strdup(const char *) __malloc_like; #endif # 93 "/usr/include/string.h" 3 4 char *strerror(int); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 95 "/usr/include/string.h" 3 4 int strerror_r(int, char *, size_t); #endif # 97 "/usr/include/string.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 98 "/usr/include/string.h" 3 4 size_t strlcat(char * __restrict, const char * __restrict, size_t); size_t strlcpy(char * __restrict, const char * __restrict, size_t); #endif # 101 "/usr/include/string.h" 3 4 size_t strlen(const char *) __pure; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 103 "/usr/include/string.h" 3 4 #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; #define _MODE_T_DECLARED #endif # 108 "/usr/include/string.h" 3 4 void strmode(mode_t, char *); #endif # 111 "/usr/include/string.h" 3 4 char *strncat(char * __restrict, const char * __restrict, size_t); int strncmp(const char *, const char *, size_t) __pure; char *strncpy(char * __restrict, const char * __restrict, size_t); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 115 "/usr/include/string.h" 3 4 char *strndup(const char *, size_t) __malloc_like; size_t strnlen(const char *, size_t) __pure; #endif # 118 "/usr/include/string.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 119 "/usr/include/string.h" 3 4 char *strnstr(const char *, const char *, size_t) __pure; #endif # 121 "/usr/include/string.h" 3 4 char *strpbrk(const char *, const char *) __pure; char *strrchr(const char *, int) __pure; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 124 "/usr/include/string.h" 3 4 char *strsep(char **, const char *); #endif # 126 "/usr/include/string.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 127 "/usr/include/string.h" 3 4 char *strsignal(int); #endif # 129 "/usr/include/string.h" 3 4 size_t strspn(const char *, const char *) __pure; char *strstr(const char *, const char *) __pure; char *strtok(char * __restrict, const char * __restrict); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 133 "/usr/include/string.h" 3 4 char *strtok_r(char *, const char *, char **); #endif # 135 "/usr/include/string.h" 3 4 size_t strxfrm(char * __restrict, const char * __restrict, size_t); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 137 "/usr/include/string.h" 3 4 #ifndef _SWAB_DECLARED #define _SWAB_DECLARED #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif /* _SIZE_T_DECLARED */ # 145 "/usr/include/string.h" 3 4 void swab(const void * __restrict, void * __restrict, ssize_t); #endif /* _SWAB_DECLARED */ # 148 "/usr/include/string.h" 3 4 int timingsafe_bcmp(const void *, const void *, size_t); int timingsafe_memcmp(const void *, const void *, size_t); #endif /* __BSD_VISIBLE */ # 152 "/usr/include/string.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || defined(_XLOCALE_H_) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 154 "/usr/include/string.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 154 "/usr/include/string.h" 3 4 # 1 "/usr/include/xlocale/_string.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 The FreeBSD Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 34 "/usr/include/xlocale/_string.h" 3 4 /* * This file is included from both string.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from string.h. */ #ifndef _XLOCALE_STRING1_H #define _XLOCALE_STRING1_H /* * POSIX2008 functions */ int strcoll_l(const char *, const char *, locale_t); char *strerror_l(int num, locale_t); size_t strxfrm_l(char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRING1_H */ # 51 "/usr/include/xlocale/_string.h" 3 4 /* * xlocale extensions */ #ifdef _XLOCALE_H_ #ifndef _XLOCALE_STRING2_H #define _XLOCALE_STRING2_H char *strcasestr_l(const char *, const char *, locale_t); #endif /* _XLOCALE_STRING2_H */ # 61 "/usr/include/xlocale/_string.h" 3 4 #endif /* _XLOCALE_H_ */ # 62 "/usr/include/xlocale/_string.h" 3 4 # 155 "/usr/include/string.h" 2 3 4 #endif # 156 "/usr/include/string.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __EXT1_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 158 "/usr/include/string.h" 3 4 #ifndef _RSIZE_T_DEFINED #define _RSIZE_T_DEFINED typedef size_t rsize_t; #endif # 163 "/usr/include/string.h" 3 4 #ifndef _ERRNO_T_DEFINED #define _ERRNO_T_DEFINED typedef int errno_t; #endif # 168 "/usr/include/string.h" 3 4 /* ISO/IEC 9899:2011 K.3.7.4.1.1 */ errno_t memset_s(void *, rsize_t, int, rsize_t); #endif /* __EXT1_VISIBLE */ # 172 "/usr/include/string.h" 3 4 __END_DECLS #endif /* _STRING_H_ */ # 175 "/usr/include/string.h" 3 4 # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" 2 #if 0 /* disabled by -frewrite-includes */ #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 1 "/usr/include/unistd.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)unistd.h 8.12 (Berkeley) 4/27/95 * $FreeBSD$ */ #ifndef _UNISTD_H_ #define _UNISTD_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/unistd.h" 3 4 # 39 "/usr/include/unistd.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include /* XXX adds too much pollution. */ #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/unistd.h" 3 4 # 40 "/usr/include/unistd.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/unistd.h" 3 4 # 1 "/usr/include/sys/unistd.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)unistd.h 8.2 (Berkeley) 1/7/94 * $FreeBSD$ */ #ifndef _SYS_UNISTD_H_ #define _SYS_UNISTD_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/unistd.h" 3 4 # 39 "/usr/include/sys/unistd.h" 3 4 /* * POSIX options and option groups we unconditionally do or don't * implement. Those options which are implemented (or not) entirely * in user mode are defined in . Please keep this list in * alphabetical order. * * Anything which is defined as zero below **must** have an * implementation for the corresponding sysconf() which is able to * determine conclusively whether or not the feature is supported. * Anything which is defined as other than -1 below **must** have * complete headers, types, and function declarations as specified by * the POSIX standard; however, if the relevant sysconf() function * returns -1, the functions may be stubbed out. */ #define _POSIX_ADVISORY_INFO 200112L #define _POSIX_ASYNCHRONOUS_IO 200112L #define _POSIX_CHOWN_RESTRICTED 1 #define _POSIX_CLOCK_SELECTION (-1) #define _POSIX_CPUTIME 200112L #define _POSIX_FSYNC 200112L #define _POSIX_IPV6 0 #define _POSIX_JOB_CONTROL 1 #define _POSIX_MAPPED_FILES 200112L #define _POSIX_MEMLOCK (-1) #define _POSIX_MEMLOCK_RANGE 200112L #define _POSIX_MEMORY_PROTECTION 200112L #define _POSIX_MESSAGE_PASSING 200112L #define _POSIX_MONOTONIC_CLOCK 200112L #define _POSIX_NO_TRUNC 1 #define _POSIX_PRIORITIZED_IO (-1) #define _POSIX_PRIORITY_SCHEDULING 0 #define _POSIX_RAW_SOCKETS 200112L #define _POSIX_REALTIME_SIGNALS 200112L #define _POSIX_SEMAPHORES 200112L #define _POSIX_SHARED_MEMORY_OBJECTS 200112L #define _POSIX_SPORADIC_SERVER (-1) #define _POSIX_SYNCHRONIZED_IO (-1) #define _POSIX_TIMEOUTS 200112L #define _POSIX_TIMERS 200112L #define _POSIX_TYPED_MEMORY_OBJECTS (-1) #define _POSIX_VDISABLE 0xff #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 83 "/usr/include/sys/unistd.h" 3 4 #define _XOPEN_SHM 1 #define _XOPEN_STREAMS (-1) #endif # 86 "/usr/include/sys/unistd.h" 3 4 /* * Although we have saved user/group IDs, we do not use them in setuid * as described in POSIX 1003.1, because the feature does not work for * root. We use the saved IDs in seteuid/setegid, which are not currently * part of the POSIX 1003.1 specification. XXX revisit for 1003.1-2001 * as this is now mandatory. */ #ifdef _NOT_AVAILABLE #define _POSIX_SAVED_IDS 1 /* saved set-user-ID and set-group-ID */ #endif # 97 "/usr/include/sys/unistd.h" 3 4 /* Define the POSIX.1 version we target for compliance. */ #define _POSIX_VERSION 200112L /* access function */ #define F_OK 0 /* test for existence of file */ #define X_OK 0x01 /* test for execute or search permission */ #define W_OK 0x02 /* test for write permission */ #define R_OK 0x04 /* test for read permission */ /* whence values for lseek(2) */ #ifndef SEEK_SET #define SEEK_SET 0 /* set file offset to offset */ #define SEEK_CUR 1 /* set file offset to current plus offset */ #define SEEK_END 2 /* set file offset to EOF plus offset */ #endif # 113 "/usr/include/sys/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 114 "/usr/include/sys/unistd.h" 3 4 #define SEEK_DATA 3 /* set file offset to next data past offset */ #define SEEK_HOLE 4 /* set file offset to next hole past offset */ #endif # 117 "/usr/include/sys/unistd.h" 3 4 #ifndef _POSIX_SOURCE /* whence values for lseek(2); renamed by POSIX 1003.1 */ #define L_SET SEEK_SET #define L_INCR SEEK_CUR #define L_XTND SEEK_END #endif # 124 "/usr/include/sys/unistd.h" 3 4 /* configurable pathname variables */ #define _PC_LINK_MAX 1 #define _PC_MAX_CANON 2 #define _PC_MAX_INPUT 3 #define _PC_NAME_MAX 4 #define _PC_PATH_MAX 5 #define _PC_PIPE_BUF 6 #define _PC_CHOWN_RESTRICTED 7 #define _PC_NO_TRUNC 8 #define _PC_VDISABLE 9 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 137 "/usr/include/sys/unistd.h" 3 4 #define _PC_ASYNC_IO 53 #define _PC_PRIO_IO 54 #define _PC_SYNC_IO 55 #endif # 141 "/usr/include/sys/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 143 "/usr/include/sys/unistd.h" 3 4 #define _PC_ALLOC_SIZE_MIN 10 #define _PC_FILESIZEBITS 12 #define _PC_REC_INCR_XFER_SIZE 14 #define _PC_REC_MAX_XFER_SIZE 15 #define _PC_REC_MIN_XFER_SIZE 16 #define _PC_REC_XFER_ALIGN 17 #define _PC_SYMLINK_MAX 18 #endif # 151 "/usr/include/sys/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 153 "/usr/include/sys/unistd.h" 3 4 #define _PC_ACL_EXTENDED 59 #define _PC_ACL_PATH_MAX 60 #define _PC_CAP_PRESENT 61 #define _PC_INF_PRESENT 62 #define _PC_MAC_PRESENT 63 #define _PC_ACL_NFS4 64 #define _PC_DEALLOC_PRESENT 65 #endif # 161 "/usr/include/sys/unistd.h" 3 4 /* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */ #define _PC_MIN_HOLE_SIZE 21 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 166 "/usr/include/sys/unistd.h" 3 4 /* * rfork() options. * * XXX currently, some operations without RFPROC set are not supported. */ #define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */ #define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */ #define RFFDG (1<<2) /* copy fd table */ #define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */ #define RFPROC (1<<4) /* change child (else changes curproc) */ #define RFMEM (1<<5) /* share `address space' */ #define RFNOWAIT (1<<6) /* give child to init */ #define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */ #define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */ #define RFCFDG (1<<12) /* close all fds, zero fd table */ #define RFTHREAD (1<<13) /* enable kernel thread support */ #define RFSIGSHARE (1<<14) /* share signal handlers */ #define RFLINUXTHPN (1<<16) /* do linux clone exit parent notification */ #define RFSTOPPED (1<<17) /* leave child in a stopped state */ #define RFHIGHPID (1<<18) /* use a pid higher than 10 (idleproc) */ #define RFTSIGZMB (1<<19) /* select signal for exit parent notification */ #define RFTSIGSHIFT 20 /* selected signal number is in bits 20-27 */ #define RFTSIGMASK 0xFF #define RFTSIGNUM(flags) (((flags) >> RFTSIGSHIFT) & RFTSIGMASK) #define RFTSIGFLAGS(signum) ((signum) << RFTSIGSHIFT) #define RFPROCDESC (1<<28) /* return a process descriptor */ /* kernel: parent sleeps until child exits (vfork) */ #define RFPPWAIT (1<<31) /* user: vfork(2) semantics, clear signals */ #define RFSPAWN (1U<<31) #define RFFLAGS (RFFDG | RFPROC | RFMEM | RFNOWAIT | RFCFDG | \ RFTHREAD | RFSIGSHARE | RFLINUXTHPN | RFSTOPPED | RFHIGHPID | RFTSIGZMB | \ RFPROCDESC | RFSPAWN | RFPPWAIT) #define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPROCDESC) #define SWAPOFF_FORCE 0x00000001 /* * close_range() options. */ #define CLOSE_RANGE_CLOEXEC (1<<2) #endif /* __BSD_VISIBLE */ # 209 "/usr/include/sys/unistd.h" 3 4 #endif /* !_SYS_UNISTD_H_ */ # 211 "/usr/include/sys/unistd.h" 3 4 # 41 "/usr/include/unistd.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/unistd.h" 3 4 # 42 "/usr/include/unistd.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/usr/include/unistd.h" 3 4 # 43 "/usr/include/unistd.h" 3 4 #ifndef _GID_T_DECLARED typedef __gid_t gid_t; #define _GID_T_DECLARED #endif # 48 "/usr/include/unistd.h" 3 4 #ifndef _OFF_T_DECLARED typedef __off_t off_t; #define _OFF_T_DECLARED #endif # 53 "/usr/include/unistd.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif # 58 "/usr/include/unistd.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 63 "/usr/include/unistd.h" 3 4 #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif # 68 "/usr/include/unistd.h" 3 4 #ifndef _UID_T_DECLARED typedef __uid_t uid_t; #define _UID_T_DECLARED #endif # 73 "/usr/include/unistd.h" 3 4 #ifndef _USECONDS_T_DECLARED typedef __useconds_t useconds_t; #define _USECONDS_T_DECLARED #endif # 78 "/usr/include/unistd.h" 3 4 #define STDIN_FILENO 0 /* standard input file descriptor */ #define STDOUT_FILENO 1 /* standard output file descriptor */ #define STDERR_FILENO 2 /* standard error file descriptor */ #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 84 "/usr/include/unistd.h" 3 4 #define F_ULOCK 0 /* unlock locked section */ #define F_LOCK 1 /* lock a section for exclusive use */ #define F_TLOCK 2 /* test and lock a section for exclusive use */ #define F_TEST 3 /* test a section for locks by other procs */ #endif # 89 "/usr/include/unistd.h" 3 4 /* * POSIX options and option groups we unconditionally do or don't * implement. This list includes those options which are exclusively * implemented (or not) in user mode. Please keep this list in * alphabetical order. * * Anything which is defined as zero below **must** have an * implementation for the corresponding sysconf() which is able to * determine conclusively whether or not the feature is supported. * Anything which is defined as other than -1 below **must** have * complete headers, types, and function declarations as specified by * the POSIX standard; however, if the relevant sysconf() function * returns -1, the functions may be stubbed out. */ #define _POSIX_BARRIERS 200112L #define _POSIX_CPUTIME 200112L #define _POSIX_READER_WRITER_LOCKS 200112L #define _POSIX_REGEXP 1 #define _POSIX_SHELL 1 #define _POSIX_SPAWN 200112L #define _POSIX_SPIN_LOCKS 200112L #define _POSIX_THREAD_ATTR_STACKADDR 200112L #define _POSIX_THREAD_ATTR_STACKSIZE 200112L #define _POSIX_THREAD_CPUTIME 200112L #define _POSIX_THREAD_PRIO_INHERIT 200112L #define _POSIX_THREAD_PRIO_PROTECT 200112L #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L #define _POSIX_THREAD_PROCESS_SHARED 200112L #define _POSIX_THREAD_SAFE_FUNCTIONS -1 #define _POSIX_THREAD_SPORADIC_SERVER -1 #define _POSIX_THREADS 200112L #define _POSIX_TRACE -1 #define _POSIX_TRACE_EVENT_FILTER -1 #define _POSIX_TRACE_INHERIT -1 #define _POSIX_TRACE_LOG -1 #define _POSIX2_C_BIND 200112L /* mandatory */ #define _POSIX2_C_DEV -1 /* need c99 utility */ #define _POSIX2_CHAR_TERM 1 #define _POSIX2_FORT_DEV -1 /* need fort77 utility */ #define _POSIX2_FORT_RUN 200112L #define _POSIX2_LOCALEDEF -1 #define _POSIX2_PBS -1 #define _POSIX2_PBS_ACCOUNTING -1 #define _POSIX2_PBS_CHECKPOINT -1 #define _POSIX2_PBS_LOCATE -1 #define _POSIX2_PBS_MESSAGE -1 #define _POSIX2_PBS_TRACK -1 #define _POSIX2_SW_DEV -1 /* XXX ??? */ #define _POSIX2_UPE 200112L #define _V6_ILP32_OFF32 -1 #define _V6_ILP32_OFFBIG 0 #define _V6_LP64_OFF64 0 #define _V6_LPBIG_OFFBIG -1 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 145 "/usr/include/unistd.h" 3 4 #define _XOPEN_CRYPT -1 /* XXX ??? */ #define _XOPEN_ENH_I18N -1 /* mandatory in XSI */ #define _XOPEN_LEGACY -1 #define _XOPEN_REALTIME -1 #define _XOPEN_REALTIME_THREADS -1 #define _XOPEN_UNIX -1 #endif # 152 "/usr/include/unistd.h" 3 4 /* Define the POSIX.2 version we target for compliance. */ #define _POSIX2_VERSION 199212L /* * POSIX-style system configuration variable accessors (for the * sysconf function). The kernel does not directly implement the * sysconf() interface; rather, a C library stub translates references * to sysconf() into calls to sysctl() using a giant switch statement. * Those that are marked `user' are implemented entirely in the C * library and never query the kernel. pathconf() is implemented * directly by the kernel so those are not defined here. */ #define _SC_ARG_MAX 1 #define _SC_CHILD_MAX 2 #define _SC_CLK_TCK 3 #define _SC_NGROUPS_MAX 4 #define _SC_OPEN_MAX 5 #define _SC_JOB_CONTROL 6 #define _SC_SAVED_IDS 7 #define _SC_VERSION 8 #define _SC_BC_BASE_MAX 9 /* user */ #define _SC_BC_DIM_MAX 10 /* user */ #define _SC_BC_SCALE_MAX 11 /* user */ #define _SC_BC_STRING_MAX 12 /* user */ #define _SC_COLL_WEIGHTS_MAX 13 /* user */ #define _SC_EXPR_NEST_MAX 14 /* user */ #define _SC_LINE_MAX 15 /* user */ #define _SC_RE_DUP_MAX 16 /* user */ #define _SC_2_VERSION 17 /* user */ #define _SC_2_C_BIND 18 /* user */ #define _SC_2_C_DEV 19 /* user */ #define _SC_2_CHAR_TERM 20 /* user */ #define _SC_2_FORT_DEV 21 /* user */ #define _SC_2_FORT_RUN 22 /* user */ #define _SC_2_LOCALEDEF 23 /* user */ #define _SC_2_SW_DEV 24 /* user */ #define _SC_2_UPE 25 /* user */ #define _SC_STREAM_MAX 26 /* user */ #define _SC_TZNAME_MAX 27 /* user */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 194 "/usr/include/unistd.h" 3 4 #define _SC_ASYNCHRONOUS_IO 28 #define _SC_MAPPED_FILES 29 #define _SC_MEMLOCK 30 #define _SC_MEMLOCK_RANGE 31 #define _SC_MEMORY_PROTECTION 32 #define _SC_MESSAGE_PASSING 33 #define _SC_PRIORITIZED_IO 34 #define _SC_PRIORITY_SCHEDULING 35 #define _SC_REALTIME_SIGNALS 36 #define _SC_SEMAPHORES 37 #define _SC_FSYNC 38 #define _SC_SHARED_MEMORY_OBJECTS 39 #define _SC_SYNCHRONIZED_IO 40 #define _SC_TIMERS 41 #define _SC_AIO_LISTIO_MAX 42 #define _SC_AIO_MAX 43 #define _SC_AIO_PRIO_DELTA_MAX 44 #define _SC_DELAYTIMER_MAX 45 #define _SC_MQ_OPEN_MAX 46 #define _SC_PAGESIZE 47 #define _SC_RTSIG_MAX 48 #define _SC_SEM_NSEMS_MAX 49 #define _SC_SEM_VALUE_MAX 50 #define _SC_SIGQUEUE_MAX 51 #define _SC_TIMER_MAX 52 #endif # 220 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 222 "/usr/include/unistd.h" 3 4 #define _SC_2_PBS 59 /* user */ #define _SC_2_PBS_ACCOUNTING 60 /* user */ #define _SC_2_PBS_CHECKPOINT 61 /* user */ #define _SC_2_PBS_LOCATE 62 /* user */ #define _SC_2_PBS_MESSAGE 63 /* user */ #define _SC_2_PBS_TRACK 64 /* user */ #define _SC_ADVISORY_INFO 65 #define _SC_BARRIERS 66 /* user */ #define _SC_CLOCK_SELECTION 67 #define _SC_CPUTIME 68 #define _SC_FILE_LOCKING 69 #define _SC_GETGR_R_SIZE_MAX 70 /* user */ #define _SC_GETPW_R_SIZE_MAX 71 /* user */ #define _SC_HOST_NAME_MAX 72 #define _SC_LOGIN_NAME_MAX 73 #define _SC_MONOTONIC_CLOCK 74 #define _SC_MQ_PRIO_MAX 75 #define _SC_READER_WRITER_LOCKS 76 /* user */ #define _SC_REGEXP 77 /* user */ #define _SC_SHELL 78 /* user */ #define _SC_SPAWN 79 /* user */ #define _SC_SPIN_LOCKS 80 /* user */ #define _SC_SPORADIC_SERVER 81 #define _SC_THREAD_ATTR_STACKADDR 82 /* user */ #define _SC_THREAD_ATTR_STACKSIZE 83 /* user */ #define _SC_THREAD_CPUTIME 84 /* user */ #define _SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */ #define _SC_THREAD_KEYS_MAX 86 /* user */ #define _SC_THREAD_PRIO_INHERIT 87 /* user */ #define _SC_THREAD_PRIO_PROTECT 88 /* user */ #define _SC_THREAD_PRIORITY_SCHEDULING 89 /* user */ #define _SC_THREAD_PROCESS_SHARED 90 /* user */ #define _SC_THREAD_SAFE_FUNCTIONS 91 /* user */ #define _SC_THREAD_SPORADIC_SERVER 92 /* user */ #define _SC_THREAD_STACK_MIN 93 /* user */ #define _SC_THREAD_THREADS_MAX 94 /* user */ #define _SC_TIMEOUTS 95 /* user */ #define _SC_THREADS 96 /* user */ #define _SC_TRACE 97 /* user */ #define _SC_TRACE_EVENT_FILTER 98 /* user */ #define _SC_TRACE_INHERIT 99 /* user */ #define _SC_TRACE_LOG 100 /* user */ #define _SC_TTY_NAME_MAX 101 /* user */ #define _SC_TYPED_MEMORY_OBJECTS 102 #define _SC_V6_ILP32_OFF32 103 /* user */ #define _SC_V6_ILP32_OFFBIG 104 /* user */ #define _SC_V6_LP64_OFF64 105 /* user */ #define _SC_V6_LPBIG_OFFBIG 106 /* user */ #define _SC_IPV6 118 #define _SC_RAW_SOCKETS 119 #define _SC_SYMLOOP_MAX 120 #endif # 274 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 276 "/usr/include/unistd.h" 3 4 #define _SC_ATEXIT_MAX 107 /* user */ #define _SC_IOV_MAX 56 #define _SC_PAGE_SIZE _SC_PAGESIZE #define _SC_XOPEN_CRYPT 108 /* user */ #define _SC_XOPEN_ENH_I18N 109 /* user */ #define _SC_XOPEN_LEGACY 110 /* user */ #define _SC_XOPEN_REALTIME 111 #define _SC_XOPEN_REALTIME_THREADS 112 #define _SC_XOPEN_SHM 113 #define _SC_XOPEN_STREAMS 114 #define _SC_XOPEN_UNIX 115 #define _SC_XOPEN_VERSION 116 #define _SC_XOPEN_XCU_VERSION 117 /* user */ #endif # 290 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 292 "/usr/include/unistd.h" 3 4 #define _SC_NPROCESSORS_CONF 57 #define _SC_NPROCESSORS_ONLN 58 #define _SC_CPUSET_SIZE 122 #endif # 296 "/usr/include/unistd.h" 3 4 /* Extensions found in Solaris and Linux. */ #define _SC_PHYS_PAGES 121 /* Keys for the confstr(3) function. */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199209 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 302 "/usr/include/unistd.h" 3 4 #define _CS_PATH 1 /* default value of PATH */ #endif # 304 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 306 "/usr/include/unistd.h" 3 4 #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2 #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3 #define _CS_POSIX_V6_ILP32_OFF32_LIBS 4 #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5 #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6 #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7 #define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8 #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9 #define _CS_POSIX_V6_LP64_OFF64_LIBS 10 #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11 #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12 #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13 #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14 #endif # 320 "/usr/include/unistd.h" 3 4 __BEGIN_DECLS /* 1003.1-1990 */ void _exit(int) __dead2; int access(const char *, int); unsigned int alarm(unsigned int); int chdir(const char *); int chown(const char *, uid_t, gid_t); int close(int); void closefrom(int); int dup(int); int dup2(int, int); int execl(const char *, const char *, ...) __null_sentinel; int execle(const char *, const char *, ...); int execlp(const char *, const char *, ...) __null_sentinel; int execv(const char *, char * const *); int execve(const char *, char * const *, char * const *); int execvp(const char *, char * const *); pid_t fork(void); long fpathconf(int, int); char *getcwd(char *, size_t); gid_t getegid(void); uid_t geteuid(void); gid_t getgid(void); int getgroups(int, gid_t []); char *getlogin(void); pid_t getpgrp(void); pid_t getpid(void); pid_t getppid(void); uid_t getuid(void); int isatty(int); int link(const char *, const char *); #ifndef _LSEEK_DECLARED #define _LSEEK_DECLARED off_t lseek(int, off_t, int); #endif # 356 "/usr/include/unistd.h" 3 4 long pathconf(const char *, int); int pause(void); int pipe(int *); ssize_t read(int, void *, size_t); int rmdir(const char *); int setgid(gid_t); int setpgid(pid_t, pid_t); pid_t setsid(void); int setuid(uid_t); unsigned int sleep(unsigned int); long sysconf(int); pid_t tcgetpgrp(int); int tcsetpgrp(int, pid_t); char *ttyname(int); int ttyname_r(int, char *, size_t); int unlink(const char *); ssize_t write(int, const void *, size_t); /* 1003.2-1992 */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 376 "/usr/include/unistd.h" 3 4 size_t confstr(int, char *, size_t); #ifndef _GETOPT_DECLARED #define _GETOPT_DECLARED int getopt(int, char * const [], const char *); extern char *optarg; /* getopt(3) external variables */ extern int optind, opterr, optopt; #endif /* _GETOPT_DECLARED */ # 384 "/usr/include/unistd.h" 3 4 #endif # 385 "/usr/include/unistd.h" 3 4 /* ISO/IEC 9945-1: 1996 */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 388 "/usr/include/unistd.h" 3 4 int fsync(int); int fdatasync(int); /* * ftruncate() was in the POSIX Realtime Extension (it's used for shared * memory), but truncate() was not. */ #ifndef _FTRUNCATE_DECLARED #define _FTRUNCATE_DECLARED int ftruncate(int, off_t); #endif # 399 "/usr/include/unistd.h" 3 4 #endif # 400 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 402 "/usr/include/unistd.h" 3 4 int getlogin_r(char *, size_t); #endif # 404 "/usr/include/unistd.h" 3 4 /* 1003.1-2001 */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 407 "/usr/include/unistd.h" 3 4 int fchown(int, uid_t, gid_t); ssize_t readlink(const char * __restrict, char * __restrict, size_t); #endif # 410 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 411 "/usr/include/unistd.h" 3 4 int gethostname(char *, size_t); int setegid(gid_t); int seteuid(uid_t); #endif # 415 "/usr/include/unistd.h" 3 4 /* 1003.1-2008 */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 418 "/usr/include/unistd.h" 3 4 int getsid(pid_t _pid); int fchdir(int); int getpgid(pid_t _pid); int lchown(const char *, uid_t, gid_t); ssize_t pread(int, void *, size_t, off_t); ssize_t pwrite(int, const void *, size_t, off_t); /* See comment at ftruncate() above. */ #ifndef _TRUNCATE_DECLARED #define _TRUNCATE_DECLARED int truncate(const char *, off_t); #endif # 430 "/usr/include/unistd.h" 3 4 #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ # 431 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 433 "/usr/include/unistd.h" 3 4 int faccessat(int, const char *, int, int); int fchownat(int, const char *, uid_t, gid_t, int); int fexecve(int, char *const [], char *const []); int linkat(int, const char *, int, const char *, int); ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t); int symlinkat(const char *, int, const char *); int unlinkat(int, const char *, int); #endif /* __POSIX_VISIBLE >= 200809 */ # 441 "/usr/include/unistd.h" 3 4 /* * symlink() was originally in POSIX.1a, which was withdrawn after * being overtaken by events (1003.1-2001). It was in XPG4.2, and of * course has been in BSD since 4.2. */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 448 "/usr/include/unistd.h" 3 4 int symlink(const char * __restrict, const char * __restrict); #endif # 450 "/usr/include/unistd.h" 3 4 /* X/Open System Interfaces */ #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 453 "/usr/include/unistd.h" 3 4 char *crypt(const char *, const char *); long gethostid(void); int lockf(int, int, off_t); int nice(int); int setregid(gid_t, gid_t); int setreuid(uid_t, uid_t); #ifndef _SWAB_DECLARED #define _SWAB_DECLARED void swab(const void * __restrict, void * __restrict, ssize_t); #endif /* _SWAB_DECLARED */ # 464 "/usr/include/unistd.h" 3 4 void sync(void); #endif /* __XSI_VISIBLE */ # 468 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 470 "/usr/include/unistd.h" 3 4 int brk(const void *); int chroot(const char *); int getdtablesize(void); int getpagesize(void) __pure2; char *getpass(const char *); void *sbrk(intptr_t); #endif # 477 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if (__XSI_VISIBLE && __XSI_VISIBLE <= 600) || __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 479 "/usr/include/unistd.h" 3 4 char *getwd(char *); /* obsoleted by getcwd() */ useconds_t ualarm(useconds_t, useconds_t); int usleep(useconds_t); pid_t vfork(void) __returns_twice; #endif # 485 "/usr/include/unistd.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 487 "/usr/include/unistd.h" 3 4 struct timeval; /* select(2) */ struct crypt_data { int initialized; /* For compatibility with glibc. */ char __buf[256]; /* Buffer returned by crypt_r(). */ }; int acct(const char *); int async_daemon(void); int check_utility_compat(const char *); int close_range(unsigned int, unsigned int, int); ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned int); const char * crypt_get_format(void); char *crypt_r(const char *, const char *, struct crypt_data *); int crypt_set_format(const char *); int dup3(int, int, int); int eaccess(const char *, int); void endusershell(void); int exect(const char *, char * const *, char * const *); int execvP(const char *, const char *, char * const *); int feature_present(const char *); char *fflagstostr(u_long); int getdomainname(char *, int); int getentropy(void *, size_t); int getgrouplist(const char *, gid_t, gid_t *, int *); int getloginclass(char *, size_t); mode_t getmode(const void *, mode_t); int getosreldate(void); int getpeereid(int, uid_t *, gid_t *); int getresgid(gid_t *, gid_t *, gid_t *); int getresuid(uid_t *, uid_t *, uid_t *); char *getusershell(void); int initgroups(const char *, gid_t); int iruserok(unsigned long, int, const char *, const char *); int iruserok_sa(const void *, int, int, const char *, const char *); int issetugid(void); void __FreeBSD_libc_enter_restricted_mode(void); long lpathconf(const char *, int); #ifndef _MKDTEMP_DECLARED char *mkdtemp(char *); #define _MKDTEMP_DECLARED #endif # 530 "/usr/include/unistd.h" 3 4 #ifndef _MKNOD_DECLARED int mknod(const char *, mode_t, dev_t); #define _MKNOD_DECLARED #endif # 534 "/usr/include/unistd.h" 3 4 #ifndef _MKSTEMP_DECLARED int mkstemp(char *); #define _MKSTEMP_DECLARED #endif # 538 "/usr/include/unistd.h" 3 4 int mkstemps(char *, int); #ifndef _MKTEMP_DECLARED char *mktemp(char *); #define _MKTEMP_DECLARED #endif # 543 "/usr/include/unistd.h" 3 4 int nfssvc(int, void *); int nlm_syscall(int, int, int, char **); int pipe2(int *, int); int profil(char *, size_t, vm_offset_t, int); int rcmd(char **, int, const char *, const char *, const char *, int *); int rcmd_af(char **, int, const char *, const char *, const char *, int *, int); int rcmdsh(char **, int, const char *, const char *, const char *, const char *); char *re_comp(const char *); int re_exec(const char *); int reboot(int); int revoke(const char *); pid_t rfork(int) __returns_twice; pid_t rfork_thread(int, void *, int (*)(void *), void *); int rresvport(int *); int rresvport_af(int *, int); int ruserok(const char *, int, const char *, const char *); #ifndef _SELECT_DECLARED #define _SELECT_DECLARED int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); #endif # 565 "/usr/include/unistd.h" 3 4 int setdomainname(const char *, int); int setgroups(int, const gid_t *); void sethostid(long); int sethostname(const char *, int); int setlogin(const char *); int setloginclass(const char *); void *setmode(const char *); int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */ void setproctitle(const char *_fmt, ...) __printf0like(1, 2); void setproctitle_fast(const char *_fmt, ...) __printf0like(1, 2); int setresgid(gid_t, gid_t, gid_t); int setresuid(uid_t, uid_t, uid_t); int setrgid(gid_t); int setruid(uid_t); void setusershell(void); int strtofflags(char **, u_long *, u_long *); int swapon(const char *); int swapoff(const char *, u_int); int syscall(int, ...); off_t __syscall(quad_t, ...); int undelete(const char *); int unwhiteout(const char *); void *valloc(size_t); /* obsoleted by malloc() */ int funlinkat(int, const char *, int, int); pid_t _Fork(void); #ifndef _OPTRESET_DECLARED #define _OPTRESET_DECLARED extern int optreset; /* getopt(3) external variable */ #endif # 595 "/usr/include/unistd.h" 3 4 #endif /* __BSD_VISIBLE */ # 596 "/usr/include/unistd.h" 3 4 __END_DECLS #endif /* !_UNISTD_H_ */ # 599 "/usr/include/unistd.h" 3 4 # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" 2 #endif # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #endif # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* disabled by -frewrite-includes */ #if (defined(__linux__) || defined(__FreeBSD__)) && defined(__has_feature) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(modules) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 51 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(__arm__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include // for off_t (to match Glibc.modulemap) #endif /* expanded by -frewrite-includes */ # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 53 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #endif # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #endif # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #endif # 56 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #define DISPATCH_API_VERSION 20180109 #ifndef __DISPATCH_BUILDING_DISPATCH__ #ifndef __DISPATCH_INDIRECT__ #define __DISPATCH_INDIRECT__ #endif # 63 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 67 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 67 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 70 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 70 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 72 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 72 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 75 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 75 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 76 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #undef __DISPATCH_INDIRECT__ #endif /* !__DISPATCH_BUILDING_DISPATCH__ */ # 79 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" #endif # 81 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/dispatch.h" # 95 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 95 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" 1 /* * Copyright (c) 2008-2012 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_BASE__ #define __DISPATCH_BASE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #endif # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef __has_builtin #define __has_builtin(x) 0 #endif # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef __has_include #define __has_include(x) 0 #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef __has_feature #define __has_feature(x) 0 #endif # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef __has_attribute #define __has_attribute(x) 0 #endif # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef __has_extension #define __has_extension(x) 0 #endif # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_NORETURN __attribute__((__noreturn__)) #define DISPATCH_NOTHROW __attribute__((__nothrow__)) #define DISPATCH_NONNULL1 __attribute__((__nonnull__(1))) #define DISPATCH_NONNULL2 __attribute__((__nonnull__(2))) #define DISPATCH_NONNULL3 __attribute__((__nonnull__(3))) #define DISPATCH_NONNULL4 __attribute__((__nonnull__(4))) #define DISPATCH_NONNULL5 __attribute__((__nonnull__(5))) #define DISPATCH_NONNULL6 __attribute__((__nonnull__(6))) #define DISPATCH_NONNULL7 __attribute__((__nonnull__(7))) #if 0 /* disabled by -frewrite-includes */ #if __clang__ && __clang_major__ < 3 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" // rdar://problem/6857843 #define DISPATCH_NONNULL_ALL #else # 58 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_NONNULL_ALL __attribute__((__nonnull__)) #endif # 60 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SENTINEL __attribute__((__sentinel__)) #define DISPATCH_PURE __attribute__((__pure__)) #define DISPATCH_CONST __attribute__((__const__)) #define DISPATCH_WARN_RESULT __attribute__((__warn_unused_result__)) #define DISPATCH_MALLOC __attribute__((__malloc__)) #define DISPATCH_ALWAYS_INLINE __attribute__((__always_inline__)) #define DISPATCH_UNAVAILABLE __attribute__((__unavailable__)) #define DISPATCH_UNAVAILABLE_MSG(msg) __attribute__((__unavailable__(msg))) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_MSC_VER) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_NORETURN __declspec(noreturn) #define DISPATCH_NOTHROW __declspec(nothrow) #define DISPATCH_NONNULL1 #define DISPATCH_NONNULL2 #define DISPATCH_NONNULL3 #define DISPATCH_NONNULL4 #define DISPATCH_NONNULL5 #define DISPATCH_NONNULL6 #define DISPATCH_NONNULL7 #define DISPATCH_NONNULL_ALL #define DISPATCH_SENTINEL #define DISPATCH_PURE #define DISPATCH_CONST #if 0 /* disabled by -frewrite-includes */ #if (_MSC_VER >= 1700) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 83 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_WARN_RESULT _Check_return_ #else # 85 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_WARN_RESULT #endif # 87 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_MALLOC #define DISPATCH_ALWAYS_INLINE __forceinline #define DISPATCH_UNAVAILABLE #define DISPATCH_UNAVAILABLE_MSG(msg) #else # 92 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" /*! @parseOnly */ #define DISPATCH_NORETURN /*! @parseOnly */ #define DISPATCH_NOTHROW /*! @parseOnly */ #define DISPATCH_NONNULL1 /*! @parseOnly */ #define DISPATCH_NONNULL2 /*! @parseOnly */ #define DISPATCH_NONNULL3 /*! @parseOnly */ #define DISPATCH_NONNULL4 /*! @parseOnly */ #define DISPATCH_NONNULL5 /*! @parseOnly */ #define DISPATCH_NONNULL6 /*! @parseOnly */ #define DISPATCH_NONNULL7 /*! @parseOnly */ #define DISPATCH_NONNULL_ALL /*! @parseOnly */ #define DISPATCH_SENTINEL /*! @parseOnly */ #define DISPATCH_PURE /*! @parseOnly */ #define DISPATCH_CONST /*! @parseOnly */ #define DISPATCH_WARN_RESULT /*! @parseOnly */ #define DISPATCH_MALLOC /*! @parseOnly */ #define DISPATCH_ALWAYS_INLINE /*! @parseOnly */ #define DISPATCH_UNAVAILABLE /*! @parseOnly */ #define DISPATCH_UNAVAILABLE_MSG(msg) #endif # 129 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 131 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ # if __cplusplus >= 201703L #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 132 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH [[fallthrough]] #if 0 /* disabled by -frewrite-includes */ #if 0 # elif __cplusplus >= 201103L #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 134 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ # if defined(__clang__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 135 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH [[clang::fallthrough]] #if 0 /* disabled by -frewrite-includes */ #if 0 # elif defined(__GNUC__) && __GNUC__ >= 7 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 137 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH [[gnu::fallthrough]] # else # 139 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH # endif # 141 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # else # 142 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH # endif # 144 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__GNUC__) && __GNUC__ >= 7 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 145 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH __attribute__((__fallthrough__)) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__clang__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 147 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ # if __has_attribute(fallthrough) && __clang_major__ >= 5 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 148 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH __attribute__((__fallthrough__)) # else # 150 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH # endif # 152 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #else # 153 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # define DISPATCH_FALLTHROUGH #endif # 155 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifdef __linux__ #define DISPATCH_LINUX_UNAVAILABLE() \ DISPATCH_UNAVAILABLE_MSG( \ "This interface is unavailable on linux systems") #else # 162 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_LINUX_UNAVAILABLE() #endif # 164 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifdef __FreeBSD__ #define DISPATCH_FREEBSD_UNAVAILABLE() \ DISPATCH_UNAVAILABLE_MSG( \ "This interface is unavailable on FreeBSD systems") #else # 170 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_FREEBSD_UNAVAILABLE() #endif # 172 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef DISPATCH_ALIAS_V2 #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 175 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_ALIAS_V2(sym) __asm__("_" #sym "$V2") #else # 177 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_ALIAS_V2(sym) #endif # 179 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #endif # 180 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 182 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__DISPATCH_BUILDING_DISPATCH__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 183 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 184 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_EXPORT extern "C" __declspec(dllexport) #else # 186 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_EXPORT extern __declspec(dllexport) #endif # 188 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #else # 189 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 190 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_EXPORT extern "C" __declspec(dllimport) #else # 192 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_EXPORT extern __declspec(dllimport) #endif # 194 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #endif # 195 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __GNUC__ #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 196 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_EXPORT extern __attribute__((visibility("default"))) #else # 198 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_EXPORT extern #endif # 200 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 202 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_INLINE static __inline__ #else # 204 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_INLINE static inline #endif # 206 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 208 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_EXPECT(x, v) __builtin_expect((x), (v)) #define dispatch_compiler_barrier() __asm__ __volatile__("" ::: "memory") #else # 211 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_EXPECT(x, v) (x) #define dispatch_compiler_barrier() do { } while (0) #endif # 214 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(not_tail_called) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 216 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_NOT_TAIL_CALLED __attribute__((__not_tail_called__)) #else # 218 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_NOT_TAIL_CALLED #endif # 220 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_builtin(__builtin_assume) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 222 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_COMPILER_CAN_ASSUME(expr) __builtin_assume(expr) #else # 224 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_COMPILER_CAN_ASSUME(expr) ((void)(expr)) #endif # 226 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(noescape) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 228 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_NOESCAPE __attribute__((__noescape__)) #else # 230 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_NOESCAPE #endif # 232 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(cold) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 234 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_COLD __attribute__((__cold__)) #else # 236 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_COLD #endif # 238 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(assume_nonnull) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 240 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") #define DISPATCH_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") #else # 243 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_ASSUME_NONNULL_BEGIN #define DISPATCH_ASSUME_NONNULL_END #endif # 246 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if !__has_feature(nullability) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 248 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef _Nullable #define _Nullable #endif # 251 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef _Nonnull #define _Nonnull #endif # 254 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef _Null_unspecified #define _Null_unspecified #endif # 257 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #endif # 258 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef DISPATCH_RETURNS_RETAINED_BLOCK #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(ns_returns_retained) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 261 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_RETURNS_RETAINED_BLOCK __attribute__((__ns_returns_retained__)) #else # 263 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_RETURNS_RETAINED_BLOCK #endif # 265 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #endif # 266 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums) || defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 268 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_ENUM(name, type, ...) \ typedef enum : type { __VA_ARGS__ } name##_t #else # 271 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_ENUM(name, type, ...) \ enum { __VA_ARGS__ }; typedef type name##_t #endif # 274 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(enumerator_attributes) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 276 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_ENUM_API_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__) #define DISPATCH_ENUM_API_DEPRECATED(...) API_DEPRECATED(__VA_ARGS__) #define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...) \ API_DEPRECATED_WITH_REPLACEMENT(__VA_ARGS__) #else # 281 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_ENUM_API_AVAILABLE(...) #define DISPATCH_ENUM_API_DEPRECATED(...) #define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...) #endif # 285 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if defined(SWIFT_SDK_OVERLAY_DISPATCH_EPOCH) && \ SWIFT_SDK_OVERLAY_DISPATCH_EPOCH >= 2 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 288 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SWIFT3_OVERLAY 1 #else # 290 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SWIFT3_OVERLAY 0 #endif // SWIFT_SDK_OVERLAY_DISPATCH_EPOCH >= 2 # 292 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(attribute_availability_swift) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 294 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SWIFT_UNAVAILABLE(_msg) \ __attribute__((__availability__(swift, unavailable, message=_msg))) #else # 297 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SWIFT_UNAVAILABLE(_msg) #endif # 299 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_SWIFT3_OVERLAY #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 301 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SWIFT3_UNAVAILABLE(_msg) DISPATCH_SWIFT_UNAVAILABLE(_msg) #else # 303 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SWIFT3_UNAVAILABLE(_msg) #endif # 305 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(swift_private) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 307 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_REFINED_FOR_SWIFT __attribute__((__swift_private__)) #else # 309 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_REFINED_FOR_SWIFT #endif # 311 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(swift_name) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 313 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SWIFT_NAME(_name) __attribute__((__swift_name__(#_name))) #else # 315 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_SWIFT_NAME(_name) #endif # 317 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #ifndef __cplusplus #define DISPATCH_TRANSPARENT_UNION __attribute__((__transparent_union__)) #else # 321 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" #define DISPATCH_TRANSPARENT_UNION #endif # 323 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" typedef void (*dispatch_function_t)(void *_Nullable); #endif # 327 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/base.h" # 96 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #define __DISPATCH_HIDE_SYMBOL(sym, version) \ __asm__(".section __TEXT,__const\n\t" \ ".globl $ld$hide$os" #version "$_" #sym "\n\t" \ "$ld$hide$os" #version "$_" #sym ":\n\t" \ " .byte 0\n\t" \ ".previous") #ifndef DISPATCH_HIDE_SYMBOL #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC && !TARGET_OS_IPHONE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 107 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_HIDE_SYMBOL(sym, osx, ios, tvos, watchos) \ __DISPATCH_HIDE_SYMBOL(sym, osx) #else # 110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_HIDE_SYMBOL(sym, osx, ios, tvos, watchos) #endif # 112 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 113 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_STATIC_GLOBAL #define DISPATCH_STATIC_GLOBAL(declaration) static declaration #endif # 117 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_GLOBAL #define DISPATCH_GLOBAL(declaration) declaration #endif # 120 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_GLOBAL_INIT #define DISPATCH_GLOBAL_INIT(declaration, ...) declaration = __VA_ARGS__ #endif # 123 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__OBJC__) || defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 125 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_PURE_C 0 #else # 127 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_PURE_C 1 #endif # 129 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifdef __OBJC__ @protocol OS_dispatch_queue; #endif # 133 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" // Lane cluster class: type for all the queues that have a single head/tail pair typedef union { struct dispatch_lane_s *_dl; struct dispatch_queue_static_s *_dsq; struct dispatch_queue_global_s *_dgq; struct dispatch_queue_pthread_root_s *_dpq; struct dispatch_source_s *_ds; struct dispatch_mach_s *_dm; #ifdef __OBJC__ id _objc_dq; // unsafe cast for the sake of object.m #endif # 145 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" } dispatch_lane_class_t DISPATCH_TRANSPARENT_UNION; // Dispatch queue cluster class: type for any dispatch_queue_t typedef union { struct dispatch_queue_s *_dq; struct dispatch_workloop_s *_dwl; struct dispatch_lane_s *_dl; struct dispatch_queue_static_s *_dsq; struct dispatch_queue_global_s *_dgq; struct dispatch_queue_pthread_root_s *_dpq; struct dispatch_source_s *_ds; struct dispatch_mach_s *_dm; dispatch_lane_class_t _dlu; #ifdef __OBJC__ id _objc_dq; #endif # 161 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" } dispatch_queue_class_t DISPATCH_TRANSPARENT_UNION; #ifndef __OBJC__ typedef union { struct _os_object_s *_os_obj; struct dispatch_object_s *_do; struct dispatch_queue_s *_dq; struct dispatch_queue_attr_s *_dqa; struct dispatch_group_s *_dg; struct dispatch_source_s *_ds; struct dispatch_mach_s *_dm; struct dispatch_mach_msg_s *_dmsg; struct dispatch_semaphore_s *_dsema; struct dispatch_data_s *_ddata; struct dispatch_io_s *_dchannel; struct dispatch_continuation_s *_dc; struct dispatch_sync_context_s *_dsc; struct dispatch_operation_s *_doperation; struct dispatch_disk_s *_ddisk; struct dispatch_workloop_s *_dwl; struct dispatch_lane_s *_dl; struct dispatch_queue_static_s *_dsq; struct dispatch_queue_global_s *_dgq; struct dispatch_queue_pthread_root_s *_dpq; dispatch_queue_class_t _dqu; dispatch_lane_class_t _dlu; uintptr_t _do_value; } dispatch_object_t DISPATCH_TRANSPARENT_UNION; DISPATCH_ALWAYS_INLINE static inline dispatch_object_t upcast(dispatch_object_t dou) { return dou; } #endif // __OBJC__ # 198 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 199 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" 1 /* * Copyright (c) 2011-2014 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __OS_OBJECT__ #define __OS_OBJECT__ #ifdef __APPLE__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # 29 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__unix__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" /*! * @header * * @preprocinfo * By default, libSystem objects such as GCD and XPC objects are declared as * Objective-C types when building with an Objective-C compiler. This allows * them to participate in ARC, in RR management by the Blocks runtime and in * leaks checking by the static analyzer, and enables them to be added to Cocoa * collections. * * NOTE: this requires explicit cancellation of dispatch sources and xpc * connections whose handler blocks capture the source/connection object, * resp. ensuring that such captures do not form retain cycles (e.g. by * declaring the source as __weak). * * To opt-out of this default behavior, add -DOS_OBJECT_USE_OBJC=0 to your * compiler flags. * * This mode requires a platform with the modern Objective-C runtime, the * Objective-C GC compiler option to be disabled, and at least a Mac OS X 10.8 * or iOS 6.0 deployment target. */ #ifndef OS_OBJECT_HAVE_OBJC_SUPPORT #if 0 /* disabled by -frewrite-includes */ #if !defined(__OBJC__) || defined(__OBJC_GC__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 60 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif !defined(TARGET_OS_MAC) || !TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif TARGET_OS_MAC && !TARGET_OS_IPHONE #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ # if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 67 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 #if 0 /* disabled by -frewrite-includes */ #if 0 # elif defined(__i386__) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 # else # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # define OS_OBJECT_HAVE_OBJC_SUPPORT 1 # endif # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #else # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # define OS_OBJECT_HAVE_OBJC_SUPPORT 1 #endif # 76 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #endif // OS_OBJECT_HAVE_OBJC_SUPPORT # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC_SUPPORT #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 79 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__swift__) && __swift__ && !OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 80 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_USE_OBJC 1 #endif # 82 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #ifndef OS_OBJECT_USE_OBJC #define OS_OBJECT_USE_OBJC 1 #endif # 85 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(OS_OBJECT_USE_OBJC) && OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 86 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" /* Unsupported platform for OS_OBJECT_USE_OBJC=1 */ #undef OS_OBJECT_USE_OBJC #define OS_OBJECT_USE_OBJC 0 #else # 90 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_USE_OBJC 0 #endif # 92 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #ifndef OS_OBJECT_SWIFT3 #if 0 /* disabled by -frewrite-includes */ #if defined(SWIFT_SDK_OVERLAY_DISPATCH_EPOCH) && \ SWIFT_SDK_OVERLAY_DISPATCH_EPOCH >= 2 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 96 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_SWIFT3 1 #else # 98 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_SWIFT3 0 #endif // SWIFT_SDK_OVERLAY_DISPATCH_EPOCH >= 2 # 100 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #endif // OS_OBJECT_SWIFT3 # 101 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 103 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* expanded by -frewrite-includes */ #import #endif /* expanded by -frewrite-includes */ # 103 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # 104 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(objc_independent_class) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 105 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJC_INDEPENDENT_CLASS __attribute__((objc_independent_class)) #endif // __has_attribute(objc_independent_class) # 107 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #ifndef OS_OBJC_INDEPENDENT_CLASS #define OS_OBJC_INDEPENDENT_CLASS #endif # 110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_CLASS(name) OS_##name #define OS_OBJECT_DECL_PROTOCOL(name, ...) \ @protocol OS_OBJECT_CLASS(name) __VA_ARGS__ \ @end #define OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL_IMPL(name, proto) \ @interface name () \ @end #define OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, proto) \ OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL_IMPL( \ OS_OBJECT_CLASS(name), OS_OBJECT_CLASS(proto)) #define OS_OBJECT_DECL_IMPL(name, ...) \ OS_OBJECT_DECL_PROTOCOL(name, __VA_ARGS__) \ typedef NSObject \ * OS_OBJC_INDEPENDENT_CLASS name##_t #define OS_OBJECT_DECL_BASE(name, ...) \ @interface OS_OBJECT_CLASS(name) : __VA_ARGS__ \ - (instancetype)init OS_SWIFT_UNAVAILABLE("Unavailable in Swift"); \ @end #define OS_OBJECT_DECL_IMPL_CLASS(name, ...) \ OS_OBJECT_DECL_BASE(name, ## __VA_ARGS__) \ typedef OS_OBJECT_CLASS(name) \ * OS_OBJC_INDEPENDENT_CLASS name##_t #define OS_OBJECT_DECL(name, ...) \ OS_OBJECT_DECL_IMPL(name, ) #define OS_OBJECT_DECL_SUBCLASS(name, super) \ OS_OBJECT_DECL_IMPL(name, ) #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(ns_returns_retained) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 137 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_RETURNS_RETAINED __attribute__((__ns_returns_retained__)) #else # 139 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_RETURNS_RETAINED #endif # 141 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(ns_consumed) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 142 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_CONSUMED __attribute__((__ns_consumed__)) #else # 144 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_CONSUMED #endif # 146 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(objc_arc) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 147 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_BRIDGE __bridge #define OS_WARN_RESULT_NEEDS_RELEASE #else # 150 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_BRIDGE #define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT #endif # 153 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(objc_runtime_visible) && \ ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12) || \ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \ !defined(__TV_OS_VERSION_MIN_REQUIRED) && \ !defined(__WATCH_OS_VERSION_MIN_REQUIRED) && \ __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0) || \ (defined(__TV_OS_VERSION_MIN_REQUIRED) && \ __TV_OS_VERSION_MIN_REQUIRED < __TVOS_10_0) || \ (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && \ __WATCH_OS_VERSION_MIN_REQUIRED < __WATCHOS_3_0)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 164 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" /* * To provide backward deployment of ObjC objects in Swift on pre-10.12 * SDKs, OS_object classes can be marked as OS_OBJECT_OBJC_RUNTIME_VISIBLE. * When compiling with a deployment target earlier than OS X 10.12 (iOS 10.0, * tvOS 10.0, watchOS 3.0) the Swift compiler will only refer to this type at * runtime (using the ObjC runtime). */ #define OS_OBJECT_OBJC_RUNTIME_VISIBLE __attribute__((objc_runtime_visible)) #else # 173 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_OBJC_RUNTIME_VISIBLE #endif # 175 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #ifndef OS_OBJECT_USE_OBJC_RETAIN_RELEASE #if 0 /* disabled by -frewrite-includes */ #if defined(__clang_analyzer__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 177 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 1 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __has_feature(objc_arc) && !OS_OBJECT_SWIFT3 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 179 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 1 #else # 181 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0 #endif # 183 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #endif # 184 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_SWIFT3 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 185 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_DECL_SWIFT(name) \ OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ OS_OBJECT_DECL_IMPL_CLASS(name, NSObject) #define OS_OBJECT_DECL_SUBCLASS_SWIFT(name, super) \ OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ OS_OBJECT_DECL_IMPL_CLASS(name, OS_OBJECT_CLASS(super)) OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE OS_OBJECT_DECL_BASE(object, NSObject); #endif // OS_OBJECT_SWIFT3 # 194 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #else # 195 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" /*! @parseOnly */ #define OS_OBJECT_RETURNS_RETAINED /*! @parseOnly */ #define OS_OBJECT_CONSUMED /*! @parseOnly */ #define OS_OBJECT_BRIDGE /*! @parseOnly */ #define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT /*! @parseOnly */ #define OS_OBJECT_OBJC_RUNTIME_VISIBLE #define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0 #endif # 207 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_SWIFT3 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 209 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_DECL_CLASS(name) \ OS_OBJECT_DECL_SUBCLASS_SWIFT(name, object) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 212 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_DECL_CLASS(name) \ OS_OBJECT_DECL(name) #else # 215 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_DECL_CLASS(name) \ typedef struct name##_s *name##_t #endif # 218 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #define OS_OBJECT_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object)) __BEGIN_DECLS /*! * @function os_retain * * @abstract * Increment the reference count of an os_object. * * @discussion * On a platform with the modern Objective-C runtime this is exactly equivalent * to sending the object the -[retain] message. * * @param object * The object to retain. * * @result * The retained object. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_EXPORT OS_SWIFT_UNAVAILABLE("Can't be used with ARC") void* os_retain(void *object); #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 244 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #undef os_retain #define os_retain(object) [object retain] #endif # 247 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" /*! * @function os_release * * @abstract * Decrement the reference count of a os_object. * * @discussion * On a platform with the modern Objective-C runtime this is exactly equivalent * to sending the object the -[release] message. * * @param object * The object to release. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_EXPORT void OS_SWIFT_UNAVAILABLE("Can't be used with ARC") os_release(void *object); #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 266 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" #undef os_release #define os_release(object) [object release] #endif # 269 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" __END_DECLS #endif # 273 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object.h" # 200 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 200 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" 1 /* * Copyright (c) 2008-2011 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_TIME__ #define __DISPATCH_TIME__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 29 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" // #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" #endif # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" DISPATCH_ASSUME_NONNULL_BEGIN #ifdef NSEC_PER_SEC #undef NSEC_PER_SEC #endif # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" #ifdef USEC_PER_SEC #undef USEC_PER_SEC #endif # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" #ifdef NSEC_PER_USEC #undef NSEC_PER_USEC #endif # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" #ifdef NSEC_PER_MSEC #undef NSEC_PER_MSEC #endif # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" #define NSEC_PER_SEC 1000000000ull #define NSEC_PER_MSEC 1000000ull #define USEC_PER_SEC 1000000ull #define NSEC_PER_USEC 1000ull __BEGIN_DECLS struct timespec; /*! * @typedef dispatch_time_t * * @abstract * A somewhat abstract representation of time; where zero means "now" and * DISPATCH_TIME_FOREVER means "infinity" and every value in between is an * opaque encoding. */ typedef uint64_t dispatch_time_t; enum { DISPATCH_WALLTIME_NOW DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = ~1ull, }; #define DISPATCH_TIME_NOW (0ull) #define DISPATCH_TIME_FOREVER (~0ull) /*! * @function dispatch_time * * @abstract * Create a dispatch_time_t relative to the current value of the default or * wall time clock, or modify an existing dispatch_time_t. * * @discussion * On Apple platforms, the default clock is based on mach_absolute_time(). * * @param when * An optional dispatch_time_t to add nanoseconds to. If DISPATCH_TIME_NOW is * passed, then dispatch_time() will use the default clock (which is based on * mach_absolute_time() on Apple platforms). If DISPATCH_WALLTIME_NOW is used, * dispatch_time() will use the value returned by gettimeofday(3). * dispatch_time(DISPATCH_WALLTIME_NOW, delta) is equivalent to * dispatch_walltime(NULL, delta). * * @param delta * Nanoseconds to add. * * @result * A new dispatch_time_t. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_time_t dispatch_time(dispatch_time_t when, int64_t delta); /*! * @function dispatch_walltime * * @abstract * Create a dispatch_time_t using the wall clock. * * @discussion * On Mac OS X the wall clock is based on gettimeofday(3). * * @param when * A struct timespec to add time to. If NULL is passed, then * dispatch_walltime() will use the result of gettimeofday(3). * dispatch_walltime(NULL, delta) returns the same value as * dispatch_time(DISPATCH_WALLTIME_NOW, delta). * * @param delta * Nanoseconds to add. * * @result * A new dispatch_time_t. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_time_t dispatch_walltime(const struct timespec *_Nullable when, int64_t delta); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 136 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/time.h" # 201 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 201 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" 1 /* * Copyright (c) 2008-2012 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_OBJECT__ #define __DISPATCH_OBJECT__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" DISPATCH_ASSUME_NONNULL_BEGIN /*! * @typedef dispatch_object_t * * @abstract * Abstract base type for all dispatch objects. * The details of the type definition are language-specific. * * @discussion * Dispatch objects are reference counted via calls to dispatch_retain() and * dispatch_release(). */ #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" /* * By default, dispatch objects are declared as Objective-C types when building * with an Objective-C compiler. This allows them to participate in ARC, in RR * management by the Blocks runtime and in leaks checking by the static * analyzer, and enables them to be added to Cocoa collections. * See for details. */ OS_OBJECT_DECL_CLASS(dispatch_object); #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_SWIFT3 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define DISPATCH_DECL(name) OS_OBJECT_DECL_SUBCLASS_SWIFT(name, dispatch_object) #define DISPATCH_DECL_SUBCLASS(name, base) OS_OBJECT_DECL_SUBCLASS_SWIFT(name, base) #else // OS_OBJECT_SWIFT3 # 57 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define DISPATCH_DECL(name) OS_OBJECT_DECL_SUBCLASS(name, dispatch_object) #define DISPATCH_DECL_SUBCLASS(name, base) OS_OBJECT_DECL_SUBCLASS(name, base) DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void _dispatch_object_validate(dispatch_object_t object) { void *isa = *(void *volatile*)(OS_OBJECT_BRIDGE void*)object; (void)isa; } #endif // OS_OBJECT_SWIFT3 # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define DISPATCH_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object)) #define DISPATCH_RETURNS_RETAINED OS_OBJECT_RETURNS_RETAINED #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__cplusplus) && !defined(__DISPATCH_BUILDING_DISPATCH__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 72 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" /* * Dispatch objects are NOT C++ objects. Nevertheless, we can at least keep C++ * aware of type compatibility. */ typedef struct dispatch_object_s { private: dispatch_object_s(); ~dispatch_object_s(); dispatch_object_s(const dispatch_object_s &); void operator=(const dispatch_object_s &); } *dispatch_object_t; #define DISPATCH_DECL(name) \ typedef struct name##_s : public dispatch_object_s {} *name##_t #define DISPATCH_DECL_SUBCLASS(name, base) \ typedef struct name##_s : public base##_s {} *name##_t #define DISPATCH_GLOBAL_OBJECT(type, object) (static_cast(&(object))) #define DISPATCH_RETURNS_RETAINED #else /* Plain C */ # 90 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #ifndef __DISPATCH_BUILDING_DISPATCH__ typedef union { struct _os_object_s *_os_obj; struct dispatch_object_s *_do; struct dispatch_queue_s *_dq; struct dispatch_queue_attr_s *_dqa; struct dispatch_group_s *_dg; struct dispatch_source_s *_ds; struct dispatch_mach_s *_dm; struct dispatch_mach_msg_s *_dmsg; struct dispatch_semaphore_s *_dsema; struct dispatch_data_s *_ddata; struct dispatch_io_s *_dchannel; } dispatch_object_t DISPATCH_TRANSPARENT_UNION; #endif // !__DISPATCH_BUILDING_DISPATCH__ # 105 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define DISPATCH_DECL(name) typedef struct name##_s *name##_t #define DISPATCH_DECL_SUBCLASS(name, base) typedef base##_t name##_t #define DISPATCH_GLOBAL_OBJECT(type, object) ((type)&(object)) #define DISPATCH_RETURNS_RETAINED #endif # 110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_SWIFT3 && OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 112 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define DISPATCH_SOURCE_TYPE_DECL(name) \ DISPATCH_EXPORT struct dispatch_source_type_s \ _dispatch_source_type_##name; \ OS_OBJECT_DECL_PROTOCOL(dispatch_source_##name, ); \ OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL( \ dispatch_source, dispatch_source_##name) #define DISPATCH_SOURCE_DECL(name) \ DISPATCH_DECL(name); \ OS_OBJECT_DECL_PROTOCOL(name, ); \ OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, name) #ifndef DISPATCH_DATA_DECL #define DISPATCH_DATA_DECL(name) OS_OBJECT_DECL_SWIFT(name) #endif // DISPATCH_DATA_DECL # 125 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #else # 126 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define DISPATCH_SOURCE_DECL(name) \ DISPATCH_DECL(name); #define DISPATCH_DATA_DECL(name) DISPATCH_DECL(name) #define DISPATCH_SOURCE_TYPE_DECL(name) \ DISPATCH_EXPORT const struct dispatch_source_type_s \ _dispatch_source_type_##name #endif # 133 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #ifdef __BLOCKS__ /*! * @typedef dispatch_block_t * * @abstract * The type of blocks submitted to dispatch queues, which take no arguments * and have no return value. * * @discussion * When not building with Objective-C ARC, a block object allocated on or * copied to the heap must be released with a -[release] message or the * Block_release() function. * * The declaration of a block literal allocates storage on the stack. * Therefore, this is an invalid construct: * * dispatch_block_t block; * if (x) { * block = ^{ printf("true\n"); }; * } else { * block = ^{ printf("false\n"); }; * } * block(); // unsafe!!! * * * What is happening behind the scenes: * * if (x) { * struct Block __tmp_1 = ...; // setup details * block = &__tmp_1; * } else { * struct Block __tmp_2 = ...; // setup details * block = &__tmp_2; * } * * * As the example demonstrates, the address of a stack variable is escaping the * scope in which it is allocated. That is a classic C bug. * * Instead, the block literal must be copied to the heap with the Block_copy() * function or by sending it a -[copy] message. */ typedef void (^dispatch_block_t)(void); #endif // __BLOCKS__ # 178 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" __BEGIN_DECLS /*! * @function dispatch_retain * * @abstract * Increment the reference count of a dispatch object. * * @discussion * Calls to dispatch_retain() must be balanced with calls to * dispatch_release(). * * @param object * The object to retain. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW DISPATCH_SWIFT_UNAVAILABLE("Can't be used with ARC") void dispatch_retain(dispatch_object_t object); #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_USE_OBJC_RETAIN_RELEASE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 201 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #undef dispatch_retain #define dispatch_retain(object) \ __extension__({ dispatch_object_t _o = (object); \ _dispatch_object_validate(_o); (void)[_o retain]; }) #endif # 206 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" /*! * @function dispatch_release * * @abstract * Decrement the reference count of a dispatch object. * * @discussion * A dispatch object is asynchronously deallocated once all references are * released (i.e. the reference count becomes zero). The system does not * guarantee that a given client is the last or only reference to a given * object. * * @param object * The object to release. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW DISPATCH_SWIFT_UNAVAILABLE("Can't be used with ARC") void dispatch_release(dispatch_object_t object); #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_USE_OBJC_RETAIN_RELEASE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 229 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #undef dispatch_release #define dispatch_release(object) \ __extension__({ dispatch_object_t _o = (object); \ _dispatch_object_validate(_o); [_o release]; }) #endif # 234 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" /*! * @function dispatch_get_context * * @abstract * Returns the application defined context of the object. * * @param object * The result of passing NULL in this parameter is undefined. * * @result * The context of the object; may be NULL. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW void *_Nullable dispatch_get_context(dispatch_object_t object); /*! * @function dispatch_set_context * * @abstract * Associates an application defined context with the object. * * @param object * The result of passing NULL in this parameter is undefined. * * @param context * The new client defined context for the object. This may be NULL. * */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_set_context(dispatch_object_t object, void *_Nullable context); /*! * @function dispatch_set_finalizer_f * * @abstract * Set the finalizer function for a dispatch object. * * @param object * The dispatch object to modify. * The result of passing NULL in this parameter is undefined. * * @param finalizer * The finalizer function pointer. * * @discussion * A dispatch object's finalizer will be invoked on the object's target queue * after all references to the object have been released. This finalizer may be * used by the application to release any resources associated with the object, * such as freeing the object's context. * The context parameter passed to the finalizer function is the current * context of the dispatch object at the time the finalizer call is made. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_set_finalizer_f(dispatch_object_t object, dispatch_function_t _Nullable finalizer); /*! * @function dispatch_activate * * @abstract * Activates the specified dispatch object. * * @discussion * Dispatch objects such as queues and sources may be created in an inactive * state. Objects in this state have to be activated before any blocks * associated with them will be invoked. * * The target queue of inactive objects can be changed using * dispatch_set_target_queue(). Change of target queue is no longer permitted * once an initially inactive object has been activated. * * Calling dispatch_activate() on an active object has no effect. * Releasing the last reference count on an inactive object is undefined. * * @param object * The object to be activated. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_activate(dispatch_object_t object); /*! * @function dispatch_suspend * * @abstract * Suspends the invocation of blocks on a dispatch object. * * @discussion * A suspended object will not invoke any blocks associated with it. The * suspension of an object will occur after any running block associated with * the object completes. * * Calls to dispatch_suspend() must be balanced with calls * to dispatch_resume(). * * @param object * The object to be suspended. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_suspend(dispatch_object_t object); /*! * @function dispatch_resume * * @abstract * Resumes the invocation of blocks on a dispatch object. * * @discussion * Dispatch objects can be suspended with dispatch_suspend(), which increments * an internal suspension count. dispatch_resume() is the inverse operation, * and consumes suspension counts. When the last suspension count is consumed, * blocks associated with the object will be invoked again. * * For backward compatibility reasons, dispatch_resume() on an inactive and not * otherwise suspended dispatch source object has the same effect as calling * dispatch_activate(). For new code, using dispatch_activate() is preferred. * * If the specified object has zero suspension count and is not an inactive * source, this function will result in an assertion and the process being * terminated. * * @param object * The object to be resumed. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_resume(dispatch_object_t object); #ifdef __BLOCKS__ /*! * @function dispatch_wait * * @abstract * Wait synchronously for an object or until the specified timeout has elapsed. * * @discussion * Type-generic macro that maps to dispatch_block_wait, dispatch_group_wait or * dispatch_semaphore_wait, depending on the type of the first argument. * See documentation for these functions for more details. * This function is unavailable for any other object type. * * @param object * The object to wait on. * The result of passing NULL in this parameter is undefined. * * @param timeout * When to timeout (see dispatch_time). As a convenience, there are the * DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants. * * @result * Returns zero on success or non-zero on error (i.e. timed out). */ DISPATCH_UNAVAILABLE DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW intptr_t dispatch_wait(void *object, dispatch_time_t timeout); #if 0 /* disabled by -frewrite-includes */ #if __has_extension(c_generic_selections) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 406 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define dispatch_wait(object, timeout) \ _Generic((object), \ dispatch_block_t:dispatch_block_wait, \ dispatch_group_t:dispatch_group_wait, \ dispatch_semaphore_t:dispatch_semaphore_wait \ )((object),(timeout)) #endif # 413 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" /*! * @function dispatch_notify * * @abstract * Schedule a notification block to be submitted to a queue when the execution * of a specified object has completed. * * @discussion * Type-generic macro that maps to dispatch_block_notify or * dispatch_group_notify, depending on the type of the first argument. * See documentation for these functions for more details. * This function is unavailable for any other object type. * * @param object * The object to observe. * The result of passing NULL in this parameter is undefined. * * @param queue * The queue to which the supplied notification block will be submitted when * the observed object completes. * * @param notification_block * The block to submit when the observed object completes. */ DISPATCH_UNAVAILABLE DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_notify(void *object, dispatch_object_t queue, dispatch_block_t notification_block); #if 0 /* disabled by -frewrite-includes */ #if __has_extension(c_generic_selections) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 444 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define dispatch_notify(object, queue, notification_block) \ _Generic((object), \ dispatch_block_t:dispatch_block_notify, \ dispatch_group_t:dispatch_group_notify \ )((object),(queue), (notification_block)) #endif # 450 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" /*! * @function dispatch_cancel * * @abstract * Cancel the specified object. * * @discussion * Type-generic macro that maps to dispatch_block_cancel or * dispatch_source_cancel, depending on the type of the first argument. * See documentation for these functions for more details. * This function is unavailable for any other object type. * * @param object * The object to cancel. * The result of passing NULL in this parameter is undefined. */ DISPATCH_UNAVAILABLE DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_cancel(void *object); #if 0 /* disabled by -frewrite-includes */ #if __has_extension(c_generic_selections) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 472 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define dispatch_cancel(object) \ _Generic((object), \ dispatch_block_t:dispatch_block_cancel, \ dispatch_source_t:dispatch_source_cancel \ )((object)) #endif # 478 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" /*! * @function dispatch_testcancel * * @abstract * Test whether the specified object has been canceled * * @discussion * Type-generic macro that maps to dispatch_block_testcancel or * dispatch_source_testcancel, depending on the type of the first argument. * See documentation for these functions for more details. * This function is unavailable for any other object type. * * @param object * The object to test. * The result of passing NULL in this parameter is undefined. * * @result * Non-zero if canceled and zero if not canceled. */ DISPATCH_UNAVAILABLE DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW intptr_t dispatch_testcancel(void *object); #if 0 /* disabled by -frewrite-includes */ #if __has_extension(c_generic_selections) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 504 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #define dispatch_testcancel(object) \ _Generic((object), \ dispatch_block_t:dispatch_block_testcancel, \ dispatch_source_t:dispatch_source_testcancel \ )((object)) #endif # 510 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" #endif // __BLOCKS__ # 511 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" /*! * @function dispatch_debug * * @abstract * Programmatically log debug information about a dispatch object. * * @discussion * Programmatically log debug information about a dispatch object. By default, * the log output is sent to syslog at notice level. In the debug version of * the library, the log output is sent to a file in /var/tmp. * The log output destination can be configured via the LIBDISPATCH_LOG * environment variable, valid values are: YES, NO, syslog, stderr, file. * * This function is deprecated and will be removed in a future release. * Objective-C callers may use -debugDescription instead. * * @param object * The object to introspect. * * @param message * The message to log above and beyond the introspection. */ API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW DISPATCH_COLD __attribute__((__format__(printf,2,3))) void dispatch_debug(dispatch_object_t object, const char *message, ...); API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW DISPATCH_COLD __attribute__((__format__(printf,2,0))) void dispatch_debugv(dispatch_object_t object, const char *message, va_list ap); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 551 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/object.h" # 202 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 202 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" 1 /* * Copyright (c) 2008-2014 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_QUEUE__ #define __DISPATCH_QUEUE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" #endif # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" DISPATCH_ASSUME_NONNULL_BEGIN /*! * @header * * Dispatch is an abstract model for expressing concurrency via simple but * powerful API. * * At the core, dispatch provides serial FIFO queues to which blocks may be * submitted. Blocks submitted to these dispatch queues are invoked on a pool * of threads fully managed by the system. No guarantee is made regarding * which thread a block will be invoked on; however, it is guaranteed that only * one block submitted to the FIFO dispatch queue will be invoked at a time. * * When multiple queues have blocks to be processed, the system is free to * allocate additional threads to invoke the blocks concurrently. When the * queues become empty, these threads are automatically released. */ /*! * @typedef dispatch_queue_t * * @abstract * Dispatch queues invoke workitems submitted to them. * * @discussion * Dispatch queues come in many flavors, the most common one being the dispatch * serial queue (See dispatch_queue_serial_t). * * The system manages a pool of threads which process dispatch queues and invoke * workitems submitted to them. * * Conceptually a dispatch queue may have its own thread of execution, and * interaction between queues is highly asynchronous. * * Dispatch queues are reference counted via calls to dispatch_retain() and * dispatch_release(). Pending workitems submitted to a queue also hold a * reference to the queue until they have finished. Once all references to a * queue have been released, the queue will be deallocated by the system. */ DISPATCH_DECL(dispatch_queue); /*! * @typedef dispatch_queue_global_t * * @abstract * Dispatch global concurrent queues are an abstraction around the system thread * pool which invokes workitems that are submitted to dispatch queues. * * @discussion * Dispatch global concurrent queues provide buckets of priorities on top of the * thread pool the system manages. The system will decide how many threads * to allocate to this pool depending on demand and system load. In particular, * the system tries to maintain a good level of concurrency for this resource, * and will create new threads when too many existing worker threads block in * system calls. * * The global concurrent queues are a shared resource and as such it is the * responsiblity of every user of this resource to not submit an unbounded * amount of work to this pool, especially work that may block, as this can * cause the system to spawn very large numbers of threads (aka. thread * explosion). * * Work items submitted to the global concurrent queues have no ordering * guarantee with respect to the order of submission, and workitems submitted * to these queues may be invoked concurrently. * * Dispatch global concurrent queues are well-known global objects that are * returned by dispatch_get_global_queue(). These objects cannot be modified. * Calls to dispatch_suspend(), dispatch_resume(), dispatch_set_context(), etc., * will have no effect when used with queues of this type. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__DISPATCH_BUILDING_DISPATCH__) && !defined(__OBJC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 106 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" typedef struct dispatch_queue_global_s *dispatch_queue_global_t; #else # 108 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" DISPATCH_DECL_SUBCLASS(dispatch_queue_global, dispatch_queue); #endif # 110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @typedef dispatch_queue_serial_t * * @abstract * Dispatch serial queues invoke workitems submitted to them serially in FIFO * order. * * @discussion * Dispatch serial queues are lightweight objects to which workitems may be * submitted to be invoked in FIFO order. A serial queue will only invoke one * workitem at a time, but independent serial queues may each invoke their work * items concurrently with respect to each other. * * Serial queues can target each other (See dispatch_set_target_queue()). The * serial queue at the bottom of a queue hierarchy provides an exclusion * context: at most one workitem submitted to any of the queues in such * a hiearchy will run at any given time. * * Such hierarchies provide a natural construct to organize an application * subsystem around. * * Serial queues are created by passing a dispatch queue attribute derived from * DISPATCH_QUEUE_SERIAL to dispatch_queue_create_with_target(). */ #if 0 /* disabled by -frewrite-includes */ #if defined(__DISPATCH_BUILDING_DISPATCH__) && !defined(__OBJC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 136 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" typedef struct dispatch_lane_s *dispatch_queue_serial_t; #else # 138 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" DISPATCH_DECL_SUBCLASS(dispatch_queue_serial, dispatch_queue); #endif # 140 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @typedef dispatch_queue_main_t * * @abstract * The type of the default queue that is bound to the main thread. * * @discussion * The main queue is a serial queue (See dispatch_queue_serial_t) which is bound * to the main thread of an application. * * In order to invoke workitems submitted to the main queue, the application * must call dispatch_main(), NSApplicationMain(), or use a CFRunLoop on the * main thread. * * The main queue is a well known global object that is made automatically on * behalf of the main thread during process initialization and is returned by * dispatch_get_main_queue(). This object cannot be modified. Calls to * dispatch_suspend(), dispatch_resume(), dispatch_set_context(), etc., will * have no effect when used on the main queue. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__DISPATCH_BUILDING_DISPATCH__) && !defined(__OBJC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 162 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" typedef struct dispatch_queue_static_s *dispatch_queue_main_t; #else # 164 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" DISPATCH_DECL_SUBCLASS(dispatch_queue_main, dispatch_queue_serial); #endif # 166 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @typedef dispatch_queue_concurrent_t * * @abstract * Dispatch concurrent queues invoke workitems submitted to them concurrently, * and admit a notion of barrier workitems. * * @discussion * Dispatch concurrent queues are lightweight objects to which regular and * barrier workitems may be submited. Barrier workitems are invoked in * exclusion of any other kind of workitem in FIFO order. * * Regular workitems can be invoked concurrently for the same concurrent queue, * in any order. However, regular workitems will not be invoked before any * barrier workitem submited ahead of them has been invoked. * * In other words, if a serial queue is equivalent to a mutex in the Dispatch * world, a concurrent queue is equivalent to a reader-writer lock, where * regular items are readers and barriers are writers. * * Concurrent queues are created by passing a dispatch queue attribute derived * from DISPATCH_QUEUE_CONCURRENT to dispatch_queue_create_with_target(). * * Caveat: * Dispatch concurrent queues at this time do not implement priority inversion * avoidance when lower priority regular workitems (readers) are being invoked * and are preventing a higher priority barrier (writer) from being invoked. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__DISPATCH_BUILDING_DISPATCH__) && !defined(__OBJC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 196 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" typedef struct dispatch_lane_s *dispatch_queue_concurrent_t; #else # 198 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" DISPATCH_DECL_SUBCLASS(dispatch_queue_concurrent, dispatch_queue); #endif # 200 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" __BEGIN_DECLS /*! * @function dispatch_async * * @abstract * Submits a block for asynchronous execution on a dispatch queue. * * @discussion * The dispatch_async() function is the fundamental mechanism for submitting * blocks to a dispatch queue. * * Calls to dispatch_async() always return immediately after the block has * been submitted, and never wait for the block to be invoked. * * The target queue determines whether the block will be invoked serially or * concurrently with respect to other blocks submitted to that same queue. * Serial queues are processed concurrently with respect to each other. * * @param queue * The target dispatch queue to which the block is submitted. * The system will hold a reference on the target queue until the block * has finished. * The result of passing NULL in this parameter is undefined. * * @param block * The block to submit to the target dispatch queue. This function performs * Block_copy() and Block_release() on behalf of callers. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_async(dispatch_queue_t queue, dispatch_block_t block); #endif # 237 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_async_f * * @abstract * Submits a function for asynchronous execution on a dispatch queue. * * @discussion * See dispatch_async() for details. * * @param queue * The target dispatch queue to which the function is submitted. * The system will hold a reference on the target queue until the function * has returned. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_async_f(). * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_async_f(dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); /*! * @function dispatch_sync * * @abstract * Submits a block for synchronous execution on a dispatch queue. * * @discussion * Submits a workitem to a dispatch queue like dispatch_async(), however * dispatch_sync() will not return until the workitem has finished. * * Work items submitted to a queue with dispatch_sync() do not observe certain * queue attributes of that queue when invoked (such as autorelease frequency * and QOS class). * * Calls to dispatch_sync() targeting the current queue will result * in dead-lock. Use of dispatch_sync() is also subject to the same * multi-party dead-lock problems that may result from the use of a mutex. * Use of dispatch_async() is preferred. * * Unlike dispatch_async(), no retain is performed on the target queue. Because * calls to this function are synchronous, the dispatch_sync() "borrows" the * reference of the caller. * * As an optimization, dispatch_sync() invokes the workitem on the thread which * submitted the workitem, except when the passed queue is the main queue or * a queue targetting it (See dispatch_queue_main_t, * dispatch_set_target_queue()). * * @param queue * The target dispatch queue to which the block is submitted. * The result of passing NULL in this parameter is undefined. * * @param block * The block to be invoked on the target dispatch queue. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_sync(dispatch_queue_t queue, DISPATCH_NOESCAPE dispatch_block_t block); #endif # 310 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_sync_f * * @abstract * Submits a function for synchronous execution on a dispatch queue. * * @discussion * See dispatch_sync() for details. * * @param queue * The target dispatch queue to which the function is submitted. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_sync_f(). * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_sync_f(dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); #if 0 /* disabled by -frewrite-includes */ #if defined(__APPLE__) && \ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \ __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0) || \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 345 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" #define DISPATCH_APPLY_AUTO_AVAILABLE 0 #define DISPATCH_APPLY_QUEUE_ARG_NULLABILITY _Nonnull #else # 348 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" #define DISPATCH_APPLY_AUTO_AVAILABLE 1 #define DISPATCH_APPLY_QUEUE_ARG_NULLABILITY _Nullable #endif # 351 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @constant DISPATCH_APPLY_AUTO * * @abstract * Constant to pass to dispatch_apply() or dispatch_apply_f() to request that * the system automatically use worker threads that match the configuration of * the current thread as closely as possible. * * @discussion * When submitting a block for parallel invocation, passing this constant as the * queue argument will automatically use the global concurrent queue that * matches the Quality of Service of the caller most closely. * * No assumptions should be made about which global concurrent queue will * actually be used. * * Using this constant deploys backward to macOS 10.9, iOS 7.0 and any tvOS or * watchOS version. */ #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_APPLY_AUTO_AVAILABLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 372 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" #define DISPATCH_APPLY_AUTO ((dispatch_queue_t _Nonnull)0) #endif # 374 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_apply * * @abstract * Submits a block to a dispatch queue for parallel invocation. * * @discussion * Submits a block to a dispatch queue for parallel invocation. This function * waits for the task block to complete before returning. If the specified queue * is concurrent, the block may be invoked concurrently, and it must therefore * be reentrant safe. * * Each invocation of the block will be passed the current index of iteration. * * @param iterations * The number of iterations to perform. * * @param queue * The dispatch queue to which the block is submitted. * The preferred value to pass is DISPATCH_APPLY_AUTO to automatically use * a queue appropriate for the calling thread. * * @param block * The block to be invoked the specified number of iterations. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_apply(size_t iterations, dispatch_queue_t DISPATCH_APPLY_QUEUE_ARG_NULLABILITY queue, DISPATCH_NOESCAPE void (^block)(size_t)); #endif # 409 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_apply_f * * @abstract * Submits a function to a dispatch queue for parallel invocation. * * @discussion * See dispatch_apply() for details. * * @param iterations * The number of iterations to perform. * * @param queue * The dispatch queue to which the function is submitted. * The preferred value to pass is DISPATCH_APPLY_AUTO to automatically use * a queue appropriate for the calling thread. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the specified queue. The first * parameter passed to this function is the context provided to * dispatch_apply_f(). The second parameter passed to this function is the * current index of iteration. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_NOTHROW void dispatch_apply_f(size_t iterations, dispatch_queue_t DISPATCH_APPLY_QUEUE_ARG_NULLABILITY queue, void *_Nullable context, void (*work)(void *_Nullable, size_t)); /*! * @function dispatch_get_current_queue * * @abstract * Returns the queue on which the currently executing block is running. * * @discussion * Returns the queue on which the currently executing block is running. * * When dispatch_get_current_queue() is called outside of the context of a * submitted block, it will return the default concurrent queue. * * Recommended for debugging and logging purposes only: * The code must not make any assumptions about the queue returned, unless it * is one of the global queues or a queue the code has itself created. * The code must not assume that synchronous execution onto a queue is safe * from deadlock if that queue is not the one returned by * dispatch_get_current_queue(). * * When dispatch_get_current_queue() is called on the main thread, it may * or may not return the same value as dispatch_get_main_queue(). Comparing * the two is not a valid way to test whether code is executing on the * main thread (see dispatch_assert_queue() and dispatch_assert_queue_not()). * * This function is deprecated and will be removed in a future release. * * @result * Returns the current queue. */ API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0)) DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_t dispatch_get_current_queue(void); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT #if 0 /* disabled by -frewrite-includes */ #if defined(__DISPATCH_BUILDING_DISPATCH__) && !defined(__OBJC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 481 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" struct dispatch_queue_static_s _dispatch_main_q; #else # 483 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" struct dispatch_queue_s _dispatch_main_q; #endif # 485 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_get_main_queue * * @abstract * Returns the default queue that is bound to the main thread. * * @discussion * In order to invoke blocks submitted to the main queue, the application must * call dispatch_main(), NSApplicationMain(), or use a CFRunLoop on the main * thread. * * The main queue is meant to be used in application context to interact with * the main thread and the main runloop. * * Because the main queue doesn't behave entirely like a regular serial queue, * it may have unwanted side-effects when used in processes that are not UI apps * (daemons). For such processes, the main queue should be avoided. * * @see dispatch_queue_main_t * * @result * Returns the main queue. This queue is created automatically on behalf of * the main thread before main() is called. */ DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_CONST DISPATCH_NOTHROW dispatch_queue_main_t dispatch_get_main_queue(void) { return DISPATCH_GLOBAL_OBJECT(dispatch_queue_main_t, _dispatch_main_q); } /*! * @typedef dispatch_queue_priority_t * Type of dispatch_queue_priority * * @constant DISPATCH_QUEUE_PRIORITY_HIGH * Items dispatched to the queue will run at high priority, * i.e. the queue will be scheduled for execution before * any default priority or low priority queue. * * @constant DISPATCH_QUEUE_PRIORITY_DEFAULT * Items dispatched to the queue will run at the default * priority, i.e. the queue will be scheduled for execution * after all high priority queues have been scheduled, but * before any low priority queues have been scheduled. * * @constant DISPATCH_QUEUE_PRIORITY_LOW * Items dispatched to the queue will run at low priority, * i.e. the queue will be scheduled for execution after all * default priority and high priority queues have been * scheduled. * * @constant DISPATCH_QUEUE_PRIORITY_BACKGROUND * Items dispatched to the queue will run at background priority, i.e. the queue * will be scheduled for execution after all higher priority queues have been * scheduled and the system will run items on this queue on a thread with * background status as per setpriority(2) (i.e. disk I/O is throttled and the * thread's scheduling priority is set to lowest value). */ #define DISPATCH_QUEUE_PRIORITY_HIGH 2 #define DISPATCH_QUEUE_PRIORITY_DEFAULT 0 #define DISPATCH_QUEUE_PRIORITY_LOW (-2) #define DISPATCH_QUEUE_PRIORITY_BACKGROUND INT16_MIN typedef long dispatch_queue_priority_t; /*! * @typedef dispatch_qos_class_t * Alias for qos_class_t type. */ #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 557 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" typedef qos_class_t dispatch_qos_class_t; #else # 559 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" typedef unsigned int dispatch_qos_class_t; #endif # 561 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_get_global_queue * * @abstract * Returns a well-known global concurrent queue of a given quality of service * class. * * @discussion * See dispatch_queue_global_t. * * @param identifier * A quality of service class defined in qos_class_t or a priority defined in * dispatch_queue_priority_t. * * It is recommended to use quality of service class values to identify the * well-known global concurrent queues: * - QOS_CLASS_USER_INTERACTIVE * - QOS_CLASS_USER_INITIATED * - QOS_CLASS_DEFAULT * - QOS_CLASS_UTILITY * - QOS_CLASS_BACKGROUND * * The global concurrent queues may still be identified by their priority, * which map to the following QOS classes: * - DISPATCH_QUEUE_PRIORITY_HIGH: QOS_CLASS_USER_INITIATED * - DISPATCH_QUEUE_PRIORITY_DEFAULT: QOS_CLASS_DEFAULT * - DISPATCH_QUEUE_PRIORITY_LOW: QOS_CLASS_UTILITY * - DISPATCH_QUEUE_PRIORITY_BACKGROUND: QOS_CLASS_BACKGROUND * * @param flags * Reserved for future use. Passing any value other than zero may result in * a NULL return value. * * @result * Returns the requested global queue or NULL if the requested global queue * does not exist. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_global_t dispatch_get_global_queue(intptr_t identifier, uintptr_t flags); /*! * @typedef dispatch_queue_attr_t * * @abstract * Attribute for dispatch queues. */ DISPATCH_DECL(dispatch_queue_attr); /*! * @const DISPATCH_QUEUE_SERIAL * * @discussion * An attribute that can be used to create a dispatch queue that invokes blocks * serially in FIFO order. * * See dispatch_queue_serial_t. */ #define DISPATCH_QUEUE_SERIAL NULL /*! * @const DISPATCH_QUEUE_SERIAL_INACTIVE * * @discussion * An attribute that can be used to create a dispatch queue that invokes blocks * serially in FIFO order, and that is initially inactive. * * See dispatch_queue_attr_make_initially_inactive(). */ #define DISPATCH_QUEUE_SERIAL_INACTIVE \ dispatch_queue_attr_make_initially_inactive(DISPATCH_QUEUE_SERIAL) /*! * @const DISPATCH_QUEUE_CONCURRENT * * @discussion * An attribute that can be used to create a dispatch queue that may invoke * blocks concurrently and supports barrier blocks submitted with the dispatch * barrier API. * * See dispatch_queue_concurrent_t. */ #define DISPATCH_QUEUE_CONCURRENT \ DISPATCH_GLOBAL_OBJECT(dispatch_queue_attr_t, \ _dispatch_queue_attr_concurrent) API_AVAILABLE(macos(10.7), ios(4.3)) DISPATCH_EXPORT struct dispatch_queue_attr_s _dispatch_queue_attr_concurrent; /*! * @const DISPATCH_QUEUE_CONCURRENT_INACTIVE * * @discussion * An attribute that can be used to create a dispatch queue that may invoke * blocks concurrently and supports barrier blocks submitted with the dispatch * barrier API, and that is initially inactive. * * See dispatch_queue_attr_make_initially_inactive(). */ #define DISPATCH_QUEUE_CONCURRENT_INACTIVE \ dispatch_queue_attr_make_initially_inactive(DISPATCH_QUEUE_CONCURRENT) /*! * @function dispatch_queue_attr_make_initially_inactive * * @abstract * Returns an attribute value which may be provided to dispatch_queue_create() * or dispatch_queue_create_with_target(), in order to make the created queue * initially inactive. * * @discussion * Dispatch queues may be created in an inactive state. Queues in this state * have to be activated before any blocks associated with them will be invoked. * * A queue in inactive state cannot be deallocated, dispatch_activate() must be * called before the last reference to a queue created with this attribute is * released. * * The target queue of a queue in inactive state can be changed using * dispatch_set_target_queue(). Change of target queue is no longer permitted * once an initially inactive queue has been activated. * * @param attr * A queue attribute value to be combined with the initially inactive attribute. * * @return * Returns an attribute value which may be provided to dispatch_queue_create() * and dispatch_queue_create_with_target(). * The new value combines the attributes specified by the 'attr' parameter with * the initially inactive attribute. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW dispatch_queue_attr_t dispatch_queue_attr_make_initially_inactive( dispatch_queue_attr_t _Nullable attr); /*! * @const DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL * * @discussion * A dispatch queue created with this attribute invokes blocks serially in FIFO * order, and surrounds execution of any block submitted asynchronously to it * with the equivalent of a individual Objective-C @autoreleasepool * scope. * * See dispatch_queue_attr_make_with_autorelease_frequency(). */ #define DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL \ dispatch_queue_attr_make_with_autorelease_frequency(\ DISPATCH_QUEUE_SERIAL, DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM) /*! * @const DISPATCH_QUEUE_CONCURRENT_WITH_AUTORELEASE_POOL * * @discussion * A dispatch queue created with this attribute may invokes blocks concurrently * and supports barrier blocks submitted with the dispatch barrier API. It also * surrounds execution of any block submitted asynchronously to it with the * equivalent of a individual Objective-C @autoreleasepool * * See dispatch_queue_attr_make_with_autorelease_frequency(). */ #define DISPATCH_QUEUE_CONCURRENT_WITH_AUTORELEASE_POOL \ dispatch_queue_attr_make_with_autorelease_frequency(\ DISPATCH_QUEUE_CONCURRENT, DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM) /*! * @typedef dispatch_autorelease_frequency_t * Values to pass to the dispatch_queue_attr_make_with_autorelease_frequency() * function. * * @const DISPATCH_AUTORELEASE_FREQUENCY_INHERIT * Dispatch queues with this autorelease frequency inherit the behavior from * their target queue. This is the default behavior for manually created queues. * * @const DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM * Dispatch queues with this autorelease frequency push and pop an autorelease * pool around the execution of every block that was submitted to it * asynchronously. * @see dispatch_queue_attr_make_with_autorelease_frequency(). * * @const DISPATCH_AUTORELEASE_FREQUENCY_NEVER * Dispatch queues with this autorelease frequency never set up an individual * autorelease pool around the execution of a block that is submitted to it * asynchronously. This is the behavior of the global concurrent queues. */ DISPATCH_ENUM(dispatch_autorelease_frequency, unsigned long, DISPATCH_AUTORELEASE_FREQUENCY_INHERIT DISPATCH_ENUM_API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) = 0, DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM DISPATCH_ENUM_API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) = 1, DISPATCH_AUTORELEASE_FREQUENCY_NEVER DISPATCH_ENUM_API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) = 2, ); /*! * @function dispatch_queue_attr_make_with_autorelease_frequency * * @abstract * Returns a dispatch queue attribute value with the autorelease frequency * set to the specified value. * * @discussion * When a queue uses the per-workitem autorelease frequency (either directly * or inherithed from its target queue), any block submitted asynchronously to * this queue (via dispatch_async(), dispatch_barrier_async(), * dispatch_group_notify(), etc...) is executed as if surrounded by a individual * Objective-C @autoreleasepool scope. * * Autorelease frequency has no effect on blocks that are submitted * synchronously to a queue (via dispatch_sync(), dispatch_barrier_sync()). * * The global concurrent queues have the DISPATCH_AUTORELEASE_FREQUENCY_NEVER * behavior. Manually created dispatch queues use * DISPATCH_AUTORELEASE_FREQUENCY_INHERIT by default. * * Queues created with this attribute cannot change target queues after having * been activated. See dispatch_set_target_queue() and dispatch_activate(). * * @param attr * A queue attribute value to be combined with the specified autorelease * frequency or NULL. * * @param frequency * The requested autorelease frequency. * * @return * Returns an attribute value which may be provided to dispatch_queue_create() * or NULL if an invalid autorelease frequency was requested. * This new value combines the attributes specified by the 'attr' parameter and * the chosen autorelease frequency. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW dispatch_queue_attr_t dispatch_queue_attr_make_with_autorelease_frequency( dispatch_queue_attr_t _Nullable attr, dispatch_autorelease_frequency_t frequency); /*! * @function dispatch_queue_attr_make_with_qos_class * * @abstract * Returns an attribute value which may be provided to dispatch_queue_create() * or dispatch_queue_create_with_target(), in order to assign a QOS class and * relative priority to the queue. * * @discussion * When specified in this manner, the QOS class and relative priority take * precedence over those inherited from the dispatch queue's target queue (if * any) as long that does not result in a lower QOS class and relative priority. * * The global queue priorities map to the following QOS classes: * - DISPATCH_QUEUE_PRIORITY_HIGH: QOS_CLASS_USER_INITIATED * - DISPATCH_QUEUE_PRIORITY_DEFAULT: QOS_CLASS_DEFAULT * - DISPATCH_QUEUE_PRIORITY_LOW: QOS_CLASS_UTILITY * - DISPATCH_QUEUE_PRIORITY_BACKGROUND: QOS_CLASS_BACKGROUND * * Example: * * dispatch_queue_t queue; * dispatch_queue_attr_t attr; * attr = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, * QOS_CLASS_UTILITY, 0); * queue = dispatch_queue_create("com.example.myqueue", attr); * * * The QOS class and relative priority set this way on a queue have no effect on * blocks that are submitted synchronously to a queue (via dispatch_sync(), * dispatch_barrier_sync()). * * @param attr * A queue attribute value to be combined with the QOS class, or NULL. * * @param qos_class * A QOS class value: * - QOS_CLASS_USER_INTERACTIVE * - QOS_CLASS_USER_INITIATED * - QOS_CLASS_DEFAULT * - QOS_CLASS_UTILITY * - QOS_CLASS_BACKGROUND * Passing any other value results in NULL being returned. * * @param relative_priority * A relative priority within the QOS class. This value is a negative * offset from the maximum supported scheduler priority for the given class. * Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY * results in NULL being returned. * * @return * Returns an attribute value which may be provided to dispatch_queue_create() * and dispatch_queue_create_with_target(), or NULL if an invalid QOS class was * requested. * The new value combines the attributes specified by the 'attr' parameter and * the new QOS class and relative priority. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW dispatch_queue_attr_t dispatch_queue_attr_make_with_qos_class(dispatch_queue_attr_t _Nullable attr, dispatch_qos_class_t qos_class, int relative_priority); /*! * @const DISPATCH_TARGET_QUEUE_DEFAULT * @discussion Constant to pass to the dispatch_queue_create_with_target(), * dispatch_set_target_queue() and dispatch_source_create() functions to * indicate that the default target queue for the object type in question * should be used. */ #define DISPATCH_TARGET_QUEUE_DEFAULT NULL /*! * @function dispatch_queue_create_with_target * * @abstract * Creates a new dispatch queue with a specified target queue. * * @discussion * Dispatch queues created with the DISPATCH_QUEUE_SERIAL or a NULL attribute * invoke blocks serially in FIFO order. * * Dispatch queues created with the DISPATCH_QUEUE_CONCURRENT attribute may * invoke blocks concurrently (similarly to the global concurrent queues, but * potentially with more overhead), and support barrier blocks submitted with * the dispatch barrier API, which e.g. enables the implementation of efficient * reader-writer schemes. * * When a dispatch queue is no longer needed, it should be released with * dispatch_release(). Note that any pending blocks submitted asynchronously to * a queue will hold a reference to that queue. Therefore a queue will not be * deallocated until all pending blocks have finished. * * When using a dispatch queue attribute @a attr specifying a QoS class (derived * from the result of dispatch_queue_attr_make_with_qos_class()), passing the * result of dispatch_get_global_queue() in @a target will ignore the QoS class * of that global queue and will use the global queue with the QoS class * specified by attr instead. * * Queues created with dispatch_queue_create_with_target() cannot have their * target queue changed, unless created inactive (See * dispatch_queue_attr_make_initially_inactive()), in which case the target * queue can be changed until the newly created queue is activated with * dispatch_activate(). * * @param label * A string label to attach to the queue. * This parameter is optional and may be NULL. * * @param attr * A predefined attribute such as DISPATCH_QUEUE_SERIAL, * DISPATCH_QUEUE_CONCURRENT, or the result of a call to * a dispatch_queue_attr_make_with_* function. * * @param target * The target queue for the newly created queue. The target queue is retained. * If this parameter is DISPATCH_TARGET_QUEUE_DEFAULT, sets the queue's target * queue to the default target queue for the given queue type. * * @result * The newly created dispatch queue. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_t dispatch_queue_create_with_target(const char *_Nullable label, dispatch_queue_attr_t _Nullable attr, dispatch_queue_t _Nullable target) DISPATCH_ALIAS_V2(dispatch_queue_create_with_target); /*! * @function dispatch_queue_create * * @abstract * Creates a new dispatch queue to which blocks may be submitted. * * @discussion * Dispatch queues created with the DISPATCH_QUEUE_SERIAL or a NULL attribute * invoke blocks serially in FIFO order. * * Dispatch queues created with the DISPATCH_QUEUE_CONCURRENT attribute may * invoke blocks concurrently (similarly to the global concurrent queues, but * potentially with more overhead), and support barrier blocks submitted with * the dispatch barrier API, which e.g. enables the implementation of efficient * reader-writer schemes. * * When a dispatch queue is no longer needed, it should be released with * dispatch_release(). Note that any pending blocks submitted asynchronously to * a queue will hold a reference to that queue. Therefore a queue will not be * deallocated until all pending blocks have finished. * * Passing the result of the dispatch_queue_attr_make_with_qos_class() function * to the attr parameter of this function allows a quality of service class and * relative priority to be specified for the newly created queue. * The quality of service class so specified takes precedence over the quality * of service class of the newly created dispatch queue's target queue (if any) * as long that does not result in a lower QOS class and relative priority. * * When no quality of service class is specified, the target queue of a newly * created dispatch queue is the default priority global concurrent queue. * * @param label * A string label to attach to the queue. * This parameter is optional and may be NULL. * * @param attr * A predefined attribute such as DISPATCH_QUEUE_SERIAL, * DISPATCH_QUEUE_CONCURRENT, or the result of a call to * a dispatch_queue_attr_make_with_* function. * * @result * The newly created dispatch queue. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_t dispatch_queue_create(const char *_Nullable label, dispatch_queue_attr_t _Nullable attr); /*! * @const DISPATCH_CURRENT_QUEUE_LABEL * @discussion Constant to pass to the dispatch_queue_get_label() function to * retrieve the label of the current queue. */ #define DISPATCH_CURRENT_QUEUE_LABEL NULL /*! * @function dispatch_queue_get_label * * @abstract * Returns the label of the given queue, as specified when the queue was * created, or the empty string if a NULL label was specified. * * Passing DISPATCH_CURRENT_QUEUE_LABEL will return the label of the current * queue. * * @param queue * The queue to query, or DISPATCH_CURRENT_QUEUE_LABEL. * * @result * The label of the queue. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW const char * dispatch_queue_get_label(dispatch_queue_t _Nullable queue); /*! * @function dispatch_queue_get_qos_class * * @abstract * Returns the QOS class and relative priority of the given queue. * * @discussion * If the given queue was created with an attribute value returned from * dispatch_queue_attr_make_with_qos_class(), this function returns the QOS * class and relative priority specified at that time; for any other attribute * value it returns a QOS class of QOS_CLASS_UNSPECIFIED and a relative * priority of 0. * * If the given queue is one of the global queues, this function returns its * assigned QOS class value as documented under dispatch_get_global_queue() and * a relative priority of 0; in the case of the main queue it returns the QOS * value provided by qos_class_main() and a relative priority of 0. * * @param queue * The queue to query. * * @param relative_priority_ptr * A pointer to an int variable to be filled with the relative priority offset * within the QOS class, or NULL. * * @return * A QOS class value: * - QOS_CLASS_USER_INTERACTIVE * - QOS_CLASS_USER_INITIATED * - QOS_CLASS_DEFAULT * - QOS_CLASS_UTILITY * - QOS_CLASS_BACKGROUND * - QOS_CLASS_UNSPECIFIED */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NONNULL1 DISPATCH_NOTHROW dispatch_qos_class_t dispatch_queue_get_qos_class(dispatch_queue_t queue, int *_Nullable relative_priority_ptr); /*! * @function dispatch_set_target_queue * * @abstract * Sets the target queue for the given object. * * @discussion * An object's target queue is responsible for processing the object. * * When no quality of service class and relative priority is specified for a * dispatch queue at the time of creation, a dispatch queue's quality of service * class is inherited from its target queue. The dispatch_get_global_queue() * function may be used to obtain a target queue of a specific quality of * service class, however the use of dispatch_queue_attr_make_with_qos_class() * is recommended instead. * * Blocks submitted to a serial queue whose target queue is another serial * queue will not be invoked concurrently with blocks submitted to the target * queue or to any other queue with that same target queue. * * The result of introducing a cycle into the hierarchy of target queues is * undefined. * * A dispatch source's target queue specifies where its event handler and * cancellation handler blocks will be submitted. * * A dispatch I/O channel's target queue specifies where where its I/O * operations are executed. If the channel's target queue's priority is set to * DISPATCH_QUEUE_PRIORITY_BACKGROUND, then the I/O operations performed by * dispatch_io_read() or dispatch_io_write() on that queue will be * throttled when there is I/O contention. * * For all other dispatch object types, the only function of the target queue * is to determine where an object's finalizer function is invoked. * * In general, changing the target queue of an object is an asynchronous * operation that doesn't take effect immediately, and doesn't affect blocks * already associated with the specified object. * * However, if an object is inactive at the time dispatch_set_target_queue() is * called, then the target queue change takes effect immediately, and will * affect blocks already associated with the specified object. After an * initially inactive object has been activated, calling * dispatch_set_target_queue() results in an assertion and the process being * terminated. * * If a dispatch queue is active and targeted by other dispatch objects, * changing its target queue results in undefined behavior. * * @param object * The object to modify. * The result of passing NULL in this parameter is undefined. * * @param queue * The new target queue for the object. The queue is retained, and the * previous target queue, if any, is released. * If queue is DISPATCH_TARGET_QUEUE_DEFAULT, set the object's target queue * to the default target queue for the given object type. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_set_target_queue(dispatch_object_t object, dispatch_queue_t _Nullable queue); /*! * @function dispatch_main * * @abstract * Execute blocks submitted to the main queue. * * @discussion * This function "parks" the main thread and waits for blocks to be submitted * to the main queue. This function never returns. * * Applications that call NSApplicationMain() or CFRunLoopRun() on the * main thread do not need to call dispatch_main(). */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NOTHROW DISPATCH_NORETURN void dispatch_main(void); /*! * @function dispatch_after * * @abstract * Schedule a block for execution on a given queue at a specified time. * * @discussion * Passing DISPATCH_TIME_NOW as the "when" parameter is supported, but not as * optimal as calling dispatch_async() instead. Passing DISPATCH_TIME_FOREVER * is undefined. * * @param when * A temporal milestone returned by dispatch_time() or dispatch_walltime(). * * @param queue * A queue to which the given block will be submitted at the specified time. * The result of passing NULL in this parameter is undefined. * * @param block * The block of code to execute. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_after(dispatch_time_t when, dispatch_queue_t queue, dispatch_block_t block); #endif # 1160 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_after_f * * @abstract * Schedule a function for execution on a given queue at a specified time. * * @discussion * See dispatch_after() for details. * * @param when * A temporal milestone returned by dispatch_time() or dispatch_walltime(). * * @param queue * A queue to which the given function will be submitted at the specified time. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_after_f(). * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL4 DISPATCH_NOTHROW void dispatch_after_f(dispatch_time_t when, dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); /*! * @functiongroup Dispatch Barrier API * The dispatch barrier API is a mechanism for submitting barrier blocks to a * dispatch queue, analogous to the dispatch_async()/dispatch_sync() API. * It enables the implementation of efficient reader/writer schemes. * Barrier blocks only behave specially when submitted to queues created with * the DISPATCH_QUEUE_CONCURRENT attribute; on such a queue, a barrier block * will not run until all blocks submitted to the queue earlier have completed, * and any blocks submitted to the queue after a barrier block will not run * until the barrier block has completed. * When submitted to a a global queue or to a queue not created with the * DISPATCH_QUEUE_CONCURRENT attribute, barrier blocks behave identically to * blocks submitted with the dispatch_async()/dispatch_sync() API. */ /*! * @function dispatch_barrier_async * * @abstract * Submits a barrier block for asynchronous execution on a dispatch queue. * * @discussion * Submits a block to a dispatch queue like dispatch_async(), but marks that * block as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues). * * See dispatch_async() for details. * * @param queue * The target dispatch queue to which the block is submitted. * The system will hold a reference on the target queue until the block * has finished. * The result of passing NULL in this parameter is undefined. * * @param block * The block to submit to the target dispatch queue. This function performs * Block_copy() and Block_release() on behalf of callers. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.7), ios(4.3)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_barrier_async(dispatch_queue_t queue, dispatch_block_t block); #endif # 1236 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_barrier_async_f * * @abstract * Submits a barrier function for asynchronous execution on a dispatch queue. * * @discussion * Submits a function to a dispatch queue like dispatch_async_f(), but marks * that function as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT * queues). * * See dispatch_async_f() for details. * * @param queue * The target dispatch queue to which the function is submitted. * The system will hold a reference on the target queue until the function * has returned. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_barrier_async_f(). * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.7), ios(4.3)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_barrier_async_f(dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); /*! * @function dispatch_barrier_sync * * @abstract * Submits a barrier block for synchronous execution on a dispatch queue. * * @discussion * Submits a block to a dispatch queue like dispatch_sync(), but marks that * block as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues). * * See dispatch_sync() for details. * * @param queue * The target dispatch queue to which the block is submitted. * The result of passing NULL in this parameter is undefined. * * @param block * The block to be invoked on the target dispatch queue. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.7), ios(4.3)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_barrier_sync(dispatch_queue_t queue, DISPATCH_NOESCAPE dispatch_block_t block); #endif # 1298 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" /*! * @function dispatch_barrier_sync_f * * @abstract * Submits a barrier function for synchronous execution on a dispatch queue. * * @discussion * Submits a function to a dispatch queue like dispatch_sync_f(), but marks that * fuction as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues). * * See dispatch_sync_f() for details. * * @param queue * The target dispatch queue to which the function is submitted. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_barrier_sync_f(). * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.7), ios(4.3)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_barrier_sync_f(dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); /*! * @functiongroup Dispatch queue-specific contexts * This API allows different subsystems to associate context to a shared queue * without risk of collision and to retrieve that context from blocks executing * on that queue or any of its child queues in the target queue hierarchy. */ /*! * @function dispatch_queue_set_specific * * @abstract * Associates a subsystem-specific context with a dispatch queue, for a key * unique to the subsystem. * * @discussion * The specified destructor will be invoked with the context on the default * priority global concurrent queue when a new context is set for the same key, * or after all references to the queue have been released. * * @param queue * The dispatch queue to modify. * The result of passing NULL in this parameter is undefined. * * @param key * The key to set the context for, typically a pointer to a static variable * specific to the subsystem. Keys are only compared as pointers and never * dereferenced. Passing a string constant directly is not recommended. * The NULL key is reserved and attempts to set a context for it are ignored. * * @param context * The new subsystem-specific context for the object. This may be NULL. * * @param destructor * The destructor function pointer. This may be NULL and is ignored if context * is NULL. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_queue_set_specific(dispatch_queue_t queue, const void *key, void *_Nullable context, dispatch_function_t _Nullable destructor); /*! * @function dispatch_queue_get_specific * * @abstract * Returns the subsystem-specific context associated with a dispatch queue, for * a key unique to the subsystem. * * @discussion * Returns the context for the specified key if it has been set on the specified * queue. * * @param queue * The dispatch queue to query. * The result of passing NULL in this parameter is undefined. * * @param key * The key to get the context for, typically a pointer to a static variable * specific to the subsystem. Keys are only compared as pointers and never * dereferenced. Passing a string constant directly is not recommended. * * @result * The context for the specified key or NULL if no context was found. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW void *_Nullable dispatch_queue_get_specific(dispatch_queue_t queue, const void *key); /*! * @function dispatch_get_specific * * @abstract * Returns the current subsystem-specific context for a key unique to the * subsystem. * * @discussion * When called from a block executing on a queue, returns the context for the * specified key if it has been set on the queue, otherwise returns the result * of dispatch_get_specific() executed on the queue's target queue or NULL * if the current queue is a global concurrent queue. * * @param key * The key to get the context for, typically a pointer to a static variable * specific to the subsystem. Keys are only compared as pointers and never * dereferenced. Passing a string constant directly is not recommended. * * @result * The context for the specified key or NULL if no context was found. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW void *_Nullable dispatch_get_specific(const void *key); /*! * @functiongroup Dispatch assertion API * * This API asserts at runtime that code is executing in (or out of) the context * of a given queue. It can be used to check that a block accessing a resource * does so from the proper queue protecting the resource. It also can be used * to verify that a block that could cause a deadlock if run on a given queue * never executes on that queue. */ /*! * @function dispatch_assert_queue * * @abstract * Verifies that the current block is executing on a given dispatch queue. * * @discussion * Some code expects to be run on a specific dispatch queue. This function * verifies that that expectation is true. * * If the currently executing block was submitted to the specified queue or to * any queue targeting it (see dispatch_set_target_queue()), this function * returns. * * If the currently executing block was submitted with a synchronous API * (dispatch_sync(), dispatch_barrier_sync(), ...), the context of the * submitting block is also evaluated (recursively). * If a synchronously submitting block is found that was itself submitted to * the specified queue or to any queue targeting it, this function returns. * * Otherwise this function asserts: it logs an explanation to the system log and * terminates the application. * * Passing the result of dispatch_get_main_queue() to this function verifies * that the current block was submitted to the main queue, or to a queue * targeting it, or is running on the main thread (in any context). * * When dispatch_assert_queue() is called outside of the context of a * submitted block (for example from the context of a thread created manually * with pthread_create()) then this function will also assert and terminate * the application. * * The variant dispatch_assert_queue_debug() is compiled out when the * preprocessor macro NDEBUG is defined. (See also assert(3)). * * @param queue * The dispatch queue that the current block is expected to run on. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 void dispatch_assert_queue(dispatch_queue_t queue) DISPATCH_ALIAS_V2(dispatch_assert_queue); /*! * @function dispatch_assert_queue_barrier * * @abstract * Verifies that the current block is executing on a given dispatch queue, * and that the block acts as a barrier on that queue. * * @discussion * This behaves exactly like dispatch_assert_queue(), with the additional check * that the current block acts as a barrier on the specified queue, which is * always true if the specified queue is serial (see DISPATCH_BLOCK_BARRIER or * dispatch_barrier_async() for details). * * The variant dispatch_assert_queue_barrier_debug() is compiled out when the * preprocessor macro NDEBUG is defined. (See also assert()). * * @param queue * The dispatch queue that the current block is expected to run as a barrier on. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 void dispatch_assert_queue_barrier(dispatch_queue_t queue); /*! * @function dispatch_assert_queue_not * * @abstract * Verifies that the current block is not executing on a given dispatch queue. * * @discussion * This function is the equivalent of dispatch_queue_assert() with the test for * equality inverted. That means that it will terminate the application when * dispatch_queue_assert() would return, and vice-versa. See discussion there. * * The variant dispatch_assert_queue_not_debug() is compiled out when the * preprocessor macro NDEBUG is defined. (See also assert(3)). * * @param queue * The dispatch queue that the current block is expected not to run on. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 void dispatch_assert_queue_not(dispatch_queue_t queue) DISPATCH_ALIAS_V2(dispatch_assert_queue_not); #ifdef NDEBUG #define dispatch_assert_queue_debug(q) ((void)(0 && (q))) #define dispatch_assert_queue_barrier_debug(q) ((void)(0 && (q))) #define dispatch_assert_queue_not_debug(q) ((void)(0 && (q))) #else # 1536 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" #define dispatch_assert_queue_debug(q) dispatch_assert_queue(q) #define dispatch_assert_queue_barrier_debug(q) dispatch_assert_queue_barrier(q) #define dispatch_assert_queue_not_debug(q) dispatch_assert_queue_not(q) #endif # 1540 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 1546 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/queue.h" # 203 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 203 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/block.h" 1 /* * Copyright (c) 2014 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_BLOCK__ #define __DISPATCH_BLOCK__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/block.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/block.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/block.h" #ifdef __BLOCKS__ /*! * @group Dispatch block objects */ DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @typedef dispatch_block_flags_t * Flags to pass to the dispatch_block_create* functions. * * @const DISPATCH_BLOCK_BARRIER * Flag indicating that a dispatch block object should act as a barrier block * when submitted to a DISPATCH_QUEUE_CONCURRENT queue. * See dispatch_barrier_async() for details. * This flag has no effect when the dispatch block object is invoked directly. * * @const DISPATCH_BLOCK_DETACHED * Flag indicating that a dispatch block object should execute disassociated * from current execution context attributes such as os_activity_t * and properties of the current IPC request (if any). With regard to QoS class, * the behavior is the same as for DISPATCH_BLOCK_NO_QOS. If invoked directly, * the block object will remove the other attributes from the calling thread for * the duration of the block body (before applying attributes assigned to the * block object, if any). If submitted to a queue, the block object will be * executed with the attributes of the queue (or any attributes specifically * assigned to the block object). * * @const DISPATCH_BLOCK_ASSIGN_CURRENT * Flag indicating that a dispatch block object should be assigned the execution * context attributes that are current at the time the block object is created. * This applies to attributes such as QOS class, os_activity_t and properties of * the current IPC request (if any). If invoked directly, the block object will * apply these attributes to the calling thread for the duration of the block * body. If the block object is submitted to a queue, this flag replaces the * default behavior of associating the submitted block instance with the * execution context attributes that are current at the time of submission. * If a specific QOS class is assigned with DISPATCH_BLOCK_NO_QOS_CLASS or * dispatch_block_create_with_qos_class(), that QOS class takes precedence over * the QOS class assignment indicated by this flag. * * @const DISPATCH_BLOCK_NO_QOS_CLASS * Flag indicating that a dispatch block object should be not be assigned a QOS * class. If invoked directly, the block object will be executed with the QOS * class of the calling thread. If the block object is submitted to a queue, * this replaces the default behavior of associating the submitted block * instance with the QOS class current at the time of submission. * This flag is ignored if a specific QOS class is assigned with * dispatch_block_create_with_qos_class(). * * @const DISPATCH_BLOCK_INHERIT_QOS_CLASS * Flag indicating that execution of a dispatch block object submitted to a * queue should prefer the QOS class assigned to the queue over the QOS class * assigned to the block (resp. associated with the block at the time of * submission). The latter will only be used if the queue in question does not * have an assigned QOS class, as long as doing so does not result in a QOS * class lower than the QOS class inherited from the queue's target queue. * This flag is the default when a dispatch block object is submitted to a queue * for asynchronous execution and has no effect when the dispatch block object * is invoked directly. It is ignored if DISPATCH_BLOCK_ENFORCE_QOS_CLASS is * also passed. * * @const DISPATCH_BLOCK_ENFORCE_QOS_CLASS * Flag indicating that execution of a dispatch block object submitted to a * queue should prefer the QOS class assigned to the block (resp. associated * with the block at the time of submission) over the QOS class assigned to the * queue, as long as doing so will not result in a lower QOS class. * This flag is the default when a dispatch block object is submitted to a queue * for synchronous execution or when the dispatch block object is invoked * directly. */ DISPATCH_ENUM(dispatch_block_flags, unsigned long, DISPATCH_BLOCK_BARRIER DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x1, DISPATCH_BLOCK_DETACHED DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x2, DISPATCH_BLOCK_ASSIGN_CURRENT DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x4, DISPATCH_BLOCK_NO_QOS_CLASS DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x8, DISPATCH_BLOCK_INHERIT_QOS_CLASS DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x10, DISPATCH_BLOCK_ENFORCE_QOS_CLASS DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x20, ); /*! * @function dispatch_block_create * * @abstract * Create a new dispatch block object on the heap from an existing block and * the given flags. * * @discussion * The provided block is Block_copy'ed to the heap and retained by the newly * created dispatch block object. * * The returned dispatch block object is intended to be submitted to a dispatch * queue with dispatch_async() and related functions, but may also be invoked * directly. Both operations can be performed an arbitrary number of times but * only the first completed execution of a dispatch block object can be waited * on with dispatch_block_wait() or observed with dispatch_block_notify(). * * If the returned dispatch block object is submitted to a dispatch queue, the * submitted block instance will be associated with the QOS class current at the * time of submission, unless one of the following flags assigned a specific QOS * class (or no QOS class) at the time of block creation: * - DISPATCH_BLOCK_ASSIGN_CURRENT * - DISPATCH_BLOCK_NO_QOS_CLASS * - DISPATCH_BLOCK_DETACHED * The QOS class the block object will be executed with also depends on the QOS * class assigned to the queue and which of the following flags was specified or * defaulted to: * - DISPATCH_BLOCK_INHERIT_QOS_CLASS (default for asynchronous execution) * - DISPATCH_BLOCK_ENFORCE_QOS_CLASS (default for synchronous execution) * See description of dispatch_block_flags_t for details. * * If the returned dispatch block object is submitted directly to a serial queue * and is configured to execute with a specific QOS class, the system will make * a best effort to apply the necessary QOS overrides to ensure that blocks * submitted earlier to the serial queue are executed at that same QOS class or * higher. * * @param flags * Configuration flags for the block object. * Passing a value that is not a bitwise OR of flags from dispatch_block_flags_t * results in NULL being returned. * * @param block * The block to create the dispatch block object from. * * @result * The newly created dispatch block object, or NULL. * When not building with Objective-C ARC, must be released with a -[release] * message or the Block_release() function. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_RETURNS_RETAINED_BLOCK DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_block_t dispatch_block_create(dispatch_block_flags_t flags, dispatch_block_t block); /*! * @function dispatch_block_create_with_qos_class * * @abstract * Create a new dispatch block object on the heap from an existing block and * the given flags, and assign it the specified QOS class and relative priority. * * @discussion * The provided block is Block_copy'ed to the heap and retained by the newly * created dispatch block object. * * The returned dispatch block object is intended to be submitted to a dispatch * queue with dispatch_async() and related functions, but may also be invoked * directly. Both operations can be performed an arbitrary number of times but * only the first completed execution of a dispatch block object can be waited * on with dispatch_block_wait() or observed with dispatch_block_notify(). * * If invoked directly, the returned dispatch block object will be executed with * the assigned QOS class as long as that does not result in a lower QOS class * than what is current on the calling thread. * * If the returned dispatch block object is submitted to a dispatch queue, the * QOS class it will be executed with depends on the QOS class assigned to the * block, the QOS class assigned to the queue and which of the following flags * was specified or defaulted to: * - DISPATCH_BLOCK_INHERIT_QOS_CLASS: default for asynchronous execution * - DISPATCH_BLOCK_ENFORCE_QOS_CLASS: default for synchronous execution * See description of dispatch_block_flags_t for details. * * If the returned dispatch block object is submitted directly to a serial queue * and is configured to execute with a specific QOS class, the system will make * a best effort to apply the necessary QOS overrides to ensure that blocks * submitted earlier to the serial queue are executed at that same QOS class or * higher. * * @param flags * Configuration flags for the new block object. * Passing a value that is not a bitwise OR of flags from dispatch_block_flags_t * results in NULL being returned. * * @param qos_class * A QOS class value: * - QOS_CLASS_USER_INTERACTIVE * - QOS_CLASS_USER_INITIATED * - QOS_CLASS_DEFAULT * - QOS_CLASS_UTILITY * - QOS_CLASS_BACKGROUND * - QOS_CLASS_UNSPECIFIED * Passing QOS_CLASS_UNSPECIFIED is equivalent to specifying the * DISPATCH_BLOCK_NO_QOS_CLASS flag. Passing any other value results in NULL * being returned. * * @param relative_priority * A relative priority within the QOS class. This value is a negative * offset from the maximum supported scheduler priority for the given class. * Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY * results in NULL being returned. * * @param block * The block to create the dispatch block object from. * * @result * The newly created dispatch block object, or NULL. * When not building with Objective-C ARC, must be released with a -[release] * message or the Block_release() function. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_RETURNS_RETAINED_BLOCK DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_block_t dispatch_block_create_with_qos_class(dispatch_block_flags_t flags, dispatch_qos_class_t qos_class, int relative_priority, dispatch_block_t block); /*! * @function dispatch_block_perform * * @abstract * Create, synchronously execute and release a dispatch block object from the * specified block and flags. * * @discussion * Behaves identically to the sequence * * dispatch_block_t b = dispatch_block_create(flags, block); * b(); * Block_release(b); * * but may be implemented more efficiently internally by not requiring a copy * to the heap of the specified block or the allocation of a new block object. * * @param flags * Configuration flags for the temporary block object. * The result of passing a value that is not a bitwise OR of flags from * dispatch_block_flags_t is undefined. * * @param block * The block to create the temporary block object from. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW void dispatch_block_perform(dispatch_block_flags_t flags, DISPATCH_NOESCAPE dispatch_block_t block); /*! * @function dispatch_block_wait * * @abstract * Wait synchronously until execution of the specified dispatch block object has * completed or until the specified timeout has elapsed. * * @discussion * This function will return immediately if execution of the block object has * already completed. * * It is not possible to wait for multiple executions of the same block object * with this interface; use dispatch_group_wait() for that purpose. A single * dispatch block object may either be waited on once and executed once, * or it may be executed any number of times. The behavior of any other * combination is undefined. Submission to a dispatch queue counts as an * execution, even if cancellation (dispatch_block_cancel) means the block's * code never runs. * * The result of calling this function from multiple threads simultaneously * with the same dispatch block object is undefined, but note that doing so * would violate the rules described in the previous paragraph. * * If this function returns indicating that the specified timeout has elapsed, * then that invocation does not count as the one allowed wait. * * If at the time this function is called, the specified dispatch block object * has been submitted directly to a serial queue, the system will make a best * effort to apply the necessary QOS overrides to ensure that the block and any * blocks submitted earlier to that serial queue are executed at the QOS class * (or higher) of the thread calling dispatch_block_wait(). * * @param block * The dispatch block object to wait on. * The result of passing NULL or a block object not returned by one of the * dispatch_block_create* functions is undefined. * * @param timeout * When to timeout (see dispatch_time). As a convenience, there are the * DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants. * * @result * Returns zero on success (the dispatch block object completed within the * specified timeout) or non-zero on error (i.e. timed out). */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW intptr_t dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout); /*! * @function dispatch_block_notify * * @abstract * Schedule a notification block to be submitted to a queue when the execution * of a specified dispatch block object has completed. * * @discussion * This function will submit the notification block immediately if execution of * the observed block object has already completed. * * It is not possible to be notified of multiple executions of the same block * object with this interface, use dispatch_group_notify() for that purpose. * * A single dispatch block object may either be observed one or more times * and executed once, or it may be executed any number of times. The behavior * of any other combination is undefined. Submission to a dispatch queue * counts as an execution, even if cancellation (dispatch_block_cancel) means * the block's code never runs. * * If multiple notification blocks are scheduled for a single block object, * there is no defined order in which the notification blocks will be submitted * to their associated queues. * * @param block * The dispatch block object to observe. * The result of passing NULL or a block object not returned by one of the * dispatch_block_create* functions is undefined. * * @param queue * The queue to which the supplied notification block will be submitted when * the observed block completes. * * @param notification_block * The notification block to submit when the observed block object completes. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_block_notify(dispatch_block_t block, dispatch_queue_t queue, dispatch_block_t notification_block); /*! * @function dispatch_block_cancel * * @abstract * Asynchronously cancel the specified dispatch block object. * * @discussion * Cancellation causes any future execution of the dispatch block object to * return immediately, but does not affect any execution of the block object * that is already in progress. * * Release of any resources associated with the block object will be delayed * until execution of the block object is next attempted (or any execution * already in progress completes). * * NOTE: care needs to be taken to ensure that a block object that may be * canceled does not capture any resources that require execution of the * block body in order to be released (e.g. memory allocated with * malloc(3) that the block body calls free(3) on). Such resources will * be leaked if the block body is never executed due to cancellation. * * @param block * The dispatch block object to cancel. * The result of passing NULL or a block object not returned by one of the * dispatch_block_create* functions is undefined. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_block_cancel(dispatch_block_t block); /*! * @function dispatch_block_testcancel * * @abstract * Tests whether the given dispatch block object has been canceled. * * @param block * The dispatch block object to test. * The result of passing NULL or a block object not returned by one of the * dispatch_block_create* functions is undefined. * * @result * Non-zero if canceled and zero if not canceled. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW intptr_t dispatch_block_testcancel(dispatch_block_t block); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif // __BLOCKS__ # 427 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/block.h" #endif // __DISPATCH_BLOCK__ # 429 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/block.h" # 204 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 204 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_SOURCE__ #define __DISPATCH_SOURCE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" #endif # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" #endif # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" DISPATCH_ASSUME_NONNULL_BEGIN /*! * @header * The dispatch framework provides a suite of interfaces for monitoring low- * level system objects (file descriptors, Mach ports, signals, VFS nodes, etc.) * for activity and automatically submitting event handler blocks to dispatch * queues when such activity occurs. * * This suite of interfaces is known as the Dispatch Source API. */ /*! * @typedef dispatch_source_t * * @abstract * Dispatch sources are used to automatically submit event handler blocks to * dispatch queues in response to external events. */ DISPATCH_SOURCE_DECL(dispatch_source); __BEGIN_DECLS /*! * @typedef dispatch_source_type_t * * @abstract * Constants of this type represent the class of low-level system object that * is being monitored by the dispatch source. Constants of this type are * passed as a parameter to dispatch_source_create() and determine how the * handle argument is interpreted (i.e. as a file descriptor, mach port, * signal number, process identifier, etc.), and how the mask argument is * interpreted. */ typedef const struct dispatch_source_type_s *dispatch_source_type_t; /*! * @const DISPATCH_SOURCE_TYPE_DATA_ADD * @discussion A dispatch source that coalesces data obtained via calls to * dispatch_source_merge_data(). An ADD is used to coalesce the data. * The handle is unused (pass zero for now). * The mask is unused (pass zero for now). */ #define DISPATCH_SOURCE_TYPE_DATA_ADD (&_dispatch_source_type_data_add) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_SOURCE_TYPE_DECL(data_add); /*! * @const DISPATCH_SOURCE_TYPE_DATA_OR * @discussion A dispatch source that coalesces data obtained via calls to * dispatch_source_merge_data(). A bitwise OR is used to coalesce the data. * The handle is unused (pass zero for now). * The mask is unused (pass zero for now). */ #define DISPATCH_SOURCE_TYPE_DATA_OR (&_dispatch_source_type_data_or) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_SOURCE_TYPE_DECL(data_or); /*! * @const DISPATCH_SOURCE_TYPE_DATA_REPLACE * @discussion A dispatch source that tracks data obtained via calls to * dispatch_source_merge_data(). Newly obtained data values replace existing * data values not yet delivered to the source handler * * A data value of zero will cause the source handler to not be invoked. * * The handle is unused (pass zero for now). * The mask is unused (pass zero for now). */ #define DISPATCH_SOURCE_TYPE_DATA_REPLACE (&_dispatch_source_type_data_replace) API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_SOURCE_TYPE_DECL(data_replace); /*! * @const DISPATCH_SOURCE_TYPE_MACH_SEND * @discussion A dispatch source that monitors a Mach port for dead name * notifications (send right no longer has any corresponding receive right). * The handle is a Mach port with a send or send-once right (mach_port_t). * The mask is a mask of desired events from dispatch_source_mach_send_flags_t. */ #define DISPATCH_SOURCE_TYPE_MACH_SEND (&_dispatch_source_type_mach_send) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(mach_send); /*! * @const DISPATCH_SOURCE_TYPE_MACH_RECV * @discussion A dispatch source that monitors a Mach port for pending messages. * The handle is a Mach port with a receive right (mach_port_t). * The mask is unused (pass zero for now). */ #define DISPATCH_SOURCE_TYPE_MACH_RECV (&_dispatch_source_type_mach_recv) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(mach_recv); /*! * @const DISPATCH_SOURCE_TYPE_MEMORYPRESSURE * @discussion A dispatch source that monitors the system for changes in * memory pressure condition. * The handle is unused (pass zero for now). * The mask is a mask of desired events from * dispatch_source_memorypressure_flags_t. */ #define DISPATCH_SOURCE_TYPE_MEMORYPRESSURE \ (&_dispatch_source_type_memorypressure) API_AVAILABLE(macos(10.9), ios(8.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(memorypressure); /*! * @const DISPATCH_SOURCE_TYPE_PROC * @discussion A dispatch source that monitors an external process for events * defined by dispatch_source_proc_flags_t. * The handle is a process identifier (pid_t). * The mask is a mask of desired events from dispatch_source_proc_flags_t. */ #define DISPATCH_SOURCE_TYPE_PROC (&_dispatch_source_type_proc) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(proc); /*! * @const DISPATCH_SOURCE_TYPE_READ * @discussion A dispatch source that monitors a file descriptor for pending * bytes available to be read. * The handle is a file descriptor (int). * The mask is unused (pass zero for now). */ #define DISPATCH_SOURCE_TYPE_READ (&_dispatch_source_type_read) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_SOURCE_TYPE_DECL(read); /*! * @const DISPATCH_SOURCE_TYPE_SIGNAL * @discussion A dispatch source that monitors the current process for signals. * The handle is a signal number (int). * The mask is unused (pass zero for now). */ #define DISPATCH_SOURCE_TYPE_SIGNAL (&_dispatch_source_type_signal) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_SOURCE_TYPE_DECL(signal); /*! * @const DISPATCH_SOURCE_TYPE_TIMER * @discussion A dispatch source that submits the event handler block based * on a timer. * The handle is unused (pass zero for now). * The mask specifies which flags from dispatch_source_timer_flags_t to apply. */ #define DISPATCH_SOURCE_TYPE_TIMER (&_dispatch_source_type_timer) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_SOURCE_TYPE_DECL(timer); /*! * @const DISPATCH_SOURCE_TYPE_VNODE * @discussion A dispatch source that monitors a file descriptor for events * defined by dispatch_source_vnode_flags_t. * The handle is a file descriptor (int). * The mask is a mask of desired events from dispatch_source_vnode_flags_t. */ #define DISPATCH_SOURCE_TYPE_VNODE (&_dispatch_source_type_vnode) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(vnode); /*! * @const DISPATCH_SOURCE_TYPE_WRITE * @discussion A dispatch source that monitors a file descriptor for available * buffer space to write bytes. * The handle is a file descriptor (int). * The mask is unused (pass zero for now). */ #define DISPATCH_SOURCE_TYPE_WRITE (&_dispatch_source_type_write) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_SOURCE_TYPE_DECL(write); /*! * @typedef dispatch_source_mach_send_flags_t * Type of dispatch_source_mach_send flags * * @constant DISPATCH_MACH_SEND_DEAD * The receive right corresponding to the given send right was destroyed. */ #define DISPATCH_MACH_SEND_DEAD 0x1 typedef unsigned long dispatch_source_mach_send_flags_t; /*! * @typedef dispatch_source_memorypressure_flags_t * Type of dispatch_source_memorypressure flags * * @constant DISPATCH_MEMORYPRESSURE_NORMAL * The system memory pressure condition has returned to normal. * * @constant DISPATCH_MEMORYPRESSURE_WARN * The system memory pressure condition has changed to warning. * * @constant DISPATCH_MEMORYPRESSURE_CRITICAL * The system memory pressure condition has changed to critical. * * @discussion * Elevated memory pressure is a system-wide condition that applications * registered for this source should react to by changing their future memory * use behavior, e.g. by reducing cache sizes of newly initiated operations * until memory pressure returns back to normal. * NOTE: applications should NOT traverse and discard existing caches for past * operations when the system memory pressure enters an elevated state, as that * is likely to trigger VM operations that will further aggravate system memory * pressure. */ #define DISPATCH_MEMORYPRESSURE_NORMAL 0x01 #define DISPATCH_MEMORYPRESSURE_WARN 0x02 #define DISPATCH_MEMORYPRESSURE_CRITICAL 0x04 typedef unsigned long dispatch_source_memorypressure_flags_t; /*! * @typedef dispatch_source_proc_flags_t * Type of dispatch_source_proc flags * * @constant DISPATCH_PROC_EXIT * The process has exited (perhaps cleanly, perhaps not). * * @constant DISPATCH_PROC_FORK * The process has created one or more child processes. * * @constant DISPATCH_PROC_EXEC * The process has become another executable image via * exec*() or posix_spawn*(). * * @constant DISPATCH_PROC_SIGNAL * A Unix signal was delivered to the process. */ #define DISPATCH_PROC_EXIT 0x80000000 #define DISPATCH_PROC_FORK 0x40000000 #define DISPATCH_PROC_EXEC 0x20000000 #define DISPATCH_PROC_SIGNAL 0x08000000 typedef unsigned long dispatch_source_proc_flags_t; /*! * @typedef dispatch_source_vnode_flags_t * Type of dispatch_source_vnode flags * * @constant DISPATCH_VNODE_DELETE * The filesystem object was deleted from the namespace. * * @constant DISPATCH_VNODE_WRITE * The filesystem object data changed. * * @constant DISPATCH_VNODE_EXTEND * The filesystem object changed in size. * * @constant DISPATCH_VNODE_ATTRIB * The filesystem object metadata changed. * * @constant DISPATCH_VNODE_LINK * The filesystem object link count changed. * * @constant DISPATCH_VNODE_RENAME * The filesystem object was renamed in the namespace. * * @constant DISPATCH_VNODE_REVOKE * The filesystem object was revoked. * * @constant DISPATCH_VNODE_FUNLOCK * The filesystem object was unlocked. */ #define DISPATCH_VNODE_DELETE 0x1 #define DISPATCH_VNODE_WRITE 0x2 #define DISPATCH_VNODE_EXTEND 0x4 #define DISPATCH_VNODE_ATTRIB 0x8 #define DISPATCH_VNODE_LINK 0x10 #define DISPATCH_VNODE_RENAME 0x20 #define DISPATCH_VNODE_REVOKE 0x40 #define DISPATCH_VNODE_FUNLOCK 0x100 typedef unsigned long dispatch_source_vnode_flags_t; /*! * @typedef dispatch_source_timer_flags_t * Type of dispatch_source_timer flags * * @constant DISPATCH_TIMER_STRICT * Specifies that the system should make a best effort to strictly observe the * leeway value specified for the timer via dispatch_source_set_timer(), even * if that value is smaller than the default leeway value that would be applied * to the timer otherwise. A minimal amount of leeway will be applied to the * timer even if this flag is specified. * * CAUTION: Use of this flag may override power-saving techniques employed by * the system and cause higher power consumption, so it must be used with care * and only when absolutely necessary. */ #define DISPATCH_TIMER_STRICT 0x1 typedef unsigned long dispatch_source_timer_flags_t; /*! * @function dispatch_source_create * * @abstract * Creates a new dispatch source to monitor low-level system objects and auto- * matically submit a handler block to a dispatch queue in response to events. * * @discussion * Dispatch sources are not reentrant. Any events received while the dispatch * source is suspended or while the event handler block is currently executing * will be coalesced and delivered after the dispatch source is resumed or the * event handler block has returned. * * Dispatch sources are created in an inactive state. After creating the * source and setting any desired attributes (i.e. the handler, context, etc.), * a call must be made to dispatch_activate() in order to begin event delivery. * * Calling dispatch_set_target_queue() on a source once it has been activated * is not allowed (see dispatch_activate() and dispatch_set_target_queue()). * * For backward compatibility reasons, dispatch_resume() on an inactive, * and not otherwise suspended source has the same effect as calling * dispatch_activate(). For new code, using dispatch_activate() is preferred. * * @param type * Declares the type of the dispatch source. Must be one of the defined * dispatch_source_type_t constants. * * @param handle * The underlying system handle to monitor. The interpretation of this argument * is determined by the constant provided in the type parameter. * * @param mask * A mask of flags specifying which events are desired. The interpretation of * this argument is determined by the constant provided in the type parameter. * * @param queue * The dispatch queue to which the event handler block will be submitted. * If queue is DISPATCH_TARGET_QUEUE_DEFAULT, the source will submit the event * handler block to the default priority global queue. * * @result * The newly created dispatch source. Or NULL if invalid arguments are passed. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_source_t dispatch_source_create(dispatch_source_type_t type, uintptr_t handle, uintptr_t mask, dispatch_queue_t _Nullable queue); /*! * @function dispatch_source_set_event_handler * * @abstract * Sets the event handler block for the given dispatch source. * * @param source * The dispatch source to modify. * The result of passing NULL in this parameter is undefined. * * @param handler * The event handler block to submit to the source's target queue. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_source_set_event_handler(dispatch_source_t source, dispatch_block_t _Nullable handler); #endif /* __BLOCKS__ */ # 408 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" /*! * @function dispatch_source_set_event_handler_f * * @abstract * Sets the event handler function for the given dispatch source. * * @param source * The dispatch source to modify. * The result of passing NULL in this parameter is undefined. * * @param handler * The event handler function to submit to the source's target queue. * The context parameter passed to the event handler function is the context of * the dispatch source current at the time the event handler was set. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_source_set_event_handler_f(dispatch_source_t source, dispatch_function_t _Nullable handler); /*! * @function dispatch_source_set_cancel_handler * * @abstract * Sets the cancellation handler block for the given dispatch source. * * @discussion * The cancellation handler (if specified) will be submitted to the source's * target queue in response to a call to dispatch_source_cancel() once the * system has released all references to the source's underlying handle and * the source's event handler block has returned. * * IMPORTANT: * Source cancellation and a cancellation handler are required for file * descriptor and mach port based sources in order to safely close the * descriptor or destroy the port. * Closing the descriptor or port before the cancellation handler is invoked may * result in a race condition. If a new descriptor is allocated with the same * value as the recently closed descriptor while the source's event handler is * still running, the event handler may read/write data to the wrong descriptor. * * @param source * The dispatch source to modify. * The result of passing NULL in this parameter is undefined. * * @param handler * The cancellation handler block to submit to the source's target queue. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_source_set_cancel_handler(dispatch_source_t source, dispatch_block_t _Nullable handler); #endif /* __BLOCKS__ */ # 465 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" /*! * @function dispatch_source_set_cancel_handler_f * * @abstract * Sets the cancellation handler function for the given dispatch source. * * @discussion * See dispatch_source_set_cancel_handler() for more details. * * @param source * The dispatch source to modify. * The result of passing NULL in this parameter is undefined. * * @param handler * The cancellation handler function to submit to the source's target queue. * The context parameter passed to the event handler function is the current * context of the dispatch source at the time the handler call is made. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_source_set_cancel_handler_f(dispatch_source_t source, dispatch_function_t _Nullable handler); /*! * @function dispatch_source_cancel * * @abstract * Asynchronously cancel the dispatch source, preventing any further invocation * of its event handler block. * * @discussion * Cancellation prevents any further invocation of the event handler block for * the specified dispatch source, but does not interrupt an event handler * block that is already in progress. * * The cancellation handler is submitted to the source's target queue once the * the source's event handler has finished, indicating it is now safe to close * the source's handle (i.e. file descriptor or mach port). * * See dispatch_source_set_cancel_handler() for more information. * * @param source * The dispatch source to be canceled. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_source_cancel(dispatch_source_t source); /*! * @function dispatch_source_testcancel * * @abstract * Tests whether the given dispatch source has been canceled. * * @param source * The dispatch source to be tested. * The result of passing NULL in this parameter is undefined. * * @result * Non-zero if canceled and zero if not canceled. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW intptr_t dispatch_source_testcancel(dispatch_source_t source); /*! * @function dispatch_source_get_handle * * @abstract * Returns the underlying system handle associated with this dispatch source. * * @param source * The result of passing NULL in this parameter is undefined. * * @result * The return value should be interpreted according to the type of the dispatch * source, and may be one of the following handles: * * DISPATCH_SOURCE_TYPE_DATA_ADD: n/a * DISPATCH_SOURCE_TYPE_DATA_OR: n/a * DISPATCH_SOURCE_TYPE_DATA_REPLACE: n/a * DISPATCH_SOURCE_TYPE_MACH_SEND: mach port (mach_port_t) * DISPATCH_SOURCE_TYPE_MACH_RECV: mach port (mach_port_t) * DISPATCH_SOURCE_TYPE_MEMORYPRESSURE n/a * DISPATCH_SOURCE_TYPE_PROC: process identifier (pid_t) * DISPATCH_SOURCE_TYPE_READ: file descriptor (int) * DISPATCH_SOURCE_TYPE_SIGNAL: signal number (int) * DISPATCH_SOURCE_TYPE_TIMER: n/a * DISPATCH_SOURCE_TYPE_VNODE: file descriptor (int) * DISPATCH_SOURCE_TYPE_WRITE: file descriptor (int) */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW uintptr_t dispatch_source_get_handle(dispatch_source_t source); /*! * @function dispatch_source_get_mask * * @abstract * Returns the mask of events monitored by the dispatch source. * * @param source * The result of passing NULL in this parameter is undefined. * * @result * The return value should be interpreted according to the type of the dispatch * source, and may be one of the following flag sets: * * DISPATCH_SOURCE_TYPE_DATA_ADD: n/a * DISPATCH_SOURCE_TYPE_DATA_OR: n/a * DISPATCH_SOURCE_TYPE_DATA_REPLACE: n/a * DISPATCH_SOURCE_TYPE_MACH_SEND: dispatch_source_mach_send_flags_t * DISPATCH_SOURCE_TYPE_MACH_RECV: n/a * DISPATCH_SOURCE_TYPE_MEMORYPRESSURE dispatch_source_memorypressure_flags_t * DISPATCH_SOURCE_TYPE_PROC: dispatch_source_proc_flags_t * DISPATCH_SOURCE_TYPE_READ: n/a * DISPATCH_SOURCE_TYPE_SIGNAL: n/a * DISPATCH_SOURCE_TYPE_TIMER: dispatch_source_timer_flags_t * DISPATCH_SOURCE_TYPE_VNODE: dispatch_source_vnode_flags_t * DISPATCH_SOURCE_TYPE_WRITE: n/a */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW uintptr_t dispatch_source_get_mask(dispatch_source_t source); /*! * @function dispatch_source_get_data * * @abstract * Returns pending data for the dispatch source. * * @discussion * This function is intended to be called from within the event handler block. * The result of calling this function outside of the event handler callback is * undefined. * * @param source * The result of passing NULL in this parameter is undefined. * * @result * The return value should be interpreted according to the type of the dispatch * source, and may be one of the following: * * DISPATCH_SOURCE_TYPE_DATA_ADD: application defined data * DISPATCH_SOURCE_TYPE_DATA_OR: application defined data * DISPATCH_SOURCE_TYPE_DATA_REPLACE: application defined data * DISPATCH_SOURCE_TYPE_MACH_SEND: dispatch_source_mach_send_flags_t * DISPATCH_SOURCE_TYPE_MACH_RECV: n/a * DISPATCH_SOURCE_TYPE_MEMORYPRESSURE dispatch_source_memorypressure_flags_t * DISPATCH_SOURCE_TYPE_PROC: dispatch_source_proc_flags_t * DISPATCH_SOURCE_TYPE_READ: estimated bytes available to read * DISPATCH_SOURCE_TYPE_SIGNAL: number of signals delivered since * the last handler invocation * DISPATCH_SOURCE_TYPE_TIMER: number of times the timer has fired * since the last handler invocation * DISPATCH_SOURCE_TYPE_VNODE: dispatch_source_vnode_flags_t * DISPATCH_SOURCE_TYPE_WRITE: estimated buffer space available */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW uintptr_t dispatch_source_get_data(dispatch_source_t source); /*! * @function dispatch_source_merge_data * * @abstract * Merges data into a dispatch source of type DISPATCH_SOURCE_TYPE_DATA_ADD, * DISPATCH_SOURCE_TYPE_DATA_OR or DISPATCH_SOURCE_TYPE_DATA_REPLACE, * and submits its event handler block to its target queue. * * @param source * The result of passing NULL in this parameter is undefined. * * @param value * The value to coalesce with the pending data using a logical OR or an ADD * as specified by the dispatch source type. A value of zero has no effect * and will not result in the submission of the event handler block. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_source_merge_data(dispatch_source_t source, uintptr_t value); /*! * @function dispatch_source_set_timer * * @abstract * Sets a start time, interval, and leeway value for a timer source. * * @discussion * Once this function returns, any pending source data accumulated for the * previous timer values has been cleared; the next fire of the timer will * occur at 'start', and every 'interval' nanoseconds thereafter until the * timer source is canceled. * * Any fire of the timer may be delayed by the system in order to improve power * consumption and system performance. The upper limit to the allowable delay * may be configured with the 'leeway' argument, the lower limit is under the * control of the system. * * For the initial timer fire at 'start', the upper limit to the allowable * delay is set to 'leeway' nanoseconds. For the subsequent timer fires at * 'start' + N * 'interval', the upper limit is MIN('leeway','interval'/2). * * The lower limit to the allowable delay may vary with process state such as * visibility of application UI. If the specified timer source was created with * a mask of DISPATCH_TIMER_STRICT, the system will make a best effort to * strictly observe the provided 'leeway' value even if it is smaller than the * current lower limit. Note that a minimal amount of delay is to be expected * even if this flag is specified. * * The 'start' argument also determines which clock will be used for the timer: * If 'start' is DISPATCH_TIME_NOW or was created with dispatch_time(3), the * timer is based on up time (which is obtained from mach_absolute_time() on * Apple platforms). If 'start' was created with dispatch_walltime(3), the * timer is based on gettimeofday(3). * * Calling this function has no effect if the timer source has already been * canceled. * * @param start * The start time of the timer. See dispatch_time() and dispatch_walltime() * for more information. * * @param interval * The nanosecond interval for the timer. Use DISPATCH_TIME_FOREVER for a * one-shot timer. * * @param leeway * The nanosecond leeway for the timer. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_source_set_timer(dispatch_source_t source, dispatch_time_t start, uint64_t interval, uint64_t leeway); /*! * @function dispatch_source_set_registration_handler * * @abstract * Sets the registration handler block for the given dispatch source. * * @discussion * The registration handler (if specified) will be submitted to the source's * target queue once the corresponding kevent() has been registered with the * system, following the initial dispatch_resume() of the source. * * If a source is already registered when the registration handler is set, the * registration handler will be invoked immediately. * * @param source * The dispatch source to modify. * The result of passing NULL in this parameter is undefined. * * @param handler * The registration handler block to submit to the source's target queue. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.7), ios(4.3)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_source_set_registration_handler(dispatch_source_t source, dispatch_block_t _Nullable handler); #endif /* __BLOCKS__ */ # 744 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" /*! * @function dispatch_source_set_registration_handler_f * * @abstract * Sets the registration handler function for the given dispatch source. * * @discussion * See dispatch_source_set_registration_handler() for more details. * * @param source * The dispatch source to modify. * The result of passing NULL in this parameter is undefined. * * @param handler * The registration handler function to submit to the source's target queue. * The context parameter passed to the registration handler function is the * current context of the dispatch source at the time the handler call is made. */ API_AVAILABLE(macos(10.7), ios(4.3)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_source_set_registration_handler_f(dispatch_source_t source, dispatch_function_t _Nullable handler); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 774 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/source.h" # 205 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 205 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/group.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_GROUP__ #define __DISPATCH_GROUP__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/group.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/group.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/group.h" DISPATCH_ASSUME_NONNULL_BEGIN /*! * @typedef dispatch_group_t * @abstract * A group of blocks submitted to queues for asynchronous invocation. */ DISPATCH_DECL(dispatch_group); __BEGIN_DECLS /*! * @function dispatch_group_create * * @abstract * Creates new group with which blocks may be associated. * * @discussion * This function creates a new group with which blocks may be associated. * The dispatch group may be used to wait for the completion of the blocks it * references. The group object memory is freed with dispatch_release(). * * @result * The newly created group, or NULL on failure. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_group_t dispatch_group_create(void); /*! * @function dispatch_group_async * * @abstract * Submits a block to a dispatch queue and associates the block with the given * dispatch group. * * @discussion * Submits a block to a dispatch queue and associates the block with the given * dispatch group. The dispatch group may be used to wait for the completion * of the blocks it references. * * @param group * A dispatch group to associate with the submitted block. * The result of passing NULL in this parameter is undefined. * * @param queue * The dispatch queue to which the block will be submitted for asynchronous * invocation. * * @param block * The block to perform asynchronously. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_group_async(dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block); #endif /* __BLOCKS__ */ # 91 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/group.h" /*! * @function dispatch_group_async_f * * @abstract * Submits a function to a dispatch queue and associates the block with the * given dispatch group. * * @discussion * See dispatch_group_async() for details. * * @param group * A dispatch group to associate with the submitted function. * The result of passing NULL in this parameter is undefined. * * @param queue * The dispatch queue to which the function will be submitted for asynchronous * invocation. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_group_async_f(). */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4 DISPATCH_NOTHROW void dispatch_group_async_f(dispatch_group_t group, dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); /*! * @function dispatch_group_wait * * @abstract * Wait synchronously until all the blocks associated with a group have * completed or until the specified timeout has elapsed. * * @discussion * This function waits for the completion of the blocks associated with the * given dispatch group, and returns after all blocks have completed or when * the specified timeout has elapsed. * * This function will return immediately if there are no blocks associated * with the dispatch group (i.e. the group is empty). * * The result of calling this function from multiple threads simultaneously * with the same dispatch group is undefined. * * After the successful return of this function, the dispatch group is empty. * It may either be released with dispatch_release() or re-used for additional * blocks. See dispatch_group_async() for more information. * * @param group * The dispatch group to wait on. * The result of passing NULL in this parameter is undefined. * * @param timeout * When to timeout (see dispatch_time). As a convenience, there are the * DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants. * * @result * Returns zero on success (all blocks associated with the group completed * within the specified timeout) or non-zero on error (i.e. timed out). */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW intptr_t dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout); /*! * @function dispatch_group_notify * * @abstract * Schedule a block to be submitted to a queue when all the blocks associated * with a group have completed. * * @discussion * This function schedules a notification block to be submitted to the specified * queue once all blocks associated with the dispatch group have completed. * * If no blocks are associated with the dispatch group (i.e. the group is empty) * then the notification block will be submitted immediately. * * The group will be empty at the time the notification block is submitted to * the target queue. The group may either be released with dispatch_release() * or reused for additional operations. * See dispatch_group_async() for more information. * * @param group * The dispatch group to observe. * The result of passing NULL in this parameter is undefined. * * @param queue * The queue to which the supplied block will be submitted when the group * completes. * * @param block * The block to submit when the group completes. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_group_notify(dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block); #endif /* __BLOCKS__ */ # 204 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/group.h" /*! * @function dispatch_group_notify_f * * @abstract * Schedule a function to be submitted to a queue when all the blocks * associated with a group have completed. * * @discussion * See dispatch_group_notify() for details. * * @param group * The dispatch group to observe. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_group_notify_f(). */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4 DISPATCH_NOTHROW void dispatch_group_notify_f(dispatch_group_t group, dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); /*! * @function dispatch_group_enter * * @abstract * Manually indicate a block has entered the group * * @discussion * Calling this function indicates another block has joined the group through * a means other than dispatch_group_async(). Calls to this function must be * balanced with dispatch_group_leave(). * * @param group * The dispatch group to update. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_group_enter(dispatch_group_t group); /*! * @function dispatch_group_leave * * @abstract * Manually indicate a block in the group has completed * * @discussion * Calling this function indicates block has completed and left the dispatch * group by a means other than dispatch_group_async(). * * @param group * The dispatch group to update. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_group_leave(dispatch_group_t group); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 280 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/group.h" # 206 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 206 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/semaphore.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_SEMAPHORE__ #define __DISPATCH_SEMAPHORE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/semaphore.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/semaphore.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/semaphore.h" DISPATCH_ASSUME_NONNULL_BEGIN /*! * @typedef dispatch_semaphore_t * * @abstract * A counting semaphore. */ DISPATCH_DECL(dispatch_semaphore); __BEGIN_DECLS /*! * @function dispatch_semaphore_create * * @abstract * Creates new counting semaphore with an initial value. * * @discussion * Passing zero for the value is useful for when two threads need to reconcile * the completion of a particular event. Passing a value greater than zero is * useful for managing a finite pool of resources, where the pool size is equal * to the value. * * @param value * The starting value for the semaphore. Passing a value less than zero will * cause NULL to be returned. * * @result * The newly created semaphore, or NULL on failure. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_semaphore_t dispatch_semaphore_create(intptr_t value); /*! * @function dispatch_semaphore_wait * * @abstract * Wait (decrement) for a semaphore. * * @discussion * Decrement the counting semaphore. If the resulting value is less than zero, * this function waits for a signal to occur before returning. * * @param dsema * The semaphore. The result of passing NULL in this parameter is undefined. * * @param timeout * When to timeout (see dispatch_time). As a convenience, there are the * DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants. * * @result * Returns zero on success, or non-zero if the timeout occurred. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW intptr_t dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout); /*! * @function dispatch_semaphore_signal * * @abstract * Signal (increment) a semaphore. * * @discussion * Increment the counting semaphore. If the previous value was less than zero, * this function wakes a waiting thread before returning. * * @param dsema The counting semaphore. * The result of passing NULL in this parameter is undefined. * * @result * This function returns non-zero if a thread is woken. Otherwise, zero is * returned. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW intptr_t dispatch_semaphore_signal(dispatch_semaphore_t dsema); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif /* __DISPATCH_SEMAPHORE__ */ # 118 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/semaphore.h" # 207 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 207 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" 1 /* * Copyright (c) 2008-2010 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_ONCE__ #define __DISPATCH_ONCE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @typedef dispatch_once_t * * @abstract * A predicate for use with dispatch_once(). It must be initialized to zero. * Note: static and global variables default to zero. */ DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") typedef intptr_t dispatch_once_t; #if 0 /* disabled by -frewrite-includes */ #if defined(__x86_64__) || defined(__i386__) || defined(__s390x__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" #define DISPATCH_ONCE_INLINE_FASTPATH 1 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__APPLE__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" #define DISPATCH_ONCE_INLINE_FASTPATH 1 #else # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" #define DISPATCH_ONCE_INLINE_FASTPATH 0 #endif # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" /*! * @function dispatch_once * * @abstract * Execute a block once and only once. * * @param predicate * A pointer to a dispatch_once_t that is used to test whether the block has * completed or not. * * @param block * The block to execute once. * * @discussion * Always call dispatch_once() before using or testing any variables that are * initialized by the block. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") void dispatch_once(dispatch_once_t *predicate, DISPATCH_NOESCAPE dispatch_block_t block); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_ONCE_INLINE_FASTPATH #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") void _dispatch_once(dispatch_once_t *predicate, DISPATCH_NOESCAPE dispatch_block_t block) { if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) { dispatch_once(predicate, block); } else { dispatch_compiler_barrier(); } DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l); } #undef dispatch_once #define dispatch_once _dispatch_once #endif # 93 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" #endif // DISPATCH_ONCE_INLINE_FASTPATH # 94 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") void dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context, dispatch_function_t function); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_ONCE_INLINE_FASTPATH #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 103 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") void _dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context, dispatch_function_t function) { if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) { dispatch_once_f(predicate, context, function); } else { dispatch_compiler_barrier(); } DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l); } #undef dispatch_once_f #define dispatch_once_f _dispatch_once_f #endif // DISPATCH_ONCE_INLINE_FASTPATH # 120 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 126 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/once.h" # 208 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 208 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" 1 /* * Copyright (c) 2009-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_DATA__ #define __DISPATCH_DATA__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! @header * Dispatch data objects describe contiguous or sparse regions of memory that * may be managed by the system or by the application. * Dispatch data objects are immutable, any direct access to memory regions * represented by dispatch objects must not modify that memory. */ /*! * @typedef dispatch_data_t * A dispatch object representing memory regions. */ DISPATCH_DATA_DECL(dispatch_data); /*! * @var dispatch_data_empty * @discussion The singleton dispatch data object representing a zero-length * memory region. */ #define dispatch_data_empty \ DISPATCH_GLOBAL_OBJECT(dispatch_data_t, _dispatch_data_empty) API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT struct dispatch_data_s _dispatch_data_empty; /*! * @const DISPATCH_DATA_DESTRUCTOR_DEFAULT * @discussion The default destructor for dispatch data objects. * Used at data object creation to indicate that the supplied buffer should * be copied into internal storage managed by the system. */ #define DISPATCH_DATA_DESTRUCTOR_DEFAULT NULL #ifdef __BLOCKS__ /*! @parseOnly */ #define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \ DISPATCH_EXPORT const dispatch_block_t _dispatch_data_destructor_##name #else # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" #define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \ DISPATCH_EXPORT const dispatch_function_t \ _dispatch_data_destructor_##name #endif /* __BLOCKS__ */ # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" /*! * @const DISPATCH_DATA_DESTRUCTOR_FREE * @discussion The destructor for dispatch data objects created from a malloc'd * buffer. Used at data object creation to indicate that the supplied buffer * was allocated by the malloc() family and should be destroyed with free(3). */ #define DISPATCH_DATA_DESTRUCTOR_FREE (_dispatch_data_destructor_free) API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free); /*! * @const DISPATCH_DATA_DESTRUCTOR_MUNMAP * @discussion The destructor for dispatch data objects that have been created * from buffers that require deallocation with munmap(2). */ #define DISPATCH_DATA_DESTRUCTOR_MUNMAP (_dispatch_data_destructor_munmap) API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap); #ifdef __BLOCKS__ /*! * @function dispatch_data_create * Creates a dispatch data object from the given contiguous buffer of memory. If * a non-default destructor is provided, ownership of the buffer remains with * the caller (i.e. the bytes will not be copied). The last release of the data * object will result in the invocation of the specified destructor on the * specified queue to free the buffer. * * If the DISPATCH_DATA_DESTRUCTOR_FREE destructor is provided the buffer will * be freed via free(3) and the queue argument ignored. * * If the DISPATCH_DATA_DESTRUCTOR_DEFAULT destructor is provided, data object * creation will copy the buffer into internal memory managed by the system. * * @param buffer A contiguous buffer of data. * @param size The size of the contiguous buffer of data. * @param queue The queue to which the destructor should be submitted. * @param destructor The destructor responsible for freeing the data when it * is no longer needed. * @result A newly created dispatch data object. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_data_t dispatch_data_create(const void *buffer, size_t size, dispatch_queue_t _Nullable queue, dispatch_block_t _Nullable destructor); #endif /* __BLOCKS__ */ # 123 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" /*! * @function dispatch_data_get_size * Returns the logical size of the memory region(s) represented by the specified * dispatch data object. * * @param data The dispatch data object to query. * @result The number of bytes represented by the data object. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_PURE DISPATCH_NONNULL1 DISPATCH_NOTHROW size_t dispatch_data_get_size(dispatch_data_t data); /*! * @function dispatch_data_create_map * Maps the memory represented by the specified dispatch data object as a single * contiguous memory region and returns a new data object representing it. * If non-NULL references to a pointer and a size variable are provided, they * are filled with the location and extent of that region. These allow direct * read access to the represented memory, but are only valid until the returned * object is released. Under ARC, if that object is held in a variable with * automatic storage, care needs to be taken to ensure that it is not released * by the compiler before memory access via the pointer has been completed. * * @param data The dispatch data object to map. * @param buffer_ptr A pointer to a pointer variable to be filled with the * location of the mapped contiguous memory region, or * NULL. * @param size_ptr A pointer to a size_t variable to be filled with the * size of the mapped contiguous memory region, or NULL. * @result A newly created dispatch data object. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_data_t dispatch_data_create_map(dispatch_data_t data, const void *_Nullable *_Nullable buffer_ptr, size_t *_Nullable size_ptr); /*! * @function dispatch_data_create_concat * Returns a new dispatch data object representing the concatenation of the * specified data objects. Those objects may be released by the application * after the call returns (however, the system might not deallocate the memory * region(s) described by them until the newly created object has also been * released). * * @param data1 The data object representing the region(s) of memory to place * at the beginning of the newly created object. * @param data2 The data object representing the region(s) of memory to place * at the end of the newly created object. * @result A newly created object representing the concatenation of the * data1 and data2 objects. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_data_t dispatch_data_create_concat(dispatch_data_t data1, dispatch_data_t data2); /*! * @function dispatch_data_create_subrange * Returns a new dispatch data object representing a subrange of the specified * data object, which may be released by the application after the call returns * (however, the system might not deallocate the memory region(s) described by * that object until the newly created object has also been released). * * @param data The data object representing the region(s) of memory to * create a subrange of. * @param offset The offset into the data object where the subrange * starts. * @param length The length of the range. * @result A newly created object representing the specified * subrange of the data object. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_data_t dispatch_data_create_subrange(dispatch_data_t data, size_t offset, size_t length); #ifdef __BLOCKS__ /*! * @typedef dispatch_data_applier_t * A block to be invoked for every contiguous memory region in a data object. * * @param region A data object representing the current region. * @param offset The logical offset of the current region to the start * of the data object. * @param buffer The location of the memory for the current region. * @param size The size of the memory for the current region. * @result A Boolean indicating whether traversal should continue. */ typedef bool (^dispatch_data_applier_t)(dispatch_data_t region, size_t offset, const void *buffer, size_t size); /*! * @function dispatch_data_apply * Traverse the memory regions represented by the specified dispatch data object * in logical order and invoke the specified block once for every contiguous * memory region encountered. * * Each invocation of the block is passed a data object representing the current * region and its logical offset, along with the memory location and extent of * the region. These allow direct read access to the memory region, but are only * valid until the passed-in region object is released. Note that the region * object is released by the system when the block returns, it is the * responsibility of the application to retain it if the region object or the * associated memory location are needed after the block returns. * * @param data The data object to traverse. * @param applier The block to be invoked for every contiguous memory * region in the data object. * @result A Boolean indicating whether traversal completed * successfully. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW bool dispatch_data_apply(dispatch_data_t data, DISPATCH_NOESCAPE dispatch_data_applier_t applier); #endif /* __BLOCKS__ */ # 251 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" /*! * @function dispatch_data_copy_region * Finds the contiguous memory region containing the specified location among * the regions represented by the specified object and returns a copy of the * internal dispatch data object representing that region along with its logical * offset in the specified object. * * @param data The dispatch data object to query. * @param location The logical position in the data object to query. * @param offset_ptr A pointer to a size_t variable to be filled with the * logical offset of the returned region object to the * start of the queried data object. * @result A newly created dispatch data object. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_data_t dispatch_data_copy_region(dispatch_data_t data, size_t location, size_t *offset_ptr); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif /* __DISPATCH_DATA__ */ # 279 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/data.h" # 209 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 209 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" 1 /* * Copyright (c) 2009-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_IO__ #define __DISPATCH_IO__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! @header * Dispatch I/O provides both stream and random access asynchronous read and * write operations on file descriptors. One or more dispatch I/O channels may * be created from a file descriptor as either the DISPATCH_IO_STREAM type or * DISPATCH_IO_RANDOM type. Once a channel has been created the application may * schedule asynchronous read and write operations. * * The application may set policies on the dispatch I/O channel to indicate the * desired frequency of I/O handlers for long-running operations. * * Dispatch I/O also provides a memory management model for I/O buffers that * avoids unnecessary copying of data when pipelined between channels. Dispatch * I/O monitors the overall memory pressure and I/O access patterns for the * application to optimize resource utilization. */ /*! * @typedef dispatch_fd_t * Native file descriptor type for the platform. */ #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" typedef intptr_t dispatch_fd_t; #else # 56 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" typedef int dispatch_fd_t; #endif # 58 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" /*! * @functiongroup Dispatch I/O Convenience API * Convenience wrappers around the dispatch I/O channel API, with simpler * callback handler semantics and no explicit management of channel objects. * File descriptors passed to the convenience API are treated as streams, and * scheduling multiple operations on one file descriptor via the convenience API * may incur more overhead than by using the dispatch I/O channel API directly. */ #ifdef __BLOCKS__ /*! * @function dispatch_read * Schedule a read operation for asynchronous execution on the specified file * descriptor. The specified handler is enqueued with the data read from the * file descriptor when the operation has completed or an error occurs. * * The data object passed to the handler will be automatically released by the * system when the handler returns. It is the responsibility of the application * to retain, concatenate or copy the data object if it is needed after the * handler returns. * * The data object passed to the handler will only contain as much data as is * currently available from the file descriptor (up to the specified length). * * If an unrecoverable error occurs on the file descriptor, the handler will be * enqueued with the appropriate error code along with a data object of any data * that could be read successfully. * * An invocation of the handler with an error code of zero and an empty data * object indicates that EOF was reached. * * The system takes control of the file descriptor until the handler is * enqueued, and during this time file descriptor flags such as O_NONBLOCK will * be modified by the system on behalf of the application. It is an error for * the application to modify a file descriptor directly while it is under the * control of the system, but it may create additional dispatch I/O convenience * operations or dispatch I/O channels associated with that file descriptor. * * @param fd The file descriptor from which to read the data. * @param length The length of data to read from the file descriptor, * or SIZE_MAX to indicate that all of the data currently * available from the file descriptor should be read. * @param queue The dispatch queue to which the handler should be * submitted. * @param handler The handler to enqueue when data is ready to be * delivered. * param data The data read from the file descriptor. * param error An errno condition for the read operation or * zero if the read was successful. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NONNULL4 DISPATCH_NOTHROW void dispatch_read(dispatch_fd_t fd, size_t length, dispatch_queue_t queue, void (^handler)(dispatch_data_t data, int error)); /*! * @function dispatch_write * Schedule a write operation for asynchronous execution on the specified file * descriptor. The specified handler is enqueued when the operation has * completed or an error occurs. * * If an unrecoverable error occurs on the file descriptor, the handler will be * enqueued with the appropriate error code along with the data that could not * be successfully written. * * An invocation of the handler with an error code of zero indicates that the * data was fully written to the channel. * * The system takes control of the file descriptor until the handler is * enqueued, and during this time file descriptor flags such as O_NONBLOCK will * be modified by the system on behalf of the application. It is an error for * the application to modify a file descriptor directly while it is under the * control of the system, but it may create additional dispatch I/O convenience * operations or dispatch I/O channels associated with that file descriptor. * * @param fd The file descriptor to which to write the data. * @param data The data object to write to the file descriptor. * @param queue The dispatch queue to which the handler should be * submitted. * @param handler The handler to enqueue when the data has been written. * param data The data that could not be written to the I/O * channel, or NULL. * param error An errno condition for the write operation or * zero if the write was successful. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL3 DISPATCH_NONNULL4 DISPATCH_NOTHROW void dispatch_write(dispatch_fd_t fd, dispatch_data_t data, dispatch_queue_t queue, void (^handler)(dispatch_data_t _Nullable data, int error)); #endif /* __BLOCKS__ */ # 156 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" /*! * @functiongroup Dispatch I/O Channel API */ /*! * @typedef dispatch_io_t * A dispatch I/O channel represents the asynchronous I/O policy applied to a * file descriptor. I/O channels are first class dispatch objects and may be * retained and released, suspended and resumed, etc. */ DISPATCH_DECL(dispatch_io); /*! * @typedef dispatch_io_type_t * The type of a dispatch I/O channel: * * @const DISPATCH_IO_STREAM A dispatch I/O channel representing a stream of * bytes. Read and write operations on a channel of this type are performed * serially (in order of creation) and read/write data at the file pointer * position that is current at the time the operation starts executing. * Operations of different type (read vs. write) may be performed simultaneously. * Offsets passed to operations on a channel of this type are ignored. * * @const DISPATCH_IO_RANDOM A dispatch I/O channel representing a random * access file. Read and write operations on a channel of this type may be * performed concurrently and read/write data at the specified offset. Offsets * are interpreted relative to the file pointer position current at the time the * I/O channel is created. Attempting to create a channel of this type for a * file descriptor that is not seekable will result in an error. */ #define DISPATCH_IO_STREAM 0 #define DISPATCH_IO_RANDOM 1 typedef unsigned long dispatch_io_type_t; #ifdef __BLOCKS__ /*! * @function dispatch_io_create * Create a dispatch I/O channel associated with a file descriptor. The system * takes control of the file descriptor until the channel is closed, an error * occurs on the file descriptor or all references to the channel are released. * At that time the specified cleanup handler will be enqueued and control over * the file descriptor relinquished. * * While a file descriptor is under the control of a dispatch I/O channel, file * descriptor flags such as O_NONBLOCK will be modified by the system on behalf * of the application. It is an error for the application to modify a file * descriptor directly while it is under the control of a dispatch I/O channel, * but it may create additional channels associated with that file descriptor. * * @param type The desired type of I/O channel (DISPATCH_IO_STREAM * or DISPATCH_IO_RANDOM). * @param fd The file descriptor to associate with the I/O channel. * @param queue The dispatch queue to which the handler should be submitted. * @param cleanup_handler The handler to enqueue when the system * relinquishes control over the file descriptor. * param error An errno condition if control is relinquished * because channel creation failed, zero otherwise. * @result The newly created dispatch I/O channel or NULL if an error * occurred (invalid type specified). */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_io_t dispatch_io_create(dispatch_io_type_t type, dispatch_fd_t fd, dispatch_queue_t queue, void (^cleanup_handler)(int error)); /*! * @function dispatch_io_create_with_path * Create a dispatch I/O channel associated with a path name. The specified * path, oflag and mode parameters will be passed to open(2) when the first I/O * operation on the channel is ready to execute and the resulting file * descriptor will remain open and under the control of the system until the * channel is closed, an error occurs on the file descriptor or all references * to the channel are released. At that time the file descriptor will be closed * and the specified cleanup handler will be enqueued. * * @param type The desired type of I/O channel (DISPATCH_IO_STREAM * or DISPATCH_IO_RANDOM). * @param path The absolute path to associate with the I/O channel. * @param oflag The flags to pass to open(2) when opening the file at * path. * @param mode The mode to pass to open(2) when creating the file at * path (i.e. with flag O_CREAT), zero otherwise. * @param queue The dispatch queue to which the handler should be * submitted. * @param cleanup_handler The handler to enqueue when the system * has closed the file at path. * param error An errno condition if control is relinquished * because channel creation or opening of the * specified file failed, zero otherwise. * @result The newly created dispatch I/O channel or NULL if an error * occurred (invalid type or non-absolute path specified). */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_io_t dispatch_io_create_with_path(dispatch_io_type_t type, const char *path, int oflag, mode_t mode, dispatch_queue_t queue, void (^cleanup_handler)(int error)); /*! * @function dispatch_io_create_with_io * Create a new dispatch I/O channel from an existing dispatch I/O channel. * The new channel inherits the file descriptor or path name associated with * the existing channel, but not its channel type or policies. * * If the existing channel is associated with a file descriptor, control by the * system over that file descriptor is extended until the new channel is also * closed, an error occurs on the file descriptor, or all references to both * channels are released. At that time the specified cleanup handler will be * enqueued and control over the file descriptor relinquished. * * While a file descriptor is under the control of a dispatch I/O channel, file * descriptor flags such as O_NONBLOCK will be modified by the system on behalf * of the application. It is an error for the application to modify a file * descriptor directly while it is under the control of a dispatch I/O channel, * but it may create additional channels associated with that file descriptor. * * @param type The desired type of I/O channel (DISPATCH_IO_STREAM * or DISPATCH_IO_RANDOM). * @param io The existing channel to create the new I/O channel from. * @param queue The dispatch queue to which the handler should be submitted. * @param cleanup_handler The handler to enqueue when the system * relinquishes control over the file descriptor * (resp. closes the file at path) associated with * the existing channel. * param error An errno condition if control is relinquished * because channel creation failed, zero otherwise. * @result The newly created dispatch I/O channel or NULL if an error * occurred (invalid type specified). */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_io_t dispatch_io_create_with_io(dispatch_io_type_t type, dispatch_io_t io, dispatch_queue_t queue, void (^cleanup_handler)(int error)); /*! * @typedef dispatch_io_handler_t * The prototype of I/O handler blocks for dispatch I/O operations. * * @param done A flag indicating whether the operation is complete. * @param data The data object to be handled. * @param error An errno condition for the operation. */ typedef void (^dispatch_io_handler_t)(bool done, dispatch_data_t _Nullable data, int error); /*! * @function dispatch_io_read * Schedule a read operation for asynchronous execution on the specified I/O * channel. The I/O handler is enqueued one or more times depending on the * general load of the system and the policy specified on the I/O channel. * * Any data read from the channel is described by the dispatch data object * passed to the I/O handler. This object will be automatically released by the * system when the I/O handler returns. It is the responsibility of the * application to retain, concatenate or copy the data object if it is needed * after the I/O handler returns. * * Dispatch I/O handlers are not reentrant. The system will ensure that no new * I/O handler instance is invoked until the previously enqueued handler block * has returned. * * An invocation of the I/O handler with the done flag set indicates that the * read operation is complete and that the handler will not be enqueued again. * * If an unrecoverable error occurs on the I/O channel's underlying file * descriptor, the I/O handler will be enqueued with the done flag set, the * appropriate error code and a NULL data object. * * An invocation of the I/O handler with the done flag set, an error code of * zero and an empty data object indicates that EOF was reached. * * @param channel The dispatch I/O channel from which to read the data. * @param offset The offset relative to the channel position from which * to start reading (only for DISPATCH_IO_RANDOM). * @param length The length of data to read from the I/O channel, or * SIZE_MAX to indicate that data should be read until EOF * is reached. * @param queue The dispatch queue to which the I/O handler should be * submitted. * @param io_handler The I/O handler to enqueue when data is ready to be * delivered. * param done A flag indicating whether the operation is complete. * param data An object with the data most recently read from the * I/O channel as part of this read operation, or NULL. * param error An errno condition for the read operation or zero if * the read was successful. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL4 DISPATCH_NONNULL5 DISPATCH_NOTHROW void dispatch_io_read(dispatch_io_t channel, off_t offset, size_t length, dispatch_queue_t queue, dispatch_io_handler_t io_handler); /*! * @function dispatch_io_write * Schedule a write operation for asynchronous execution on the specified I/O * channel. The I/O handler is enqueued one or more times depending on the * general load of the system and the policy specified on the I/O channel. * * Any data remaining to be written to the I/O channel is described by the * dispatch data object passed to the I/O handler. This object will be * automatically released by the system when the I/O handler returns. It is the * responsibility of the application to retain, concatenate or copy the data * object if it is needed after the I/O handler returns. * * Dispatch I/O handlers are not reentrant. The system will ensure that no new * I/O handler instance is invoked until the previously enqueued handler block * has returned. * * An invocation of the I/O handler with the done flag set indicates that the * write operation is complete and that the handler will not be enqueued again. * * If an unrecoverable error occurs on the I/O channel's underlying file * descriptor, the I/O handler will be enqueued with the done flag set, the * appropriate error code and an object containing the data that could not be * written. * * An invocation of the I/O handler with the done flag set and an error code of * zero indicates that the data was fully written to the channel. * * @param channel The dispatch I/O channel on which to write the data. * @param offset The offset relative to the channel position from which * to start writing (only for DISPATCH_IO_RANDOM). * @param data The data to write to the I/O channel. The data object * will be retained by the system until the write operation * is complete. * @param queue The dispatch queue to which the I/O handler should be * submitted. * @param io_handler The I/O handler to enqueue when data has been delivered. * param done A flag indicating whether the operation is complete. * param data An object of the data remaining to be * written to the I/O channel as part of this write * operation, or NULL. * param error An errno condition for the write operation or zero * if the write was successful. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NONNULL4 DISPATCH_NONNULL5 DISPATCH_NOTHROW void dispatch_io_write(dispatch_io_t channel, off_t offset, dispatch_data_t data, dispatch_queue_t queue, dispatch_io_handler_t io_handler); #endif /* __BLOCKS__ */ # 419 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" /*! * @typedef dispatch_io_close_flags_t * The type of flags you can set on a dispatch_io_close() call * * @const DISPATCH_IO_STOP Stop outstanding operations on a channel when * the channel is closed. */ #define DISPATCH_IO_STOP 0x1 typedef unsigned long dispatch_io_close_flags_t; /*! * @function dispatch_io_close * Close the specified I/O channel to new read or write operations; scheduling * operations on a closed channel results in their handler returning an error. * * If the DISPATCH_IO_STOP flag is provided, the system will make a best effort * to interrupt any outstanding read and write operations on the I/O channel, * otherwise those operations will run to completion normally. * Partial results of read and write operations may be returned even after a * channel is closed with the DISPATCH_IO_STOP flag. * The final invocation of an I/O handler of an interrupted operation will be * passed an ECANCELED error code, as will the I/O handler of an operation * scheduled on a closed channel. * * @param channel The dispatch I/O channel to close. * @param flags The flags for the close operation. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_io_close(dispatch_io_t channel, dispatch_io_close_flags_t flags); #ifdef __BLOCKS__ /*! * @function dispatch_io_barrier * Schedule a barrier operation on the specified I/O channel; all previously * scheduled operations on the channel will complete before the provided * barrier block is enqueued onto the global queue determined by the channel's * target queue, and no subsequently scheduled operations will start until the * barrier block has returned. * * If multiple channels are associated with the same file descriptor, a barrier * operation scheduled on any of these channels will act as a barrier across all * channels in question, i.e. all previously scheduled operations on any of the * channels will complete before the barrier block is enqueued, and no * operations subsequently scheduled on any of the channels will start until the * barrier block has returned. * * While the barrier block is running, it may safely operate on the channel's * underlying file descriptor with fsync(2), lseek(2) etc. (but not close(2)). * * @param channel The dispatch I/O channel to schedule the barrier on. * @param barrier The barrier block. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_io_barrier(dispatch_io_t channel, dispatch_block_t barrier); #endif /* __BLOCKS__ */ # 480 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" /*! * @function dispatch_io_get_descriptor * Returns the file descriptor underlying a dispatch I/O channel. * * Will return -1 for a channel closed with dispatch_io_close() and for a * channel associated with a path name that has not yet been open(2)ed. * * If called from a barrier block scheduled on a channel associated with a path * name that has not yet been open(2)ed, this will trigger the channel open(2) * operation and return the resulting file descriptor. * * @param channel The dispatch I/O channel to query. * @result The file descriptor underlying the channel, or -1. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_fd_t dispatch_io_get_descriptor(dispatch_io_t channel); /*! * @function dispatch_io_set_high_water * Set a high water mark on the I/O channel for all operations. * * The system will make a best effort to enqueue I/O handlers with partial * results as soon the number of bytes processed by an operation (i.e. read or * written) reaches the high water mark. * * The size of data objects passed to I/O handlers for this channel will never * exceed the specified high water mark. * * The default value for the high water mark is unlimited (i.e. SIZE_MAX). * * @param channel The dispatch I/O channel on which to set the policy. * @param high_water The number of bytes to use as a high water mark. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_io_set_high_water(dispatch_io_t channel, size_t high_water); /*! * @function dispatch_io_set_low_water * Set a low water mark on the I/O channel for all operations. * * The system will process (i.e. read or write) at least the low water mark * number of bytes for an operation before enqueueing I/O handlers with partial * results. * * The size of data objects passed to intermediate I/O handler invocations for * this channel (i.e. excluding the final invocation) will never be smaller than * the specified low water mark, except if the channel has an interval with the * DISPATCH_IO_STRICT_INTERVAL flag set or if EOF or an error was encountered. * * I/O handlers should be prepared to receive amounts of data significantly * larger than the low water mark in general. If an I/O handler requires * intermediate results of fixed size, set both the low and and the high water * mark to that size. * * The default value for the low water mark is unspecified, but must be assumed * to be such that intermediate handler invocations may occur. * If I/O handler invocations with partial results are not desired, set the * low water mark to SIZE_MAX. * * @param channel The dispatch I/O channel on which to set the policy. * @param low_water The number of bytes to use as a low water mark. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_io_set_low_water(dispatch_io_t channel, size_t low_water); /*! * @typedef dispatch_io_interval_flags_t * Type of flags to set on dispatch_io_set_interval() * * @const DISPATCH_IO_STRICT_INTERVAL Enqueue I/O handlers at a channel's * interval setting even if the amount of data ready to be delivered is inferior * to the low water mark (or zero). */ #define DISPATCH_IO_STRICT_INTERVAL 0x1 typedef unsigned long dispatch_io_interval_flags_t; /*! * @function dispatch_io_set_interval * Set a nanosecond interval at which I/O handlers are to be enqueued on the * I/O channel for all operations. * * This allows an application to receive periodic feedback on the progress of * read and write operations, e.g. for the purposes of displaying progress bars. * * If the amount of data ready to be delivered to an I/O handler at the interval * is inferior to the channel low water mark, the handler will only be enqueued * if the DISPATCH_IO_STRICT_INTERVAL flag is set. * * Note that the system may defer enqueueing interval I/O handlers by a small * unspecified amount of leeway in order to align with other system activity for * improved system performance or power consumption. * * @param channel The dispatch I/O channel on which to set the policy. * @param interval The interval in nanoseconds at which delivery of the I/O * handler is desired. * @param flags Flags indicating desired data delivery behavior at * interval time. */ API_AVAILABLE(macos(10.7), ios(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_io_set_interval(dispatch_io_t channel, uint64_t interval, dispatch_io_interval_flags_t flags); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif /* __DISPATCH_IO__ */ # 598 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/dispatch/io.h" # 210 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 /* private.h must be included last to avoid picking up installed headers. */ #if 0 /* disabled by -frewrite-includes */ #if !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 213 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 213 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/pthread.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu * Copyright (c) 1995-1998 by John Birrell * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Chris Provenzano. * 4. The name of Chris Provenzano may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _PTHREAD_H_ #define _PTHREAD_H_ /* * Header files. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/pthread.h" 3 4 # 44 "/usr/include/pthread.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/pthread.h" 3 4 # 45 "/usr/include/pthread.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/pthread.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_limits.h" 3 4 # 7 "/usr/include/machine/_limits.h" 3 4 # 46 "/usr/include/pthread.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 46 "/usr/include/pthread.h" 3 4 # 47 "/usr/include/pthread.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/usr/include/pthread.h" 3 4 # 48 "/usr/include/pthread.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 48 "/usr/include/pthread.h" 3 4 # 1 "/usr/include/sched.h" 1 3 4 /*- * Copyright (c) 2021 The FreeBSD Foundation * * This software were developed by Konstantin Belousov * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef __SCHED_H__ #define __SCHED_H__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/usr/include/sched.h" 3 4 # 33 "/usr/include/sched.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/usr/include/sched.h" 3 4 # 34 "/usr/include/sched.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/include/sched.h" 3 4 # 1 "/usr/include/sys/sched.h" 1 3 4 /*- * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) * * Copyright (c) 1996, 1997 * HD Associates, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by HD Associates, Inc * and Jukka Antero Ukkonen. * 4. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /*- * Copyright (c) 2002-2008, Jeffrey Roberson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SCHED_H_ #define _SCHED_H_ #ifdef _KERNEL /* * General scheduling info. * * sched_load: * Total runnable non-ithread threads in the system. * * sched_runnable: * Runnable threads for this processor. */ int sched_load(void); int sched_rr_interval(void); int sched_runnable(void); /* * Proc related scheduling hooks. */ void sched_exit(struct proc *p, struct thread *childtd); void sched_fork(struct thread *td, struct thread *childtd); void sched_fork_exit(struct thread *td); void sched_class(struct thread *td, int class); void sched_nice(struct proc *p, int nice); /* * Threads are switched in and out, block on resources, have temporary * priorities inherited from their procs, and use up cpu time. */ void sched_ap_entry(void); void sched_exit_thread(struct thread *td, struct thread *child); u_int sched_estcpu(struct thread *td); void sched_fork_thread(struct thread *td, struct thread *child); void sched_ithread_prio(struct thread *td, u_char prio); void sched_lend_prio(struct thread *td, u_char prio); void sched_lend_user_prio(struct thread *td, u_char pri); void sched_lend_user_prio_cond(struct thread *td, u_char pri); fixpt_t sched_pctcpu(struct thread *td); void sched_prio(struct thread *td, u_char prio); void sched_sleep(struct thread *td, int prio); void sched_switch(struct thread *td, int flags); void sched_throw(struct thread *td); void sched_unlend_prio(struct thread *td, u_char prio); void sched_user_prio(struct thread *td, u_char prio); void sched_userret_slowpath(struct thread *td); #ifdef RACCT #ifdef SCHED_4BSD fixpt_t sched_pctcpu_delta(struct thread *td); #endif # 114 "/usr/include/sys/sched.h" 3 4 #endif # 115 "/usr/include/sys/sched.h" 3 4 static inline void sched_userret(struct thread *td) { /* * XXX we cheat slightly on the locking here to avoid locking in * the usual case. Setting td_priority here is essentially an * incomplete workaround for not setting it properly elsewhere. * Now that some interrupt handlers are threads, not setting it * properly elsewhere can clobber it in the window between setting * it here and returning to user mode, so don't waste time setting * it perfectly here. */ KASSERT((td->td_flags & TDF_BORROWING) == 0, ("thread with borrowed priority returning to userland")); if (__predict_false(td->td_priority != td->td_user_pri)) sched_userret_slowpath(td); } /* * Threads are moved on and off of run queues */ void sched_add(struct thread *td, int flags); struct thread *sched_choose(void); void sched_clock(struct thread *td, int cnt); void sched_idletd(void *); void sched_preempt(struct thread *td); void sched_relinquish(struct thread *td); void sched_rem(struct thread *td); void sched_wakeup(struct thread *td, int srqflags); /* * Binding makes cpu affinity permanent while pinning is used to temporarily * hold a thread on a particular CPU. */ void sched_bind(struct thread *td, int cpu); static __inline void sched_pin(void); void sched_unbind(struct thread *td); static __inline void sched_unpin(void); int sched_is_bound(struct thread *td); void sched_affinity(struct thread *td); /* * These procedures tell the process data structure allocation code how * many bytes to actually allocate. */ int sched_sizeof_proc(void); int sched_sizeof_thread(void); /* * This routine provides a consistent thread name for use with KTR graphing * functions. */ char *sched_tdname(struct thread *td); #ifdef KTR void sched_clear_tdname(struct thread *td); #endif # 173 "/usr/include/sys/sched.h" 3 4 static __inline void sched_pin(void) { curthread->td_pinned++; atomic_interrupt_fence(); } static __inline void sched_unpin(void) { atomic_interrupt_fence(); curthread->td_pinned--; } /* sched_add arguments (formerly setrunqueue) */ #define SRQ_BORING 0x0000 /* No special circumstances. */ #define SRQ_YIELDING 0x0001 /* We are yielding (from mi_switch). */ #define SRQ_OURSELF 0x0002 /* It is ourself (from mi_switch). */ #define SRQ_INTR 0x0004 /* It is probably urgent. */ #define SRQ_PREEMPTED 0x0008 /* has been preempted.. be kind */ #define SRQ_BORROWING 0x0010 /* Priority updated due to prio_lend */ #define SRQ_HOLD 0x0020 /* Return holding original td lock */ #define SRQ_HOLDTD 0x0040 /* Return holding td lock */ /* Scheduler stats. */ #ifdef SCHED_STATS DPCPU_DECLARE(long, sched_switch_stats[SWT_COUNT]); #define SCHED_STAT_DEFINE_VAR(name, ptr, descr) \ static void name ## _add_proc(void *dummy __unused) \ { \ \ SYSCTL_ADD_PROC(NULL, \ SYSCTL_STATIC_CHILDREN(_kern_sched_stats), OID_AUTO, \ #name, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE, \ ptr, 0, sysctl_dpcpu_long, "LU", descr); \ } \ SYSINIT(name, SI_SUB_LAST, SI_ORDER_MIDDLE, name ## _add_proc, NULL); #define SCHED_STAT_DEFINE(name, descr) \ DPCPU_DEFINE(unsigned long, name); \ SCHED_STAT_DEFINE_VAR(name, &DPCPU_NAME(name), descr) /* * Sched stats are always incremented in critical sections so no atomic * is necesssary to increment them. */ #define SCHED_STAT_INC(var) DPCPU_GET(var)++; #else # 222 "/usr/include/sys/sched.h" 3 4 #define SCHED_STAT_DEFINE_VAR(name, descr, ptr) #define SCHED_STAT_DEFINE(name, descr) #define SCHED_STAT_INC(var) (void)0 #endif # 226 "/usr/include/sys/sched.h" 3 4 /* * Fixup scheduler state for proc0 and thread0 */ void schedinit(void); /* * Fixup scheduler state for secondary APs */ void schedinit_ap(void); #endif /* _KERNEL */ # 237 "/usr/include/sys/sched.h" 3 4 /* POSIX 1003.1b Process Scheduling */ /* * POSIX scheduling policies */ #define SCHED_FIFO 1 #define SCHED_OTHER 2 #define SCHED_RR 3 struct sched_param { int sched_priority; }; /* * POSIX scheduling declarations for userland. */ #ifndef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 255 "/usr/include/sys/sched.h" 3 4 # 256 "/usr/include/sys/sched.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 256 "/usr/include/sys/sched.h" 3 4 # 257 "/usr/include/sys/sched.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 257 "/usr/include/sys/sched.h" 3 4 # 258 "/usr/include/sys/sched.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif # 263 "/usr/include/sys/sched.h" 3 4 __BEGIN_DECLS int sched_get_priority_max(int); int sched_get_priority_min(int); int sched_getparam(pid_t, struct sched_param *); int sched_getscheduler(pid_t); int sched_rr_get_interval(pid_t, struct timespec *); int sched_setparam(pid_t, const struct sched_param *); int sched_setscheduler(pid_t, int, const struct sched_param *); int sched_yield(void); __END_DECLS #endif # 276 "/usr/include/sys/sched.h" 3 4 #endif /* !_SCHED_H_ */ # 277 "/usr/include/sys/sched.h" 3 4 # 35 "/usr/include/sched.h" 2 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 36 "/usr/include/sched.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/sched.h" 3 4 # 1 "/usr/include/sys/cpuset.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2008, Jeffrey Roberson * All rights reserved. * * Copyright (c) 2008 Nokia Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_CPUSET_H_ #define _SYS_CPUSET_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/sys/cpuset.h" 3 4 # 1 "/usr/include/sys/_cpuset.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2008, Jeffrey Roberson * All rights reserved. * * Copyright (c) 2008 Nokia Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__CPUSET_H_ #define _SYS__CPUSET_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/sys/_cpuset.h" 3 4 # 1 "/usr/include/sys/_bitset.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2008, Jeffrey Roberson * All rights reserved. * * Copyright (c) 2008 Nokia Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__BITSET_H_ #define _SYS__BITSET_H_ /* * Macros addressing word and bit within it, tuned to make compiler * optimize cases when SETSIZE fits into single machine word. */ #define _BITSET_BITS (sizeof(long) * 8) #define __howmany(x, y) (((x) + ((y) - 1)) / (y)) #define __bitset_words(_s) (__howmany(_s, _BITSET_BITS)) #define __BITSET_DEFINE(_t, _s) \ struct _t { \ long __bits[__bitset_words((_s))]; \ } /* * Helper to declare a bitset without it's size being a constant. * * Sadly we cannot declare a bitset struct with 'bits[]', because it's * the only member of the struct and the compiler complains. */ #define __BITSET_DEFINE_VAR(_t) __BITSET_DEFINE(_t, 1) /* * Define a default type that can be used while manually specifying size * to every call. */ #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 66 "/usr/include/sys/_bitset.h" 3 4 __BITSET_DEFINE(bitset, 1); #define BITSET_DEFINE(_t, _s) __BITSET_DEFINE(_t, _s) #define BITSET_DEFINE_VAR(_t) __BITSET_DEFINE_VAR(_t) #endif /* defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) */ # 71 "/usr/include/sys/_bitset.h" 3 4 #endif /* !_SYS__BITSET_H_ */ # 73 "/usr/include/sys/_bitset.h" 3 4 # 38 "/usr/include/sys/_cpuset.h" 2 3 4 #ifdef _KERNEL #define CPU_SETSIZE MAXCPU #endif # 42 "/usr/include/sys/_cpuset.h" 3 4 #define CPU_MAXSIZE 256 #ifndef CPU_SETSIZE #define CPU_SETSIZE CPU_MAXSIZE #endif # 48 "/usr/include/sys/_cpuset.h" 3 4 __BITSET_DEFINE(_cpuset, CPU_SETSIZE); typedef struct _cpuset cpuset_t; #ifndef _KERNEL __BEGIN_DECLS cpuset_t *__cpuset_alloc(size_t set_size); void __cpuset_free(cpuset_t *ptr); __END_DECLS #endif # 58 "/usr/include/sys/_cpuset.h" 3 4 #endif /* !_SYS__CPUSET_H_ */ # 60 "/usr/include/sys/_cpuset.h" 3 4 # 38 "/usr/include/sys/cpuset.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/cpuset.h" 3 4 # 40 "/usr/include/sys/cpuset.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/sys/cpuset.h" 3 4 # 1 "/usr/include/sys/bitset.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2008, Jeffrey Roberson * All rights reserved. * * Copyright (c) 2008 Nokia Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_BITSET_H_ #define _SYS_BITSET_H_ /* * Whether expr is both constant and true. Result is itself constant. * Used to enable optimizations for sets with a known small size. */ #define __constexpr_cond(expr) (__builtin_constant_p((expr)) && (expr)) #define __bitset_mask(_s, n) \ (1UL << (__constexpr_cond(__bitset_words((_s)) == 1) ? \ (__size_t)(n) : ((n) % _BITSET_BITS))) #define __bitset_word(_s, n) \ (__constexpr_cond(__bitset_words((_s)) == 1) ? \ 0 : ((n) / _BITSET_BITS)) #define __BIT_CLR(_s, n, p) \ ((p)->__bits[__bitset_word(_s, n)] &= ~__bitset_mask((_s), (n))) #define __BIT_COPY(_s, f, t) (void)(*(t) = *(f)) #define __BIT_ISSET(_s, n, p) \ ((((p)->__bits[__bitset_word(_s, n)] & __bitset_mask((_s), (n))) != 0)) #define __BIT_SET(_s, n, p) \ ((p)->__bits[__bitset_word(_s, n)] |= __bitset_mask((_s), (n))) #define __BIT_ZERO(_s, p) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (p)->__bits[__i] = 0L; \ } while (0) #define __BIT_FILL(_s, p) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (p)->__bits[__i] = -1L; \ } while (0) #define __BIT_SETOF(_s, n, p) do { \ __BIT_ZERO(_s, p); \ (p)->__bits[__bitset_word(_s, n)] = __bitset_mask((_s), (n)); \ } while (0) /* Is p empty. */ #define __BIT_EMPTY(_s, p) __extension__ ({ \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ if ((p)->__bits[__i]) \ break; \ __i == __bitset_words((_s)); \ }) /* Is p full set. */ #define __BIT_ISFULLSET(_s, p) __extension__ ({ \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ if ((p)->__bits[__i] != (long)-1) \ break; \ __i == __bitset_words((_s)); \ }) /* Is c a subset of p. */ #define __BIT_SUBSET(_s, p, c) __extension__ ({ \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ if (((c)->__bits[__i] & \ (p)->__bits[__i]) != \ (c)->__bits[__i]) \ break; \ __i == __bitset_words((_s)); \ }) /* Are there any common bits between b & c? */ #define __BIT_OVERLAP(_s, p, c) __extension__ ({ \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ if (((c)->__bits[__i] & \ (p)->__bits[__i]) != 0) \ break; \ __i != __bitset_words((_s)); \ }) /* Compare two sets, returns 0 if equal 1 otherwise. */ #define __BIT_CMP(_s, p, c) __extension__ ({ \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ if (((c)->__bits[__i] != \ (p)->__bits[__i])) \ break; \ __i != __bitset_words((_s)); \ }) #define __BIT_OR(_s, d, s) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] |= (s)->__bits[__i]; \ } while (0) #define __BIT_OR2(_s, d, s1, s2) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] = (s1)->__bits[__i] | (s2)->__bits[__i];\ } while (0) #define __BIT_AND(_s, d, s) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] &= (s)->__bits[__i]; \ } while (0) #define __BIT_AND2(_s, d, s1, s2) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] = (s1)->__bits[__i] & (s2)->__bits[__i];\ } while (0) #define __BIT_ANDNOT(_s, d, s) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] &= ~(s)->__bits[__i]; \ } while (0) #define __BIT_ANDNOT2(_s, d, s1, s2) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] = (s1)->__bits[__i] & ~(s2)->__bits[__i];\ } while (0) #define __BIT_XOR(_s, d, s) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] ^= (s)->__bits[__i]; \ } while (0) #define __BIT_XOR2(_s, d, s1, s2) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] = (s1)->__bits[__i] ^ (s2)->__bits[__i];\ } while (0) /* * Note, the atomic(9) API is not consistent between clear/set and * testandclear/testandset in whether the value argument is a mask * or a bit index. */ #define __BIT_CLR_ATOMIC(_s, n, p) \ atomic_clear_long(&(p)->__bits[__bitset_word(_s, n)], \ __bitset_mask((_s), n)) #define __BIT_SET_ATOMIC(_s, n, p) \ atomic_set_long(&(p)->__bits[__bitset_word(_s, n)], \ __bitset_mask((_s), n)) #define __BIT_SET_ATOMIC_ACQ(_s, n, p) \ atomic_set_acq_long(&(p)->__bits[__bitset_word(_s, n)], \ __bitset_mask((_s), n)) #define __BIT_TEST_CLR_ATOMIC(_s, n, p) \ (atomic_testandclear_long( \ &(p)->__bits[__bitset_word((_s), (n))], (n)) != 0) #define __BIT_TEST_SET_ATOMIC(_s, n, p) \ (atomic_testandset_long( \ &(p)->__bits[__bitset_word((_s), (n))], (n)) != 0) /* Convenience functions catering special cases. */ #define __BIT_AND_ATOMIC(_s, d, s) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ atomic_clear_long(&(d)->__bits[__i], \ ~(s)->__bits[__i]); \ } while (0) #define __BIT_OR_ATOMIC(_s, d, s) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ atomic_set_long(&(d)->__bits[__i], \ (s)->__bits[__i]); \ } while (0) #define __BIT_COPY_STORE_REL(_s, f, t) do { \ __size_t __i; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ atomic_store_rel_long(&(t)->__bits[__i], \ (f)->__bits[__i]); \ } while (0) /* * Note that `start` and the returned value from __BIT_FFS_AT are * 1-based bit indices. */ #define __BIT_FFS_AT(_s, p, start) __extension__ ({ \ __size_t __i; \ long __bit, __mask; \ \ __mask = ~0UL << ((start) % _BITSET_BITS); \ __bit = 0; \ for (__i = __bitset_word((_s), (start)); \ __i < __bitset_words((_s)); \ __i++) { \ if (((p)->__bits[__i] & __mask) != 0) { \ __bit = ffsl((p)->__bits[__i] & __mask); \ __bit += __i * _BITSET_BITS; \ break; \ } \ __mask = ~0UL; \ } \ __bit; \ }) #define __BIT_FFS(_s, p) __BIT_FFS_AT((_s), (p), 0) #define __BIT_FLS(_s, p) __extension__ ({ \ __size_t __i; \ long __bit; \ \ __bit = 0; \ for (__i = __bitset_words((_s)); __i > 0; __i--) { \ if ((p)->__bits[__i - 1] != 0) { \ __bit = flsl((p)->__bits[__i - 1]); \ __bit += (__i - 1) * _BITSET_BITS; \ break; \ } \ } \ __bit; \ }) #define __BIT_COUNT(_s, p) __extension__ ({ \ __size_t __i; \ long __count; \ \ __count = 0; \ for (__i = 0; __i < __bitset_words((_s)); __i++) \ __count += __bitcountl((p)->__bits[__i]); \ __count; \ }) #define __BIT_FOREACH_ADVANCE(_s, i, p, op) __extension__ ({ \ int __found; \ for (;;) { \ if (__bits != 0) { \ int __bit = ffsl(__bits) - 1; \ __bits &= ~(1ul << __bit); \ (i) = __i * _BITSET_BITS + __bit; \ __found = 1; \ break; \ } \ if (++__i == __bitset_words(_s)) { \ __found = 0; \ break; \ } \ __bits = op((p)->__bits[__i]); \ } \ __found != 0; \ }) /* * Non-destructively loop over all set or clear bits in the set. */ #define __BIT_FOREACH(_s, i, p, op) \ for (long __i = -1, __bits = 0; \ __BIT_FOREACH_ADVANCE(_s, i, p, op); ) #define __BIT_FOREACH_ISSET(_s, i, p) __BIT_FOREACH(_s, i, p, ) #define __BIT_FOREACH_ISCLR(_s, i, p) __BIT_FOREACH(_s, i, p, ~) #define __BITSET_T_INITIALIZER(x) \ { .__bits = { x } } #define __BITSET_FSET(n) \ [ 0 ... ((n) - 1) ] = (-1L) #define __BITSET_SIZE(_s) (__bitset_words((_s)) * sizeof(long)) #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 312 "/usr/include/sys/bitset.h" 3 4 /* * Dynamically allocate a bitset. */ #define BIT_AND(_s, d, s) __BIT_AND(_s, d, s) #define BIT_AND2(_s, d, s1, s2) __BIT_AND2(_s, d, s1, s2) #define BIT_ANDNOT(_s, d, s) __BIT_ANDNOT(_s, d, s) #define BIT_ANDNOT2(_s, d, s1, s2) __BIT_ANDNOT2(_s, d, s1, s2) #define BIT_AND_ATOMIC(_s, d, s) __BIT_AND_ATOMIC(_s, d, s) #define BIT_CLR(_s, n, p) __BIT_CLR(_s, n, p) #define BIT_CLR_ATOMIC(_s, n, p) __BIT_CLR_ATOMIC(_s, n, p) #define BIT_CMP(_s, p, c) __BIT_CMP(_s, p, c) #define BIT_COPY(_s, f, t) __BIT_COPY(_s, f, t) #define BIT_COPY_STORE_REL(_s, f, t) __BIT_COPY_STORE_REL(_s, f, t) #define BIT_COUNT(_s, p) __BIT_COUNT(_s, p) #define BIT_EMPTY(_s, p) __BIT_EMPTY(_s, p) #define BIT_FFS(_s, p) __BIT_FFS(_s, p) #define BIT_FFS_AT(_s, p, start) __BIT_FFS_AT(_s, p, start) #define BIT_FILL(_s, p) __BIT_FILL(_s, p) #define BIT_FLS(_s, p) __BIT_FLS(_s, p) #define BIT_FOREACH(_s, i, p, op) __BIT_FOREACH(_s, i, p, op) #define BIT_FOREACH_ADVANCE(_s, i, p, op) __BIT_FOREACH_ADVANCE(_s, i, p, op) #define BIT_FOREACH_ISCLR(_s, i, p) __BIT_FOREACH_ISCLR(_s, i, p) #define BIT_FOREACH_ISSET(_s, i, p) __BIT_FOREACH_ISSET(_s, i, p) #define BIT_ISFULLSET(_s, p) __BIT_ISFULLSET(_s, p) #define BIT_ISSET(_s, n, p) __BIT_ISSET(_s, n, p) #define BIT_OR(_s, d, s) __BIT_OR(_s, d, s) #define BIT_OR2(_s, d, s1, s2) __BIT_OR2(_s, d, s1, s2) #define BIT_OR_ATOMIC(_s, d, s) __BIT_OR_ATOMIC(_s, d, s) #define BIT_OVERLAP(_s, p, c) __BIT_OVERLAP(_s, p, c) #define BIT_SET(_s, n, p) __BIT_SET(_s, n, p) #define BIT_SETOF(_s, n, p) __BIT_SETOF(_s, n, p) #define BIT_SET_ATOMIC(_s, n, p) __BIT_SET_ATOMIC(_s, n, p) #define BIT_SET_ATOMIC_ACQ(_s, n, p) __BIT_SET_ATOMIC_ACQ(_s, n, p) #define BIT_SUBSET(_s, p, c) __BIT_SUBSET(_s, p, c) #define BIT_TEST_CLR_ATOMIC(_s, n, p) __BIT_TEST_CLR_ATOMIC(_s, n, p) #define BIT_TEST_SET_ATOMIC(_s, n, p) __BIT_TEST_SET_ATOMIC(_s, n, p) #define BIT_XOR(_s, d, s) __BIT_XOR(_s, d, s) #define BIT_XOR2(_s, d, s1, s2) __BIT_XOR2(_s, d, s1, s2) #define BIT_ZERO(_s, p) __BIT_ZERO(_s, p) #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 353 "/usr/include/sys/bitset.h" 3 4 #define BITSET_ALLOC(_s, mt, mf) malloc(__BITSET_SIZE((_s)), mt, (mf)) #define BITSET_FREE(p, mt) free(p, mt) #endif /* _KERNEL */ # 356 "/usr/include/sys/bitset.h" 3 4 #define BITSET_FSET(n) __BITSET_FSET(n) #define BITSET_SIZE(_s) __BITSET_SIZE(_s) #define BITSET_T_INITIALIZER(x) __BITSET_T_INITIALIZER(x) #endif /* defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) */ # 361 "/usr/include/sys/bitset.h" 3 4 #endif /* !_SYS_BITSET_H_ */ # 363 "/usr/include/sys/bitset.h" 3 4 # 41 "/usr/include/sys/cpuset.h" 2 3 4 #define _NCPUBITS _BITSET_BITS #define _NCPUWORDS __bitset_words(CPU_SETSIZE) #define CPUSETBUFSIZ ((2 + sizeof(long) * 2) * _NCPUWORDS) #define CPU_CLR(n, p) __BIT_CLR(CPU_SETSIZE, n, p) #define CPU_COPY(f, t) __BIT_COPY(CPU_SETSIZE, f, t) #define CPU_ISSET(n, p) __BIT_ISSET(CPU_SETSIZE, n, p) #define CPU_SET(n, p) __BIT_SET(CPU_SETSIZE, n, p) #define CPU_ZERO(p) __BIT_ZERO(CPU_SETSIZE, p) #define CPU_FILL(p) __BIT_FILL(CPU_SETSIZE, p) #define CPU_SETOF(n, p) __BIT_SETOF(CPU_SETSIZE, n, p) #define CPU_EQUAL(p, c) (__BIT_CMP(CPU_SETSIZE, p, c) == 0) #define CPU_EMPTY(p) __BIT_EMPTY(CPU_SETSIZE, p) #define CPU_ISFULLSET(p) __BIT_ISFULLSET(CPU_SETSIZE, p) #define CPU_SUBSET(p, c) __BIT_SUBSET(CPU_SETSIZE, p, c) #define CPU_OVERLAP(p, c) __BIT_OVERLAP(CPU_SETSIZE, p, c) #define CPU_CMP(p, c) __BIT_CMP(CPU_SETSIZE, p, c) #define CPU_OR(d, s1, s2) __BIT_OR2(CPU_SETSIZE, d, s1, s2) #define CPU_AND(d, s1, s2) __BIT_AND2(CPU_SETSIZE, d, s1, s2) #define CPU_ANDNOT(d, s1, s2) __BIT_ANDNOT2(CPU_SETSIZE, d, s1, s2) #define CPU_XOR(d, s1, s2) __BIT_XOR2(CPU_SETSIZE, d, s1, s2) #define CPU_CLR_ATOMIC(n, p) __BIT_CLR_ATOMIC(CPU_SETSIZE, n, p) #define CPU_SET_ATOMIC(n, p) __BIT_SET_ATOMIC(CPU_SETSIZE, n, p) #define CPU_SET_ATOMIC_ACQ(n, p) __BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p) #define CPU_AND_ATOMIC(n, p) __BIT_AND_ATOMIC(CPU_SETSIZE, n, p) #define CPU_OR_ATOMIC(d, s) __BIT_OR_ATOMIC(CPU_SETSIZE, d, s) #define CPU_COPY_STORE_REL(f, t) __BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) __BIT_FFS(CPU_SETSIZE, p) #define CPU_FLS(p) __BIT_FLS(CPU_SETSIZE, p) #define CPU_FOREACH_ISSET(i, p) __BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) #define CPU_FOREACH_ISCLR(i, p) __BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) #define CPU_COUNT(p) ((int)__BIT_COUNT(CPU_SETSIZE, p)) #define CPUSET_FSET __BITSET_FSET(_NCPUWORDS) #define CPUSET_T_INITIALIZER(x) __BITSET_T_INITIALIZER(x) #if 0 /* disabled by -frewrite-includes */ #if !defined(_KERNEL) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 79 "/usr/include/sys/cpuset.h" 3 4 #define CPU_ALLOC_SIZE(_s) __BITSET_SIZE(_s) #define CPU_ALLOC(_s) __cpuset_alloc(_s) #define CPU_FREE(p) __cpuset_free(p) #define CPU_ISSET_S(n, _s, p) __BIT_ISSET(_s, n, p) #define CPU_SET_S(n, _s, p) __BIT_SET(_s, n, p) #define CPU_CLR_S(n, _s, p) __BIT_CLR(_s, n, p) #define CPU_ZERO_S(_s, p) __BIT_ZERO(_s, p) #define CPU_OR_S(_s, d, s1, s2) __BIT_OR2(_s, d, s1, s2) #define CPU_AND_S(_s, d, s1, s2) __BIT_AND2(_s, d, s1, s2) #define CPU_XOR_S(_s, d, s1, s2) __BIT_XOR2(_s, d, s1, s2) #define CPU_COUNT_S(_s, p) ((int)__BIT_COUNT(_s, p)) #define CPU_EQUAL_S(_s, p, c) (__BIT_CMP(_s, p, c) == 0) #endif # 95 "/usr/include/sys/cpuset.h" 3 4 /* * Valid cpulevel_t values. */ #define CPU_LEVEL_ROOT 1 /* All system cpus. */ #define CPU_LEVEL_CPUSET 2 /* Available cpus for which. */ #define CPU_LEVEL_WHICH 3 /* Actual mask/id for which. */ /* * Valid cpuwhich_t values. */ #define CPU_WHICH_TID 1 /* Specifies a thread id. */ #define CPU_WHICH_PID 2 /* Specifies a process id. */ #define CPU_WHICH_CPUSET 3 /* Specifies a set id. */ #define CPU_WHICH_IRQ 4 /* Specifies an irq #. */ #define CPU_WHICH_JAIL 5 /* Specifies a jail id. */ #define CPU_WHICH_DOMAIN 6 /* Specifies a NUMA domain id. */ #define CPU_WHICH_INTRHANDLER 7 /* Specifies an irq # (not ithread). */ #define CPU_WHICH_ITHREAD 8 /* Specifies an irq's ithread. */ /* * Reserved cpuset identifiers. */ #define CPUSET_INVALID -1 #define CPUSET_DEFAULT 0 #ifdef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 122 "/usr/include/sys/cpuset.h" 3 4 # 123 "/usr/include/sys/cpuset.h" 3 4 LIST_HEAD(setlist, cpuset); /* * cpusets encapsulate cpu binding information for one or more threads. * * a - Accessed with atomics. * s - Set at creation, never modified. Only a ref required to read. * c - Locked internally by a cpuset lock. * * The bitmask is only modified while holding the cpuset lock. It may be * read while only a reference is held but the consumer must be prepared * to deal with inconsistent results. */ struct cpuset { volatile u_int cs_ref; /* (a) Reference count. */ int cs_flags; /* (s) Flags from below. */ LIST_ENTRY(cpuset) cs_link; /* (c) All identified sets. */ LIST_ENTRY(cpuset) cs_siblings; /* (c) Sibling set link. */ struct setlist cs_children; /* (c) List of children. */ struct domainset *cs_domain; /* (c) NUMA policy. */ cpusetid_t cs_id; /* (s) Id or INVALID. */ struct cpuset *cs_parent; /* (s) Pointer to our parent. */ cpuset_t cs_mask; /* bitmask of valid cpus. */ }; #define CPU_SET_ROOT 0x0001 /* Set is a root set. */ #define CPU_SET_RDONLY 0x0002 /* No modification allowed. */ extern cpuset_t *cpuset_root; struct prison; struct proc; struct thread; /* * Callbacks for copying in/out a cpuset or domainset. Used for alternate * ABIs, like compat32. */ struct cpuset_copy_cb { int (*cpuset_copyin)(const void *, void *, size_t); int (*cpuset_copyout)(const void *, void *, size_t); }; struct cpuset *cpuset_thread0(void); struct cpuset *cpuset_ref(struct cpuset *); void cpuset_rel(struct cpuset *); int cpuset_setthread(lwpid_t id, cpuset_t *); int cpuset_setithread(lwpid_t id, int cpu); int cpuset_create_root(struct prison *, struct cpuset **); int cpuset_setproc_update_set(struct proc *, struct cpuset *); int cpuset_which(cpuwhich_t, id_t, struct proc **, struct thread **, struct cpuset **); void cpuset_kernthread(struct thread *); char *cpusetobj_strprint(char *, const cpuset_t *); int cpusetobj_strscan(cpuset_t *, const char *); #ifdef DDB void ddb_display_cpuset(const cpuset_t *); #endif # 182 "/usr/include/sys/cpuset.h" 3 4 #else # 184 "/usr/include/sys/cpuset.h" 3 4 __BEGIN_DECLS int cpuset(cpusetid_t *); int cpuset_setid(cpuwhich_t, id_t, cpusetid_t); int cpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *); int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t *); int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const cpuset_t *); __END_DECLS #endif # 192 "/usr/include/sys/cpuset.h" 3 4 #endif /* !_SYS_CPUSET_H_ */ # 193 "/usr/include/sys/cpuset.h" 3 4 # 37 "/usr/include/sched.h" 2 3 4 struct _cpuset; typedef struct _cpuset cpu_set_t; #endif /* __BSD_VISIBLE */ # 40 "/usr/include/sched.h" 3 4 __BEGIN_DECLS #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 43 "/usr/include/sched.h" 3 4 int sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset); int sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset); int sched_getcpu(void); #endif /* __BSD_VISIBLE */ # 47 "/usr/include/sched.h" 3 4 __END_DECLS #endif /* __SCHED_H__ */ # 50 "/usr/include/sched.h" 3 4 # 49 "/usr/include/pthread.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 49 "/usr/include/pthread.h" 3 4 # 1 "/usr/include/time.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)time.h 8.3 (Berkeley) 1/21/94 */ /* * $FreeBSD$ */ #ifndef _TIME_H_ #define _TIME_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 46 "/usr/include/time.h" 3 4 # 47 "/usr/include/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/usr/include/time.h" 3 4 # 48 "/usr/include/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 48 "/usr/include/time.h" 3 4 # 49 "/usr/include/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 49 "/usr/include/time.h" 3 4 # 1 "/usr/include/sys/_clock_id.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _SYS_SYS__CLOCK_ID_H #define _SYS_SYS__CLOCK_ID_H /* * These macros are shared between time.h and sys/time.h. */ /* * Note: The values shown below as a comment for the __POSIX_VISIBLE values are * the ones FreeBSD traditionally used based on our reading of the POSIX * standards. However, glibc uses 199309 for all of them, even those many were * not defined there. To remain bug compatible with glibc means more software * that relied on the glibc behavior will compile easily on FreeBSD. * * Also, CLOCK_UPTIME_FAST is improperly visible temporarily for the lang/pocl * port until it can be updated properly. It incorrectly assumes that this was a * standard value. It will be moved back to the __BSD_VISIBLE section once the * issue is corrected. */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 /* 199506 */ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 49 "/usr/include/sys/_clock_id.h" 3 4 #define CLOCK_REALTIME 0 #endif /* __POSIX_VISIBLE >= 199309 */ # 51 "/usr/include/sys/_clock_id.h" 3 4 #ifdef __BSD_VISIBLE #define CLOCK_VIRTUAL 1 #define CLOCK_PROF 2 #endif /* __BSD_VISIBLE */ # 55 "/usr/include/sys/_clock_id.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 /* 200112 */ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 56 "/usr/include/sys/_clock_id.h" 3 4 #define CLOCK_MONOTONIC 4 #define CLOCK_UPTIME_FAST 8 #endif /* __POSIX_VISIBLE >= 199309 */ # 59 "/usr/include/sys/_clock_id.h" 3 4 #ifdef __BSD_VISIBLE /* * FreeBSD-specific clocks. */ #define CLOCK_UPTIME 5 #define CLOCK_UPTIME_PRECISE 7 #define CLOCK_REALTIME_PRECISE 9 #define CLOCK_REALTIME_FAST 10 #define CLOCK_MONOTONIC_PRECISE 11 #define CLOCK_MONOTONIC_FAST 12 #define CLOCK_SECOND 13 #endif /* __BSD_VISIBLE */ # 71 "/usr/include/sys/_clock_id.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 /* 200112 */ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 73 "/usr/include/sys/_clock_id.h" 3 4 #define CLOCK_THREAD_CPUTIME_ID 14 #define CLOCK_PROCESS_CPUTIME_ID 15 #endif /* __POSIX_VISIBLE >= 199309 */ # 76 "/usr/include/sys/_clock_id.h" 3 4 /* * Linux compatible names. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 81 "/usr/include/sys/_clock_id.h" 3 4 #define CLOCK_BOOTTIME CLOCK_UPTIME #define CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST #define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST #endif # 85 "/usr/include/sys/_clock_id.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 87 "/usr/include/sys/_clock_id.h" 3 4 #define TIMER_RELTIME 0x0 /* relative timer */ #endif # 89 "/usr/include/sys/_clock_id.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 90 "/usr/include/sys/_clock_id.h" 3 4 #define TIMER_ABSTIME 0x1 /* absolute timer */ #endif /* __POSIX_VISIBLE >= 199309 */ # 92 "/usr/include/sys/_clock_id.h" 3 4 #endif /* _SYS_SYS__CLOCK_ID_H */ # 94 "/usr/include/sys/_clock_id.h" 3 4 # 50 "/usr/include/time.h" 2 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 52 "/usr/include/time.h" 3 4 /* * Frequency of the clock ticks reported by times(). Deprecated - use * sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.) */ #define CLK_TCK 128 #endif # 58 "/usr/include/time.h" 3 4 /* Frequency of the clock ticks reported by clock(). */ #define CLOCKS_PER_SEC 128 #ifndef _CLOCK_T_DECLARED typedef __clock_t clock_t; #define _CLOCK_T_DECLARED #endif # 66 "/usr/include/time.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 71 "/usr/include/time.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 76 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 78 "/usr/include/time.h" 3 4 /* * New in POSIX 1003.1b-1993. */ #ifndef _CLOCKID_T_DECLARED typedef __clockid_t clockid_t; #define _CLOCKID_T_DECLARED #endif # 85 "/usr/include/time.h" 3 4 #ifndef _TIMER_T_DECLARED typedef __timer_t timer_t; #define _TIMER_T_DECLARED #endif # 90 "/usr/include/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 91 "/usr/include/time.h" 3 4 # 92 "/usr/include/time.h" 3 4 #endif /* __POSIX_VISIBLE >= 199309 */ # 93 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 95 "/usr/include/time.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif # 99 "/usr/include/time.h" 3 4 #endif # 100 "/usr/include/time.h" 3 4 struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ int tm_hour; /* hours since midnight [0-23] */ int tm_mday; /* day of the month [1-31] */ int tm_mon; /* months since January [0-11] */ int tm_year; /* years since 1900 */ int tm_wday; /* days since Sunday [0-6] */ int tm_yday; /* days since January 1 [0-365] */ int tm_isdst; /* Daylight Savings Time flag */ long tm_gmtoff; /* offset from UTC in seconds */ char *tm_zone; /* timezone abbreviation */ }; #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 116 "/usr/include/time.h" 3 4 extern char *tzname[]; #endif # 118 "/usr/include/time.h" 3 4 __BEGIN_DECLS char *asctime(const struct tm *); clock_t clock(void); char *ctime(const time_t *); #ifndef _STANDALONE double difftime(time_t, time_t); #endif # 126 "/usr/include/time.h" 3 4 /* XXX missing: getdate() */ struct tm *gmtime(const time_t *); struct tm *localtime(const time_t *); time_t mktime(struct tm *); size_t strftime(char * __restrict, size_t, const char * __restrict, const struct tm * __restrict); time_t time(time_t *); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 134 "/usr/include/time.h" 3 4 struct sigevent; int timer_create(clockid_t, struct sigevent *__restrict, timer_t *__restrict); int timer_delete(timer_t); int timer_gettime(timer_t, struct itimerspec *); int timer_getoverrun(timer_t); int timer_settime(timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict); #endif # 142 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 143 "/usr/include/time.h" 3 4 void tzset(void); #endif # 145 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 147 "/usr/include/time.h" 3 4 int clock_getres(clockid_t, struct timespec *); int clock_gettime(clockid_t, struct timespec *); int clock_settime(clockid_t, const struct timespec *); int nanosleep(const struct timespec *, struct timespec *); #endif /* __POSIX_VISIBLE >= 199309 */ # 152 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 154 "/usr/include/time.h" 3 4 int clock_getcpuclockid(pid_t, clockid_t *); int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *); #endif # 157 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 159 "/usr/include/time.h" 3 4 char *asctime_r(const struct tm *, char *); char *ctime_r(const time_t *, char *); struct tm *gmtime_r(const time_t *, struct tm *); struct tm *localtime_r(const time_t *, struct tm *); #endif # 164 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 166 "/usr/include/time.h" 3 4 char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict); #endif # 169 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 171 "/usr/include/time.h" 3 4 char *timezone(int, int); /* XXX XSI conflict */ void tzsetwall(void); time_t timelocal(struct tm * const); time_t timegm(struct tm * const); int timer_oshandle_np(timer_t timerid); time_t time2posix(time_t t); time_t posix2time(time_t t); #endif /* __BSD_VISIBLE */ # 179 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 181 "/usr/include/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 181 "/usr/include/time.h" 3 4 # 1 "/usr/include/xlocale/_time.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 The FreeBSD Foundation * * This software was developed by David Chisnall under sponsorship from * the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 37 "/usr/include/xlocale/_time.h" 3 4 /* * This file is included from both locale.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from locale.h. */ #ifndef _XLOCALE_LOCALE1_H #define _XLOCALE_LOCALE1_H size_t strftime_l(char * __restrict, size_t, const char * __restrict, const struct tm * __restrict, locale_t) __strftimelike(3, 0); #endif /* _XLOCALE_LOCALE1_H */ # 50 "/usr/include/xlocale/_time.h" 3 4 #ifdef _XLOCALE_H_ #ifndef _XLOCALE_LOCALE2_H #define _XLOCALE_LOCALE2_H char *strptime_l(const char * __restrict, const char * __restrict, struct tm * __restrict, locale_t); #endif /* _XLOCALE_LOCALE2_H */ # 59 "/usr/include/xlocale/_time.h" 3 4 #endif /* _XLOCALE_H_ */ # 60 "/usr/include/xlocale/_time.h" 3 4 # 182 "/usr/include/time.h" 2 3 4 #endif # 183 "/usr/include/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(__BSD_VISIBLE) || __ISO_C_VISIBLE >= 2011 || \ (defined(__cplusplus) && __cplusplus >= 201703) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 186 "/usr/include/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 186 "/usr/include/time.h" 3 4 # 187 "/usr/include/time.h" 3 4 /* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */ #define TIME_UTC 1 /* time elapsed since epoch */ int timespec_get(struct timespec *ts, int base); #endif # 191 "/usr/include/time.h" 3 4 __END_DECLS #endif /* !_TIME_H_ */ # 195 "/usr/include/time.h" 3 4 # 50 "/usr/include/pthread.h" 2 3 4 /* * Run-time invariant values: */ #define PTHREAD_DESTRUCTOR_ITERATIONS 4 #define PTHREAD_KEYS_MAX 256 #define PTHREAD_STACK_MIN __MINSIGSTKSZ #define PTHREAD_THREADS_MAX __ULONG_MAX #define PTHREAD_BARRIER_SERIAL_THREAD -1 /* * Flags for threads and thread attributes. */ #define PTHREAD_DETACHED 0x1 #define PTHREAD_SCOPE_SYSTEM 0x2 #define PTHREAD_INHERIT_SCHED 0x4 #define PTHREAD_NOFLOAT 0x8 #define PTHREAD_CREATE_DETACHED PTHREAD_DETACHED #define PTHREAD_CREATE_JOINABLE 0 #define PTHREAD_SCOPE_PROCESS 0 #define PTHREAD_EXPLICIT_SCHED 0 /* * Values for process shared/private attributes. */ #define PTHREAD_PROCESS_PRIVATE 0 #define PTHREAD_PROCESS_SHARED 1 /* * Flags for cancelling threads */ #define PTHREAD_CANCEL_ENABLE 0 #define PTHREAD_CANCEL_DISABLE 1 #define PTHREAD_CANCEL_DEFERRED 0 #define PTHREAD_CANCEL_ASYNCHRONOUS 2 #define PTHREAD_CANCELED ((void *) 1) /* * Flags for once initialization. */ #define PTHREAD_NEEDS_INIT 0 #define PTHREAD_DONE_INIT 1 /* * Static once initialization values. */ #define PTHREAD_ONCE_INIT { PTHREAD_NEEDS_INIT, NULL } /* * Static initialization values. */ #define PTHREAD_MUTEX_INITIALIZER NULL #define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP ((pthread_mutex_t)1) #define PTHREAD_COND_INITIALIZER NULL #define PTHREAD_RWLOCK_INITIALIZER NULL /* * Default attribute arguments (draft 4, deprecated). */ #ifndef PTHREAD_KERNEL #define pthread_condattr_default NULL #define pthread_mutexattr_default NULL #define pthread_attr_default NULL #endif # 115 "/usr/include/pthread.h" 3 4 #define PTHREAD_PRIO_NONE 0 #define PTHREAD_PRIO_INHERIT 1 #define PTHREAD_PRIO_PROTECT 2 /* * Mutex types (Single UNIX Specification, Version 2, 1997). * * Note that a mutex attribute with one of the following types: * * PTHREAD_MUTEX_NORMAL * PTHREAD_MUTEX_RECURSIVE * * will deviate from POSIX specified semantics. */ enum pthread_mutextype { PTHREAD_MUTEX_ERRORCHECK = 1, /* Default POSIX mutex */ PTHREAD_MUTEX_RECURSIVE = 2, /* Recursive mutex */ PTHREAD_MUTEX_NORMAL = 3, /* No error checking */ PTHREAD_MUTEX_ADAPTIVE_NP = 4, /* Adaptive mutex, spins briefly before blocking on lock */ PTHREAD_MUTEX_TYPE_MAX }; #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_ERRORCHECK #define PTHREAD_MUTEX_STALLED 0 #define PTHREAD_MUTEX_ROBUST 1 struct _pthread_cleanup_info { __uintptr_t pthread_cleanup_pad[8]; }; /* * Thread function prototype definitions: */ __BEGIN_DECLS int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); int pthread_attr_destroy(pthread_attr_t *); int pthread_attr_getstack( const pthread_attr_t * __restrict, void ** __restrict, size_t * __restrict); int pthread_attr_getstacksize(const pthread_attr_t * __restrict, size_t * __restrict); int pthread_attr_getguardsize(const pthread_attr_t * __restrict, size_t * __restrict); int pthread_attr_getstackaddr(const pthread_attr_t *, void **); int pthread_attr_getdetachstate(const pthread_attr_t *, int *); int pthread_attr_init(pthread_attr_t *); int pthread_attr_setstacksize(pthread_attr_t *, size_t); int pthread_attr_setguardsize(pthread_attr_t *, size_t); int pthread_attr_setstack(pthread_attr_t *, void *, size_t); int pthread_attr_setstackaddr(pthread_attr_t *, void *); int pthread_attr_setdetachstate(pthread_attr_t *, int); int pthread_barrier_destroy(pthread_barrier_t *); int pthread_barrier_init(pthread_barrier_t * __restrict, const pthread_barrierattr_t * __restrict, unsigned); int pthread_barrier_wait(pthread_barrier_t *); int pthread_barrierattr_destroy(pthread_barrierattr_t *); int pthread_barrierattr_getpshared( const pthread_barrierattr_t * __restrict, int * __restrict); int pthread_barrierattr_init(pthread_barrierattr_t *); int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); #define pthread_cleanup_push(cleanup_routine, cleanup_arg) \ { \ struct _pthread_cleanup_info __cleanup_info__; \ __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ &__cleanup_info__); \ { #define pthread_cleanup_pop(execute) \ (void)0; \ } \ __pthread_cleanup_pop_imp(execute); \ } int pthread_condattr_destroy(pthread_condattr_t *); int pthread_condattr_getclock(const pthread_condattr_t * __restrict, clockid_t * __restrict); int pthread_condattr_getpshared(const pthread_condattr_t *, int *); int pthread_condattr_init(pthread_condattr_t *); int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); int pthread_condattr_setpshared(pthread_condattr_t *, int); int pthread_cond_broadcast(pthread_cond_t *); int pthread_cond_destroy(pthread_cond_t *); int pthread_cond_init(pthread_cond_t * __restrict, const pthread_condattr_t * __restrict); int pthread_cond_signal(pthread_cond_t *); int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t * __mutex, const struct timespec *) __requires_exclusive(*__mutex); int pthread_cond_wait(pthread_cond_t * __restrict, pthread_mutex_t * __restrict __mutex) __requires_exclusive(*__mutex); int pthread_create(pthread_t * __restrict, const pthread_attr_t * __restrict, void *(*) (void *), void * __restrict); int pthread_detach(pthread_t); int pthread_equal(pthread_t, pthread_t); void pthread_exit(void *) __dead2; void *pthread_getspecific(pthread_key_t); int pthread_getcpuclockid(pthread_t, clockid_t *); int pthread_join(pthread_t, void **); int pthread_key_create(pthread_key_t *, void (*) (void *)); int pthread_key_delete(pthread_key_t); int pthread_mutexattr_init(pthread_mutexattr_t *); int pthread_mutexattr_destroy(pthread_mutexattr_t *); int pthread_mutexattr_getpshared( const pthread_mutexattr_t * __restrict, int * __restrict); int pthread_mutexattr_gettype( const pthread_mutexattr_t * __restrict, int * __restrict); int pthread_mutexattr_settype(pthread_mutexattr_t *, int); int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); int pthread_mutex_consistent(pthread_mutex_t * __mutex) __requires_exclusive(*__mutex); int pthread_mutex_destroy(pthread_mutex_t * __mutex) __requires_unlocked(*__mutex); int pthread_mutex_init(pthread_mutex_t * __restrict __mutex, const pthread_mutexattr_t * __restrict) __requires_unlocked(*__mutex); int pthread_mutex_lock(pthread_mutex_t * __mutex) __locks_exclusive(*__mutex); int pthread_mutex_trylock(pthread_mutex_t * __mutex) __trylocks_exclusive(0, *__mutex); int pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex, const struct timespec * __restrict) __trylocks_exclusive(0, *__mutex); int pthread_mutex_unlock(pthread_mutex_t * __mutex) __unlocks(*__mutex); int pthread_once(pthread_once_t *, void (*) (void)); int pthread_rwlock_destroy(pthread_rwlock_t * __rwlock) __requires_unlocked(*__rwlock); int pthread_rwlock_init(pthread_rwlock_t * __restrict __rwlock, const pthread_rwlockattr_t * __restrict) __requires_unlocked(*__rwlock); int pthread_rwlock_rdlock(pthread_rwlock_t * __rwlock) __locks_shared(*__rwlock); int pthread_rwlock_timedrdlock( pthread_rwlock_t * __restrict __rwlock, const struct timespec * __restrict) __trylocks_shared(0, *__rwlock); int pthread_rwlock_timedwrlock( pthread_rwlock_t * __restrict __rwlock, const struct timespec * __restrict) __trylocks_exclusive(0, *__rwlock); int pthread_rwlock_tryrdlock(pthread_rwlock_t * __rwlock) __trylocks_shared(0, *__rwlock); int pthread_rwlock_trywrlock(pthread_rwlock_t * __rwlock) __trylocks_exclusive(0, *__rwlock); int pthread_rwlock_unlock(pthread_rwlock_t * __rwlock) __unlocks(*__rwlock); int pthread_rwlock_wrlock(pthread_rwlock_t * __rwlock) __locks_exclusive(*__rwlock); int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *, int *); int pthread_rwlockattr_getpshared( const pthread_rwlockattr_t * __restrict, int * __restrict); int pthread_rwlockattr_init(pthread_rwlockattr_t *); int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *, int); int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); pthread_t pthread_self(void); int pthread_setspecific(pthread_key_t, const void *); int pthread_spin_init(pthread_spinlock_t * __spin, int) __requires_unlocked(*__spin); int pthread_spin_destroy(pthread_spinlock_t * __spin) __requires_unlocked(*__spin); int pthread_spin_lock(pthread_spinlock_t * __spin) __locks_exclusive(*__spin); int pthread_spin_trylock(pthread_spinlock_t * __spin) __trylocks_exclusive(0, *__spin); int pthread_spin_unlock(pthread_spinlock_t * __spin) __unlocks(*__spin); int pthread_cancel(pthread_t); int pthread_setcancelstate(int, int *); int pthread_setcanceltype(int, int *); void pthread_testcancel(void); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 301 "/usr/include/pthread.h" 3 4 int pthread_getprio(pthread_t); int pthread_setprio(pthread_t, int); void pthread_yield(void); int pthread_getname_np(pthread_t, char *, size_t); int pthread_setname_np(pthread_t, const char *); #endif # 308 "/usr/include/pthread.h" 3 4 int pthread_mutexattr_getprioceiling( const pthread_mutexattr_t * __restrict, int * __restrict); int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); int pthread_mutex_getprioceiling(const pthread_mutex_t * __restrict, int * __restrict); int pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int, int * __restrict); int pthread_mutexattr_getprotocol( const pthread_mutexattr_t * __restrict, int * __restrict); int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); int pthread_mutexattr_getrobust( pthread_mutexattr_t * __restrict, int * __restrict); int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int); int pthread_attr_getinheritsched(const pthread_attr_t * __restrict, int * __restrict); int pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *); int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict, int * __restrict); int pthread_attr_getscope(const pthread_attr_t * __restrict, int * __restrict); int pthread_attr_setinheritsched(pthread_attr_t *, int); int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *); int pthread_attr_setschedpolicy(pthread_attr_t *, int); int pthread_attr_setscope(pthread_attr_t *, int); int pthread_getschedparam(pthread_t pthread, int * __restrict, struct sched_param * __restrict); int pthread_setschedparam(pthread_t, int, const struct sched_param *); #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 345 "/usr/include/pthread.h" 3 4 int pthread_getconcurrency(void); int pthread_setconcurrency(int); #endif # 348 "/usr/include/pthread.h" 3 4 void __pthread_cleanup_push_imp(void (*)(void *), void *, struct _pthread_cleanup_info *); void __pthread_cleanup_pop_imp(int); __END_DECLS #endif /* !_PTHREAD_H_ */ # 355 "/usr/include/pthread.h" 3 4 # 214 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #endif # 215 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include "os/object_private.h" #endif /* expanded by -frewrite-includes */ # 215 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" 1 /* * Copyright (c) 2011-2012 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __OS_OBJECT_PRIVATE__ #define __OS_OBJECT_PRIVATE__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define OS_OBJECT_NOTHROW __attribute__((__nothrow__)) #define OS_OBJECT_NONNULL __attribute__((__nonnull__)) #define OS_OBJECT_WARN_RESULT __attribute__((__warn_unused_result__)) #define OS_OBJECT_MALLOC __attribute__((__malloc__)) #ifndef OS_OBJECT_EXPORT #define OS_OBJECT_EXPORT extern __attribute__((visibility("default"))) #endif # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #else # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" /*! @parseOnly */ #define OS_OBJECT_NOTHROW /*! @parseOnly */ #define OS_OBJECT_NONNULL /*! @parseOnly */ #define OS_OBJECT_WARN_RESULT /*! @parseOnly */ #define OS_OBJECT_MALLOC #ifndef OS_OBJECT_EXPORT /*! @parseOnly */ #define OS_OBJECT_EXPORT extern #endif # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #endif # 56 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_USE_OBJC && __has_feature(objc_arc) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 58 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define _OS_OBJECT_OBJC_ARC 1 #else # 60 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define _OS_OBJECT_OBJC_ARC 0 #endif # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define _OS_OBJECT_GLOBAL_REFCNT INT_MAX #define _OS_OBJECT_HEADER(isa, ref_cnt, xref_cnt) \ isa; /* must be pointer-sized */ \ int volatile ref_cnt; \ int volatile xref_cnt #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC_SUPPORT #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define OS_OBJECT_CLASS_SYMBOL(name) OS_##name##_class #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC && !TARGET_OS_SIMULATOR && defined(__i386__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define OS_OBJECT_HAVE_OBJC1 1 #define OS_OBJECT_HAVE_OBJC2 0 #define OS_OBJC_CLASS_RAW_SYMBOL_NAME(name) \ ".objc_class_name_" OS_STRINGIFY(name) #define _OS_OBJECT_CLASS_HEADER() \ const void *_os_obj_objc_isa #else # 80 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define OS_OBJECT_HAVE_OBJC1 0 #define OS_OBJECT_HAVE_OBJC2 1 #define OS_OBJC_CLASS_RAW_SYMBOL_NAME(name) "_OBJC_CLASS_$_" OS_STRINGIFY(name) // Must match size of compiler-generated OBJC_CLASS structure rdar://10640168 #define _OS_OBJECT_CLASS_HEADER() \ void *_os_obj_objc_class_t[5] #endif # 87 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define OS_OBJECT_OBJC_CLASS_DECL(name) \ extern void *OS_OBJECT_CLASS_SYMBOL(name) \ __asm__(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name))) #else # 91 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define OS_OBJECT_HAVE_OBJC1 0 #define OS_OBJECT_HAVE_OBJC2 0 #define _OS_OBJECT_CLASS_HEADER() \ void (*_os_obj_xref_dispose)(_os_object_t); \ void (*_os_obj_dispose)(_os_object_t) #endif # 97 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define OS_OBJECT_CLASS(name) OS_##name #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_USE_OBJC && OS_OBJECT_SWIFT3 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 101 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" @interface OS_OBJECT_CLASS(object) (OSObjectPrivate) - (void)_xref_dispose; - (void)_dispose; @end OS_OBJECT_DECL_PROTOCOL(object, ); typedef OS_OBJECT_CLASS(object) *_os_object_t; #define _OS_OBJECT_DECL_SUBCLASS_INTERFACE(name, super) \ @interface OS_OBJECT_CLASS(name) : OS_OBJECT_CLASS(super) \ \ @end #define _OS_OBJECT_DECL_PROTOCOL(name, super) \ OS_OBJECT_DECL_PROTOCOL(name, ) #define _OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, super) \ OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, super) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 116 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT @interface OS_OBJECT_CLASS(object) : NSObject - (void)_xref_dispose; - (void)_dispose; @end typedef OS_OBJECT_CLASS(object) *_os_object_t; #define _OS_OBJECT_DECL_SUBCLASS_INTERFACE(name, super) \ @interface OS_OBJECT_CLASS(name) : OS_OBJECT_CLASS(super) \ \ @end #else # 128 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" #define _OS_OBJECT_DECL_SUBCLASS_INTERFACE(name, super) #define _OS_OBJECT_DECL_PROTOCOL(name, super) #define _OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, super) typedef struct _os_object_s *_os_object_t; #endif # 133 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" OS_ASSUME_NONNULL_BEGIN __BEGIN_DECLS #if 0 /* disabled by -frewrite-includes */ #if !_OS_OBJECT_OBJC_ARC #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 139 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT OS_OBJECT_MALLOC OS_OBJECT_WARN_RESULT OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") _os_object_t _os_object_alloc(const void *cls, size_t size); API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT OS_OBJECT_MALLOC OS_OBJECT_WARN_RESULT OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") _os_object_t _os_object_alloc_realized(const void *cls, size_t size); API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT OS_OBJECT_NONNULL OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") void _os_object_dealloc(_os_object_t object); API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT OS_OBJECT_NONNULL OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") _os_object_t _os_object_retain(_os_object_t object); API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT OS_OBJECT_NONNULL OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") _os_object_t _os_object_retain_with_resurrect(_os_object_t obj); API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT OS_OBJECT_NONNULL OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") void _os_object_release(_os_object_t object); API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT OS_OBJECT_NONNULL OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") _os_object_t _os_object_retain_internal(_os_object_t object); API_AVAILABLE(macos(10.8), ios(6.0)) OS_OBJECT_EXPORT OS_OBJECT_NONNULL OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") void _os_object_release_internal(_os_object_t object); API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) OS_OBJECT_EXPORT OS_OBJECT_NONNULL OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") _os_object_t _os_object_retain_internal_n(_os_object_t object, uint16_t n); API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) OS_OBJECT_EXPORT OS_OBJECT_NONNULL OS_OBJECT_NOTHROW OS_SWIFT_UNAVAILABLE("Unavailable in Swift") void _os_object_release_internal_n(_os_object_t object, uint16_t n); #endif // !_OS_OBJECT_OBJC_ARC # 200 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" __END_DECLS OS_ASSUME_NONNULL_END #endif # 206 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/object_private.h" # 216 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "queue_private.h" #endif /* expanded by -frewrite-includes */ # 216 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_QUEUE_PRIVATE__ #define __DISPATCH_QUEUE_PRIVATE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @enum dispatch_queue_flags_t * * @constant DISPATCH_QUEUE_OVERCOMMIT * The queue will create a new thread for invoking blocks, regardless of how * busy the computer is. */ enum { DISPATCH_QUEUE_OVERCOMMIT = 0x2ull, }; /*! * @function dispatch_set_qos_class * * @abstract * Sets the QOS class on a dispatch queue, source or mach channel. * * @discussion * This is equivalent to using dispatch_queue_make_attr_with_qos_class() * when creating a dispatch queue, but is availabile on additional dispatch * object types. * * When configured in this manner, the specified QOS class will be used over * the assigned QOS of workitems submitted asynchronously to this object, * unless the workitem has been created with ENFORCE semantics * (see DISPATCH_BLOCK_ENFORCE_QOS_CLASS). * * Calling this function will supersede any prior calls to * dispatch_set_qos_class() or dispatch_set_qos_class_floor(). * * @param object * A dispatch queue, source or mach channel to configure. * The object must be inactive, and can't be a workloop. * * Passing another object type or an object that has been activated is undefined * and will cause the process to be terminated. * * @param qos_class * A QOS class value: * - QOS_CLASS_USER_INTERACTIVE * - QOS_CLASS_USER_INITIATED * - QOS_CLASS_DEFAULT * - QOS_CLASS_UTILITY * - QOS_CLASS_BACKGROUND * Passing any other value is undefined. * * @param relative_priority * A relative priority within the QOS class. This value is a negative * offset from the maximum supported scheduler priority for the given class. * Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY * is undefined. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_set_qos_class(dispatch_object_t object, dispatch_qos_class_t qos_class, int relative_priority); /*! * @function dispatch_set_qos_class_floor * * @abstract * Sets the QOS class floor on a dispatch queue, source, workloop or mach * channel. * * @discussion * The QOS class of workitems submitted to this object asynchronously will be * elevated to at least the specified QOS class floor. * Unlike dispatch_set_qos_class(), the QOS of the workitem will be used if * higher than the floor even when the workitem has been created without * "ENFORCE" semantics. * * Setting the QOS class floor is equivalent to the QOS effects of configuring * a target queue whose QOS class has been set with dispatch_set_qos_class(). * * Calling this function will supersede any prior calls to * dispatch_set_qos_class() or dispatch_set_qos_class_floor(). * * @param object * A dispatch queue, workloop, source or mach channel to configure. * The object must be inactive. * * Passing another object type or an object that has been activated is undefined * and will cause the process to be terminated. * * @param qos_class * A QOS class value: * - QOS_CLASS_USER_INTERACTIVE * - QOS_CLASS_USER_INITIATED * - QOS_CLASS_DEFAULT * - QOS_CLASS_UTILITY * - QOS_CLASS_BACKGROUND * Passing any other value is undefined. * * @param relative_priority * A relative priority within the QOS class. This value is a negative * offset from the maximum supported scheduler priority for the given class. * Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY * is undefined. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_set_qos_class_floor(dispatch_object_t object, dispatch_qos_class_t qos_class, int relative_priority); /*! * @function dispatch_set_qos_class_fallback * * @abstract * Sets the fallback QOS class on a dispatch queue, source, workloop or mach * channel. * * @discussion * Workitems submitted asynchronously to this object that don't have an assigned * QOS class will use the specified QOS class as a fallback. This interface * doesn't support relative priority. * * Workitems without an assigned QOS are: * - workitems submitted from the context of a thread opted-out of QOS, * - workitems created with the DISPATCH_BLOCK_DETACHED or * DISPATCH_BLOCK_NO_QOS_CLASS flags, * - XPC messages sent with xpc_connection_send_notification(), * - XPC connection and dispatch source handlers. * * Calling both dispatch_set_qos_class_fallback() and dispatch_set_qos_class() * on an object will only apply the effect of dispatch_set_qos_class(). * * A QOS class fallback must always be at least as high as the current QOS * floor for the dispatch queue hierarchy, else it is ignored. * * When no QOS fallback has been explicitly specified: * - queues on hierarchies without a QOS class or QOS class floor have * a fallback of QOS_CLASS_DEFAULT, * - queues on hierarchies with a QOS class or QOS class floor configured will * also use that QOS class as a fallback. * * @param object * A dispatch queue, workloop, source or mach channel to configure. * The object must be inactive. * * Passing another object type or an object that has been activated is undefined * and will cause the process to be terminated. * * @param qos_class * A QOS class value: * - QOS_CLASS_USER_INTERACTIVE * - QOS_CLASS_USER_INITIATED * - QOS_CLASS_DEFAULT * - QOS_CLASS_UTILITY * - QOS_CLASS_BACKGROUND * Passing any other value is undefined. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_set_qos_class_fallback(dispatch_object_t object, dispatch_qos_class_t qos_class); #define DISPATCH_QUEUE_FLAGS_MASK (DISPATCH_QUEUE_OVERCOMMIT) // On FreeBSD pthread_attr_t is a typedef to a pointer type #if 0 /* disabled by -frewrite-includes */ #if defined(__FreeBSD__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 203 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" # define DISPATCH_QUEUE_NULLABLE_PTHREAD_ATTR_PTR _Nullable #else # 205 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" # define DISPATCH_QUEUE_NULLABLE_PTHREAD_ATTR_PTR #endif # 207 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" /*! * @function dispatch_queue_attr_make_with_overcommit * * @discussion * Returns a dispatch queue attribute value with the overcommit flag set to the * specified value. * * This attribute only makes sense when the specified queue is targeted at * a root queue. Passing this attribute to dispatch_queue_create_with_target() * with a target queue that is not a root queue will result in an assertion and * the process being terminated. * * It is recommended to not specify a target queue at all when using this * attribute and to use dispatch_queue_attr_make_with_qos_class() to select the * appropriate QOS class instead. * * Queues created with this attribute cannot change target after having been * activated. See dispatch_set_target_queue() and dispatch_activate(). * * @param attr * A queue attribute value to be combined with the overcommit flag, or NULL. * * @param overcommit * Boolean overcommit flag. * * @return * Returns an attribute value which may be provided to dispatch_queue_create(). * This new value combines the attributes specified by the 'attr' parameter and * the overcommit flag. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW dispatch_queue_attr_t dispatch_queue_attr_make_with_overcommit(dispatch_queue_attr_t _Nullable attr, bool overcommit); /*! * @typedef dispatch_queue_priority_t * * @constant DISPATCH_QUEUE_PRIORITY_NON_INTERACTIVE * Items dispatched to the queue will run at non-interactive priority. * This priority level is intended for user-initiated application activity that * is long-running and CPU or IO intensive and that the user is actively waiting * on, but that should not interfere with interactive use of the application. * * This global queue priority level is mapped to QOS_CLASS_UTILITY. */ #define DISPATCH_QUEUE_PRIORITY_NON_INTERACTIVE INT8_MIN /*! * @function dispatch_queue_set_label_nocopy * * @abstract * Set the label for a given queue, without copying the input string. * * @discussion * The queue must have been initially created with a NULL label, else using * this function to set the queue label is undefined. * * The caller of this function must make sure the label pointer remains valid * while it is used as the queue label and while any callers to * dispatch_queue_get_label() may have obtained it. Since the queue lifetime * may extend past the last release, it is advised to call this function with * a constant string or NULL before the queue is released, or to destroy the * label from a finalizer for that queue. * * This function should be called before any work item could call * dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) or from the context of * the queue itself. * * @param queue * The queue to adjust. Attempts to set the label of the main queue or a global * concurrent queue will be ignored. * * @param label * The new label for the queue. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_queue_set_label_nocopy(dispatch_queue_t queue, const char * _Nullable label); /*! * @function dispatch_queue_set_width * * @abstract * Set the width of concurrency for a given queue. The width of a serial queue * is one. * * @discussion * This SPI is DEPRECATED and will be removed in a future release. * Uses of this SPI to make a queue concurrent by setting its width to LONG_MAX * should be replaced by passing DISPATCH_QUEUE_CONCURRENT to * dispatch_queue_create(). * Uses of this SPI to limit queue concurrency are not recommended and should * be replaced by alternative mechanisms such as a dispatch semaphore created * with the desired concurrency width. * * @param queue * The queue to adjust. Attempts to set the width of the main queue or a global * concurrent queue will be ignored. * * @param width * The new maximum width of concurrency depending on available resources. * If zero is passed, then the value is promoted to one. * Negative values are magic values that map to automatic width values. * Unknown negative values default to DISPATCH_QUEUE_WIDTH_MAX_LOGICAL_CPUS. */ #define DISPATCH_QUEUE_WIDTH_ACTIVE_CPUS -1 #define DISPATCH_QUEUE_WIDTH_MAX_PHYSICAL_CPUS -2 #define DISPATCH_QUEUE_WIDTH_MAX_LOGICAL_CPUS -3 API_DEPRECATED("Use dispatch_queue_create(name, DISPATCH_QUEUE_CONCURRENT)", macos(10.6,10.10), ios(4.0,8.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_queue_set_width(dispatch_queue_t dq, long width); #if 0 /* disabled by -frewrite-includes */ #if defined(__BLOCKS__) && defined(__APPLE__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 328 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" /*! * @function dispatch_pthread_root_queue_create * * @abstract * Creates a new concurrent dispatch root queue with a pthread-based pool of * worker threads owned by the application. * * @discussion * Dispatch pthread root queues are similar to the global concurrent dispatch * queues in that they invoke blocks concurrently, however the blocks are not * executed on ordinary worker threads but use a dedicated pool of pthreads not * shared with the global queues or any other pthread root queues. * * NOTE: this is a special-purpose facility that should only be used in very * limited circumstances, in almost all cases the global concurrent queues * should be preferred. While this facility allows for more flexibility in * configuring worker threads for special needs it comes at the cost of * increased overall memory usage due to reduced thread sharing and higher * latency in worker thread bringup. * * Dispatch pthread root queues do not support suspension, application context * and change of width or of target queue. They can however be used as the * target queue for serial or concurrent queues obtained via * dispatch_queue_create() or dispatch_queue_create_with_target(), which * enables the blocks submitted to those queues to be processed on the root * queue's pthread pool. * * When a dispatch pthread root queue is no longer needed, it should be * released with dispatch_release(). Existing worker pthreads and pending blocks * submitted to the root queue will hold a reference to the queue so it will not * be deallocated until all blocks have finished and worker threads exited. * * @param label * A string label to attach to the queue. * This parameter is optional and may be NULL. * * @param flags * Pass flags value returned by dispatch_pthread_root_queue_flags_pool_size() * or 0 if unused. * * @param attr * Attributes passed to pthread_create(3) when creating worker pthreads. This * parameter is copied and can be destroyed after this call returns. * This parameter is optional and may be NULL. * * @param configure * Configuration block called on newly created worker pthreads before any blocks * for the root queue are executed. The block may configure the current thread * as needed. * This parameter is optional and may be NULL. * * @result * The newly created dispatch pthread root queue. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_global_t dispatch_pthread_root_queue_create(const char *_Nullable label, unsigned long flags, const pthread_attr_t DISPATCH_QUEUE_NULLABLE_PTHREAD_ATTR_PTR *_Nullable attr, dispatch_block_t _Nullable configure); /*! * @function dispatch_pthread_root_queue_flags_pool_size * * @abstract * Returns flags argument to pass to dispatch_pthread_root_queue_create() to * specify the maximum size of the pthread pool to use for a pthread root queue. * * @param pool_size * Maximum size of the pthread pool to use for the root queue. The number of * pthreads created for this root queue will never exceed this number but there * is no guarantee that the specified number will be reached. * Pass 0 to specify that a default pool size determined by the system should * be used. * NOTE: passing pool_size == 1 does NOT make the pthread root queue equivalent * to a serial queue. * * @result * The flags argument to pass to dispatch_pthread_root_queue_create(). */ DISPATCH_INLINE DISPATCH_ALWAYS_INLINE unsigned long dispatch_pthread_root_queue_flags_pool_size(uint8_t pool_size) { #define _DISPATCH_PTHREAD_ROOT_QUEUE_FLAG_POOL_SIZE (0x80000000ul) return (_DISPATCH_PTHREAD_ROOT_QUEUE_FLAG_POOL_SIZE | (unsigned long)pool_size); } /*! * @function dispatch_pthread_root_queue_copy_current * * @abstract * Returns a reference to the pthread root queue object that has created the * currently executing thread, or NULL if the current thread is not associated * to a pthread root queue. * * @result * A new reference to a pthread root queue object or NULL. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_global_t _Nullable dispatch_pthread_root_queue_copy_current(void); /*! * @constant DISPATCH_APPLY_CURRENT_ROOT_QUEUE * * @discussion * This constant is deprecated, please use DISPATCH_APPLY_AUTO. * * DISPATCH_APPLY_AUTO also selects the current pthread root queue if * applicable. */ #define DISPATCH_APPLY_CURRENT_ROOT_QUEUE ((dispatch_queue_t _Nonnull)0) #endif /* defined(__BLOCKS__) && defined(__APPLE__) */ # 447 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" /*! * @function dispatch_async_enforce_qos_class_f * * @abstract * Submits a function for asynchronous execution on a dispatch queue. * * @discussion * See dispatch_async() for details. The QOS will be enforced as if * this was called: * * dispatch_async(queue, dispatch_block_create(DISPATCH_BLOCK_ENFORCE_QOS_CLASS, ^{ * work(context); * }); * * * @param queue * The target dispatch queue to which the function is submitted. * The system will hold a reference on the target queue until the function * has returned. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_async_f(). * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.11), ios(9.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_async_enforce_qos_class_f(dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); #ifdef __ANDROID__ /*! * @function _dispatch_install_thread_detach_callback * * @param cb * Function to be called before each worker thread exits to detach JVM. * * Hook to be able to detach threads from the Java JVM before they exit. * If JNI has been used on a thread on Android it needs to have been * "detached" before the thread exits or the application will crash. */ DISPATCH_EXPORT void _dispatch_install_thread_detach_callback(void (*cb)(void)); #endif # 498 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 504 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/queue_private.h" # 217 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "workloop_private.h" #endif /* expanded by -frewrite-includes */ # 217 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" 1 /* * Copyright (c) 2017-2018 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_WORKLOOP_PRIVATE__ #define __DISPATCH_WORKLOOP_PRIVATE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" /******************************************************************************\ * * THIS FILE IS AN IN-PROGRESS INTERFACE THAT IS SUBJECT TO CHANGE * \******************************************************************************/ DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @typedef dispatch_workloop_t * * @abstract * Dispatch workloops invoke workitems submitted to them in priority order. * * @discussion * A dispatch workloop is a flavor of dispatch_queue_t that is a priority * ordered queue (using the QOS class of the submitted workitems as the * ordering). * * Between each workitem invocation, the workloop will evaluate whether higher * priority workitems have since been submitted and execute these first. * * Serial queues targeting a workloop maintain FIFO execution of their * workitems. However, the workloop may reorder workitems submitted to * independent serial queues targeting it with respect to each other, * based on their priorities. * * A dispatch workloop is a "subclass" of dispatch_queue_t which can be passed * to all APIs accepting a dispatch queue, except for functions from the * dispatch_sync() family. dispatch_async_and_wait() must be used for workloop * objects. Functions from the dispatch_sync() family on queues targeting * a workloop are still permitted but discouraged for performance reasons. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__DISPATCH_BUILDING_DISPATCH__) && !defined(__OBJC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" typedef struct dispatch_workloop_s *dispatch_workloop_t; #else # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" DISPATCH_DECL_SUBCLASS(dispatch_workloop, dispatch_queue); #endif # 75 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" /*! * @function dispatch_workloop_create * * @abstract * Creates a new dispatch workloop to which workitems may be submitted. * * @param label * A string label to attach to the workloop. * * @result * The newly created dispatch workloop. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_workloop_t dispatch_workloop_create(const char *_Nullable label); /*! * @function dispatch_workloop_create_inactive * * @abstract * Creates a new inactive dispatch workloop that can be setup and then * activated. * * @discussion * Creating an inactive workloop allows for it to receive further configuration * before it is activated, and workitems can be submitted to it. * * Submitting workitems to an inactive workloop is undefined and will cause the * process to be terminated. * * @param label * A string label to attach to the workloop. * * @result * The newly created dispatch workloop. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_workloop_t dispatch_workloop_create_inactive(const char *_Nullable label); /*! * @function dispatch_workloop_set_autorelease_frequency * * @abstract * Sets the autorelease frequency of the workloop. * * @discussion * See dispatch_queue_attr_make_with_autorelease_frequency(). * The default policy for a workloop is * DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM. * * @param workloop * The dispatch workloop to modify. * * This workloop must be inactive, passing an activated object is undefined * and will cause the process to be terminated. * * @param frequency * The requested autorelease frequency. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_workloop_set_autorelease_frequency(dispatch_workloop_t workloop, dispatch_autorelease_frequency_t frequency); DISPATCH_ENUM(dispatch_workloop_param_flags, uint64_t, DISPATCH_WORKLOOP_NONE DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = 0x0, DISPATCH_WORKLOOP_FIXED_PRIORITY DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = 0x1, ); /*! * @function dispatch_workloop_set_qos_class_floor * * @abstract * Sets the QOS class floor of a workloop. * * @discussion * See dispatch_set_qos_class_floor(). * * This function is strictly equivalent to dispatch_set_qos_class_floor() but * allows to pass extra flags. * * Using both dispatch_workloop_set_scheduler_priority() and * dispatch_set_qos_class_floor() or dispatch_workloop_set_qos_class_floor() * is undefined and will cause the process to be terminated. * * @param workloop * The dispatch workloop to modify. * * This workloop must be inactive, passing an activated object is undefined * and will cause the process to be terminated. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_workloop_set_qos_class_floor(dispatch_workloop_t workloop, dispatch_qos_class_t qos, int relpri, dispatch_workloop_param_flags_t flags); /*! * @function dispatch_workloop_set_scheduler_priority * * @abstract * Sets the scheduler priority for a dispatch workloop. * * @discussion * This sets the scheduler priority of the threads that the runtime will bring * up to service this workloop. * * QOS propagation still functions on these workloops, but its effect on the * priority of the thread brought up to service this workloop is ignored. * * Using both dispatch_workloop_set_scheduler_priority() and * dispatch_set_qos_class_floor() or dispatch_workloop_set_qos_class_floor() * is undefined and will cause the process to be terminated. * * @param workloop * The dispatch workloop to modify. * * This workloop must be inactive, passing an activated object is undefined * and will cause the process to be terminated. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_workloop_set_scheduler_priority(dispatch_workloop_t workloop, int priority, dispatch_workloop_param_flags_t flags); /*! * @function dispatch_workloop_set_cpupercent * * @abstract * Sets the cpu percent and refill attributes for a dispatch workloop. * * @discussion * This should only used if the workloop was also setup with the * DISPATCH_WORKLOOP_FIXED_PRIORITY flag as a safe guard against * busy loops that could starve the rest of the system forever. * * If DISPATCH_WORKLOOP_FIXED_PRIORITY wasn't passed, using this function is * undefined and will cause the process to be terminated. * * @param workloop * The dispatch workloop to modify. * * This workloop must be inactive, passing an activated object is undefined * and will cause the process to be terminated. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_workloop_set_cpupercent(dispatch_workloop_t workloop, uint8_t percent, uint32_t refillms); /*! * @function dispatch_workloop_is_current() * * @abstract * Returns whether the current thread has been made by the runtime to service * this workloop. * * @discussion * Note that when using dispatch_async_and_wait(workloop, ^{ ... }) * then workloop will be seen as the "current" one by the submitted * workitem, but that is not the case when using dispatch_sync() on a queue * targeting the workloop. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW bool dispatch_workloop_is_current(dispatch_workloop_t workloop); /*! * @function dispatch_workloop_copy_current() * * @abstract * Returns a copy of the workoop that is being serviced on the calling thread * if any. * * @discussion * If the thread is not a workqueue thread, or is not servicing a dispatch * workloop, then NULL is returned. * * This returns a retained object that must be released with dispatch_release(). */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_NOTHROW dispatch_workloop_t _Nullable dispatch_workloop_copy_current(void); // Equivalent to dispatch_workloop_set_qos_class_floor(workoop, qos, 0, flags) API_DEPRECATED_WITH_REPLACEMENT("dispatch_workloop_set_qos_class_floor", macos(10.14,10.14), ios(12.0,12.0), tvos(12.0,12.0), watchos(5.0,5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_workloop_set_qos_class(dispatch_workloop_t workloop, dispatch_qos_class_t qos, dispatch_workloop_param_flags_t flags); API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NOTHROW bool _dispatch_workloop_should_yield_4NW(void); /*! * @function dispatch_async_and_wait * * @abstract * Submits a block for synchronous execution on a dispatch queue. * * @discussion * Submits a workitem to a dispatch queue like dispatch_async(), however * dispatch_async_and_wait() will not return until the workitem has finished. * * Like functions of the dispatch_sync family, dispatch_async_and_wait() is * subject to dead-lock (See dispatch_sync() for details). * * However, dispatch_async_and_wait() differs from functions of the * dispatch_sync family in two fundamental ways: how it respects queue * attributes and how it chooses the execution context invoking the workitem. * * Differences with dispatch_sync() * * Work items submitted to a queue with dispatch_async_and_wait() observe all * queue attributes of that queue when invoked (inluding autorelease frequency * or QOS class). * * When the runtime has brought up a thread to invoke the asynchronous workitems * already submitted to the specified queue, that servicing thread will also be * used to execute synchronous work submitted to the queue with * dispatch_async_and_wait(). * * However, if the runtime has not brought up a thread to service the specified * queue (because it has no workitems enqueued, or only synchronous workitems), * then dispatch_async_and_wait() will invoke the workitem on the calling thread, * similar to the behaviour of functions in the dispatch_sync family. * * As an exception, if the queue the work is submitted to doesn't target * a global concurrent queue (for example because it targets the main queue), * then the workitem will never be invoked by the thread calling * dispatch_async_and_wait(). * * In other words, dispatch_async_and_wait() is similar to submitting * a dispatch_block_create()d workitem to a queue and then waiting on it, as * shown in the code example below. However, dispatch_async_and_wait() is * significantly more efficient when a new thread is not required to execute * the workitem (as it will use the stack of the submitting thread instead of * requiring heap allocations). * * * dispatch_block_t b = dispatch_block_create(0, block); * dispatch_async(queue, b); * dispatch_block_wait(b, DISPATCH_TIME_FOREVER); * Block_release(b); * * * @param queue * The target dispatch queue to which the block is submitted. * The result of passing NULL in this parameter is undefined. * * @param block * The block to be invoked on the target dispatch queue. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_async_and_wait(dispatch_queue_t queue, DISPATCH_NOESCAPE dispatch_block_t block); #endif # 350 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" /*! * @function dispatch_async_and_wait_f * * @abstract * Submits a function for synchronous execution on a dispatch queue. * * @discussion * See dispatch_async_and_wait() for details. * * @param queue * The target dispatch queue to which the function is submitted. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_async_and_wait_f(). * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_async_and_wait_f(dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); /*! * @function dispatch_barrier_async_and_wait * * @abstract * Submits a block for synchronous execution on a dispatch queue. * * @discussion * Submits a block to a dispatch queue like dispatch_async_and_wait(), but marks * that block as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT * queues). * * @param queue * The target dispatch queue to which the block is submitted. * The result of passing NULL in this parameter is undefined. * * @param work * The application-defined block to invoke on the target queue. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_barrier_async_and_wait(dispatch_queue_t queue, DISPATCH_NOESCAPE dispatch_block_t block); #endif # 405 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" /*! * @function dispatch_barrier_async_and_wait_f * * @abstract * Submits a function for synchronous execution on a dispatch queue. * * @discussion * Submits a function to a dispatch queue like dispatch_async_and_wait_f(), but * marks that function as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT * queues). * * @param queue * The target dispatch queue to which the function is submitted. * The result of passing NULL in this parameter is undefined. * * @param context * The application-defined context parameter to pass to the function. * * @param work * The application-defined function to invoke on the target queue. The first * parameter passed to this function is the context provided to * dispatch_barrier_async_and_wait_f(). * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_barrier_async_and_wait_f(dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 441 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/workloop_private.h" # 218 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "source_private.h" #endif /* expanded by -frewrite-includes */ # 218 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/source_private.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SOURCE_PRIVATE__ #define __DISPATCH_SOURCE_PRIVATE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/source_private.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/source_private.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/source_private.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @const DISPATCH_SOURCE_TYPE_INTERVAL * @discussion A dispatch source that submits the event handler block at a * specified time interval, phase-aligned with all other interval sources on * the system that have the same interval value. * * The initial submission of the event handler will occur at some point during * the first time interval after the source is created (assuming the source is * resumed at that time). * * By default, the unit for the interval value is milliseconds and the leeway * (maximum amount of time any individual handler submission may be deferred to * align with other system activity) for the source is fixed at interval/2. * * If the DISPATCH_INTERVAL_UI_ANIMATION flag is specified, the unit for the * interval value is animation frames (1/60th of a second) and the leeway is * fixed at one frame. * * The handle is the interval value in milliseconds or frames. * The mask specifies which flags from dispatch_source_timer_flags_t to apply. * * Starting with macOS 10.14, iOS 12, dispatch_source_set_timer() * can be used on such sources, and its arguments are used as follow: * - start: * must be DISPATCH_TIME_NOW or DISPATCH_TIME_FOREVER. * DISPATCH_TIME_NOW will enable the timer, and align its phase, and * DISPATCH_TIME_FOREVER will disable the timer as usual.* * - interval: * its unit is in milliseconds by default, or frames if the source * was created with the DISPATCH_INTERVAL_UI_ANIMATION flag. * - leeway: * per-thousands of the interval (valid values range from 0 to 1000). * If ~0ull is passed, the default leeway for the interval is used instead. */ #define DISPATCH_SOURCE_TYPE_INTERVAL (&_dispatch_source_type_interval) API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_SOURCE_TYPE_DECL(interval); /*! * @const DISPATCH_SOURCE_TYPE_VFS * @discussion Apple-internal dispatch source that monitors for vfs events * defined by dispatch_vfs_flags_t. * The handle is a process identifier (pid_t). */ #define DISPATCH_SOURCE_TYPE_VFS (&_dispatch_source_type_vfs) API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(vfs); /*! * @const DISPATCH_SOURCE_TYPE_VM * @discussion A dispatch source that monitors virtual memory * The mask is a mask of desired events from dispatch_source_vm_flags_t. * This type is deprecated, use DISPATCH_SOURCE_TYPE_MEMORYPRESSURE instead. */ #define DISPATCH_SOURCE_TYPE_VM (&_dispatch_source_type_vm) API_DEPRECATED_WITH_REPLACEMENT("DISPATCH_SOURCE_TYPE_MEMORYPRESSURE", macos(10.7,10.10), ios(4.3,8.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(vm); /*! * @const DISPATCH_SOURCE_TYPE_MEMORYSTATUS * @discussion A dispatch source that monitors memory status * The mask is a mask of desired events from * dispatch_source_memorystatus_flags_t. */ #define DISPATCH_SOURCE_TYPE_MEMORYSTATUS (&_dispatch_source_type_memorystatus) API_DEPRECATED_WITH_REPLACEMENT("DISPATCH_SOURCE_TYPE_MEMORYPRESSURE", macos(10.9, 10.12), ios(6.0, 10.0), tvos(6.0, 10.0), watchos(1.0, 3.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(memorystatus); /*! * @const DISPATCH_SOURCE_TYPE_SOCK * @discussion A dispatch source that monitors events on socket state changes. */ #define DISPATCH_SOURCE_TYPE_SOCK (&_dispatch_source_type_sock) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(sock); /*! * @const DISPATCH_SOURCE_TYPE_NW_CHANNEL * @discussion A dispatch source that monitors events on a network channel. */ #define DISPATCH_SOURCE_TYPE_NW_CHANNEL (&_dispatch_source_type_nw_channel) API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_SOURCE_TYPE_DECL(nw_channel); __END_DECLS /*! * @enum dispatch_source_sock_flags_t * * @constant DISPATCH_SOCK_CONNRESET * Received RST * * @constant DISPATCH_SOCK_READCLOSED * Read side is shutdown * * @constant DISPATCH_SOCK_WRITECLOSED * Write side is shutdown * * @constant DISPATCH_SOCK_TIMEOUT * Timeout: rexmt, keep-alive or persist * * @constant DISPATCH_SOCK_NOSRCADDR * Source address not available * * @constant DISPATCH_SOCK_IFDENIED * Interface denied connection * * @constant DISPATCH_SOCK_SUSPEND * Output queue suspended * * @constant DISPATCH_SOCK_RESUME * Output queue resumed * * @constant DISPATCH_SOCK_KEEPALIVE * TCP Keepalive received * * @constant DISPATCH_SOCK_CONNECTED * Socket is connected * * @constant DISPATCH_SOCK_DISCONNECTED * Socket is disconnected * * @constant DISPATCH_SOCK_CONNINFO_UPDATED * Connection info was updated * * @constant DISPATCH_SOCK_NOTIFY_ACK * Notify acknowledgement */ enum { DISPATCH_SOCK_CONNRESET = 0x00000001, DISPATCH_SOCK_READCLOSED = 0x00000002, DISPATCH_SOCK_WRITECLOSED = 0x00000004, DISPATCH_SOCK_TIMEOUT = 0x00000008, DISPATCH_SOCK_NOSRCADDR = 0x00000010, DISPATCH_SOCK_IFDENIED = 0x00000020, DISPATCH_SOCK_SUSPEND = 0x00000040, DISPATCH_SOCK_RESUME = 0x00000080, DISPATCH_SOCK_KEEPALIVE = 0x00000100, DISPATCH_SOCK_ADAPTIVE_WTIMO = 0x00000200, DISPATCH_SOCK_ADAPTIVE_RTIMO = 0x00000400, DISPATCH_SOCK_CONNECTED = 0x00000800, DISPATCH_SOCK_DISCONNECTED = 0x00001000, DISPATCH_SOCK_CONNINFO_UPDATED = 0x00002000, DISPATCH_SOCK_NOTIFY_ACK = 0x00004000, }; /*! * @enum dispatch_source_nw_channel_flags_t * * @constant DISPATCH_NW_CHANNEL_FLOW_ADV_UPDATE * Received network channel flow advisory. */ enum { DISPATCH_NW_CHANNEL_FLOW_ADV_UPDATE = 0x00000001, }; /*! * @enum dispatch_source_vfs_flags_t * * @constant DISPATCH_VFS_NOTRESP * Server down. * * @constant DISPATCH_VFS_NEEDAUTH * Server bad auth. * * @constant DISPATCH_VFS_LOWDISK * We're low on space. * * @constant DISPATCH_VFS_MOUNT * New filesystem arrived. * * @constant DISPATCH_VFS_UNMOUNT * Filesystem has left. * * @constant DISPATCH_VFS_DEAD * Filesystem is dead, needs force unmount. * * @constant DISPATCH_VFS_ASSIST * Filesystem needs assistance from external program. * * @constant DISPATCH_VFS_NOTRESPLOCK * Server lockd down. * * @constant DISPATCH_VFS_UPDATE * Filesystem information has changed. * * @constant DISPATCH_VFS_VERYLOWDISK * File system has *very* little disk space left. * * @constant DISPATCH_VFS_QUOTA * We hit a user quota (quotactl) for this filesystem. * * @constant DISPATCH_VFS_NEARLOWDISK * Filesystem is nearly full (below NEARLOWDISK level). * * @constant DISPATCH_VFS_DESIREDDISK * Filesystem has exceeded the DESIREDDISK level * * @constant DISPATCH_VFS_FREE_SPACE_CHANGE * Filesystem free space changed. */ enum { DISPATCH_VFS_NOTRESP = 0x0001, DISPATCH_VFS_NEEDAUTH = 0x0002, DISPATCH_VFS_LOWDISK = 0x0004, DISPATCH_VFS_MOUNT = 0x0008, DISPATCH_VFS_UNMOUNT = 0x0010, DISPATCH_VFS_DEAD = 0x0020, DISPATCH_VFS_ASSIST = 0x0040, DISPATCH_VFS_NOTRESPLOCK = 0x0080, DISPATCH_VFS_UPDATE = 0x0100, DISPATCH_VFS_VERYLOWDISK = 0x0200, DISPATCH_VFS_QUOTA = 0x1000, DISPATCH_VFS_NEARLOWDISK = 0x2000, DISPATCH_VFS_DESIREDDISK = 0x4000, DISPATCH_VFS_FREE_SPACE_CHANGE = 0x8000, }; /*! * @enum dispatch_clockid_t * * @discussion * These values can be used with DISPATCH_SOURCE_TYPE_TIMER as a "handle" * to anchor the timer to a given clock which allows for various optimizations. * * Note that using an explicit clock will make the dispatch source "strict" * like dispatch_source_set_mandatory_cancel_handler() does. * * @constant DISPATCH_CLOCKID_UPTIME * A monotonic clock that doesn't tick while the machine is asleep. * Equivalent to the CLOCK_UPTIME clock ID on BSD systems. * * @constant DISPATCH_CLOCKID_MONOTONIC * A monotonic clock that ticks while the machine sleeps. * Equivalent to POSIX CLOCK_MONOTONIC. * (Note that on Linux, CLOCK_MONOTONIC isn't conformant and doesn't tick while * sleeping, hence on Linux this is the same clock as CLOCK_BOOTTIME). * * @constant DISPATCH_CLOCKID_WALLTIME * A clock equivalent to the wall clock time, as returned by gettimeofday(). * Equivalent to POSIX CLOCK_REALTIME. * * @constant DISPATCH_CLOCKID_REALTIME * An alias for DISPATCH_CLOCKID_WALLTIME to match the POSIX clock of the * same name. */ DISPATCH_ENUM(dispatch_clockid, uintptr_t, DISPATCH_CLOCKID_UPTIME DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = 1, DISPATCH_CLOCKID_MONOTONIC DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = 2, DISPATCH_CLOCKID_WALLTIME DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = 3, DISPATCH_CLOCKID_REALTIME DISPATCH_ENUM_API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = 3, ); /*! * @enum dispatch_source_timer_flags_t * * @constant DISPATCH_TIMER_BACKGROUND * Specifies that the timer is used to trigger low priority maintenance-level * activity and that the system may apply larger minimum leeway values to the * timer in order to align it with other system activity. * * @constant DISPATCH_INTERVAL_UI_ANIMATION * Specifies that the interval source is used for UI animation. The unit for * the interval value of such sources is frames (1/60th of a second) and the * leeway is fixed at one frame. */ enum { DISPATCH_TIMER_BACKGROUND = 0x2, DISPATCH_INTERVAL_UI_ANIMATION = 0x20, }; /*! * @enum dispatch_source_mach_send_flags_t * * @constant DISPATCH_MACH_SEND_POSSIBLE * The mach port corresponding to the given send right has space available * for messages. Delivered only once a mach_msg() to that send right with * options MACH_SEND_MSG|MACH_SEND_TIMEOUT|MACH_SEND_NOTIFY has returned * MACH_SEND_TIMED_OUT (and not again until the next such mach_msg() timeout). * NOTE: The source must have registered the send right for monitoring with the * system for such a mach_msg() to arm the send-possible notifcation, so * the initial send attempt must occur from a source registration handler. */ enum { DISPATCH_MACH_SEND_POSSIBLE = 0x8, }; /*! * @enum dispatch_source_proc_flags_t * * @constant DISPATCH_PROC_REAP * The process has been reaped by the parent process via wait*(). * This flag is deprecated and will be removed in a future release. * * @constant DISPATCH_PROC_EXIT_STATUS * The process has exited. Specifying this flag allows the process exit status * to be retrieved from the source's status value, as returned by the * dispatch_source_get_extended_data() function. The macros * DISPATCH_PROC_EXIT_STATUS_EXITED(), DISPATCH_PROC_EXIT_STATUS_CODE(), * DISPATCH_PROC_EXIT_STATUS_SIGNALED(), DISPATCH_PROC_EXIT_STATUS_TERMSIG() and * DISPATCH_PROC_EXIT_STATUS_CORE_DUMPED() can be used to examine the status * value. */ enum { DISPATCH_PROC_REAP DISPATCH_ENUM_API_DEPRECATED("unsupported flag", macos(10.6,10.9), ios(4.0,7.0)) = 0x10000000, DISPATCH_PROC_EXIT_STATUS DISPATCH_ENUM_API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(2.0)) = 0x04000000, }; /*! * @enum dispatch_source_vm_flags_t * * @constant DISPATCH_VM_PRESSURE * The VM has experienced memory pressure. */ enum { DISPATCH_VM_PRESSURE DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT("DISPATCH_MEMORYPRESSURE_WARN", macos(10.7, 10.10), ios(4.3, 8.0)) = 0x80000000, }; /*! * @typedef dispatch_source_memorypressure_flags_t * Type of dispatch_source_memorypressure flags * * @constant DISPATCH_MEMORYPRESSURE_LOW_SWAP * The system's memory pressure state has entered the "low swap" condition. * Restricted to the root user. */ enum { DISPATCH_MEMORYPRESSURE_LOW_SWAP DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x08, }; /*! * @enum dispatch_source_memorystatus_flags_t * @warning Deprecated, see DISPATCH_MEMORYPRESSURE_* */ enum { DISPATCH_MEMORYSTATUS_PRESSURE_NORMAL DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT("DISPATCH_MEMORYPRESSURE_NORMAL", macos(10.9, 10.12), ios(6.0, 10.0), tvos(6.0, 10.0), watchos(1.0, 3.0)) = 0x01, DISPATCH_MEMORYSTATUS_PRESSURE_WARN DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT("DISPATCH_MEMORYPRESSURE_WARN", macos(10.9, 10.12), ios(6.0, 10.0), tvos(6.0, 10.0), watchos(1.0, 3.0)) = 0x02, DISPATCH_MEMORYSTATUS_PRESSURE_CRITICAL DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT("DISPATCH_MEMORYPRESSURE_CRITICAL", macos(10.9, 10.12), ios(6.0, 10.0), tvos(6.0, 10.0), watchos(1.0, 3.0)) = 0x04, DISPATCH_MEMORYSTATUS_LOW_SWAP DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT("DISPATCH_MEMORYPRESSURE_LOW_SWAP", macos(10.9, 10.12), ios(6.0, 10.0), tvos(6.0, 10.0), watchos(1.0, 3.0)) = 0x08, }; /*! * @typedef dispatch_source_memorypressure_flags_t * Type of dispatch_source_memorypressure flags * * @constant DISPATCH_MEMORYPRESSURE_PROC_LIMIT_WARN * The memory of the process has crossed 80% of its high watermark limit. * * @constant DISPATCH_MEMORYPRESSURE_PROC_LIMIT_CRITICAL * The memory of the process has reached 100% of its high watermark limit. * * @constant DISPATCH_MEMORYPRESSURE_MSL_STATUS * Mask for enabling/disabling malloc stack logging. */ enum { DISPATCH_MEMORYPRESSURE_PROC_LIMIT_WARN DISPATCH_ENUM_API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) = 0x10, DISPATCH_MEMORYPRESSURE_PROC_LIMIT_CRITICAL DISPATCH_ENUM_API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) = 0x20, DISPATCH_MEMORYPRESSURE_MSL_STATUS DISPATCH_ENUM_API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) = 0xf0000000, }; /*! * Macros to check the exit status obtained from the status field of the * structure returned by the dispatch_source_get_extended_data() function for a * source of type DISPATCH_SOURCE_TYPE_PROC when DISPATCH_PROC_EXIT_STATUS has * been requested. * * DISPATCH_PROC_EXIT_STATUS_EXITED returns whether the process exited. If this * is true, the exit status can be obtained from DISPATCH_PROC_EXIT_STATUS_CODE. * * DISPATCH_PROC_EXIT_STATUS_SIGNALED returns whether the process was terminated * by a signal. * * DISPATCH_PROC_EXIT_STATUS_TERMSIG returns the signal that caused the process * to terminate, or 0 if the process was not terminated by a signal. * * DISPATCH_PROC_EXIT_STATUS_CORE_DUMPED returns whether a core dump of the * process was created. */ #define DISPATCH_PROC_EXIT_STATUS_EXITED(status) ((bool)WIFEXITED(status)) #define DISPATCH_PROC_EXIT_STATUS_CODE(status) ((int)WEXITSTATUS(status)) #define DISPATCH_PROC_EXIT_STATUS_SIGNALED(status) ((bool)WIFSIGNALED(status)) #define DISPATCH_PROC_EXIT_STATUS_TERMSIG(status) ((int)WTERMSIG(status)) #define DISPATCH_PROC_EXIT_STATUS_CORE_DUMPED(status) ((bool)WCOREDUMP(status)) __BEGIN_DECLS /*! * @function dispatch_source_set_mandatory_cancel_handler * * @abstract * Sets the event handler block for the given dispatch source, and indicates * that calling dispatch_source_cancel() is mandatory for this source object. * * @discussion * The cancellation handler (if specified) will be submitted to the source's * target queue in response to a call to dispatch_source_cancel() once the * system has released all references to the source's underlying handle and * the source's event handler block has returned. * * When this function has been used used to set a cancellation handler, then * the following result in an assertion and the process being terminated: * - releasing the last reference on the dispatch source without having * cancelled it by calling dispatch_source_cancel(); * - changing any handler after the source has been activated; * - changing the target queue of the source after it has been activated. * * IMPORTANT: * Source cancellation and a cancellation handler are required for file * descriptor and mach port based sources in order to safely close the * descriptor or destroy the port. Making the cancellation handler of such * sources mandatory is strongly recommended. * Closing the descriptor or port before the cancellation handler is invoked may * result in a race condition. If a new descriptor is allocated with the same * value as the recently closed descriptor while the source's event handler is * still running, the event handler may read/write data to the wrong descriptor. * * @param source * The dispatch source to modify. * The result of passing NULL in this parameter is undefined. * * @param handler * The cancellation handler block to submit to the source's target queue. * The result of passing NULL in this parameter is undefined. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_source_set_mandatory_cancel_handler(dispatch_source_t source, dispatch_block_t handler); #endif /* __BLOCKS__ */ # 486 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/source_private.h" /*! * @function dispatch_source_set_mandatory_cancel_handler_f * * @abstract * Sets the event handler function for the given dispatch source, and causes an * assertion if this source is released before having been explicitly canceled. * * @discussion * See dispatch_source_set_mandatory_cancel_handler() for more details. * * @param source * The dispatch source to modify. * The result of passing NULL in this parameter is undefined. * * @param handler * The cancellation handler function to submit to the source's target queue. * The context parameter passed to the event handler function is the current * context of the dispatch source at the time the handler call is made. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_source_set_mandatory_cancel_handler_f(dispatch_source_t source, dispatch_function_t handler); /*! * @function dispatch_source_cancel_and_wait * * @abstract * Synchronously cancel the dispatch source, preventing any further invocation * of its event handler block. * * @discussion * Cancellation prevents any further invocation of handler blocks for the * specified dispatch source, but does not interrupt a handler block that is * already in progress. * * When this function returns, any handler block that may have been in progress * has returned, the specified source has been unregistered and it is safe to * reclaim any system resource (such as file descriptors or mach ports) that * the specified source was monitoring. * * If the specified dispatch source is inactive, it will be activated as a side * effect of calling this function. * * It is possible to call this function from several threads concurrently, * and it is the responsibility of the callers to synchronize reclaiming the * associated system resources. * * This function is not subject to priority inversion when it is waiting on * a handler block still in progress, unlike patterns based on waiting on * a dispatch semaphore or a dispatch group signaled (or left) from the source * cancel handler. * * This function must not be called if the specified source has a cancel * handler set, or from the context of its handler blocks. * * This function must not be called from the context of the target queue of * the specified source or from any queue that synchronizes with it. Note that * calling dispatch_source_cancel() from such a context already guarantees * that no handler is in progress, and that no new event will be delivered. * * This function must not be called on sources suspended with an explicit * call to dispatch_suspend(), or being concurrently activated on another * thread. * * @param source * The dispatch source to be canceled. * The result of passing NULL in this parameter is undefined. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_source_cancel_and_wait(dispatch_source_t source); #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 564 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/source_private.h" /*! * @typedef dispatch_mig_callback_t * * @abstract * The signature of a function that handles Mach message delivery and response. */ typedef boolean_t (*dispatch_mig_callback_t)(mach_msg_header_t *message, mach_msg_header_t *reply); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW mach_msg_return_t dispatch_mig_server(dispatch_source_t ds, size_t maxmsgsz, dispatch_mig_callback_t callback); /*! * @function dispatch_mach_msg_get_context * * @abstract * Extract the context pointer from a mach message trailer. */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void *_Nullable dispatch_mach_msg_get_context(mach_msg_header_t *msg); #endif # 591 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/source_private.h" /*! * @typedef dispatch_source_extended_data_t * * @abstract * Type used by dispatch_source_get_extended_data() to return a consistent * snapshot of the data and status of a dispatch source. */ typedef struct dispatch_source_extended_data_s { unsigned long data; unsigned long status; } *dispatch_source_extended_data_t; /*! * @function dispatch_source_get_extended_data * * @abstract * Returns the current data and status values for a dispatch source. * * @discussion * This function is intended to be called from within the event handler block. * The result of calling this function outside of the event handler callback is * undefined. * * @param source * The result of passing NULL in this parameter is undefined. * * @param data * A pointer to a dispatch_source_extended_data_s in which the data and status * will be returned. The data field is populated with the value that would be * returned by dispatch_source_get_data(). The value of the status field should * be interpreted according to the type of the dispatch source: * * DISPATCH_SOURCE_TYPE_PROC: dispatch_source_proc_exit_flags_t * * If called from the event handler of a data source type not listed above, the * status value is undefined. * * @param size * The size of the specified structure. Should be set to * sizeof(dispatch_source_extended_data_s). * * @result * The size of the structure returned in *data, which will never be greater than * the value of the size argument. If this is less than the value of the size * argument, the remaining space in data will have been populated with zeroes. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW size_t dispatch_source_get_extended_data(dispatch_source_t source, dispatch_source_extended_data_t data, size_t size); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 650 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/source_private.h" # 219 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "mach_private.h" #endif /* expanded by -frewrite-includes */ # 219 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" 1 /* * Copyright (c) 2012-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_MACH_PRIVATE__ #define __DISPATCH_MACH_PRIVATE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" __BEGIN_DECLS #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_MACH_SPI #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" #define DISPATCH_MACH_SPI_VERSION 20161026 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" DISPATCH_ASSUME_NONNULL_BEGIN /*! * @functiongroup Dispatch Mach Channel SPI * * IMPORTANT: This is Libsystem-internal SPI not intended for general use and * is subject to change at any time without warning. */ /*! * @typedef dispatch_mach_t * A dispatch mach channel asynchronously recevives and sends mach messages. */ DISPATCH_DECL(dispatch_mach); /*! * @typedef dispatch_mach_reason_t * Reasons for a mach channel handler to be invoked, or the result of an * immediate send attempt. * * @const DISPATCH_MACH_CONNECTED * The channel has been connected. The first handler invocation on a channel * after calling dispatch_mach_connect() will have this reason. * * @const DISPATCH_MACH_MESSAGE_RECEIVED * A message was received, it is passed in the message parameter. * It is the responsibility of the client of this API to handle this and consume * or dispose of the rights in the message (for example by calling * mach_msg_destroy()). * * @const DISPATCH_MACH_MESSAGE_SENT * A message was sent, it is passed in the message parameter (so that associated * resources can be disposed of). * * @const DISPATCH_MACH_MESSAGE_SEND_FAILED * A message failed to be sent, it is passed in the message parameter (so that * associated resources can be disposed of), along with the error code from * mach_msg(). * * @const DISPATCH_MACH_MESSAGE_NOT_SENT * A message was not sent due to the channel being canceled or reconnected, it * is passed in the message parameter (so that associated resources can be * disposed of). * * @const DISPATCH_MACH_BARRIER_COMPLETED * A barrier block has finished executing. * * @const DISPATCH_MACH_DISCONNECTED * The channel has been disconnected by a call to dispatch_mach_reconnect() or * dispatch_mach_cancel(), an empty message is passed in the message parameter * (so that associated port rights can be disposed of). * The message header will contain either a remote port with a previously * connected send right, or a local port with a previously connected receive * right (if the channel was canceled), or a local port with a receive right * that was being monitored for a direct reply to a message previously sent to * the channel (if no reply was received). * * @const DISPATCH_MACH_CANCELED * The channel has been canceled. * * @const DISPATCH_MACH_REPLY_RECEIVED * A synchronous reply to a call to dispatch_mach_send_and_wait_for_reply() has * been received on another thread, an empty message is passed in the message * parameter (so that associated port rights can be disposed of). * The message header will contain a local port with a receive right associated * with the reply to the message that was synchronously sent to the channel. * * @const DISPATCH_MACH_NEEDS_DEFERRED_SEND * The message could not be sent synchronously. Only returned from a send with * result operation and never passed to a channel handler. Indicates that the * message passed to the send operation must not be disposed of until it is * returned via the channel handler. * * @const DISPATCH_MACH_SIGTERM_RECEIVED * A SIGTERM signal has been received. This notification is delivered at most * once during the lifetime of the channel. This event is sent only for XPC * channels (i.e. channels that were created by calling * dispatch_mach_create_4libxpc()) and only if the * dmxh_enable_sigterm_notification function in the XPC hooks structure returned * true when it was called at channel activation time. * * @const DISPATCH_MACH_ASYNC_WAITER_DISCONNECTED * The channel has been disconnected by a call to dispatch_mach_reconnect() or * dispatch_mach_cancel(), an empty message is passed in the message parameter * (so that associated port rights can be disposed of). The message header will * contain a local port with the receive right previously allocated to receive * an asynchronous reply to a message previously sent to the channel. Used * only if the channel is disconnected while waiting for a reply to a message * sent with dispatch_mach_send_with_result_and_async_reply_4libxpc(). */ DISPATCH_ENUM(dispatch_mach_reason, unsigned long, DISPATCH_MACH_CONNECTED = 1, DISPATCH_MACH_MESSAGE_RECEIVED, DISPATCH_MACH_MESSAGE_SENT, DISPATCH_MACH_MESSAGE_SEND_FAILED, DISPATCH_MACH_MESSAGE_NOT_SENT, DISPATCH_MACH_BARRIER_COMPLETED, DISPATCH_MACH_DISCONNECTED, DISPATCH_MACH_CANCELED, DISPATCH_MACH_REPLY_RECEIVED, DISPATCH_MACH_NEEDS_DEFERRED_SEND, DISPATCH_MACH_SIGTERM_RECEIVED, DISPATCH_MACH_ASYNC_WAITER_DISCONNECTED, DISPATCH_MACH_REASON_LAST, /* unused */ ); /*! * @typedef dispatch_mach_send_flags_t * Flags that can be passed to the *with_flags send functions. */ DISPATCH_ENUM(dispatch_mach_send_flags, unsigned long, DISPATCH_MACH_SEND_DEFAULT = 0, ); /*! * @typedef dispatch_mach_trailer_t * Trailer type of mach message received by dispatch mach channels */ typedef mach_msg_context_trailer_t dispatch_mach_trailer_t; /*! * @constant DISPATCH_MACH_RECEIVE_MAX_INLINE_MESSAGE_SIZE * Maximum size of a message that can be received inline by a dispatch mach * channel, reception of larger messages requires an extra roundtrip through * the kernel. */ #define DISPATCH_MACH_RECEIVE_MAX_INLINE_MESSAGE_SIZE \ (0x4000 - sizeof(dispatch_mach_trailer_t)) /*! * @typedef dispatch_mach_msg_t * A dispatch mach message encapsulates messages received or sent with dispatch * mach channels. */ DISPATCH_DECL(dispatch_mach_msg); /*! * @typedef dispatch_mach_msg_destructor_t * Dispatch mach message object destructors. * * @const DISPATCH_MACH_MSG_DESTRUCTOR_DEFAULT * Message buffer storage is internal to the object, if a buffer is supplied * during object creation, its contents are copied. * * @const DISPATCH_MACH_MSG_DESTRUCTOR_FREE * Message buffer will be deallocated with free(3). * * @const DISPATCH_MACH_MSG_DESTRUCTOR_FREE * Message buffer will be deallocated with vm_deallocate. */ DISPATCH_ENUM(dispatch_mach_msg_destructor, unsigned int, DISPATCH_MACH_MSG_DESTRUCTOR_DEFAULT = 0, DISPATCH_MACH_MSG_DESTRUCTOR_FREE, DISPATCH_MACH_MSG_DESTRUCTOR_VM_DEALLOCATE, ); /*! * @function dispatch_mach_msg_create * Creates a dispatch mach message object, either with a newly allocated message * buffer of given size, or from an existing message buffer that will be * deallocated with the specified destructor when the object is released. * * If a non-NULL reference to a pointer is provided in 'msg_ptr', it is filled * with the location of the (possibly newly allocated) message buffer. * * It is the responsibility of the application to ensure that it does not modify * the underlying message buffer once the dispatch mach message object is passed * to other dispatch mach API. * * @param msg The message buffer to create the message object from. * If 'destructor' is DISPATCH_MACH_MSG_DESTRUCTOR_DEFAULT, * this argument may be NULL to leave the newly allocated * message buffer zero-initialized. * @param size The size of the message buffer. * Must be >= sizeof(mach_msg_header_t) * @param destructor The destructor to use to deallocate the message buffer * when the object is released. * @param msg_ptr A pointer to a pointer variable to be filled with the * location of the (possibly newly allocated) message * buffer, or NULL. * @result A newly created dispatch mach message object. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_mach_msg_t dispatch_mach_msg_create(mach_msg_header_t *_Nullable msg, size_t size, dispatch_mach_msg_destructor_t destructor, mach_msg_header_t *_Nonnull *_Nullable msg_ptr); /*! * @function dispatch_mach_msg_get_msg * Returns the message buffer underlying a dispatch mach message object. * * @param message The dispatch mach message object to query. * @param size_ptr A pointer to a size_t variable to be filled with the * size of the message buffer, or NULL. * @result Pointer to message buffer underlying the object. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW mach_msg_header_t* dispatch_mach_msg_get_msg(dispatch_mach_msg_t message, size_t *_Nullable size_ptr); #ifdef __BLOCKS__ /*! * @typedef dispatch_mach_handler_t * Prototype of dispatch mach channel handler blocks. * * @param reason Reason the handler was invoked. * @param message Message object that was sent or received. * @param error Mach error code for the send operation. */ typedef void (^dispatch_mach_handler_t)(dispatch_mach_reason_t reason, dispatch_mach_msg_t _Nullable message, mach_error_t error); /*! * @function dispatch_mach_create * Create a dispatch mach channel to asynchronously receive and send mach * messages. * * The specified handler will be called with the corresponding reason parameter * for each message received and for each message that was successfully sent, * that failed to be sent, or was not sent; as well as when a barrier block * has completed, or when channel connection, reconnection or cancellation has * taken effect. * * Dispatch mach channels are created in a disconnected state, they must be * connected via dispatch_mach_connect() to begin receiving and sending * messages. * * @param label * An optional string label to attach to the channel. The string is not copied, * if it is non-NULL it must point to storage that remains valid for the * lifetime of the channel object. May be NULL. * * @param queue * The target queue of the channel, where the handler and barrier blocks will * be submitted. * * @param handler * The handler block to submit when a message has been sent or received. * * @result * The newly created dispatch mach channel. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NONNULL3 DISPATCH_NOTHROW dispatch_mach_t dispatch_mach_create(const char *_Nullable label, dispatch_queue_t _Nullable queue, dispatch_mach_handler_t handler); #endif # 299 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" /*! * @typedef dispatch_mach_handler_function_t * Prototype of dispatch mach channel handler functions. * * @param context Application-defined context parameter. * @param reason Reason the handler was invoked. * @param message Message object that was sent or received. * @param error Mach error code for the send operation. */ typedef void (*dispatch_mach_handler_function_t)(void *_Nullable context, dispatch_mach_reason_t reason, dispatch_mach_msg_t _Nullable message, mach_error_t error); /*! * @function dispatch_mach_create_f * Create a dispatch mach channel to asynchronously receive and send mach * messages. * * The specified handler will be called with the corresponding reason parameter * for each message received and for each message that was successfully sent, * that failed to be sent, or was not sent; as well as when a barrier block * has completed, or when channel connection, reconnection or cancellation has * taken effect. * * Dispatch mach channels are created in a disconnected state, they must be * connected via dispatch_mach_connect() to begin receiving and sending * messages. * * @param label * An optional string label to attach to the channel. The string is not copied, * if it is non-NULL it must point to storage that remains valid for the * lifetime of the channel object. May be NULL. * * @param queue * The target queue of the channel, where the handler and barrier blocks will * be submitted. * * @param context * The application-defined context to pass to the handler. * * @param handler * The handler function to submit when a message has been sent or received. * * @result * The newly created dispatch mach channel. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NONNULL4 DISPATCH_NOTHROW dispatch_mach_t dispatch_mach_create_f(const char *_Nullable label, dispatch_queue_t _Nullable queue, void *_Nullable context, dispatch_mach_handler_function_t handler); /*! * @function dispatch_mach_connect * Connect a mach channel to the specified receive and send rights. * * This function must only be called once during the lifetime of a channel, it * will initiate message reception and perform any already submitted message * sends or barrier operations. * * @param channel * The mach channel to connect. * * @param receive * The receive right to associate with the channel. May be MACH_PORT_NULL. * * @param send * The send right to associate with the channel. May be MACH_PORT_NULL. * * @param checkin * An optional message object encapsulating the initial check-in message to send * upon channel connection. The check-in message is sent immediately before the * first message submitted via dispatch_mach_send(). The message object will be * retained until the initial send operation is complete (or not peformed due * to channel cancellation or reconnection) and the channel handler has * returned. May be NULL. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_mach_connect(dispatch_mach_t channel, mach_port_t receive, mach_port_t send, dispatch_mach_msg_t _Nullable checkin); /*! * @function dispatch_mach_reconnect * Reconnect a mach channel to the specified send right. * * Disconnects the channel from the current send right, interrupts any pending * message sends (and returns the messages as unsent), and reconnects the * channel to a new send right. * * The application must wait for the channel handler to be invoked with * DISPATCH_MACH_DISCONNECTED before releasing the previous send right. * * @param channel * The mach channel to reconnect. * * @param send * The new send right to associate with the channel. May be MACH_PORT_NULL. * * @param checkin * An optional message object encapsulating the initial check-in message to send * upon channel reconnection. The check-in message is sent immediately before * the first message submitted via dispatch_mach_send() after this function * returns. The message object will be retained until the initial send operation * is complete (or not peformed due to channel cancellation or reconnection) * and the channel handler has returned. May be NULL. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW void dispatch_mach_reconnect(dispatch_mach_t channel, mach_port_t send, dispatch_mach_msg_t _Nullable checkin); /*! * @function dispatch_mach_cancel * Cancel a mach channel, preventing any further messages from being sent or * received. * * The application must wait for the channel handler to be invoked with * DISPATCH_MACH_DISCONNECTED before releasing the underlying send and receive * rights. * * Note: explicit cancellation of mach channels is required, no implicit * cancellation takes place on release of the last application reference * to the channel object. Failure to cancel will cause the channel and * its associated resources to be leaked. * * @param channel * The mach channel to cancel. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_mach_cancel(dispatch_mach_t channel); /*! * @function dispatch_mach_mig_demux * * @abstract * Handles an incoming DISPATCH_MACH_MESSAGE_RECEIVED event through a series of * MIG subsystem demultiplexers. * * @discussion * This function can be used with a static array of MIG subsystems to try. * If it returns true, then the dispatch mach message has been consumed as per * usual MIG rules. * * If it returns false, then the mach message has not been touched, and * consuming or disposing of the rights in the message is mandatory. * * It is hence possible to write a manual demuxer this way: * * * if (!dispatch_mach_mig_demux(context, subsystems, count, message)) { * mach_msg_header_t hdr = dispatch_mach_msg_get_msg(message, NULL); * switch (hdr->msgh_id) { * case ...: // manual consumption of messages * ... * break; * default: * mach_msg_destroy(hdr); // no one claimed the message, destroy it * } * } * * * @param context * An optional context that the MIG routines can query with * dispatch_mach_mig_demux_get_context() as MIG doesn't support contexts. * * @param subsystems * An array of mig_subsystem structs for all the demuxers to try. * These are exposed by MIG in the Server header of the generated interface. * * @param count * The number of entries in the subsystems array. * * @param msg * The dispatch mach message to process. * * @returns * Whether or not the dispatch mach message has been consumed. * If false is returned, then it is the responsibility of the caller to consume * or dispose of the received message rights. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL4 DISPATCH_NOTHROW bool dispatch_mach_mig_demux(void *_Nullable context, const struct mig_subsystem *_Nonnull const subsystems[_Nonnull], size_t count, dispatch_mach_msg_t msg); /*! * @function dispatch_mach_mig_demux_get_context * * @abstract * Returns the context passed to dispatch_mach_mig_demux() from the context of * a MIG routine implementation. * * @discussion * Calling this function from another context than a MIG routine called from the * context of dispatch_mach_mig_demux_get_context() is invalid and will cause * your process to be terminated. * * @returns * The context passed to the outer call to dispatch_mach_mig_demux(). */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void *_Nullable dispatch_mach_mig_demux_get_context(void); /*! * @function dispatch_mach_send * Asynchronously send a message encapsulated in a dispatch mach message object * to the specified mach channel. * * Unless the message is being sent to a send-once right (as determined by the * presence of MACH_MSG_TYPE_MOVE_SEND_ONCE in the message header remote bits), * the message header remote port is set to the channel send right before the * send operation is performed. * * If the message expects a direct reply (as determined by the presence of * MACH_MSG_TYPE_MAKE_SEND_ONCE in the message header local bits) the receive * right specified in the message header local port will be monitored until a * reply message (or a send-once notification) is received, or the channel is * canceled. Hence the application must wait for the channel handler to be * invoked with a DISPATCH_MACH_DISCONNECTED message before releasing that * receive right. * * If the message send operation is attempted but the channel is canceled * before the send operation succesfully completes, the message returned to the * channel handler with DISPATCH_MACH_MESSAGE_NOT_SENT may be the result of a * pseudo-receive operation. If the message expected a direct reply, the * receive right originally specified in the message header local port will * returned in a DISPATCH_MACH_DISCONNECTED message. * * @param channel * The mach channel to which to send the message. * * @param message * The message object encapsulating the message to send. The object will be * retained until the send operation is complete and the channel handler has * returned. The storage underlying the message object may be modified by the * send operation. * * @param options * Additional send options to pass to mach_msg() when performing the send * operation. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NOTHROW void dispatch_mach_send(dispatch_mach_t channel, dispatch_mach_msg_t message, mach_msg_option_t options); /*! * @function dispatch_mach_send_with_result * Asynchronously send a message encapsulated in a dispatch mach message object * to the specified mach channel. If an immediate send can be performed, return * its result via out parameters. * * Unless the message is being sent to a send-once right (as determined by the * presence of MACH_MSG_TYPE_MOVE_SEND_ONCE in the message header remote bits), * the message header remote port is set to the channel send right before the * send operation is performed. * * If the message expects a direct reply (as determined by the presence of * MACH_MSG_TYPE_MAKE_SEND_ONCE in the message header local bits) the receive * right specified in the message header local port will be monitored until a * reply message (or a send-once notification) is received, or the channel is * canceled. Hence the application must wait for the channel handler to be * invoked with a DISPATCH_MACH_DISCONNECTED message before releasing that * receive right. * * If the message send operation is attempted but the channel is canceled * before the send operation succesfully completes, the message returned to the * channel handler with DISPATCH_MACH_MESSAGE_NOT_SENT may be the result of a * pseudo-receive operation. If the message expected a direct reply, the * receive right originally specified in the message header local port will * returned in a DISPATCH_MACH_DISCONNECTED message. * * If an immediate send could be performed, returns the resulting reason * (e.g. DISPATCH_MACH_MESSAGE_SENT) and possible error to the caller in the * send_result and send_error out parameters (instead of via the channel * handler), in which case the passed-in message and associated resources * can be disposed of synchronously. * * If a deferred send is required, returns DISPATCH_MACH_NEEDS_DEFERRED_SEND * in the send_result out parameter to indicate that the passed-in message has * been retained and associated resources must not be disposed of until the * message is returned asynchronusly via the channel handler. * * @param channel * The mach channel to which to send the message. * * @param message * The message object encapsulating the message to send. Unless an immediate * send could be performed, the object will be retained until the asynchronous * send operation is complete and the channel handler has returned. The storage * underlying the message object may be modified by the send operation. * * @param options * Additional send options to pass to mach_msg() when performing the send * operation. * * @param send_flags * Flags to configure the send operation. Must be 0 for now. * * @param send_result * Out parameter to return the result of the immediate send attempt. * If a deferred send is required, returns DISPATCH_MACH_NEEDS_DEFERRED_SEND. * Must not be NULL. * * @param send_error * Out parameter to return the error from the immediate send attempt. * If a deferred send is required, returns 0. Must not be NULL. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL5 DISPATCH_NONNULL6 DISPATCH_NOTHROW void dispatch_mach_send_with_result(dispatch_mach_t channel, dispatch_mach_msg_t message, mach_msg_option_t options, dispatch_mach_send_flags_t send_flags, dispatch_mach_reason_t *send_result, mach_error_t *send_error); /*! * @function dispatch_mach_send_and_wait_for_reply * Synchronously send a message encapsulated in a dispatch mach message object * to the specified mach channel and wait for a reply. * * Unless the message is being sent to a send-once right (as determined by the * presence of MACH_MSG_TYPE_MOVE_SEND_ONCE in the message header remote bits), * the message header remote port is set to the channel send right before the * send operation is performed. * * The message is required to expect a direct reply (as determined by the * presence of MACH_MSG_TYPE_MAKE_SEND_ONCE in the message header local bits) * and this function will not complete until the receive right specified in the * message header local port receives a reply message (or a send-once * notification) which will be returned, or until that receive right is * destroyed in response to the channel being canceled, in which case NULL will * be returned. * In all these cases the application must wait for the channel handler to * be invoked with a DISPATCH_MACH_REPLY_RECEIVED or DISPATCH_MACH_DISCONNECTED * message before releasing that receive right. * * Alternatively, the application may specify MACH_PORT_NULL in the header local * port to indicate that the channel should create and manage the reply receive * right internally, including destroying it upon channel cancellation. * This is a more efficient mode of operation as no asynchronous operations are * required to return the receive right (i.e. the channel handler will not be * called as described above). * * If the message send operation is attempted but the channel is canceled * before the send operation succesfully completes, the message returned to the * channel handler with DISPATCH_MACH_MESSAGE_NOT_SENT may be the result of a * pseudo-receive operation. The receive right originally specified in the * message header local port will returned in a DISPATCH_MACH_DISCONNECTED * message (unless it was MACH_PORT_NULL). * * @param channel * The mach channel to which to send the message. * * @param message * The message object encapsulating the message to send. The object will be * retained until the send operation is complete and the channel handler has * returned. The storage underlying the message object may be modified by the * send operation. * * @param options * Additional send options to pass to mach_msg() when performing the send * operation. * * @result * The received reply message object, or NULL if the channel was canceled. */ API_AVAILABLE(macos(10.11), ios(9.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NOTHROW dispatch_mach_msg_t _Nullable dispatch_mach_send_and_wait_for_reply(dispatch_mach_t channel, dispatch_mach_msg_t message, mach_msg_option_t options); /*! * @function dispatch_mach_send_with_result_and_wait_for_reply * Synchronously send a message encapsulated in a dispatch mach message object * to the specified mach channel and wait for a reply. If an immediate send can * be performed, return its result via out parameters. * * Unless the message is being sent to a send-once right (as determined by the * presence of MACH_MSG_TYPE_MOVE_SEND_ONCE in the message header remote bits), * the message header remote port is set to the channel send right before the * send operation is performed. * * The message is required to expect a direct reply (as determined by the * presence of MACH_MSG_TYPE_MAKE_SEND_ONCE in the message header local bits) * and this function will not complete until the receive right specified in the * message header local port receives a reply message (or a send-once * notification) which will be returned, or until that receive right is * destroyed in response to the channel being canceled, in which case NULL will * be returned. * In all these cases the application must wait for the channel handler to * be invoked with a DISPATCH_MACH_REPLY_RECEIVED or DISPATCH_MACH_DISCONNECTED * message before releasing that receive right. * * Alternatively, the application may specify MACH_PORT_NULL in the header local * port to indicate that the channel should create and manage the reply receive * right internally, including destroying it upon channel cancellation. * This is a more efficient mode of operation as no asynchronous operations are * required to return the receive right (i.e. the channel handler will not be * called as described above). * * If the message send operation is attempted but the channel is canceled * before the send operation succesfully completes, the message returned to the * channel handler with DISPATCH_MACH_MESSAGE_NOT_SENT may be the result of a * pseudo-receive operation. The receive right originally specified in the * message header local port will returned in a DISPATCH_MACH_DISCONNECTED * message (unless it was MACH_PORT_NULL). * * If an immediate send could be performed, returns the resulting reason * (e.g. DISPATCH_MACH_MESSAGE_SENT) and possible error to the caller in the * send_result and send_error out parameters (instead of via the channel * handler), in which case the passed-in message and associated resources * can be disposed of synchronously. * * If a deferred send is required, returns DISPATCH_MACH_NEEDS_DEFERRED_SEND * in the send_result out parameter to indicate that the passed-in message has * been retained and associated resources must not be disposed of until the * message is returned asynchronusly via the channel handler. * * @param channel * The mach channel to which to send the message. * * @param message * The message object encapsulating the message to send. Unless an immediate * send could be performed, the object will be retained until the asynchronous * send operation is complete and the channel handler has returned. The storage * underlying the message object may be modified by the send operation. * * @param options * Additional send options to pass to mach_msg() when performing the send * operation. * * @param send_flags * Flags to configure the send operation. Must be 0 for now. * * @param send_result * Out parameter to return the result of the immediate send attempt. * If a deferred send is required, returns DISPATCH_MACH_NEEDS_DEFERRED_SEND. * Must not be NULL. * * @param send_error * Out parameter to return the error from the immediate send attempt. * If a deferred send is required, returns 0. Must not be NULL. * * @result * The received reply message object, or NULL if the channel was canceled. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL5 DISPATCH_NONNULL6 DISPATCH_NOTHROW dispatch_mach_msg_t _Nullable dispatch_mach_send_with_result_and_wait_for_reply(dispatch_mach_t channel, dispatch_mach_msg_t message, mach_msg_option_t options, dispatch_mach_send_flags_t send_flags, dispatch_mach_reason_t *send_result, mach_error_t *send_error); #ifdef __BLOCKS__ /*! * @function dispatch_mach_send_barrier * Submit a send barrier to the specified mach channel. Messages submitted to * the channel before the barrier will be sent before the barrier block is * executed, and messages submitted to the channel after the barrier will only * be sent once the barrier block has completed and the channel handler * invocation for the barrier has returned. * * @param channel * The mach channel to which to submit the barrier. * * @param barrier * The barrier block to submit to the channel target queue. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_mach_send_barrier(dispatch_mach_t channel, dispatch_block_t barrier); #endif # 792 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" /*! * @function dispatch_mach_send_barrier_f * Submit a send barrier to the specified mach channel. Messages submitted to * the channel before the barrier will be sent before the barrier block is * executed, and messages submitted to the channel after the barrier will only * be sent once the barrier block has completed and the channel handler * invocation for the barrier has returned. * * @param channel * The mach channel to which to submit the barrier. * * @param context * The application-defined context parameter to pass to the function. * * @param barrier * The barrier function to submit to the channel target queue. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_mach_send_barrier_f(dispatch_mach_t channel, void *_Nullable context, dispatch_function_t barrier); #ifdef __BLOCKS__ /*! * @function dispatch_mach_receive_barrier * Submit a receive barrier to the specified mach channel. Channel handlers for * messages received by the channel after the receive barrier has been * submitted will only be invoked once the barrier block has completed and the * channel handler invocation for the barrier has returned. * * @param channel * The mach channel to which to submit the receive barrier. * * @param barrier * The barrier block to submit to the channel target queue. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_mach_receive_barrier(dispatch_mach_t channel, dispatch_block_t barrier); #endif # 836 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" /*! * @function dispatch_mach_receive_barrier_f * Submit a receive barrier to the specified mach channel. Channel handlers for * messages received by the channel after the receive barrier has been * submitted will only be invoked once the barrier block has completed and the * channel handler invocation for the barrier has returned. * * @param channel * The mach channel to which to submit the receive barrier. * * @param context * The application-defined context parameter to pass to the function. * * @param barrier * The barrier function to submit to the channel target queue. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_mach_receive_barrier_f(dispatch_mach_t channel, void *_Nullable context, dispatch_function_t barrier); /*! * @function dispatch_mach_get_checkin_port * Returns the port specified in the message header remote port of the check-in * message passed to the most recent invocation of dispatch_mach_connect() or * dispatch_mach_reconnect() for the provided mach channel (irrespective of the * completion of the (re)connect or check-in operations in question). * * Returns MACH_PORT_NULL if dispatch_mach_connect() has not yet been called or * if the most recently specified check-in message was NULL, and MACH_PORT_DEAD * if the channel has been canceled. * * It is the responsibility of the application to ensure that the port * specified in a check-in message remains valid at the time this function is * called. * * @param channel * The mach channel to query. * * @result * The most recently specified check-in port for the channel. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW mach_port_t dispatch_mach_get_checkin_port(dispatch_mach_t channel); // SPI for libxpc /* * Type for the callback for receipt of asynchronous replies to * dispatch_mach_send_with_result_and_async_reply_4libxpc(). */ typedef void (*_Nonnull dispatch_mach_async_reply_callback_t)(void *context, dispatch_mach_reason_t reason, dispatch_mach_msg_t message); API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) typedef const struct dispatch_mach_xpc_hooks_s { #define DISPATCH_MACH_XPC_MIN_HOOKS_VERSION 3 #define DISPATCH_MACH_XPC_HOOKS_VERSION 3 unsigned long version; /* Fields available in version 1. */ /* * Called to handle a Mach message event inline if possible. Returns true * if the event was handled, false if the event should be delivered to the * channel event handler. The implementation should not make any assumptions * about the thread in which the function is called and cannot assume that * invocations of this function are serialized relative to each other or * relative to the channel's event handler function. In addition, the * handler must not throw an exception or call out to any code that might * throw an exception. */ bool (* _Nonnull dmxh_direct_message_handler)(void *_Nullable context, dispatch_mach_reason_t reason, dispatch_mach_msg_t message, mach_error_t error); /* Fields available in version 2. */ /* * Gets the queue to which a reply to a message sent using * dispatch_mach_send_with_result_and_async_reply_4libxpc() should be * delivered. The msg_context argument is the value of the do_ctxt field * of the outgoing message, as returned by dispatch_get_context(). * * This function should return a consistent result until an event is * received for this message. This function must return NULL if * dispatch_mach_send_with_result_and_async_reply_4libxpc() wasn't used to * send the message, and non NULL otherwise. */ dispatch_queue_t _Nullable (*_Nonnull dmxh_msg_context_reply_queue)( void *_Nonnull msg_context); /* * Called when a reply to a message sent by * dispatch_mach_send_with_result_and_async_reply_4libxpc() is received. The * message argument points to the reply message and the context argument is * the context value passed to dispatch_mach_create_4libxpc() when creating * the Mach channel. The handler is called on the queue that is returned by * dmxh_msg_context_reply_queue() when the reply is received or if the * channel is disconnected. The reason argument is * DISPATCH_MACH_MESSAGE_RECEIVED if a reply has been received or * DISPATCH_MACH_ASYNC_WAITER_DISCONNECTED if the channel has been * disconnected. Refer to the documentation for * dispatch_mach_send_with_result_and_async_reply_4libxpc() for more * details. */ dispatch_mach_async_reply_callback_t dmxh_async_reply_handler; /* Fields available in version 3. */ /** * Called once when the Mach channel has been activated. If this function * returns true, a DISPATCH_MACH_SIGTERM_RECEIVED notification will be * delivered to the channel's event handler when a SIGTERM is received. */ bool (*_Nonnull dmxh_enable_sigterm_notification)( void *_Nullable context); } *dispatch_mach_xpc_hooks_t; /*! * @function dispatch_mach_hooks_install_4libxpc * * @abstract * installs XPC callbacks for dispatch Mach channels. * * @discussion * In order to improve the performance of the XPC/dispatch interface, it is * sometimes useful for dispatch to be able to call directly into XPC. The * channel hooks structure should be initialized with pointers to XPC callback * functions, or NULL for callbacks that XPC does not support. The version * number in the structure must be set to reflect the fields that have been * initialized. This function may be called only once. * * @param hooks * A pointer to the channel hooks structure. This must remain valid once set. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void dispatch_mach_hooks_install_4libxpc(dispatch_mach_xpc_hooks_t hooks); /*! * @function dispatch_mach_create_4libxpc * Create a dispatch mach channel to asynchronously receive and send mach * messages, specifically for libxpc. * * The specified handler will be called with the corresponding reason parameter * for each message received and for each message that was successfully sent, * that failed to be sent, or was not sent; as well as when a barrier block * has completed, or when channel connection, reconnection or cancellation has * taken effect. However, the handler will not be called for messages that * were passed to the XPC hooks dmxh_direct_message_handler function if that * function returned true. * * Dispatch mach channels are created in a disconnected state, they must be * connected via dispatch_mach_connect() to begin receiving and sending * messages. * * @param label * An optional string label to attach to the channel. The string is not copied, * if it is non-NULL it must point to storage that remains valid for the * lifetime of the channel object. May be NULL. * * @param queue * The target queue of the channel, where the handler and barrier blocks will * be submitted. * * @param context * The application-defined context to pass to the handler. * * @param handler * The handler function to submit when a message has been sent or received. * * @result * The newly created dispatch mach channel. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NONNULL4 DISPATCH_NOTHROW dispatch_mach_t dispatch_mach_create_4libxpc(const char *_Nullable label, dispatch_queue_t _Nullable queue, void *_Nullable context, dispatch_mach_handler_function_t handler); /*! * @function dispatch_mach_send_with_result_and_async_reply_4libxpc * SPI for XPC that asynchronously sends a message encapsulated in a dispatch * mach message object to the specified mach channel. If an immediate send can * be performed, returns its result via out parameters. * * The reply message is processed on the queue returned by the * dmxh_msg_context_reply_queue function in the dispatch_mach_xpc_hooks_s * structure, which is called with a single argument whose value is the * do_ctxt field of the message argument to this function. The reply message is * delivered to the dmxh_async_reply_handler hook function instead of being * passed to the channel event handler. * * If the dmxh_msg_context_reply_queue function is not implemented or returns * NULL, the reply message is delivered to the channel event handler on the * channel queue. * * Unless the message is being sent to a send-once right (as determined by the * presence of MACH_MSG_TYPE_MOVE_SEND_ONCE in the message header remote bits), * the message header remote port is set to the channel send right before the * send operation is performed. * * The message is required to expect a direct reply (as determined by the * presence of MACH_MSG_TYPE_MAKE_SEND_ONCE in the message header local bits). * The receive right specified in the message header local port will be * monitored until a reply message (or a send-once notification) is received, or * the channel is canceled. Hence the application must wait for the reply * to be received or for a DISPATCH_MACH_ASYNC_WAITER_DISCONNECTED message * before releasing that receive right. * * If the message send operation is attempted but the channel is canceled * before the send operation succesfully completes, the message returned to the * channel handler with DISPATCH_MACH_MESSAGE_NOT_SENT may be the result of a * pseudo-receive operation and the receive right originally specified in the * message header local port will be returned in a * DISPATCH_MACH_ASYNC_WAITER_DISCONNECTED message. * * If an immediate send could be performed, returns the resulting reason * (e.g. DISPATCH_MACH_MESSAGE_SENT) and possible error to the caller in the * send_result and send_error out parameters (instead of via the channel * handler), in which case the passed-in message and associated resources * can be disposed of synchronously. * * If a deferred send is required, returns DISPATCH_MACH_NEEDS_DEFERRED_SEND * in the send_result out parameter to indicate that the passed-in message has * been retained and associated resources must not be disposed of until the * message is returned asynchronusly via the channel handler. * * @param channel * The mach channel to which to send the message. * * @param message * The message object encapsulating the message to send. Unless an immediate * send could be performed, the object will be retained until the asynchronous * send operation is complete and the channel handler has returned. The storage * underlying the message object may be modified by the send operation. * * @param options * Additional send options to pass to mach_msg() when performing the send * operation. * * @param send_flags * Flags to configure the send operation. Must be 0 for now. * * @param send_result * Out parameter to return the result of the immediate send attempt. * If a deferred send is required, returns DISPATCH_MACH_NEEDS_DEFERRED_SEND. * Must not be NULL. * * @param send_error * Out parameter to return the error from the immediate send attempt. * If a deferred send is required, returns 0. Must not be NULL. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL5 DISPATCH_NONNULL6 DISPATCH_NOTHROW void dispatch_mach_send_with_result_and_async_reply_4libxpc(dispatch_mach_t channel, dispatch_mach_msg_t message, mach_msg_option_t options, dispatch_mach_send_flags_t send_flags, dispatch_mach_reason_t *send_result, mach_error_t *send_error); /*! * @function dispatch_mach_handoff_reply_f * * @abstract * Inform the runtime that a given sync IPC is being handed off to a new queue * hierarchy. * * @discussion * This function can only be called from the context of an IPC handler, or from * a work item created by dispatch_mach_handoff_reply_f. Calling * dispatch_mach_handoff_reply_f from a different context is undefined and will * cause the process to be terminated. * * dispatch_mach_handoff_reply_f will only take effect when the work item that * issued it returns. * * @param queue * The queue the IPC reply will be handed off to. This queue must be an * immutable queue hierarchy (with all nodes created with * dispatch_queue_create_with_target() for example). * * @param port * The send once right that will be replied to. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL4 DISPATCH_NOTHROW void dispatch_mach_handoff_reply_f(dispatch_queue_t queue, mach_port_t port, void *_Nullable ctxt, dispatch_function_t func); /*! * @function dispatch_mach_handoff_reply * * @abstract * Inform the runtime that a given sync IPC is being handed off to a new queue * hierarchy. * * @see dispatch_mach_handoff_reply_f */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_mach_handoff_reply(dispatch_queue_t queue, mach_port_t port, dispatch_block_t block); DISPATCH_ASSUME_NONNULL_END #endif // DISPATCH_MACH_SPI # 1152 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" __END_DECLS #endif # 1156 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/mach_private.h" # 220 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "data_private.h" #endif /* expanded by -frewrite-includes */ # 220 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/data_private.h" 1 /* * Copyright (c) 2011-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_DATA_PRIVATE__ #define __DISPATCH_DATA_PRIVATE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/data_private.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/data_private.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/data_private.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @const DISPATCH_DATA_DESTRUCTOR_NONE * @discussion The destructor for dispatch data objects that require no buffer * memory management. This can be used to allow a data object to efficiently * encapsulate buffers that should not be copied or freed by the system. */ #define DISPATCH_DATA_DESTRUCTOR_NONE (_dispatch_data_destructor_none) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(none); /*! * @const DISPATCH_DATA_DESTRUCTOR_VM_DEALLOCATE * @discussion The destructor for dispatch data objects that have been created * from buffers that require deallocation using vm_deallocate. */ #define DISPATCH_DATA_DESTRUCTOR_VM_DEALLOCATE \ (_dispatch_data_destructor_vm_deallocate) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_LINUX_UNAVAILABLE() DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(vm_deallocate); /*! * @function dispatch_data_create_f * Creates a dispatch data object from the given contiguous buffer of memory. If * a non-default destructor is provided, ownership of the buffer remains with * the caller (i.e. the bytes will not be copied). The last release of the data * object will result in the invocation of the specified destructor function on * specified queue to free the buffer (passed as the context parameter). * * If the DISPATCH_DATA_DESTRUCTOR_FREE destructor is provided the buffer will * be freed via free(3) and the queue argument ignored. * * If the DISPATCH_DATA_DESTRUCTOR_DEFAULT destructor is provided, data object * creation will copy the buffer into internal memory managed by the system. * * @param buffer A contiguous buffer of data. * @param size The size of the contiguous buffer of data. * @param queue The queue to which the destructor should be submitted. * @param destructor The destructor function responsible for freeing the * data buffer when it is no longer needed. * @result A newly created dispatch data object. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_data_t dispatch_data_create_f(const void *buffer, size_t size, dispatch_queue_t _Nullable queue, dispatch_function_t _Nullable destructor); /*! * @function dispatch_data_create_alloc * Creates a dispatch data object representing a newly allocated memory region * of the given size. If a non-NULL reference to a pointer is provided, it is * filled with the location of the memory region. * * It is the responsibility of the application to ensure that the data object * becomes immutable (i.e. the returned memory region is not further modified) * once the dispatch data object is passed to other API. * * @param size The size of the required allocation. * @param buffer_ptr A pointer to a pointer variable to be filled with the * location of the newly allocated memory region, or NULL. * @result A newly created dispatch data object. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_data_t dispatch_data_create_alloc(size_t size, void *_Nullable *_Nullable buffer_ptr); /*! * @typedef dispatch_data_applier_function_t * A function to be invoked for every contiguous memory region in a data object. * * @param context Application-defined context parameter. * @param region A data object representing the current region. * @param offset The logical offset of the current region to the start * of the data object. * @param buffer The location of the memory for the current region. * @param size The size of the memory for the current region. * @result A Boolean indicating whether traversal should continue. */ typedef bool (*dispatch_data_applier_function_t)(void *_Nullable context, dispatch_data_t region, size_t offset, const void *buffer, size_t size); /*! * @function dispatch_data_apply_f * Traverse the memory regions represented by the specified dispatch data object * in logical order and invoke the specified function once for every contiguous * memory region encountered. * * Each invocation of the function is passed a data object representing the * current region and its logical offset, along with the memory location and * extent of the region. These allow direct read access to the memory region, * but are only valid until the passed-in region object is released. Note that * the region object is released by the system when the function returns, it is * the responsibility of the application to retain it if the region object or * the associated memory location are needed after the function returns. * * @param data The data object to traverse. * @param context The application-defined context to pass to the function. * @param applier The function to be invoked for every contiguous memory * region in the data object. * @result A Boolean indicating whether traversal completed * successfully. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW bool dispatch_data_apply_f(dispatch_data_t data, void *_Nullable context, dispatch_data_applier_function_t applier); #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 152 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/data_private.h" /*! * @function dispatch_data_make_memory_entry * Return a mach memory entry for the memory regions represented by the * specified dispatch data object. * * For data objects created with the DISPATCH_DATA_DESTRUCTOR_VM_DEALLOCATE * destructor, directly makes a memory entry from the represented region; * otherwise, makes a memory entry from newly allocated pages containing a copy * of the represented memory regions. * * @param data The data object to make a memory entry for. * @result A mach port for the newly made memory entry, or * MACH_PORT_NULL if an error occurred. */ API_AVAILABLE(macos(10.9), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW mach_port_t dispatch_data_make_memory_entry(dispatch_data_t data); #endif # 171 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/data_private.h" /*! * @functiongroup Dispatch data transform SPI */ /*! * @typedef dispatch_data_format_type_t * * @abstract * Data formats are used to specify the input and output types of data supplied * to dispatch_data_create_transform. */ typedef const struct dispatch_data_format_type_s *dispatch_data_format_type_t; #define DISPATCH_DATA_FORMAT_TYPE_DECL(name) \ DISPATCH_EXPORT const struct dispatch_data_format_type_s \ _dispatch_data_format_type_##name /*! * @const DISPATCH_DATA_FORMAT_TYPE_NONE * @discussion A data format denoting that the given input or output format is, * or should be, comprised of raw data bytes with no given encoding. */ #define DISPATCH_DATA_FORMAT_TYPE_NONE (&_dispatch_data_format_type_none) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_DATA_FORMAT_TYPE_DECL(none); /*! * @const DISPATCH_DATA_FORMAT_TYPE_BASE32 * @discussion A data format denoting that the given input or output format is, * or should be, encoded in Base32 (RFC 4648) format. On input, this format will * skip whitespace characters. Cannot be used in conjunction with UTF format * types. */ #define DISPATCH_DATA_FORMAT_TYPE_BASE32 (&_dispatch_data_format_type_base32) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_DATA_FORMAT_TYPE_DECL(base32); /*! * @const DISPATCH_DATA_FORMAT_TYPE_BASE32HEX * @discussion A data format denoting that the given input or output format is, * or should be, encoded in Base32Hex (RFC 4648) format. On input, this format * will skip whitespace characters. Cannot be used in conjunction with UTF * format types. */ #define DISPATCH_DATA_FORMAT_TYPE_BASE32HEX \ (&_dispatch_data_format_type_base32hex) API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_DATA_FORMAT_TYPE_DECL(base32hex); /*! * @const DISPATCH_DATA_FORMAT_TYPE_BASE64 * @discussion A data format denoting that the given input or output format is, * or should be, encoded in Base64 (RFC 4648) format. On input, this format will * skip whitespace characters. Cannot be used in conjunction with UTF format * types. */ #define DISPATCH_DATA_FORMAT_TYPE_BASE64 (&_dispatch_data_format_type_base64) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_DATA_FORMAT_TYPE_DECL(base64); /*! * @const DISPATCH_DATA_FORMAT_TYPE_UTF8 * @discussion A data format denoting that the given input or output format is, * or should be, encoded in UTF-8 format. Is only valid when used in conjunction * with other UTF format types. */ #define DISPATCH_DATA_FORMAT_TYPE_UTF8 (&_dispatch_data_format_type_utf8) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_DATA_FORMAT_TYPE_DECL(utf8); /*! * @const DISPATCH_DATA_FORMAT_TYPE_UTF16LE * @discussion A data format denoting that the given input or output format is, * or should be, encoded in UTF-16LE format. Is only valid when used in * conjunction with other UTF format types. */ #define DISPATCH_DATA_FORMAT_TYPE_UTF16LE (&_dispatch_data_format_type_utf16le) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_DATA_FORMAT_TYPE_DECL(utf16le); /*! * @const DISPATCH_DATA_FORMAT_TYPE_UTF16BE * @discussion A data format denoting that the given input or output format is, * or should be, encoded in UTF-16BE format. Is only valid when used in * conjunction with other UTF format types. */ #define DISPATCH_DATA_FORMAT_TYPE_UTF16BE (&_dispatch_data_format_type_utf16be) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_DATA_FORMAT_TYPE_DECL(utf16be); /*! * @const DISPATCH_DATA_FORMAT_TYPE_UTFANY * @discussion A data format denoting that dispatch_data_create_transform should * attempt to automatically detect the input type based on the presence of a * byte order mark character at the beginning of the data. In the absence of a * BOM, the data will be assumed to be in UTF-8 format. Only valid as an input * format. */ #define DISPATCH_DATA_FORMAT_TYPE_UTF_ANY (&_dispatch_data_format_type_utf_any) API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_DATA_FORMAT_TYPE_DECL(utf_any); /*! * @function dispatch_data_create_transform * Returns a new dispatch data object after transforming the given data object * from the supplied format, into the given output format. * * @param data * The data object representing the region(s) of memory to transform. * @param input_type * Flags specifying the input format of the source dispatch_data_t * * @param output_type * Flags specifying the expected output format of the resulting transformation. * * @result * A newly created dispatch data object, dispatch_data_empty if no has been * produced, or NULL if an error occurred. */ API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_data_t dispatch_data_create_with_transform(dispatch_data_t data, dispatch_data_format_type_t input_type, dispatch_data_format_type_t output_type); /*! * @function dispatch_data_get_flattened_bytes_4libxpc * * Similar to dispatch_data_create_map() but attaches it to the passed in * dispatch data. * * The returned mapping, if not NULL, has the size returned by * dispatch_data_get_size() for the specified object, and its lifetime is tied * to the one of the dispatch data itself. * * @discussion * This interface is reserved for XPC usage and is not considered stable ABI. * * * @result * A newly created linear mapping for this data object, may return NULL if * making the dispatch data contiguous failed to allocate memory. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0), bridgeos(4.0)) const void *_Nullable dispatch_data_get_flattened_bytes_4libxpc(dispatch_data_t data); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif // __DISPATCH_DATA_PRIVATE__ # 326 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/data_private.h" # 221 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "os/voucher_private.h" #endif /* expanded by -frewrite-includes */ # 221 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" 1 /* * Copyright (c) 2013-2014 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __OS_VOUCHER_PRIVATE__ #define __OS_VOUCHER_PRIVATE__ #if 0 /* disabled by -frewrite-includes */ #if __APPLE__ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 29 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 29 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #endif # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #endif # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #endif # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #ifndef __DISPATCH_BUILDING_DISPATCH__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #endif /* !__DISPATCH_BUILDING_DISPATCH__ */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #define OS_VOUCHER_SPI_VERSION 20150630 #if 0 /* disabled by -frewrite-includes */ #if OS_VOUCHER_WEAK_IMPORT #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #define OS_VOUCHER_EXPORT OS_EXPORT OS_WEAK_IMPORT #else # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #define OS_VOUCHER_EXPORT OS_EXPORT #endif # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @group Voucher Transport SPI * SPI intended for clients that need to transport vouchers. */ /*! * @typedef voucher_t * * @abstract * Vouchers are immutable sets of key/value attributes that can be adopted on a * thread in the current process or sent to another process. * * @discussion * Voucher objects are os_objects (c.f. ). They are memory-managed * with the os_retain()/os_release() functions or -[retain]/-[release] methods. */ OS_OBJECT_DECL_CLASS(voucher); /*! * @const VOUCHER_NULL * Represents the empty base voucher with no attributes. */ #define VOUCHER_NULL ((voucher_t)0) /*! * @const VOUCHER_INVALID * Represents an invalid voucher */ #define VOUCHER_INVALID ((voucher_t)-1) /*! * @function voucher_adopt * * @abstract * Adopt the specified voucher on the current thread and return the voucher * that had been adopted previously. * * @discussion * Adopted vouchers are automatically carried forward by the system to other * threads and processes (across IPC). * * Consumes a reference to the specified voucher. * Returns a reference to the previous voucher. * * @param voucher * The voucher object to adopt on the current thread. * * @result * The previously adopted voucher object. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_VOUCHER_EXPORT OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT_NEEDS_RELEASE OS_NOTHROW voucher_t _Nullable voucher_adopt(voucher_t _Nullable voucher OS_OBJECT_CONSUMED); /*! * @function voucher_copy * * @abstract * Returns a reference to the voucher that had been adopted previously on the * current thread (or carried forward by the system). * * @result * The currently adopted voucher object. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_VOUCHER_EXPORT OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT OS_NOTHROW voucher_t _Nullable voucher_copy(void); /*! * @function voucher_copy_without_importance * * @abstract * Returns a reference to a voucher object with all the properties of the * voucher that had been adopted previously on the current thread, but * without the importance properties that are frequently attached to vouchers * carried with IPC requests. Importance properties may elevate the scheduling * of threads that adopt or retain the voucher while they service the request. * See xpc_transaction_begin(3) for further details on importance. * * @result * A copy of the currently adopted voucher object, with importance removed. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_VOUCHER_EXPORT OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT OS_NOTHROW voucher_t _Nullable voucher_copy_without_importance(void); /*! * @function voucher_replace_default_voucher * * @abstract * Replace process attributes of default voucher (used for IPC by this process * when no voucher is adopted on the sending thread) with the process attributes * of the voucher adopted on the current thread. * * @discussion * This allows a daemon to indicate from the context of an incoming IPC request * that all future outgoing IPC from the process should be marked as acting * "on behalf of" the sending process of the current IPC request (as long as the * thread sending that outgoing IPC is not itself in the direct context of an * IPC request, i.e. no voucher is adopted). * * If no voucher is adopted on the current thread or the current voucher does * not contain any process attributes, the default voucher is reset to the * default process attributes for the current process. * * CAUTION: Do NOT use this SPI without contacting the Darwin Runtime team. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_VOUCHER_EXPORT OS_NOTHROW void voucher_replace_default_voucher(void); /*! * @function voucher_decrement_importance_count4CF * * @abstract * Decrement external importance count of the mach voucher in the specified * voucher object. * * @discussion * This is only intended for use by CoreFoundation to explicitly manage the * App Nap state of an application following reception of a de-nap IPC message. * * CAUTION: Do NOT use this SPI without contacting the Darwin Runtime team. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_VOUCHER_EXPORT OS_NOTHROW void voucher_decrement_importance_count4CF(voucher_t _Nullable voucher); /*! * @group Voucher dispatch block SPI */ /*! * @typedef dispatch_block_flags_t * SPI Flags to pass to the dispatch_block_create* functions. * * @const DISPATCH_BLOCK_NO_VOUCHER * Flag indicating that a dispatch block object should not be assigned a voucher * object. If invoked directly, the block object will be executed with the * voucher adopted on the calling thread. If the block object is submitted to a * queue, this replaces the default behavior of associating the submitted block * instance with the voucher adopted at the time of submission. * This flag is ignored if used with the dispatch_block_create_with_voucher*() * functions. * */ #define DISPATCH_BLOCK_NO_VOUCHER (0x40ul) #define DISPATCH_BLOCK_IF_LAST_RESET_QUEUE_QOS_OVERRIDE (0x80ul) /*! * @function dispatch_block_create_with_voucher * * @abstract * Create a new dispatch block object on the heap from an existing block and * the given flags, and assign it the specified voucher object. * * @discussion * The provided block is Block_copy'ed to the heap, it and the specified voucher * object are retained by the newly created dispatch block object. * * The returned dispatch block object is intended to be submitted to a dispatch * queue with dispatch_async() and related functions, but may also be invoked * directly. Both operations can be performed an arbitrary number of times but * only the first completed execution of a dispatch block object can be waited * on with dispatch_block_wait() or observed with dispatch_block_notify(). * * The returned dispatch block will be executed with the specified voucher * adopted for the duration of the block body. * * If the returned dispatch block object is submitted to a dispatch queue, the * submitted block instance will be associated with the QOS class current at the * time of submission, unless one of the following flags assigned a specific QOS * class (or no QOS class) at the time of block creation: * - DISPATCH_BLOCK_ASSIGN_CURRENT * - DISPATCH_BLOCK_NO_QOS_CLASS * - DISPATCH_BLOCK_DETACHED * The QOS class the block object will be executed with also depends on the QOS * class assigned to the queue and which of the following flags was specified or * defaulted to: * - DISPATCH_BLOCK_INHERIT_QOS_CLASS (default for asynchronous execution) * - DISPATCH_BLOCK_ENFORCE_QOS_CLASS (default for synchronous execution) * See description of dispatch_block_flags_t for details. * * If the returned dispatch block object is submitted directly to a serial queue * and is configured to execute with a specific QOS class, the system will make * a best effort to apply the necessary QOS overrides to ensure that blocks * submitted earlier to the serial queue are executed at that same QOS class or * higher. * * @param flags * Configuration flags for the block object. * Passing a value that is not a bitwise OR of flags from dispatch_block_flags_t * results in NULL being returned. The DISPATCH_BLOCK_NO_VOUCHER flag is * ignored. * * @param voucher * A voucher object or NULL. * * @param block * The block to create the dispatch block object from. * * @result * The newly created dispatch block object, or NULL. * When not building with Objective-C ARC, must be released with a -[release] * message or the Block_release() function. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_RETURNS_RETAINED_BLOCK DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_block_t dispatch_block_create_with_voucher(dispatch_block_flags_t flags, voucher_t _Nullable voucher, dispatch_block_t block); /*! * @function dispatch_block_create_with_voucher_and_qos_class * * @abstract * Create a new dispatch block object on the heap from an existing block and * the given flags, and assign it the specified voucher object, QOS class and * relative priority. * * @discussion * The provided block is Block_copy'ed to the heap, it and the specified voucher * object are retained by the newly created dispatch block object. * * The returned dispatch block object is intended to be submitted to a dispatch * queue with dispatch_async() and related functions, but may also be invoked * directly. Both operations can be performed an arbitrary number of times but * only the first completed execution of a dispatch block object can be waited * on with dispatch_block_wait() or observed with dispatch_block_notify(). * * The returned dispatch block will be executed with the specified voucher * adopted for the duration of the block body. * * If invoked directly, the returned dispatch block object will be executed with * the assigned QOS class as long as that does not result in a lower QOS class * than what is current on the calling thread. * * If the returned dispatch block object is submitted to a dispatch queue, the * QOS class it will be executed with depends on the QOS class assigned to the * block, the QOS class assigned to the queue and which of the following flags * was specified or defaulted to: * - DISPATCH_BLOCK_INHERIT_QOS_CLASS: default for asynchronous execution * - DISPATCH_BLOCK_ENFORCE_QOS_CLASS: default for synchronous execution * See description of dispatch_block_flags_t for details. * * If the returned dispatch block object is submitted directly to a serial queue * and is configured to execute with a specific QOS class, the system will make * a best effort to apply the necessary QOS overrides to ensure that blocks * submitted earlier to the serial queue are executed at that same QOS class or * higher. * * @param flags * Configuration flags for the block object. * Passing a value that is not a bitwise OR of flags from dispatch_block_flags_t * results in NULL being returned. The DISPATCH_BLOCK_NO_VOUCHER and * DISPATCH_BLOCK_NO_QOS flags are ignored. * * @param voucher * A voucher object or NULL. * * @param qos_class * A QOS class value: * - QOS_CLASS_USER_INTERACTIVE * - QOS_CLASS_USER_INITIATED * - QOS_CLASS_DEFAULT * - QOS_CLASS_UTILITY * - QOS_CLASS_BACKGROUND * - QOS_CLASS_UNSPECIFIED * Passing QOS_CLASS_UNSPECIFIED is equivalent to specifying the * DISPATCH_BLOCK_NO_QOS_CLASS flag. Passing any other value results in NULL * being returned. * * @param relative_priority * A relative priority within the QOS class. This value is a negative * offset from the maximum supported scheduler priority for the given class. * Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY * results in NULL being returned. * * @param block * The block to create the dispatch block object from. * * @result * The newly created dispatch block object, or NULL. * When not building with Objective-C ARC, must be released with a -[release] * message or the Block_release() function. */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL5 DISPATCH_RETURNS_RETAINED_BLOCK DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_block_t dispatch_block_create_with_voucher_and_qos_class(dispatch_block_flags_t flags, voucher_t _Nullable voucher, dispatch_qos_class_t qos_class, int relative_priority, dispatch_block_t block); /*! * @group Voucher dispatch queue SPI */ /*! * @function dispatch_queue_create_with_accounting_override_voucher * * @abstract * Deprecated, do not use, will abort process if called. */ API_DEPRECATED("removed SPI", \ macos(10.11,10.13), ios(9.0,11.0), watchos(2.0,4.0), tvos(9.0,11.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_t dispatch_queue_create_with_accounting_override_voucher( const char *_Nullable label, dispatch_queue_attr_t _Nullable attr, voucher_t _Nullable voucher); #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 377 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" /*! * @group Voucher Mach SPI * SPI intended for clients that need to interact with mach messages or mach * voucher ports directly. */ /*! * @function voucher_create_with_mach_msg * * @abstract * Creates a new voucher object from a mach message carrying a mach voucher port * * @discussion * Ownership of the mach voucher port in the message is transfered to the new * voucher object and the message header mach voucher field is cleared. * * @param msg * The mach message to query. * * @result * The newly created voucher object or NULL if the message was not carrying a * mach voucher. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_VOUCHER_EXPORT OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT OS_NOTHROW voucher_t _Nullable voucher_create_with_mach_msg(mach_msg_header_t *msg); /*! * @function voucher_kvoucher_debug * * @abstract * Writes a human-readable representation of a voucher to a memory buffer. * * @discussion * The formatted representation of the voucher is written starting at a given * offset in the buffer. If the remaining space in the buffer is too small, the * output is truncated. Nothing is written before buf[offset] or at or beyond * buf[bufsize]. * * @param task * The task port for the task that owns the voucher port. * * @param voucher * The voucher port name. * * @param buf * The buffer to which the formatted representation of the voucher should be * written. * * @param bufsiz * The size of the buffer. * * @param offset * The offset of the first byte in the buffer to be used for output. * * @param prefix * A string to be written at the start of each line of formatted output. * Typically used to generate leading whitespace for indentation. Use NULL if * no prefix is required. * * @param max_hex_data * The maximum number of bytes of hex data to be formatted for voucher content * that is not of type MACH_VOUCHER_ATTR_KEY_ATM, MACH_VOUCHER_ATTR_KEY_BANK * or MACH_VOUCHER_ATTR_KEY_IMPORTANCE. * * @result * The offset of the first byte in the buffer following the formatted voucher * representation. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW DISPATCH_COLD size_t voucher_kvoucher_debug(mach_port_t task, mach_port_name_t voucher, char *buf, size_t bufsiz, size_t offset, char * _Nullable prefix, size_t max_hex_data) ; /*! * @group Voucher Persona SPI * SPI intended for clients that need to interact with personas. */ struct proc_persona_info; /*! * @function voucher_get_current_persona * * @abstract * Returns the persona identifier for the current thread. * * @discussion * Retrieve the persona identifier from the currently adopted voucher. * * If the thread has not adopted a voucher, or the current voucher does not * contain persona information, this function returns the persona identifier * of the current process. * * If the process is not running under a persona, then this returns * PERSONA_ID_NONE. * * @result * The persona identifier for the current voucher, * or the persona identifier of the current process * or PERSONA_ID_NONE */ API_AVAILABLE(macos(10.14), ios(9.2)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW uid_t voucher_get_current_persona(void); /*! * @function voucher_get_current_persona_originator_info * * @abstract * Retrieve the ’originator’ process persona info for the currently adopted * voucher. * * @discussion * If there is no currently adopted voucher, or no PERSONA_TOKEN attribute * in that voucher, this function fails. * * @param persona_info * The proc_persona_info structure to fill in case of success * * @result * 0 on success: currently adopted voucher has a PERSONA_TOKEN * -1 on failure: persona_info is untouched/uninitialized */ API_AVAILABLE(macos(10.14), ios(9.2)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW OS_NONNULL1 int voucher_get_current_persona_originator_info( struct proc_persona_info *persona_info); /*! * @function voucher_get_current_persona_proximate_info * * @abstract * Retrieve the ’proximate’ process persona info for the currently adopted * voucher. * * @discussion * If there is no currently adopted voucher, or no PERSONA_TOKEN attribute * in that voucher, this function fails. * * @param persona_info * The proc_persona_info structure to fill in case of success * * @result * 0 on success: currently adopted voucher has a PERSONA_TOKEN * -1 on failure: persona_info is untouched/uninitialized */ API_AVAILABLE(macos(10.14), ios(9.2)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW OS_NONNULL1 int voucher_get_current_persona_proximate_info( struct proc_persona_info *persona_info); /*! * @function voucher_copy_with_persona_mach_voucher * * @abstract * Creates a copy of the currently adopted voucher and replaces its * persona information with the one passed in the specified mach voucher * * @discussion * If the specified mach voucher is not one returned from * mach_voucher_persona_for_originator() (called on behalf * of the current process), this function will fail * * @param persona_mach_voucher * mach voucher containing the new persona information * * @result * On success, a copy of the current voucher with the new * persona information * On failure, VOUCHER_INVALID */ API_AVAILABLE(macos(10.14), ios(12)) OS_VOUCHER_EXPORT OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT OS_NOTHROW voucher_t _Nullable voucher_copy_with_persona_mach_voucher( mach_voucher_t persona_mach_voucher); /*! * @function mach_voucher_persona_self * * @abstract * Creates a mach voucher containing the persona information of the * current process that can be sent as a mach port descriptor in a message * * @discussion * The returned mach voucher has been pre-processed so that it can be sent * in a message * * @param persona_mach_voucher * If successful, a reference to the newly created mach voucher * * @result * KERN_SUCCESS: a mach voucher ready to be sent in a message is * successfully created * KERN_RESOURCE_SHORTAGE: mach voucher creation failed due to * lack of free space */ API_AVAILABLE(macos(10.14), ios(12)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW OS_NONNULL1 kern_return_t mach_voucher_persona_self(mach_voucher_t *persona_mach_voucher); /*! * @function mach_voucher_persona_for_originator * * @abstract * Creates a mach voucher on behalf of the originator process by copying * the persona information from the specified mach voucher and then * updating the persona identifier to the specified value * * @discussion * Should be called by a privileged process on behalf of the originator process. * The newly created mach voucher should be returned to the originator in a * message. The originator's thread can adopt the new persona by passing * this mach voucher to voucher_copy_with_persona_mach_voucher(). * * @param persona_id * The new persona identifier to be set in the mach voucher * * @param originator_persona_mach_voucher * A mach voucher received from the originator, where it was created using * mach_voucher_persona_self() * * @param originator_unique_pid * Unique pid of the originator process * * @param persona_mach_voucher * If successful, a reference to the newly created mach voucher * * @result * KERN_SUCCESS: a mach voucher ready to be returned to the * originator was successfully created * KERN_NO_ACCESS: process does not have privilege to carry * out this operation * KERN_INVALID_ARGUMENT: specified persona identifier is invalid * KERN_INVALID_CAPABILITY: originator_unique_pid does not * match the specified voucher originator's unique pid * KERN_RESOURCE_SHORTAGE: mach voucher creation failed due to * lack of free space */ API_AVAILABLE(macos(10.14), ios(12)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW OS_NONNULL4 kern_return_t mach_voucher_persona_for_originator(uid_t persona_id, mach_voucher_t originator_persona_mach_voucher, uint64_t originator_unique_pid, mach_voucher_t *persona_mach_voucher); #endif // __has_include() # 632 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif // __OS_VOUCHER_PRIVATE__ # 638 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* disabled by -frewrite-includes */ #if OS_VOUCHER_ACTIVITY_SPI #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 640 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #if 0 /* expanded by -frewrite-includes */ #include "voucher_activity_private.h" #endif /* expanded by -frewrite-includes */ # 640 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 641 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" #endif # 642 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_private.h" # 222 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "os/voucher_activity_private.h" #endif /* expanded by -frewrite-includes */ # 222 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" 1 /* * Copyright (c) 2013-2015 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __OS_VOUCHER_ACTIVITY_PRIVATE__ #define __OS_VOUCHER_ACTIVITY_PRIVATE__ #if 0 /* disabled by -frewrite-includes */ #if OS_VOUCHER_ACTIVITY_SPI #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #endif # 29 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* disabled by -frewrite-includes */ #if __APPLE__ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #endif # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #if 0 /* expanded by -frewrite-includes */ #include "voucher_private.h" #endif /* expanded by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #define OS_VOUCHER_ACTIVITY_SPI_VERSION 20161003 #if 0 /* disabled by -frewrite-includes */ #if OS_VOUCHER_WEAK_IMPORT #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #define OS_VOUCHER_EXPORT OS_EXPORT OS_WEAK_IMPORT #else # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #define OS_VOUCHER_EXPORT OS_EXPORT #endif # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" __BEGIN_DECLS /*! * @const VOUCHER_CURRENT * Shorthand for the currently adopted voucher * * This value can only be used as an argument to functions, and is never * actually returned. It looks enough like a tagged pointer object that ARC * won't crash if this is assigned to a temporary variable. */ #define VOUCHER_CURRENT ((OS_OBJECT_BRIDGE voucher_t)(void *)~2ul) /*! * @function voucher_get_activity_id * * @abstract * Returns the activity_id associated with the specified voucher at the time * of the call. * * @discussion * When the passed voucher is VOUCHER_CURRENT this returns the current * activity ID. * * @param voucher * The specified voucher. * * @param parent_id * An out parameter to return the parent ID of the returned activity ID. * * @result * The current activity identifier, if any. When 0 is returned, parent_id will * also always be 0. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) OS_VOUCHER_EXPORT OS_NOTHROW firehose_activity_id_t voucher_get_activity_id(voucher_t voucher, firehose_activity_id_t *parent_id); /*! * @function voucher_get_activity_id_and_creator * * @abstract * Returns the activity_id associated with the specified voucher at the time * of the call. * * @discussion * When the passed voucher is VOUCHER_CURRENT this returns the current * activity ID. * * @param voucher * The specified voucher. * * @param creator_pid * The unique pid of the process that created the returned activity ID if any. * * @param parent_id * An out parameter to return the parent ID of the returned activity ID. * * @result * The current activity identifier, if any. When 0 is returned, parent_id will * also always be 0. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) OS_VOUCHER_EXPORT OS_NOTHROW firehose_activity_id_t voucher_get_activity_id_and_creator(voucher_t voucher, uint64_t *creator_pid, firehose_activity_id_t *parent_id); /*! * @function voucher_activity_create_with_data * * @abstract * Creates a voucher object with a new activity identifier. * * @discussion * As part of voucher transport, activities are automatically propagated by the * system to other threads and processes (across IPC). * * When a voucher with an activity identifier is applied to a thread, work * on that thread is done on behalf of this activity. * * @param trace_id * Tracepoint identifier returned by voucher_activity_trace_id(), intended for * identification of the automatic tracepoint generated as part of creating the * new activity. * * @param base * The base voucher used to create the activity. If the base voucher has an * activity identifier, then the created activity will be parented to that one. * If the passed in base has no activity identifier, the activity identifier * will be a top-level one, on behalf of the process that created the base * voucher. * * If base is VOUCHER_NONE, the activity is a top-level one, on behalf of the * current process. * * If base is VOUCHER_CURRENT, then the activity is naturally based on the * one currently applied to the current thread (the one voucher_copy() would * return). * * @param flags * See voucher_activity_flag_t documentation for effect. * * @param pubdata * Pointer to packed buffer of tracepoint data. * * @param publen * Length of data at 'pubdata'. * * @result * A new voucher with an activity identifier. */ API_AVAILABLE(macos(10.12.4), ios(10.3), tvos(10.2), watchos(3.2)) OS_VOUCHER_EXPORT OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT OS_NOTHROW voucher_t voucher_activity_create_with_data(firehose_tracepoint_id_t *trace_id, voucher_t base, firehose_activity_flags_t flags, const void *pubdata, size_t publen); API_DEPRECATED_WITH_REPLACEMENT("voucher_activity_create_with_data", macos(10.12,10.12.4), ios(10.0,10.3), tvos(10.0,10.2), watchos(3.0,3.2)) OS_VOUCHER_EXPORT OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT OS_NOTHROW voucher_t voucher_activity_create_with_location(firehose_tracepoint_id_t *trace_id, voucher_t base, firehose_activity_flags_t flags, uint64_t location); /*! * @group Voucher Activity Trace SPI * SPI intended for libtrace only */ /*! * @function voucher_activity_id_allocate * * @abstract * Allocate a new system-wide unique activity ID. * * @param flags * The bottom-most 8 bits of the flags will be used to generate the ID. * See firehose_activity_flags_t. */ API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) OS_VOUCHER_EXPORT OS_NOTHROW firehose_activity_id_t voucher_activity_id_allocate(firehose_activity_flags_t flags); /*! * @function voucher_activity_flush * * @abstract * Force flushing the specified stream. * * @discussion * This maks all the buffers currently being written to as full, so that * their current content is pushed in a timely fashion. * * When this call returns, the actual flush may or may not yet have happened. * * @param stream * The stream to flush. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) OS_VOUCHER_EXPORT OS_NOTHROW void voucher_activity_flush(firehose_stream_t stream); /*! * @function voucher_activity_trace * * @abstract * Add a tracepoint to the specified stream. * * @param stream * The stream to trace this entry into. * * @param trace_id * Tracepoint identifier returned by voucher_activity_trace_id() * * @param timestamp * The mach_approximate_time()/mach_absolute_time() value for this tracepoint. * * @param pubdata * Pointer to packed buffer of tracepoint data. * * @param publen * Length of data at 'pubdata'. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) OS_VOUCHER_EXPORT OS_NOTHROW OS_NONNULL4 firehose_tracepoint_id_t voucher_activity_trace(firehose_stream_t stream, firehose_tracepoint_id_t trace_id, uint64_t timestamp, const void *pubdata, size_t publen); /*! * @function voucher_activity_trace_v * * @abstract * Add a tracepoint to the specified stream, with private data. * * @param stream * The stream to trace this entry into. * * @param trace_id * Tracepoint identifier returned by voucher_activity_trace_id() * * @param timestamp * The mach_approximate_time()/mach_absolute_time() value for this tracepoint. * * @param iov * Array of `struct iovec` pointing to the data to layout. * The total size of this iovec must span exactly `publen + privlen` bytes. * The `publen` boundary must coincide with the end of an iovec (each iovec * must either be pure public or pure private data). * * @param publen * Total length of data to read from the iovec for the public data. * * @param privlen * Length of data to read from the iovec after the public data for the private * data. */ API_AVAILABLE(macos(10.12.4), ios(10.3), tvos(10.2), watchos(3.2)) OS_VOUCHER_EXPORT OS_NOTHROW OS_NONNULL4 firehose_tracepoint_id_t voucher_activity_trace_v(firehose_stream_t stream, firehose_tracepoint_id_t trace_id, uint64_t timestamp, const struct iovec *iov, size_t publen, size_t privlen); #define VOUCHER_ACTIVITY_TRACE_FLAG_UNRELIABLE 0x01 API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) OS_VOUCHER_EXPORT OS_NOTHROW OS_NONNULL4 firehose_tracepoint_id_t voucher_activity_trace_v_2(firehose_stream_t stream, firehose_tracepoint_id_t trace_id, uint64_t timestamp, const struct iovec *iov, size_t publen, size_t privlen, uint32_t flags); typedef const struct voucher_activity_hooks_s { #define VOUCHER_ACTIVITY_HOOKS_VERSION 5 long vah_version; mach_port_t (*vah_get_logd_port)(void); dispatch_mach_handler_function_t vah_debug_channel_handler; kern_return_t (*vah_get_reconnect_info)(mach_vm_address_t *, mach_vm_size_t *); void (*vah_metadata_init)(void *metadata_buffer, size_t size); void (*vah_quarantine_starts)(void); } *voucher_activity_hooks_t; /*! * @function voucher_activity_initialize_4libtrace * * @abstract * Configure upcall hooks for libtrace. * * @param hooks * A pointer to a voucher_activity_hooks_s structure. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) OS_VOUCHER_EXPORT OS_NOTHROW OS_NONNULL_ALL void voucher_activity_initialize_4libtrace(voucher_activity_hooks_t hooks); /*! * @function voucher_activity_get_metadata_buffer * * @abstract * Return address and length of buffer in the process trace memory area * reserved for libtrace metadata. * * @param length * Pointer to size_t variable, filled with length of metadata buffer. * * @result * Address of metadata buffer. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW OS_NONNULL_ALL void * voucher_activity_get_metadata_buffer(size_t *length); /*! * @function voucher_activity_get_logging_preferences * * @abstract * Return address and length of vm_map()ed configuration data for the logging * subsystem. * * @discussion * The data must be deallocated with vm_deallocate(). * * @param length * Pointer to size_t variable, filled with length of preferences buffer. * * @result * Address of preferences buffer, returns NULL on error. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0), bridgeos(3.0)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW OS_NONNULL_ALL void * voucher_activity_get_logging_preferences(size_t *length); /*! * @function voucher_activity_should_send_strings * * @abstract * Returns whether the client should send the strings or not. */ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0), bridgeos(4.0)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW bool voucher_activity_should_send_strings(void); /*! * @function voucher_get_activity_id_4dyld * * @abstract * Return the current voucher activity ID. Available for the dyld client stub * only. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW firehose_activity_id_t voucher_get_activity_id_4dyld(void); __END_DECLS #endif // OS_VOUCHER_ACTIVITY_SPI # 372 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" #endif // __OS_VOUCHER_ACTIVITY_PRIVATE__ # 374 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/os/voucher_activity_private.h" # 223 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "io_private.h" #endif /* expanded by -frewrite-includes */ # 223 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/io_private.h" 1 /* * Copyright (c) 2009-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_IO_PRIVATE__ #define __DISPATCH_IO_PRIVATE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/io_private.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/io_private.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/io_private.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @function dispatch_read_f * Schedule a read operation for asynchronous execution on the specified file * descriptor. The specified handler is enqueued with the data read from the * file descriptor when the operation has completed or an error occurs. * * The data object passed to the handler will be automatically released by the * system when the handler returns. It is the responsibility of the application * to retain, concatenate or copy the data object if it is needed after the * handler returns. * * The data object passed to the handler will only contain as much data as is * currently available from the file descriptor (up to the specified length). * * If an unrecoverable error occurs on the file descriptor, the handler will be * enqueued with the appropriate error code along with a data object of any data * that could be read successfully. * * An invocation of the handler with an error code of zero and an empty data * object indicates that EOF was reached. * * The system takes control of the file descriptor until the handler is * enqueued, and during this time file descriptor flags such as O_NONBLOCK will * be modified by the system on behalf of the application. It is an error for * the application to modify a file descriptor directly while it is under the * control of the system, but it may create additional dispatch I/O convenience * operations or dispatch I/O channels associated with that file descriptor. * * @param fd The file descriptor from which to read the data. * @param length The length of data to read from the file descriptor, * or SIZE_MAX to indicate that all of the data currently * available from the file descriptor should be read. * @param queue The dispatch queue to which the handler should be * submitted. * @param context The application-defined context parameter to pass to * the handler function. * @param handler The handler to enqueue when data is ready to be * delivered. * param context Application-defined context parameter. * param data The data read from the file descriptor. * param error An errno condition for the read operation or * zero if the read was successful. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NONNULL5 DISPATCH_NOTHROW void dispatch_read_f(dispatch_fd_t fd, size_t length, dispatch_queue_t queue, void *_Nullable context, void (*handler)(void *_Nullable context, dispatch_data_t data, int error)); /*! * @function dispatch_write_f * Schedule a write operation for asynchronous execution on the specified file * descriptor. The specified handler is enqueued when the operation has * completed or an error occurs. * * If an unrecoverable error occurs on the file descriptor, the handler will be * enqueued with the appropriate error code along with the data that could not * be successfully written. * * An invocation of the handler with an error code of zero indicates that the * data was fully written to the channel. * * The system takes control of the file descriptor until the handler is * enqueued, and during this time file descriptor flags such as O_NONBLOCK will * be modified by the system on behalf of the application. It is an error for * the application to modify a file descriptor directly while it is under the * control of the system, but it may create additional dispatch I/O convenience * operations or dispatch I/O channels associated with that file descriptor. * * @param fd The file descriptor to which to write the data. * @param data The data object to write to the file descriptor. * @param queue The dispatch queue to which the handler should be * submitted. * @param context The application-defined context parameter to pass to * the handler function. * @param handler The handler to enqueue when the data has been written. * param context Application-defined context parameter. * param data The data that could not be written to the I/O * channel, or NULL. * param error An errno condition for the write operation or * zero if the write was successful. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL3 DISPATCH_NONNULL5 DISPATCH_NOTHROW void dispatch_write_f(dispatch_fd_t fd, dispatch_data_t data, dispatch_queue_t queue, void *_Nullable context, void (*handler)(void *_Nullable context, dispatch_data_t _Nullable data, int error)); /*! * @function dispatch_io_create_f * Create a dispatch I/O channel associated with a file descriptor. The system * takes control of the file descriptor until the channel is closed, an error * occurs on the file descriptor or all references to the channel are released. * At that time the specified cleanup handler will be enqueued and control over * the file descriptor relinquished. * * While a file descriptor is under the control of a dispatch I/O channel, file * descriptor flags such as O_NONBLOCK will be modified by the system on behalf * of the application. It is an error for the application to modify a file * descriptor directly while it is under the control of a dispatch I/O channel, * but it may create additional channels associated with that file descriptor. * * @param type The desired type of I/O channel (DISPATCH_IO_STREAM * or DISPATCH_IO_RANDOM). * @param fd The file descriptor to associate with the I/O channel. * @param queue The dispatch queue to which the handler should be submitted. * @param context The application-defined context parameter to pass to * the cleanup handler function. * @param cleanup_handler The handler to enqueue when the system * relinquishes control over the file descriptor. * param context Application-defined context parameter. * param error An errno condition if control is relinquished * because channel creation failed, zero otherwise. * @result The newly created dispatch I/O channel or NULL if an error * occurred (invalid type specified). */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_io_t dispatch_io_create_f(dispatch_io_type_t type, dispatch_fd_t fd, dispatch_queue_t queue, void *_Nullable context, void (*cleanup_handler)(void *_Nullable context, int error)); /*! * @function dispatch_io_create_with_path_f * Create a dispatch I/O channel associated with a path name. The specified * path, oflag and mode parameters will be passed to open(2) when the first I/O * operation on the channel is ready to execute and the resulting file * descriptor will remain open and under the control of the system until the * channel is closed, an error occurs on the file descriptor or all references * to the channel are released. At that time the file descriptor will be closed * and the specified cleanup handler will be enqueued. * * @param type The desired type of I/O channel (DISPATCH_IO_STREAM * or DISPATCH_IO_RANDOM). * @param path The absolute path to associate with the I/O channel. * @param oflag The flags to pass to open(2) when opening the file at * path. * @param mode The mode to pass to open(2) when creating the file at * path (i.e. with flag O_CREAT), zero otherwise. * @param queue The dispatch queue to which the handler should be * submitted. * @param context The application-defined context parameter to pass to * the cleanup handler function. * @param cleanup_handler The handler to enqueue when the system * has closed the file at path. * param context Application-defined context parameter. * param error An errno condition if control is relinquished * because channel creation or opening of the * specified file failed, zero otherwise. * @result The newly created dispatch I/O channel or NULL if an error * occurred (invalid type or non-absolute path specified). */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_io_t dispatch_io_create_with_path_f(dispatch_io_type_t type, const char *path, int oflag, mode_t mode, dispatch_queue_t queue, void *_Nullable context, void (*cleanup_handler)(void *_Nullable context, int error)); /*! * @function dispatch_io_create_with_io_f * Create a new dispatch I/O channel from an existing dispatch I/O channel. * The new channel inherits the file descriptor or path name associated with * the existing channel, but not its channel type or policies. * * If the existing channel is associated with a file descriptor, control by the * system over that file descriptor is extended until the new channel is also * closed, an error occurs on the file descriptor, or all references to both * channels are released. At that time the specified cleanup handler will be * enqueued and control over the file descriptor relinquished. * * While a file descriptor is under the control of a dispatch I/O channel, file * descriptor flags such as O_NONBLOCK will be modified by the system on behalf * of the application. It is an error for the application to modify a file * descriptor directly while it is under the control of a dispatch I/O channel, * but it may create additional channels associated with that file descriptor. * * @param type The desired type of I/O channel (DISPATCH_IO_STREAM * or DISPATCH_IO_RANDOM). * @param io The existing channel to create the new I/O channel from. * @param queue The dispatch queue to which the handler should be submitted. * @param context The application-defined context parameter to pass to * the cleanup handler function. * @param cleanup_handler The handler to enqueue when the system * relinquishes control over the file descriptor * (resp. closes the file at path) associated with * the existing channel. * param context Application-defined context parameter. * param error An errno condition if control is relinquished * because channel creation failed, zero otherwise. * @result The newly created dispatch I/O channel or NULL if an error * occurred (invalid type specified). */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_io_t dispatch_io_create_with_io_f(dispatch_io_type_t type, dispatch_io_t io, dispatch_queue_t queue, void *_Nullable context, void (*cleanup_handler)(void *_Nullable context, int error)); /*! * @typedef dispatch_io_handler_function_t * The prototype of I/O handler functions for dispatch I/O operations. * * @param context Application-defined context parameter. * @param done A flag indicating whether the operation is complete. * @param data The data object to be handled. * @param error An errno condition for the operation. */ typedef void (*dispatch_io_handler_function_t)(void *_Nullable context, bool done, dispatch_data_t _Nullable data, int error); /*! * @function dispatch_io_read_f * Schedule a read operation for asynchronous execution on the specified I/O * channel. The I/O handler is enqueued one or more times depending on the * general load of the system and the policy specified on the I/O channel. * * Any data read from the channel is described by the dispatch data object * passed to the I/O handler. This object will be automatically released by the * system when the I/O handler returns. It is the responsibility of the * application to retain, concatenate or copy the data object if it is needed * after the I/O handler returns. * * Dispatch I/O handlers are not reentrant. The system will ensure that no new * I/O handler instance is invoked until the previously enqueued handler * function has returned. * * An invocation of the I/O handler with the done flag set indicates that the * read operation is complete and that the handler will not be enqueued again. * * If an unrecoverable error occurs on the I/O channel's underlying file * descriptor, the I/O handler will be enqueued with the done flag set, the * appropriate error code and a NULL data object. * * An invocation of the I/O handler with the done flag set, an error code of * zero and an empty data object indicates that EOF was reached. * * @param channel The dispatch I/O channel from which to read the data. * @param offset The offset relative to the channel position from which * to start reading (only for DISPATCH_IO_RANDOM). * @param length The length of data to read from the I/O channel, or * SIZE_MAX to indicate that data should be read until EOF * is reached. * @param queue The dispatch queue to which the I/O handler should be * submitted. * @param context The application-defined context parameter to pass to * the handler function. * @param io_handler The I/O handler to enqueue when data is ready to be * delivered. * param context Application-defined context parameter. * param done A flag indicating whether the operation is complete. * param data An object with the data most recently read from the * I/O channel as part of this read operation, or NULL. * param error An errno condition for the read operation or zero if * the read was successful. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL4 DISPATCH_NONNULL6 DISPATCH_NOTHROW void dispatch_io_read_f(dispatch_io_t channel, off_t offset, size_t length, dispatch_queue_t queue, void *_Nullable context, dispatch_io_handler_function_t io_handler); /*! * @function dispatch_io_write_f * Schedule a write operation for asynchronous execution on the specified I/O * channel. The I/O handler is enqueued one or more times depending on the * general load of the system and the policy specified on the I/O channel. * * Any data remaining to be written to the I/O channel is described by the * dispatch data object passed to the I/O handler. This object will be * automatically released by the system when the I/O handler returns. It is the * responsibility of the application to retain, concatenate or copy the data * object if it is needed after the I/O handler returns. * * Dispatch I/O handlers are not reentrant. The system will ensure that no new * I/O handler instance is invoked until the previously enqueued handler * function has returned. * * An invocation of the I/O handler with the done flag set indicates that the * write operation is complete and that the handler will not be enqueued again. * * If an unrecoverable error occurs on the I/O channel's underlying file * descriptor, the I/O handler will be enqueued with the done flag set, the * appropriate error code and an object containing the data that could not be * written. * * An invocation of the I/O handler with the done flag set and an error code of * zero indicates that the data was fully written to the channel. * * @param channel The dispatch I/O channel on which to write the data. * @param offset The offset relative to the channel position from which * to start writing (only for DISPATCH_IO_RANDOM). * @param data The data to write to the I/O channel. The data object * will be retained by the system until the write operation * is complete. * @param queue The dispatch queue to which the I/O handler should be * submitted. * @param context The application-defined context parameter to pass to * the handler function. * @param io_handler The I/O handler to enqueue when data has been delivered. * param context Application-defined context parameter. * param done A flag indicating whether the operation is complete. * param data An object of the data remaining to be * written to the I/O channel as part of this write * operation, or NULL. * param error An errno condition for the write operation or zero * if the write was successful. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NONNULL4 DISPATCH_NONNULL6 DISPATCH_NOTHROW void dispatch_io_write_f(dispatch_io_t channel, off_t offset, dispatch_data_t data, dispatch_queue_t queue, void *_Nullable context, dispatch_io_handler_function_t io_handler); /*! * @function dispatch_io_barrier_f * Schedule a barrier operation on the specified I/O channel; all previously * scheduled operations on the channel will complete before the provided * barrier function is enqueued onto the global queue determined by the * channel's target queue, and no subsequently scheduled operations will start * until the barrier function has returned. * * If multiple channels are associated with the same file descriptor, a barrier * operation scheduled on any of these channels will act as a barrier across all * channels in question, i.e. all previously scheduled operations on any of the * channels will complete before the barrier function is enqueued, and no * operations subsequently scheduled on any of the channels will start until the * barrier function has returned. * * While the barrier function is running, it may safely operate on the channel's * underlying file descriptor with fsync(2), lseek(2) etc. (but not close(2)). * * @param channel The dispatch I/O channel to schedule the barrier on. * @param context The application-defined context parameter to pass to * the barrier function. * @param barrier The barrier function. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_io_barrier_f(dispatch_io_t channel, void *_Nullable context, dispatch_function_t barrier); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif /* __DISPATCH_IO_PRIVATE__ */ # 417 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/io_private.h" # 224 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "layout_private.h" #endif /* expanded by -frewrite-includes */ # 224 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" 1 /* * Copyright (c) 2014 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_LAYOUT_PRIVATE__ #define __DISPATCH_LAYOUT_PRIVATE__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" #endif # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" __BEGIN_DECLS API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT const struct dispatch_queue_offsets_s { // always add new fields at the end const uint16_t dqo_version; const uint16_t dqo_label; const uint16_t dqo_label_size; const uint16_t dqo_flags; const uint16_t dqo_flags_size; const uint16_t dqo_serialnum; const uint16_t dqo_serialnum_size; const uint16_t dqo_width; const uint16_t dqo_width_size; const uint16_t dqo_running; const uint16_t dqo_running_size; // fields added in dqo_version 5: const uint16_t dqo_suspend_cnt; const uint16_t dqo_suspend_cnt_size; const uint16_t dqo_target_queue; const uint16_t dqo_target_queue_size; const uint16_t dqo_priority; const uint16_t dqo_priority_size; } dispatch_queue_offsets; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_LAYOUT_SPI #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" /*! * @group Data Structure Layout SPI * SPI intended for CoreSymbolication only */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT const struct dispatch_tsd_indexes_s { // always add new fields at the end const uint16_t dti_version; const uint16_t dti_queue_index; const uint16_t dti_voucher_index; const uint16_t dti_qos_class_index; /* version 3 */ const uint16_t dti_continuation_cache_index; } dispatch_tsd_indexes; #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 72 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT const struct dispatch_allocator_layout_s { const uint16_t dal_version; /* version 1 */ /* Pointer to the allocator metadata address, points to NULL if unused */ void **const dal_allocator_zone; /* Magical "isa" for allocations that are on freelists */ void *const *const dal_deferred_free_isa; /* Size of allocations made in the magazine */ const uint16_t dal_allocation_size; /* fields used by the enumerator */ const uint16_t dal_magazine_size; const uint16_t dal_first_allocation_offset; const uint16_t dal_allocation_isa_offset; /* Enumerates allocated continuations */ kern_return_t (*dal_enumerator)(task_t remote_task, const struct dispatch_allocator_layout_s *remote_allocator_layout, vm_address_t zone_address, memory_reader_t reader, void (^recorder)(vm_address_t dc_address, void *dc_mem, size_t size, bool *stop)); } dispatch_allocator_layout; #endif // TARGET_OS_MAC # 97 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" #endif // DISPATCH_LAYOUT_SPI # 98 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" __END_DECLS #endif // __DISPATCH_LAYOUT_PRIVATE__ # 102 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/layout_private.h" # 225 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "benchmark.h" #endif /* expanded by -frewrite-includes */ # 225 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/benchmark.h" 1 /* * Copyright (c) 2008-2009 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_BENCHMARK__ #define __DISPATCH_BENCHMARK__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/benchmark.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/benchmark.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/benchmark.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @function dispatch_benchmark * * @abstract * Count the average number of cycles a given block takes to execute. * * @param count * The number of times to serially execute the given block. * * @param block * The block to execute. * * @result * The approximate number of cycles the block takes to execute. * * @discussion * This function is for debugging and performance analysis work. For the best * results, pass a high count value to dispatch_benchmark(). When benchmarking * concurrent code, please compare the serial version of the code against the * concurrent version, and compare the concurrent version on different classes * of hardware. Please look for inflection points with various data sets and * keep the following facts in mind: * * 1) Code bound by computational bandwidth may be inferred by proportional * changes in performance as concurrency is increased. * 2) Code bound by memory bandwidth may be inferred by negligible changes in * performance as concurrency is increased. * 3) Code bound by critical sections may be inferred by retrograde changes in * performance as concurrency is increased. * 3a) Intentional: locks, mutexes, and condition variables. * 3b) Accidental: unrelated and frequently modified data on the same * cache-line. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW uint64_t dispatch_benchmark(size_t count, dispatch_block_t block); #endif # 78 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/benchmark.h" API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NOTHROW uint64_t dispatch_benchmark_f(size_t count, void *_Nullable ctxt, dispatch_function_t func); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif # 90 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/benchmark.h" # 226 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "private.h" #endif /* expanded by -frewrite-includes */ # 226 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_PRIVATE__ #define __DISPATCH_PRIVATE__ #ifdef __APPLE__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__unix__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #endif # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #endif # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #endif # 49 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 51 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #endif # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 53 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 53 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #endif # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #ifndef __DISPATCH_BUILDING_DISPATCH__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 57 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 58 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #ifndef __DISPATCH_INDIRECT__ #define __DISPATCH_INDIRECT__ #endif # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 63 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 67 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_MACH_SPI #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #endif // DISPATCH_MACH_SPI # 70 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 70 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 72 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 72 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #undef __DISPATCH_INDIRECT__ #endif /* !__DISPATCH_BUILDING_DISPATCH__ */ # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" // Check that public and private dispatch headers match #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_API_VERSION != 20180109 // Keep in sync with #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 80 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #error "Dispatch header mismatch between /usr/include and /usr/local/include" #endif # 82 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" DISPATCH_ASSUME_NONNULL_BEGIN __BEGIN_DECLS /*! * @function _dispatch_is_multithreaded * * @abstract * Returns true if the current process has become multithreaded by the use * of libdispatch functionality. * * @discussion * This SPI is intended for use by low-level system components that need to * ensure that they do not make a single-threaded process multithreaded, to * avoid negatively affecting child processes of a fork (without exec). * * Such components must not use any libdispatch functionality if this function * returns false. * * @result * Boolean indicating whether the process has used libdispatch and become * multithreaded. */ API_AVAILABLE(macos(10.8), ios(6.0)) DISPATCH_EXPORT DISPATCH_NOTHROW bool _dispatch_is_multithreaded(void); /*! * @function _dispatch_is_fork_of_multithreaded_parent * * @abstract * Returns true if the current process is a child of a parent process that had * become multithreaded by the use of libdispatch functionality at the time of * fork (without exec). * * @discussion * This SPI is intended for use by (rare) low-level system components that need * to continue working on the child side of a fork (without exec) of a * multithreaded process. * * Such components must not use any libdispatch functionality if this function * returns true. * * @result * Boolean indicating whether the parent process had used libdispatch and * become multithreaded at the time of fork. */ API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NOTHROW bool _dispatch_is_fork_of_multithreaded_parent(void); /*! * @function _dispatch_prohibit_transition_to_multithreaded * * @abstract * Sets a mode that aborts if a program tries to use dispatch. * * @discussion * This SPI is intended for use by programs that know they will use fork() and * want their children to be able to use dispatch before exec(). Such programs * should call _dispatch_prohibit_transition_to_multithreaded(true) as early as * possible, which will cause any use of dispatch API that would make the * process multithreaded to abort immediately. * * Once the program no longer intends to call fork() it can call * _dispatch_prohibit_transition_to_multithreaded(false). * * This status is not inherited by the child process, so if the behavior * is required after fork, _dispatch_prohibit_transition_to_multithreaded(true) * should be called manually in the child after fork. * * If the program already used dispatch before the guard is enabled, then * this function will abort immediately. */ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void _dispatch_prohibit_transition_to_multithreaded(bool prohibit); /* * dispatch_time convenience macros */ #define _dispatch_time_after_nsec(t) \ dispatch_time(DISPATCH_TIME_NOW, (t)) #define _dispatch_time_after_usec(t) \ dispatch_time(DISPATCH_TIME_NOW, (t) * NSEC_PER_USEC) #define _dispatch_time_after_msec(t) \ dispatch_time(DISPATCH_TIME_NOW, (t) * NSEC_PER_MSEC) #define _dispatch_time_after_sec(t) \ dispatch_time(DISPATCH_TIME_NOW, (t) * NSEC_PER_SEC) /* * SPI for CoreFoundation/Foundation ONLY */ #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 179 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #define DISPATCH_COCOA_COMPAT 1 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 181 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #define DISPATCH_COCOA_COMPAT 1 #else # 183 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #define DISPATCH_COCOA_COMPAT 0 #endif # 185 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_COCOA_COMPAT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 187 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #define DISPATCH_CF_SPI_VERSION 20160712 #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 191 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" typedef mach_port_t dispatch_runloop_handle_t; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__linux__) || defined(__FreeBSD__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 193 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" typedef int dispatch_runloop_handle_t; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__unix__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 195 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" typedef uint64_t dispatch_runloop_handle_t; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 197 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" typedef void *dispatch_runloop_handle_t; #else # 199 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" #error "runloop support not implemented on this platform" #endif # 201 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_runloop_handle_t _dispatch_get_main_queue_port_4CF(void); API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_NOTHROW dispatch_runloop_handle_t _dispatch_get_main_queue_handle_4CF(void); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void _dispatch_main_queue_callback_4CF(void *_Null_unspecified msg); API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_serial_t _dispatch_runloop_root_queue_create_4CF(const char *_Nullable label, unsigned long flags); API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_runloop_handle_t _dispatch_runloop_root_queue_get_port_4CF(dispatch_queue_t queue); #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 230 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" API_AVAILABLE(macos(10.13.2), ios(11.2), tvos(11.2), watchos(4.2)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW bool _dispatch_source_will_reenable_kevent_4NW(dispatch_source_t source); #endif # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void _dispatch_runloop_root_queue_wakeup_4CF(dispatch_queue_t queue); API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW bool _dispatch_runloop_root_queue_perform_4CF(dispatch_queue_t queue); API_AVAILABLE(macos(10.9), ios(7.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void _dispatch_source_set_runloop_timer_4CF(dispatch_source_t source, dispatch_time_t start, uint64_t interval, uint64_t leeway); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT void *_Nonnull (*_Nullable _dispatch_begin_NSAutoReleasePool)(void); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT void (*_Nullable _dispatch_end_NSAutoReleasePool)(void *); #endif /* DISPATCH_COCOA_COMPAT */ # 261 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) DISPATCH_EXPORT DISPATCH_NOTHROW void _dispatch_poll_for_events_4launchd(void); __END_DECLS DISPATCH_ASSUME_NONNULL_END #endif // __DISPATCH_PRIVATE__ # 272 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/private/private.h" # 227 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* disabled by -frewrite-includes */ #if HAVE_LIBKERN_OSCROSSENDIAN_H #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 229 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 229 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 230 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 231 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_LIBKERN_OSATOMIC_H #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 232 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 232 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 233 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 234 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 236 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 236 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 237 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 237 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 238 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 238 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 239 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 239 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 240 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 240 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 241 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 241 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 242 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 242 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 243 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 243 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 244 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 244 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 245 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 245 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 246 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 246 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 247 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 247 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 248 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 248 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 249 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 249 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 250 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 250 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 251 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 251 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 252 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 253 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 253 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 254 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 255 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif /* HAVE_MACH */ # 256 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 257 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_OS_FAULT_WITH_PAYLOAD 1 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 258 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 259 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 259 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 260 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #else # 261 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_OS_FAULT_WITH_PAYLOAD 0 #endif # 263 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_MALLOC_MALLOC_H #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 264 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 264 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 265 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 266 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 267 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/sys/stat.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stat.h 8.12 (Berkeley) 6/16/95 * $FreeBSD$ */ #ifndef _SYS_STAT_H_ #define _SYS_STAT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/sys/stat.h" 3 4 # 44 "/usr/include/sys/stat.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/sys/stat.h" 3 4 # 45 "/usr/include/sys/stat.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/sys/stat.h" 3 4 # 46 "/usr/include/sys/stat.h" 3 4 #ifndef _BLKSIZE_T_DECLARED typedef __blksize_t blksize_t; #define _BLKSIZE_T_DECLARED #endif # 51 "/usr/include/sys/stat.h" 3 4 #ifndef _BLKCNT_T_DECLARED typedef __blkcnt_t blkcnt_t; #define _BLKCNT_T_DECLARED #endif # 56 "/usr/include/sys/stat.h" 3 4 #ifndef _DEV_T_DECLARED typedef __dev_t dev_t; #define _DEV_T_DECLARED #endif # 61 "/usr/include/sys/stat.h" 3 4 #ifndef _FFLAGS_T_DECLARED typedef __fflags_t fflags_t; #define _FFLAGS_T_DECLARED #endif # 66 "/usr/include/sys/stat.h" 3 4 #ifndef _GID_T_DECLARED typedef __gid_t gid_t; #define _GID_T_DECLARED #endif # 71 "/usr/include/sys/stat.h" 3 4 #ifndef _INO_T_DECLARED typedef __ino_t ino_t; #define _INO_T_DECLARED #endif # 76 "/usr/include/sys/stat.h" 3 4 #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; #define _MODE_T_DECLARED #endif # 81 "/usr/include/sys/stat.h" 3 4 #ifndef _NLINK_T_DECLARED typedef __nlink_t nlink_t; #define _NLINK_T_DECLARED #endif # 86 "/usr/include/sys/stat.h" 3 4 #ifndef _OFF_T_DECLARED typedef __off_t off_t; #define _OFF_T_DECLARED #endif # 91 "/usr/include/sys/stat.h" 3 4 #ifndef _UID_T_DECLARED typedef __uid_t uid_t; #define _UID_T_DECLARED #endif # 96 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if !defined(_KERNEL) && __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 98 "/usr/include/sys/stat.h" 3 4 /* * XXX We get miscellaneous namespace pollution with this. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 101 "/usr/include/sys/stat.h" 3 4 # 1 "/usr/include/sys/time.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 * $FreeBSD$ */ #ifndef _SYS_TIME_H_ #define _SYS_TIME_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/time.h" 3 4 # 39 "/usr/include/sys/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/time.h" 3 4 # 40 "/usr/include/sys/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/sys/time.h" 3 4 # 41 "/usr/include/sys/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/sys/time.h" 3 4 # 42 "/usr/include/sys/time.h" 3 4 struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ int tz_dsttime; /* type of dst correction */ }; #define DST_NONE 0 /* not on dst */ #define DST_USA 1 /* USA style dst */ #define DST_AUST 2 /* Australian style dst */ #define DST_WET 3 /* Western European dst */ #define DST_MET 4 /* Middle European dst */ #define DST_EET 5 /* Eastern European dst */ #define DST_CAN 6 /* Canada */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 56 "/usr/include/sys/time.h" 3 4 struct bintime { time_t sec; uint64_t frac; }; static __inline void bintime_addx(struct bintime *_bt, uint64_t _x) { uint64_t _u; _u = _bt->frac; _bt->frac += _x; if (_u > _bt->frac) _bt->sec++; } static __inline void bintime_add(struct bintime *_bt, const struct bintime *_bt2) { uint64_t _u; _u = _bt->frac; _bt->frac += _bt2->frac; if (_u > _bt->frac) _bt->sec++; _bt->sec += _bt2->sec; } static __inline void bintime_sub(struct bintime *_bt, const struct bintime *_bt2) { uint64_t _u; _u = _bt->frac; _bt->frac -= _bt2->frac; if (_u < _bt->frac) _bt->sec--; _bt->sec -= _bt2->sec; } static __inline void bintime_mul(struct bintime *_bt, u_int _x) { uint64_t _p1, _p2; _p1 = (_bt->frac & 0xffffffffull) * _x; _p2 = (_bt->frac >> 32) * _x + (_p1 >> 32); _bt->sec *= _x; _bt->sec += (_p2 >> 32); _bt->frac = (_p2 << 32) | (_p1 & 0xffffffffull); } static __inline void bintime_shift(struct bintime *_bt, int _exp) { if (_exp > 0) { _bt->sec <<= _exp; _bt->sec |= _bt->frac >> (64 - _exp); _bt->frac <<= _exp; } else if (_exp < 0) { _bt->frac >>= -_exp; _bt->frac |= (uint64_t)_bt->sec << (64 + _exp); _bt->sec >>= -_exp; } } #define bintime_clear(a) ((a)->sec = (a)->frac = 0) #define bintime_isset(a) ((a)->sec || (a)->frac) #define bintime_cmp(a, b, cmp) \ (((a)->sec == (b)->sec) ? \ ((a)->frac cmp (b)->frac) : \ ((a)->sec cmp (b)->sec)) #define SBT_1S ((sbintime_t)1 << 32) #define SBT_1M (SBT_1S * 60) #define SBT_1MS (SBT_1S / 1000) #define SBT_1US (SBT_1S / 1000000) #define SBT_1NS (SBT_1S / 1000000000) /* beware rounding, see nstosbt() */ #define SBT_MAX 0x7fffffffffffffffLL static __inline int sbintime_getsec(sbintime_t _sbt) { return (_sbt >> 32); } static __inline sbintime_t bttosbt(const struct bintime _bt) { return (((sbintime_t)_bt.sec << 32) + (_bt.frac >> 32)); } static __inline struct bintime sbttobt(sbintime_t _sbt) { struct bintime _bt; _bt.sec = _sbt >> 32; _bt.frac = _sbt << 32; return (_bt); } /* * Scaling functions for signed and unsigned 64-bit time using any * 32-bit fraction: */ static __inline int64_t __stime64_scale32_ceil(int64_t x, int32_t factor, int32_t divisor) { const int64_t rem = x % divisor; return (x / divisor * factor + (rem * factor + divisor - 1) / divisor); } static __inline int64_t __stime64_scale32_floor(int64_t x, int32_t factor, int32_t divisor) { const int64_t rem = x % divisor; return (x / divisor * factor + (rem * factor) / divisor); } static __inline uint64_t __utime64_scale32_ceil(uint64_t x, uint32_t factor, uint32_t divisor) { const uint64_t rem = x % divisor; return (x / divisor * factor + (rem * factor + divisor - 1) / divisor); } static __inline uint64_t __utime64_scale32_floor(uint64_t x, uint32_t factor, uint32_t divisor) { const uint64_t rem = x % divisor; return (x / divisor * factor + (rem * factor) / divisor); } /* * This function finds the common divisor between the two arguments, * in powers of two. Use a macro, so the compiler will output a * warning if the value overflows! * * Detailed description: * * Create a variable with 1's at the positions of the leading 0's * starting at the least significant bit, producing 0 if none (e.g., * 01011000 -> 0000 0111). Then these two variables are bitwise AND'ed * together, to produce the greatest common power of two minus one. In * the end add one to flip the value to the actual power of two (e.g., * 0000 0111 + 1 -> 0000 1000). */ #define __common_powers_of_two(a, b) \ ((~(a) & ((a) - 1) & ~(b) & ((b) - 1)) + 1) /* * Scaling functions for signed and unsigned 64-bit time assuming * reducable 64-bit fractions to 32-bit fractions: */ static __inline int64_t __stime64_scale64_ceil(int64_t x, int64_t factor, int64_t divisor) { const int64_t gcd = __common_powers_of_two(factor, divisor); return (__stime64_scale32_ceil(x, factor / gcd, divisor / gcd)); } static __inline int64_t __stime64_scale64_floor(int64_t x, int64_t factor, int64_t divisor) { const int64_t gcd = __common_powers_of_two(factor, divisor); return (__stime64_scale32_floor(x, factor / gcd, divisor / gcd)); } static __inline uint64_t __utime64_scale64_ceil(uint64_t x, uint64_t factor, uint64_t divisor) { const uint64_t gcd = __common_powers_of_two(factor, divisor); return (__utime64_scale32_ceil(x, factor / gcd, divisor / gcd)); } static __inline uint64_t __utime64_scale64_floor(uint64_t x, uint64_t factor, uint64_t divisor) { const uint64_t gcd = __common_powers_of_two(factor, divisor); return (__utime64_scale32_floor(x, factor / gcd, divisor / gcd)); } /* * Decimal<->sbt conversions. Multiplying or dividing by SBT_1NS * results in large roundoff errors which sbttons() and nstosbt() * avoid. Millisecond and microsecond functions are also provided for * completeness. * * When converting from sbt to another unit, the result is always * rounded down. When converting back to sbt the result is always * rounded up. This gives the property that sbttoX(Xtosbt(y)) == y . * * The conversion functions can also handle negative values. */ #define SBT_DECLARE_CONVERSION_PAIR(name, units_per_second) \ static __inline int64_t \ sbtto##name(sbintime_t sbt) \ { \ return (__stime64_scale64_floor(sbt, units_per_second, SBT_1S)); \ } \ static __inline sbintime_t \ name##tosbt(int64_t name) \ { \ return (__stime64_scale64_ceil(name, SBT_1S, units_per_second)); \ } SBT_DECLARE_CONVERSION_PAIR(ns, 1000000000) SBT_DECLARE_CONVERSION_PAIR(us, 1000000) SBT_DECLARE_CONVERSION_PAIR(ms, 1000) /*- * Background information: * * When converting between timestamps on parallel timescales of differing * resolutions it is historical and scientific practice to round down rather * than doing 4/5 rounding. * * The date changes at midnight, not at noon. * * Even at 15:59:59.999999999 it's not four'o'clock. * * time_second ticks after N.999999999 not after N.4999999999 */ static __inline void bintime2timespec(const struct bintime *_bt, struct timespec *_ts) { _ts->tv_sec = _bt->sec; _ts->tv_nsec = __utime64_scale64_floor( _bt->frac, 1000000000, 1ULL << 32) >> 32; } static __inline uint64_t bintime2ns(const struct bintime *_bt) { uint64_t ret; ret = (uint64_t)(_bt->sec) * (uint64_t)1000000000; ret += __utime64_scale64_floor( _bt->frac, 1000000000, 1ULL << 32) >> 32; return (ret); } static __inline void timespec2bintime(const struct timespec *_ts, struct bintime *_bt) { _bt->sec = _ts->tv_sec; _bt->frac = __utime64_scale64_floor( (uint64_t)_ts->tv_nsec << 32, 1ULL << 32, 1000000000); } static __inline void bintime2timeval(const struct bintime *_bt, struct timeval *_tv) { _tv->tv_sec = _bt->sec; _tv->tv_usec = __utime64_scale64_floor( _bt->frac, 1000000, 1ULL << 32) >> 32; } static __inline void timeval2bintime(const struct timeval *_tv, struct bintime *_bt) { _bt->sec = _tv->tv_sec; _bt->frac = __utime64_scale64_floor( (uint64_t)_tv->tv_usec << 32, 1ULL << 32, 1000000); } static __inline struct timespec sbttots(sbintime_t _sbt) { struct timespec _ts; _ts.tv_sec = _sbt >> 32; _ts.tv_nsec = sbttons((uint32_t)_sbt); return (_ts); } static __inline sbintime_t tstosbt(struct timespec _ts) { return (((sbintime_t)_ts.tv_sec << 32) + nstosbt(_ts.tv_nsec)); } static __inline struct timeval sbttotv(sbintime_t _sbt) { struct timeval _tv; _tv.tv_sec = _sbt >> 32; _tv.tv_usec = sbttous((uint32_t)_sbt); return (_tv); } static __inline sbintime_t tvtosbt(struct timeval _tv) { return (((sbintime_t)_tv.tv_sec << 32) + ustosbt(_tv.tv_usec)); } #endif /* __BSD_VISIBLE */ # 375 "/usr/include/sys/time.h" 3 4 #ifdef _KERNEL /* * Simple macros to convert ticks to milliseconds * or microseconds and vice-versa. The answer * will always be at least 1. Note the return * value is a uint32_t however we step up the * operations to 64 bit to avoid any overflow/underflow * problems. */ #define TICKS_2_MSEC(t) max(1, (uint32_t)(hz == 1000) ? \ (t) : (((uint64_t)(t) * (uint64_t)1000)/(uint64_t)hz)) #define TICKS_2_USEC(t) max(1, (uint32_t)(hz == 1000) ? \ ((t) * 1000) : (((uint64_t)(t) * (uint64_t)1000000)/(uint64_t)hz)) #define MSEC_2_TICKS(m) max(1, (uint32_t)((hz == 1000) ? \ (m) : ((uint64_t)(m) * (uint64_t)hz)/(uint64_t)1000)) #define USEC_2_TICKS(u) max(1, (uint32_t)((hz == 1000) ? \ ((u) / 1000) : ((uint64_t)(u) * (uint64_t)hz)/(uint64_t)1000000)) #endif # 395 "/usr/include/sys/time.h" 3 4 /* Operations on timespecs */ #define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0) #define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec) #define timespeccmp(tvp, uvp, cmp) \ (((tvp)->tv_sec == (uvp)->tv_sec) ? \ ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \ ((tvp)->tv_sec cmp (uvp)->tv_sec)) #define timespecadd(tsp, usp, vsp) \ do { \ (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \ (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \ if ((vsp)->tv_nsec >= 1000000000L) { \ (vsp)->tv_sec++; \ (vsp)->tv_nsec -= 1000000000L; \ } \ } while (0) #define timespecsub(tsp, usp, vsp) \ do { \ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ if ((vsp)->tv_nsec < 0) { \ (vsp)->tv_sec--; \ (vsp)->tv_nsec += 1000000000L; \ } \ } while (0) #define timespecvalid_interval(tsp) ((tsp)->tv_sec >= 0 && \ (tsp)->tv_nsec >= 0 && (tsp)->tv_nsec < 1000000000L) #ifdef _KERNEL /* Operations on timevals. */ #define timevalclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) #define timevalisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) #define timevalcmp(tvp, uvp, cmp) \ (((tvp)->tv_sec == (uvp)->tv_sec) ? \ ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ ((tvp)->tv_sec cmp (uvp)->tv_sec)) /* timevaladd and timevalsub are not inlined */ #endif /* _KERNEL */ # 438 "/usr/include/sys/time.h" 3 4 #ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */ #define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) #define timercmp(tvp, uvp, cmp) \ (((tvp)->tv_sec == (uvp)->tv_sec) ? \ ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ ((tvp)->tv_sec cmp (uvp)->tv_sec)) #define timeradd(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ if ((vvp)->tv_usec >= 1000000) { \ (vvp)->tv_sec++; \ (vvp)->tv_usec -= 1000000; \ } \ } while (0) #define timersub(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ if ((vvp)->tv_usec < 0) { \ (vvp)->tv_sec--; \ (vvp)->tv_usec += 1000000; \ } \ } while (0) #endif # 466 "/usr/include/sys/time.h" 3 4 /* * Names of the interval timers, and structure * defining a timer setting. */ #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 struct itimerval { struct timeval it_interval; /* timer interval */ struct timeval it_value; /* current value */ }; /* * Getkerninfo clock information structure */ struct clockinfo { int hz; /* clock frequency */ int tick; /* micro-seconds per hz tick */ int spare; int stathz; /* statistics clock frequency */ int profhz; /* profiling clock frequency */ }; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 492 "/usr/include/sys/time.h" 3 4 #define CPUCLOCK_WHICH_PID 0 #define CPUCLOCK_WHICH_TID 1 #endif # 495 "/usr/include/sys/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_STANDALONE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 497 "/usr/include/sys/time.h" 3 4 /* * Kernel to clock driver interface. */ void inittodr(time_t base); void resettodr(void); extern volatile time_t time_second; extern volatile time_t time_uptime; extern struct bintime tc_tick_bt; extern sbintime_t tc_tick_sbt; extern time_t tick_seconds_max; extern struct bintime tick_bt; extern sbintime_t tick_sbt; extern int tc_precexp; extern int tc_timepercentage; extern struct bintime bt_timethreshold; extern struct bintime bt_tickthreshold; extern sbintime_t sbt_timethreshold; extern sbintime_t sbt_tickthreshold; extern volatile int rtc_generation; /* * Functions for looking at our clock: [get]{bin,nano,micro}[up]time() * * Functions without the "get" prefix returns the best timestamp * we can produce in the given format. * * "bin" == struct bintime == seconds + 64 bit fraction of seconds. * "nano" == struct timespec == seconds + nanoseconds. * "micro" == struct timeval == seconds + microseconds. * * Functions containing "up" returns time relative to boot and * should be used for calculating time intervals. * * Functions without "up" returns UTC time. * * Functions with the "get" prefix returns a less precise result * much faster than the functions without "get" prefix and should * be used where a precision of 1/hz seconds is acceptable or where * performance is priority. (NB: "precision", _not_ "resolution" !) */ void binuptime(struct bintime *bt); void nanouptime(struct timespec *tsp); void microuptime(struct timeval *tvp); static __inline sbintime_t sbinuptime(void) { struct bintime _bt; binuptime(&_bt); return (bttosbt(_bt)); } void bintime(struct bintime *bt); void nanotime(struct timespec *tsp); void microtime(struct timeval *tvp); void getbinuptime(struct bintime *bt); void getnanouptime(struct timespec *tsp); void getmicrouptime(struct timeval *tvp); static __inline sbintime_t getsbinuptime(void) { struct bintime _bt; getbinuptime(&_bt); return (bttosbt(_bt)); } void getbintime(struct bintime *bt); void getnanotime(struct timespec *tsp); void getmicrotime(struct timeval *tvp); void getboottime(struct timeval *boottime); void getboottimebin(struct bintime *boottimebin); /* Other functions */ int itimerdecr(struct itimerval *itp, int usec); int itimerfix(struct timeval *tv); int ppsratecheck(struct timeval *, int *, int); int ratecheck(struct timeval *, const struct timeval *); void timevaladd(struct timeval *t1, const struct timeval *t2); void timevalsub(struct timeval *t1, const struct timeval *t2); int tvtohz(struct timeval *tv); /* * The following HZ limits allow the tvtohz() function * to only use integer computations. */ #define HZ_MAXIMUM (INT_MAX / (1000000 >> 6)) /* 137kHz */ #define HZ_MINIMUM 8 /* hz */ #define TC_DEFAULTPERC 5 #define BT2FREQ(bt) \ (((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) / \ ((bt)->frac >> 1)) #define SBT2FREQ(sbt) ((SBT_1S + ((sbt) >> 1)) / (sbt)) #define FREQ2BT(freq, bt) \ { \ (bt)->sec = 0; \ (bt)->frac = ((uint64_t)0x8000000000000000 / (freq)) << 1; \ } #define TIMESEL(sbt, sbt2) \ (((sbt2) >= sbt_timethreshold) ? \ ((*(sbt) = getsbinuptime()), 1) : ((*(sbt) = sbinuptime()), 0)) #else /* !_KERNEL && !_STANDALONE */ # 613 "/usr/include/sys/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 613 "/usr/include/sys/time.h" 3 4 # 614 "/usr/include/sys/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 615 "/usr/include/sys/time.h" 3 4 # 616 "/usr/include/sys/time.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 616 "/usr/include/sys/time.h" 3 4 # 617 "/usr/include/sys/time.h" 3 4 __BEGIN_DECLS int setitimer(int, const struct itimerval *, struct itimerval *); int utimes(const char *, const struct timeval *); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 623 "/usr/include/sys/time.h" 3 4 int adjtime(const struct timeval *, struct timeval *); int clock_getcpuclockid2(id_t, int, clockid_t *); int futimes(int, const struct timeval *); int futimesat(int, const char *, const struct timeval [2]); int lutimes(const char *, const struct timeval *); int settimeofday(const struct timeval *, const struct timezone *); #endif # 630 "/usr/include/sys/time.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 632 "/usr/include/sys/time.h" 3 4 int getitimer(int, struct itimerval *); int gettimeofday(struct timeval *, struct timezone *); #endif # 635 "/usr/include/sys/time.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 639 "/usr/include/sys/time.h" 3 4 #endif /* !_SYS_TIME_H_ */ # 641 "/usr/include/sys/time.h" 3 4 # 102 "/usr/include/sys/stat.h" 2 3 4 #endif # 103 "/usr/include/sys/stat.h" 3 4 #ifdef _KERNEL struct ostat { __uint16_t st_dev; /* inode's device */ __uint32_t st_ino; /* inode's number */ mode_t st_mode; /* inode protection mode */ __uint16_t st_nlink; /* number of hard links */ __uint16_t st_uid; /* user ID of the file's owner */ __uint16_t st_gid; /* group ID of the file's group */ __uint16_t st_rdev; /* device type */ __int32_t st_size; /* file size, in bytes */ struct timespec st_atim; /* time of last access */ struct timespec st_mtim; /* time of last data modification */ struct timespec st_ctim; /* time of last file status change */ __int32_t st_blksize; /* optimal blocksize for I/O */ __int32_t st_blocks; /* blocks allocated for file */ fflags_t st_flags; /* user defined flags for file */ __uint32_t st_gen; /* file generation number */ }; #endif # 123 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(_WANT_FREEBSD11_STAT) || defined(_KERNEL) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 125 "/usr/include/sys/stat.h" 3 4 struct freebsd11_stat { __uint32_t st_dev; /* inode's device */ __uint32_t st_ino; /* inode's number */ mode_t st_mode; /* inode protection mode */ __uint16_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ __uint32_t st_rdev; /* device type */ struct timespec st_atim; /* time of last access */ struct timespec st_mtim; /* time of last data modification */ struct timespec st_ctim; /* time of last file status change */ off_t st_size; /* file size, in bytes */ blkcnt_t st_blocks; /* blocks allocated for file */ blksize_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ __uint32_t st_gen; /* file generation number */ __int32_t st_lspare; struct timespec st_birthtim; /* time of file creation */ /* * Explicitly pad st_birthtim to 16 bytes so that the size of * struct stat is backwards compatible. We use bitfields instead * of an array of chars so that this doesn't require a C99 compiler * to compile if the size of the padding is 0. We use 2 bitfields * to cover up to 64 bits on 32-bit machines. We assume that * CHAR_BIT is 8... */ unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); }; #endif /* _WANT_FREEBSD11_STAT || _KERNEL */ # 155 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(__i386__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 157 "/usr/include/sys/stat.h" 3 4 #define __STAT_TIME_T_EXT 1 #endif # 159 "/usr/include/sys/stat.h" 3 4 struct stat { dev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ nlink_t st_nlink; /* number of hard links */ mode_t st_mode; /* inode protection mode */ __int16_t st_padding0; uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ __int32_t st_padding1; dev_t st_rdev; /* device type */ #ifdef __STAT_TIME_T_EXT __int32_t st_atim_ext; #endif # 173 "/usr/include/sys/stat.h" 3 4 struct timespec st_atim; /* time of last access */ #ifdef __STAT_TIME_T_EXT __int32_t st_mtim_ext; #endif # 177 "/usr/include/sys/stat.h" 3 4 struct timespec st_mtim; /* time of last data modification */ #ifdef __STAT_TIME_T_EXT __int32_t st_ctim_ext; #endif # 181 "/usr/include/sys/stat.h" 3 4 struct timespec st_ctim; /* time of last file status change */ #ifdef __STAT_TIME_T_EXT __int32_t st_btim_ext; #endif # 185 "/usr/include/sys/stat.h" 3 4 struct timespec st_birthtim; /* time of file creation */ off_t st_size; /* file size, in bytes */ blkcnt_t st_blocks; /* blocks allocated for file */ blksize_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ __uint64_t st_gen; /* file generation number */ __uint64_t st_spare[10]; }; #ifdef _KERNEL struct nstat { __uint32_t st_dev; /* inode's device */ __uint32_t st_ino; /* inode's number */ __uint32_t st_mode; /* inode protection mode */ __uint32_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ __uint32_t st_rdev; /* device type */ struct timespec st_atim; /* time of last access */ struct timespec st_mtim; /* time of last data modification */ struct timespec st_ctim; /* time of last file status change */ off_t st_size; /* file size, in bytes */ blkcnt_t st_blocks; /* blocks allocated for file */ blksize_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ __uint32_t st_gen; /* file generation number */ struct timespec st_birthtim; /* time of file creation */ /* * See comment in the definition of struct freebsd11_stat * above about the following padding. */ unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); }; #endif # 220 "/usr/include/sys/stat.h" 3 4 #ifndef _KERNEL #define st_atime st_atim.tv_sec #define st_mtime st_mtim.tv_sec #define st_ctime st_ctim.tv_sec #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 226 "/usr/include/sys/stat.h" 3 4 #define st_birthtime st_birthtim.tv_sec #define st_atimensec st_atim.tv_nsec #define st_mtimensec st_mtim.tv_nsec #define st_ctimensec st_ctim.tv_nsec #define st_birthtimensec st_birthtim.tv_nsec #endif # 232 "/usr/include/sys/stat.h" 3 4 /* For compatibility. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 235 "/usr/include/sys/stat.h" 3 4 #define st_atimespec st_atim #define st_mtimespec st_mtim #define st_ctimespec st_ctim #define st_birthtimespec st_birthtim #endif # 240 "/usr/include/sys/stat.h" 3 4 #endif /* !_KERNEL */ # 241 "/usr/include/sys/stat.h" 3 4 #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 245 "/usr/include/sys/stat.h" 3 4 #define S_ISTXT 0001000 /* sticky bit */ #endif # 247 "/usr/include/sys/stat.h" 3 4 #define S_IRWXU 0000700 /* RWX mask for owner */ #define S_IRUSR 0000400 /* R for owner */ #define S_IWUSR 0000200 /* W for owner */ #define S_IXUSR 0000100 /* X for owner */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 254 "/usr/include/sys/stat.h" 3 4 #define S_IREAD S_IRUSR #define S_IWRITE S_IWUSR #define S_IEXEC S_IXUSR #endif # 258 "/usr/include/sys/stat.h" 3 4 #define S_IRWXG 0000070 /* RWX mask for group */ #define S_IRGRP 0000040 /* R for group */ #define S_IWGRP 0000020 /* W for group */ #define S_IXGRP 0000010 /* X for group */ #define S_IRWXO 0000007 /* RWX mask for other */ #define S_IROTH 0000004 /* R for other */ #define S_IWOTH 0000002 /* W for other */ #define S_IXOTH 0000001 /* X for other */ #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 270 "/usr/include/sys/stat.h" 3 4 #define S_IFMT 0170000 /* type of file mask */ #define S_IFIFO 0010000 /* named pipe (fifo) */ #define S_IFCHR 0020000 /* character special */ #define S_IFDIR 0040000 /* directory */ #define S_IFBLK 0060000 /* block special */ #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_IFSOCK 0140000 /* socket */ #define S_ISVTX 0001000 /* save swapped text even after use */ #endif # 280 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 281 "/usr/include/sys/stat.h" 3 4 #define S_IFWHT 0160000 /* whiteout */ #endif # 283 "/usr/include/sys/stat.h" 3 4 #define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */ #define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) (((m) & 0170000) == 0010000) /* fifo or socket */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 290 "/usr/include/sys/stat.h" 3 4 #define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) (((m) & 0170000) == 0140000) /* socket */ #endif # 293 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 294 "/usr/include/sys/stat.h" 3 4 #define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */ #endif # 296 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 298 "/usr/include/sys/stat.h" 3 4 #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ /* 7777 */ #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) /* 0666 */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #define S_BLKSIZE 512 /* block size used in the stat struct */ /* * Definitions of flags stored in file flags word. * * Super-user and owner changeable flags. */ #define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */ #define UF_NODUMP 0x00000001 /* do not dump file */ #define UF_IMMUTABLE 0x00000002 /* file may not be changed */ #define UF_APPEND 0x00000004 /* writes to file may only append */ #define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ #define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */ /* * These two bits are defined in MacOS X. They are not currently used in * FreeBSD. */ #if 0 /* disabled by -frewrite-includes */ #if 0 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 322 "/usr/include/sys/stat.h" 3 4 #define UF_COMPRESSED 0x00000020 /* file is compressed */ #define UF_TRACKED 0x00000040 /* renames and deletes are tracked */ #endif # 325 "/usr/include/sys/stat.h" 3 4 #define UF_SYSTEM 0x00000080 /* Windows system file bit */ #define UF_SPARSE 0x00000100 /* sparse file */ #define UF_OFFLINE 0x00000200 /* file is offline */ #define UF_REPARSE 0x00000400 /* Windows reparse point file bit */ #define UF_ARCHIVE 0x00000800 /* file needs to be archived */ #define UF_READONLY 0x00001000 /* Windows readonly file bit */ /* This is the same as the MacOS X definition of UF_HIDDEN. */ #define UF_HIDDEN 0x00008000 /* file is hidden */ /* * Super-user changeable flags. */ #define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */ #define SF_ARCHIVED 0x00010000 /* file is archived */ #define SF_IMMUTABLE 0x00020000 /* file may not be changed */ #define SF_APPEND 0x00040000 /* writes to file may only append */ #define SF_NOUNLINK 0x00100000 /* file may not be removed or renamed */ #define SF_SNAPSHOT 0x00200000 /* snapshot inode */ #ifdef _KERNEL /* * Shorthand abbreviations of above. */ #define OPAQUE (UF_OPAQUE) #define APPEND (UF_APPEND | SF_APPEND) #define IMMUTABLE (UF_IMMUTABLE | SF_IMMUTABLE) #define NOUNLINK (UF_NOUNLINK | SF_NOUNLINK) #endif # 354 "/usr/include/sys/stat.h" 3 4 #endif /* __BSD_VISIBLE */ # 356 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 358 "/usr/include/sys/stat.h" 3 4 #define UTIME_NOW -1 #define UTIME_OMIT -2 #endif # 361 "/usr/include/sys/stat.h" 3 4 #ifndef _KERNEL __BEGIN_DECLS #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 365 "/usr/include/sys/stat.h" 3 4 int chflags(const char *, unsigned long); int chflagsat(int, const char *, unsigned long, int); #endif # 368 "/usr/include/sys/stat.h" 3 4 int chmod(const char *, mode_t); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 370 "/usr/include/sys/stat.h" 3 4 int fchflags(int, unsigned long); #endif # 372 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 373 "/usr/include/sys/stat.h" 3 4 int fchmod(int, mode_t); #endif # 375 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 376 "/usr/include/sys/stat.h" 3 4 int fchmodat(int, const char *, mode_t, int); int futimens(int fd, const struct timespec times[2]); int utimensat(int fd, const char *path, const struct timespec times[2], int flag); #endif # 381 "/usr/include/sys/stat.h" 3 4 int fstat(int, struct stat *); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 383 "/usr/include/sys/stat.h" 3 4 int lchflags(const char *, unsigned long); int lchmod(const char *, mode_t); #endif # 386 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 387 "/usr/include/sys/stat.h" 3 4 int lstat(const char * __restrict, struct stat * __restrict); #endif # 389 "/usr/include/sys/stat.h" 3 4 int mkdir(const char *, mode_t); int mkfifo(const char *, mode_t); #if 0 /* disabled by -frewrite-includes */ #if !defined(_MKNOD_DECLARED) && __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 392 "/usr/include/sys/stat.h" 3 4 int mknod(const char *, mode_t, dev_t); #define _MKNOD_DECLARED #endif # 395 "/usr/include/sys/stat.h" 3 4 int stat(const char * __restrict, struct stat * __restrict); mode_t umask(mode_t); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 398 "/usr/include/sys/stat.h" 3 4 int fstatat(int, const char *, struct stat *, int); int mkdirat(int, const char *, mode_t); int mkfifoat(int, const char *, mode_t); #endif # 402 "/usr/include/sys/stat.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE >= 700 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 403 "/usr/include/sys/stat.h" 3 4 int mknodat(int, const char *, mode_t, dev_t); #endif # 405 "/usr/include/sys/stat.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 407 "/usr/include/sys/stat.h" 3 4 #endif /* !_SYS_STAT_H_ */ # 409 "/usr/include/sys/stat.h" 3 4 # 268 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 270 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 270 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 271 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #else # 272 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 272 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/sys/mount.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)mount.h 8.21 (Berkeley) 5/20/95 * $FreeBSD$ */ #ifndef _SYS_MOUNT_H_ #define _SYS_MOUNT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/mount.h" 3 4 # 1 "/usr/include/sys/ucred.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ucred.h 8.4 (Berkeley) 1/9/95 * $FreeBSD$ */ #ifndef _SYS_UCRED_H_ #define _SYS_UCRED_H_ #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_WANT_UCRED) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 39 "/usr/include/sys/ucred.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/ucred.h" 3 4 # 40 "/usr/include/sys/ucred.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/sys/ucred.h" 3 4 # 41 "/usr/include/sys/ucred.h" 3 4 #endif # 42 "/usr/include/sys/ucred.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/usr/include/sys/ucred.h" 3 4 # 1 "/usr/include/bsm/audit.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2005-2009 Apple Inc. * Copyright (c) 2016 Robert N. M. Watson * All rights reserved. * * Portions of this software were developed by BAE Systems, the University of * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL * contract FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent * Computing (TC) research program. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _BSM_AUDIT_H #define _BSM_AUDIT_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/bsm/audit.h" 3 4 # 44 "/usr/include/bsm/audit.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/bsm/audit.h" 3 4 # 45 "/usr/include/bsm/audit.h" 3 4 #define AUDIT_RECORD_MAGIC 0x828a0f1b #define MAX_AUDIT_RECORDS 20 #define MAXAUDITDATA (0x8000 - 1) #define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA #define MIN_AUDIT_FILE_SIZE (512 * 1024) /* * Minimum noumber of free blocks on the filesystem containing the audit * log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0 * as the kernel does an unsigned compare, plus we want to leave a few blocks * free so userspace can terminate the log, etc. */ #define AUDIT_HARD_LIMIT_FREE_BLOCKS 4 /* * Triggers for the audit daemon. */ #define AUDIT_TRIGGER_MIN 1 #define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */ #define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */ #define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */ #define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */ #define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */ #define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */ #define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */ #define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */ #define AUDIT_TRIGGER_MAX 8 /* * The special device filename (FreeBSD). */ #define AUDITDEV_FILENAME "audit" #define AUDIT_TRIGGER_FILE ("/dev/" AUDITDEV_FILENAME) /* * Pre-defined audit IDs */ #define AU_DEFAUDITID (uid_t)(-1) #define AU_DEFAUDITSID 0 #define AU_ASSIGN_ASID -1 /* * IPC types. */ #define AT_IPC_MSG ((u_char)1) /* Message IPC id. */ #define AT_IPC_SEM ((u_char)2) /* Semaphore IPC id. */ #define AT_IPC_SHM ((u_char)3) /* Shared mem IPC id. */ /* * Audit conditions. */ #define AUC_UNSET 0 #define AUC_AUDITING 1 #define AUC_NOAUDIT 2 #define AUC_DISABLED -1 /* * auditon(2) commands. */ #define A_OLDGETPOLICY 2 #define A_OLDSETPOLICY 3 #define A_GETKMASK 4 #define A_SETKMASK 5 #define A_OLDGETQCTRL 6 #define A_OLDSETQCTRL 7 #define A_GETCWD 8 #define A_GETCAR 9 #define A_GETSTAT 12 #define A_SETSTAT 13 #define A_SETUMASK 14 #define A_SETSMASK 15 #define A_OLDGETCOND 20 #define A_OLDSETCOND 21 #define A_GETCLASS 22 #define A_SETCLASS 23 #define A_GETPINFO 24 #define A_SETPMASK 25 #define A_SETFSIZE 26 #define A_GETFSIZE 27 #define A_GETPINFO_ADDR 28 #define A_GETKAUDIT 29 #define A_SETKAUDIT 30 #define A_SENDTRIGGER 31 #define A_GETSINFO_ADDR 32 #define A_GETPOLICY 33 #define A_SETPOLICY 34 #define A_GETQCTRL 35 #define A_SETQCTRL 36 #define A_GETCOND 37 #define A_SETCOND 38 #define A_GETEVENT 39 /* Get audit event-to-name mapping. */ #define A_SETEVENT 40 /* Set audit event-to-name mapping. */ /* * Audit policy controls. */ #define AUDIT_CNT 0x0001 #define AUDIT_AHLT 0x0002 #define AUDIT_ARGV 0x0004 #define AUDIT_ARGE 0x0008 #define AUDIT_SEQ 0x0010 #define AUDIT_WINDATA 0x0020 #define AUDIT_USER 0x0040 #define AUDIT_GROUP 0x0080 #define AUDIT_TRAIL 0x0100 #define AUDIT_PATH 0x0200 #define AUDIT_SCNT 0x0400 #define AUDIT_PUBLIC 0x0800 #define AUDIT_ZONENAME 0x1000 #define AUDIT_PERZONE 0x2000 /* * Default audit queue control parameters. */ #define AQ_HIWATER 100 #define AQ_MAXHIGH 10000 #define AQ_LOWATER 10 #define AQ_BUFSZ MAXAUDITDATA #define AQ_MAXBUFSZ 1048576 /* * Default minimum percentage free space on file system. */ #define AU_FS_MINFREE 20 /* * Type definitions used indicating the length of variable length addresses * in tokens containing addresses, such as header fields. */ #define AU_IPv4 4 #define AU_IPv6 16 __BEGIN_DECLS typedef uid_t au_id_t; typedef pid_t au_asid_t; typedef u_int16_t au_event_t; typedef u_int16_t au_emod_t; typedef u_int32_t au_class_t; typedef u_int64_t au_asflgs_t __attribute__ ((aligned (8))); struct au_tid { u_int32_t port; /* XXX dev_t compatibility */ u_int32_t machine; }; typedef struct au_tid au_tid_t; struct au_tid_addr { u_int32_t at_port; /* XXX dev_t compatibility */ u_int32_t at_type; u_int32_t at_addr[4]; }; typedef struct au_tid_addr au_tid_addr_t; struct au_mask { unsigned int am_success; /* Success bits. */ unsigned int am_failure; /* Failure bits. */ }; typedef struct au_mask au_mask_t; struct auditinfo { au_id_t ai_auid; /* Audit user ID. */ au_mask_t ai_mask; /* Audit masks. */ au_tid_t ai_termid; /* Terminal ID. */ au_asid_t ai_asid; /* Audit session ID. */ }; typedef struct auditinfo auditinfo_t; struct auditinfo_addr { au_id_t ai_auid; /* Audit user ID. */ au_mask_t ai_mask; /* Audit masks. */ au_tid_addr_t ai_termid; /* Terminal ID. */ au_asid_t ai_asid; /* Audit session ID. */ au_asflgs_t ai_flags; /* Audit session flags. */ }; typedef struct auditinfo_addr auditinfo_addr_t; struct auditpinfo { pid_t ap_pid; /* ID of target process. */ au_id_t ap_auid; /* Audit user ID. */ au_mask_t ap_mask; /* Audit masks. */ au_tid_t ap_termid; /* Terminal ID. */ au_asid_t ap_asid; /* Audit session ID. */ }; typedef struct auditpinfo auditpinfo_t; struct auditpinfo_addr { pid_t ap_pid; /* ID of target process. */ au_id_t ap_auid; /* Audit user ID. */ au_mask_t ap_mask; /* Audit masks. */ au_tid_addr_t ap_termid; /* Terminal ID. */ au_asid_t ap_asid; /* Audit session ID. */ au_asflgs_t ap_flags; /* Audit session flags. */ }; typedef struct auditpinfo_addr auditpinfo_addr_t; struct au_session { auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */ au_mask_t as_mask; /* Process Audit Masks. */ }; typedef struct au_session au_session_t; /* * Contents of token_t are opaque outside of libbsm. */ typedef struct au_token token_t; /* * Kernel audit queue control parameters: * Default: Maximum: * aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000) * aq_lowater: AQ_LOWATER (10) #endif /* expanded by -frewrite-includes */ # 338 "/usr/include/bsm/audit.h" 3 4 # 339 "/usr/include/bsm/audit.h" 3 4 mach_port_name_t audit_session_self(void); au_asid_t audit_session_join(mach_port_name_t port); #endif /* __APPLE_API_PRIVATE */ # 342 "/usr/include/bsm/audit.h" 3 4 #endif /* defined(_KERNEL) || defined(KERNEL) */ # 344 "/usr/include/bsm/audit.h" 3 4 __END_DECLS #endif /* !_BSM_AUDIT_H */ # 348 "/usr/include/bsm/audit.h" 3 4 # 43 "/usr/include/sys/ucred.h" 2 3 4 struct loginclass; #define XU_NGROUPS 16 /* * Credentials. * * Please do not inspect cr_uid directly to determine superuserness. The * priv(9) interface should be used to check for privilege. * * Lock reference: * c - cr_mtx * * Unmarked fields are constant after creation. * * See "Credential management" comment in kern_prot.c for more information. */ #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_WANT_UCRED) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 62 "/usr/include/sys/ucred.h" 3 4 struct ucred { struct mtx cr_mtx; u_int cr_ref; /* (c) reference count */ u_int cr_users; /* (c) proc + thread using this cred */ struct auditinfo_addr cr_audit; /* Audit properties. */ #define cr_startcopy cr_uid uid_t cr_uid; /* effective user id */ uid_t cr_ruid; /* real user id */ uid_t cr_svuid; /* saved user id */ int cr_ngroups; /* number of groups */ gid_t cr_rgid; /* real group id */ gid_t cr_svgid; /* saved group id */ struct uidinfo *cr_uidinfo; /* per euid resource consumption */ struct uidinfo *cr_ruidinfo; /* per ruid resource consumption */ struct prison *cr_prison; /* jail(2) */ struct loginclass *cr_loginclass; /* login class */ u_int cr_flags; /* credential flags */ void *cr_pspare2[2]; /* general use 2 */ #define cr_endcopy cr_label struct label *cr_label; /* MAC label */ gid_t *cr_groups; /* groups */ int cr_agroups; /* Available groups */ gid_t cr_smallgroups[XU_NGROUPS]; /* storage for small groups */ }; #define NOCRED ((struct ucred *)0) /* no credential available */ #define FSCRED ((struct ucred *)-1) /* filesystem credential */ #endif /* _KERNEL || _WANT_UCRED */ # 89 "/usr/include/sys/ucred.h" 3 4 /* * Flags for cr_flags. */ #define CRED_FLAG_CAPMODE 0x00000001 /* In capability mode. */ /* * This is the external representation of struct ucred. */ struct xucred { u_int cr_version; /* structure layout version */ uid_t cr_uid; /* effective user id */ short cr_ngroups; /* number of groups */ gid_t cr_groups[XU_NGROUPS]; /* groups */ union { void *_cr_unused1; /* compatibility with old ucred */ pid_t cr_pid; }; }; #define XUCRED_VERSION 0 /* This can be used for both ucred and xucred structures. */ #define cr_gid cr_groups[0] #ifdef _KERNEL struct proc; struct thread; struct credbatch { struct ucred *cred; int users; int ref; }; static inline void credbatch_prep(struct credbatch *crb) { crb->cred = NULL; crb->users = 0; crb->ref = 0; } void credbatch_add(struct credbatch *crb, struct thread *td); static inline void credbatch_process(struct credbatch *crb __unused) { } void credbatch_final(struct credbatch *crb); void change_egid(struct ucred *newcred, gid_t egid); void change_euid(struct ucred *newcred, struct uidinfo *euip); void change_rgid(struct ucred *newcred, gid_t rgid); void change_ruid(struct ucred *newcred, struct uidinfo *ruip); void change_svgid(struct ucred *newcred, gid_t svgid); void change_svuid(struct ucred *newcred, uid_t svuid); void crcopy(struct ucred *dest, struct ucred *src); struct ucred *crcopysafe(struct proc *p, struct ucred *cr); struct ucred *crdup(struct ucred *cr); void crextend(struct ucred *cr, int n); void proc_set_cred_init(struct proc *p, struct ucred *cr); void proc_set_cred(struct proc *p, struct ucred *cr); void proc_unset_cred(struct proc *p); void crfree(struct ucred *cr); struct ucred *crcowsync(void); struct ucred *crget(void); struct ucred *crhold(struct ucred *cr); struct ucred *crcowget(struct ucred *cr); void crcowfree(struct thread *td); void cru2x(struct ucred *cr, struct xucred *xcr); void cru2xt(struct thread *td, struct xucred *xcr); void crsetgroups(struct ucred *cr, int n, gid_t *groups); int groupmember(gid_t gid, struct ucred *cred); #endif /* _KERNEL */ # 164 "/usr/include/sys/ucred.h" 3 4 #endif /* !_SYS_UCRED_H_ */ # 166 "/usr/include/sys/ucred.h" 3 4 # 39 "/usr/include/sys/mount.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/mount.h" 3 4 # 1 "/usr/include/sys/queue.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 * $FreeBSD$ */ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/queue.h" 3 4 # 39 "/usr/include/sys/queue.h" 3 4 /* * This file defines four types of data structures: singly-linked lists, * singly-linked tail queues, lists and tail queues. * * A singly-linked list is headed by a single forward pointer. The elements * are singly linked for minimum space and pointer manipulation overhead at * the expense of O(n) removal for arbitrary elements. New elements can be * added to the list after an existing element or at the head of the list. * Elements being removed from the head of the list should use the explicit * macro for this purpose for optimum efficiency. A singly-linked list may * only be traversed in the forward direction. Singly-linked lists are ideal * for applications with large datasets and few or no removals or for * implementing a LIFO queue. * * A singly-linked tail queue is headed by a pair of pointers, one to the * head of the list and the other to the tail of the list. The elements are * singly linked for minimum space and pointer manipulation overhead at the * expense of O(n) removal for arbitrary elements. New elements can be added * to the list after an existing element, at the head of the list, or at the * end of the list. Elements being removed from the head of the tail queue * should use the explicit macro for this purpose for optimum efficiency. * A singly-linked tail queue may only be traversed in the forward direction. * Singly-linked tail queues are ideal for applications with large datasets * and few or no removals or for implementing a FIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may be traversed in either direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * For details on the use of these macros, see the queue(3) manual page. * * Below is a summary of implemented functions where: * + means the macro is available * - means the macro is not available * s means the macro is available but is slow (runs in O(n) time) * * SLIST LIST STAILQ TAILQ * _HEAD + + + + * _CLASS_HEAD + + + + * _HEAD_INITIALIZER + + + + * _ENTRY + + + + * _CLASS_ENTRY + + + + * _INIT + + + + * _EMPTY + + + + * _END + + + + * _FIRST + + + + * _NEXT + + + + * _PREV - + - + * _LAST - - + + * _LAST_FAST - - - + * _FOREACH + + + + * _FOREACH_FROM + + + + * _FOREACH_SAFE + + + + * _FOREACH_FROM_SAFE + + + + * _FOREACH_REVERSE - - - + * _FOREACH_REVERSE_FROM - - - + * _FOREACH_REVERSE_SAFE - - - + * _FOREACH_REVERSE_FROM_SAFE - - - + * _INSERT_HEAD + + + + * _INSERT_BEFORE - + - + * _INSERT_AFTER + + + + * _INSERT_TAIL - - + + * _CONCAT s s + + * _REMOVE_AFTER + - + - * _REMOVE_HEAD + - + - * _REMOVE s + s + * _SWAP + + + + * */ #ifdef QUEUE_MACRO_DEBUG #warn Use QUEUE_MACRO_DEBUG_TRACE and/or QUEUE_MACRO_DEBUG_TRASH #define QUEUE_MACRO_DEBUG_TRACE #define QUEUE_MACRO_DEBUG_TRASH #endif # 124 "/usr/include/sys/queue.h" 3 4 #ifdef QUEUE_MACRO_DEBUG_TRACE /* Store the last 2 places the queue element or head was altered */ struct qm_trace { unsigned long lastline; unsigned long prevline; const char *lastfile; const char *prevfile; }; #define TRACEBUF struct qm_trace trace; #define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } , #define QMD_TRACE_HEAD(head) do { \ (head)->trace.prevline = (head)->trace.lastline; \ (head)->trace.prevfile = (head)->trace.lastfile; \ (head)->trace.lastline = __LINE__; \ (head)->trace.lastfile = __FILE__; \ } while (0) #define QMD_TRACE_ELEM(elem) do { \ (elem)->trace.prevline = (elem)->trace.lastline; \ (elem)->trace.prevfile = (elem)->trace.lastfile; \ (elem)->trace.lastline = __LINE__; \ (elem)->trace.lastfile = __FILE__; \ } while (0) #else /* !QUEUE_MACRO_DEBUG_TRACE */ # 152 "/usr/include/sys/queue.h" 3 4 #define QMD_TRACE_ELEM(elem) #define QMD_TRACE_HEAD(head) #define TRACEBUF #define TRACEBUF_INITIALIZER #endif /* QUEUE_MACRO_DEBUG_TRACE */ # 157 "/usr/include/sys/queue.h" 3 4 #ifdef QUEUE_MACRO_DEBUG_TRASH #define QMD_SAVELINK(name, link) void **name = (void *)&(link) #define TRASHIT(x) do {(x) = (void *)-1;} while (0) #define QMD_IS_TRASHED(x) ((x) == (void *)(intptr_t)-1) #else /* !QUEUE_MACRO_DEBUG_TRASH */ # 163 "/usr/include/sys/queue.h" 3 4 #define QMD_SAVELINK(name, link) #define TRASHIT(x) #define QMD_IS_TRASHED(x) 0 #endif /* QUEUE_MACRO_DEBUG_TRASH */ # 167 "/usr/include/sys/queue.h" 3 4 #ifdef __cplusplus /* * In C++ there can be structure lists and class lists: */ #define QUEUE_TYPEOF(type) type #else # 174 "/usr/include/sys/queue.h" 3 4 #define QUEUE_TYPEOF(type) struct type #endif # 176 "/usr/include/sys/queue.h" 3 4 /* * Singly-linked List declarations. */ #define SLIST_HEAD(name, type) \ struct name { \ struct type *slh_first; /* first element */ \ } #define SLIST_CLASS_HEAD(name, type) \ struct name { \ class type *slh_first; /* first element */ \ } #define SLIST_HEAD_INITIALIZER(head) \ { NULL } #define SLIST_ENTRY(type) \ struct { \ struct type *sle_next; /* next element */ \ } #define SLIST_CLASS_ENTRY(type) \ struct { \ class type *sle_next; /* next element */ \ } /* * Singly-linked List functions. */ #if 0 /* disabled by -frewrite-includes */ #if (defined(_KERNEL) && defined(INVARIANTS)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 207 "/usr/include/sys/queue.h" 3 4 #define QMD_SLIST_CHECK_PREVPTR(prevp, elm) do { \ if (*(prevp) != (elm)) \ panic("Bad prevptr *(%p) == %p != %p", \ (prevp), *(prevp), (elm)); \ } while (0) #else # 213 "/usr/include/sys/queue.h" 3 4 #define QMD_SLIST_CHECK_PREVPTR(prevp, elm) #endif # 215 "/usr/include/sys/queue.h" 3 4 #define SLIST_CONCAT(head1, head2, type, field) do { \ QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \ if (curelm == NULL) { \ if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \ SLIST_INIT(head2); \ } else if (SLIST_FIRST(head2) != NULL) { \ while (SLIST_NEXT(curelm, field) != NULL) \ curelm = SLIST_NEXT(curelm, field); \ SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \ SLIST_INIT(head2); \ } \ } while (0) #define SLIST_EMPTY(head) ((head)->slh_first == NULL) #define SLIST_FIRST(head) ((head)->slh_first) #define SLIST_FOREACH(var, head, field) \ for ((var) = SLIST_FIRST((head)); \ (var); \ (var) = SLIST_NEXT((var), field)) #define SLIST_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ (var); \ (var) = SLIST_NEXT((var), field)) #define SLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = SLIST_FIRST((head)); \ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ for ((varp) = &SLIST_FIRST((head)); \ ((var) = *(varp)) != NULL; \ (varp) = &SLIST_NEXT((var), field)) #define SLIST_INIT(head) do { \ SLIST_FIRST((head)) = NULL; \ } while (0) #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ SLIST_NEXT((slistelm), field) = (elm); \ } while (0) #define SLIST_INSERT_HEAD(head, elm, field) do { \ SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ SLIST_FIRST((head)) = (elm); \ } while (0) #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) #define SLIST_REMOVE(head, elm, type, field) do { \ if (SLIST_FIRST((head)) == (elm)) { \ SLIST_REMOVE_HEAD((head), field); \ } \ else { \ QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \ while (SLIST_NEXT(curelm, field) != (elm)) \ curelm = SLIST_NEXT(curelm, field); \ SLIST_REMOVE_AFTER(curelm, field); \ } \ } while (0) #define SLIST_REMOVE_AFTER(elm, field) do { \ QMD_SAVELINK(oldnext, SLIST_NEXT(elm, field)->field.sle_next); \ SLIST_NEXT(elm, field) = \ SLIST_NEXT(SLIST_NEXT(elm, field), field); \ TRASHIT(*oldnext); \ } while (0) #define SLIST_REMOVE_HEAD(head, field) do { \ QMD_SAVELINK(oldnext, SLIST_FIRST(head)->field.sle_next); \ SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ TRASHIT(*oldnext); \ } while (0) #define SLIST_REMOVE_PREVPTR(prevp, elm, field) do { \ QMD_SLIST_CHECK_PREVPTR(prevp, elm); \ *(prevp) = SLIST_NEXT(elm, field); \ TRASHIT((elm)->field.sle_next); \ } while (0) #define SLIST_SWAP(head1, head2, type) do { \ QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \ SLIST_FIRST(head1) = SLIST_FIRST(head2); \ SLIST_FIRST(head2) = swap_first; \ } while (0) #define SLIST_END(head) NULL /* * Singly-linked Tail queue declarations. */ #define STAILQ_HEAD(name, type) \ struct name { \ struct type *stqh_first;/* first element */ \ struct type **stqh_last;/* addr of last next element */ \ } #define STAILQ_CLASS_HEAD(name, type) \ struct name { \ class type *stqh_first; /* first element */ \ class type **stqh_last; /* addr of last next element */ \ } #define STAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).stqh_first } #define STAILQ_ENTRY(type) \ struct { \ struct type *stqe_next; /* next element */ \ } #define STAILQ_CLASS_ENTRY(type) \ struct { \ class type *stqe_next; /* next element */ \ } /* * Singly-linked Tail queue functions. */ #define STAILQ_CONCAT(head1, head2) do { \ if (!STAILQ_EMPTY((head2))) { \ *(head1)->stqh_last = (head2)->stqh_first; \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_INIT((head2)); \ } \ } while (0) #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) #define STAILQ_FIRST(head) ((head)->stqh_first) #define STAILQ_FOREACH(var, head, field) \ for((var) = STAILQ_FIRST((head)); \ (var); \ (var) = STAILQ_NEXT((var), field)) #define STAILQ_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ (var); \ (var) = STAILQ_NEXT((var), field)) #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = STAILQ_FIRST((head)); \ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define STAILQ_INIT(head) do { \ STAILQ_FIRST((head)) = NULL; \ (head)->stqh_last = &STAILQ_FIRST((head)); \ } while (0) #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ STAILQ_NEXT((tqelm), field) = (elm); \ } while (0) #define STAILQ_INSERT_HEAD(head, elm, field) do { \ if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ STAILQ_FIRST((head)) = (elm); \ } while (0) #define STAILQ_INSERT_TAIL(head, elm, field) do { \ STAILQ_NEXT((elm), field) = NULL; \ *(head)->stqh_last = (elm); \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) #define STAILQ_LAST(head, type, field) \ (STAILQ_EMPTY((head)) ? NULL : \ __containerof((head)->stqh_last, \ QUEUE_TYPEOF(type), field.stqe_next)) #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) #define STAILQ_REMOVE(head, elm, type, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \ if (STAILQ_FIRST((head)) == (elm)) { \ STAILQ_REMOVE_HEAD((head), field); \ } \ else { \ QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \ while (STAILQ_NEXT(curelm, field) != (elm)) \ curelm = STAILQ_NEXT(curelm, field); \ STAILQ_REMOVE_AFTER(head, curelm, field); \ } \ TRASHIT(*oldnext); \ } while (0) #define STAILQ_REMOVE_AFTER(head, elm, field) do { \ if ((STAILQ_NEXT(elm, field) = \ STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) #define STAILQ_REMOVE_HEAD(head, field) do { \ if ((STAILQ_FIRST((head)) = \ STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ (head)->stqh_last = &STAILQ_FIRST((head)); \ } while (0) #define STAILQ_SWAP(head1, head2, type) do { \ QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \ QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \ STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_FIRST(head2) = swap_first; \ (head2)->stqh_last = swap_last; \ if (STAILQ_EMPTY(head1)) \ (head1)->stqh_last = &STAILQ_FIRST(head1); \ if (STAILQ_EMPTY(head2)) \ (head2)->stqh_last = &STAILQ_FIRST(head2); \ } while (0) #define STAILQ_END(head) NULL /* * List declarations. */ #define LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } #define LIST_CLASS_HEAD(name, type) \ struct name { \ class type *lh_first; /* first element */ \ } #define LIST_HEAD_INITIALIZER(head) \ { NULL } #define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ } #define LIST_CLASS_ENTRY(type) \ struct { \ class type *le_next; /* next element */ \ class type **le_prev; /* address of previous next element */ \ } /* * List functions. */ #if 0 /* disabled by -frewrite-includes */ #if (defined(_KERNEL) && defined(INVARIANTS)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 481 "/usr/include/sys/queue.h" 3 4 /* * QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME) * * If the list is non-empty, validates that the first element of the list * points back at 'head.' */ #define QMD_LIST_CHECK_HEAD(head, field) do { \ if (LIST_FIRST((head)) != NULL && \ LIST_FIRST((head))->field.le_prev != \ &LIST_FIRST((head))) \ panic("Bad list head %p first->prev != head", (head)); \ } while (0) /* * QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME) * * If an element follows 'elm' in the list, validates that the next element * points back at 'elm.' */ #define QMD_LIST_CHECK_NEXT(elm, field) do { \ if (LIST_NEXT((elm), field) != NULL && \ LIST_NEXT((elm), field)->field.le_prev != \ &((elm)->field.le_next)) \ panic("Bad link elm %p next->prev != elm", (elm)); \ } while (0) /* * QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME) * * Validates that the previous element (or head of the list) points to 'elm.' */ #define QMD_LIST_CHECK_PREV(elm, field) do { \ if (*(elm)->field.le_prev != (elm)) \ panic("Bad link elm %p prev->next != elm", (elm)); \ } while (0) #else # 517 "/usr/include/sys/queue.h" 3 4 #define QMD_LIST_CHECK_HEAD(head, field) #define QMD_LIST_CHECK_NEXT(elm, field) #define QMD_LIST_CHECK_PREV(elm, field) #endif /* (_KERNEL && INVARIANTS) */ # 521 "/usr/include/sys/queue.h" 3 4 #define LIST_CONCAT(head1, head2, type, field) do { \ QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \ if (curelm == NULL) { \ if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \ LIST_FIRST(head2)->field.le_prev = \ &LIST_FIRST((head1)); \ LIST_INIT(head2); \ } \ } else if (LIST_FIRST(head2) != NULL) { \ while (LIST_NEXT(curelm, field) != NULL) \ curelm = LIST_NEXT(curelm, field); \ LIST_NEXT(curelm, field) = LIST_FIRST(head2); \ LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \ LIST_INIT(head2); \ } \ } while (0) #define LIST_EMPTY(head) ((head)->lh_first == NULL) #define LIST_FIRST(head) ((head)->lh_first) #define LIST_FOREACH(var, head, field) \ for ((var) = LIST_FIRST((head)); \ (var); \ (var) = LIST_NEXT((var), field)) #define LIST_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ (var); \ (var) = LIST_NEXT((var), field)) #define LIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = LIST_FIRST((head)); \ (var) && ((tvar) = LIST_NEXT((var), field), 1); \ (var) = (tvar)) #define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ (var) && ((tvar) = LIST_NEXT((var), field), 1); \ (var) = (tvar)) #define LIST_INIT(head) do { \ LIST_FIRST((head)) = NULL; \ } while (0) #define LIST_INSERT_AFTER(listelm, elm, field) do { \ QMD_LIST_CHECK_NEXT(listelm, field); \ if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ LIST_NEXT((listelm), field)->field.le_prev = \ &LIST_NEXT((elm), field); \ LIST_NEXT((listelm), field) = (elm); \ (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ } while (0) #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ QMD_LIST_CHECK_PREV(listelm, field); \ (elm)->field.le_prev = (listelm)->field.le_prev; \ LIST_NEXT((elm), field) = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ } while (0) #define LIST_INSERT_HEAD(head, elm, field) do { \ QMD_LIST_CHECK_HEAD((head), field); \ if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ LIST_FIRST((head)) = (elm); \ (elm)->field.le_prev = &LIST_FIRST((head)); \ } while (0) #define LIST_NEXT(elm, field) ((elm)->field.le_next) #define LIST_PREV(elm, head, type, field) \ ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \ __containerof((elm)->field.le_prev, \ QUEUE_TYPEOF(type), field.le_next)) #define LIST_REMOVE(elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.le_next); \ QMD_SAVELINK(oldprev, (elm)->field.le_prev); \ QMD_LIST_CHECK_NEXT(elm, field); \ QMD_LIST_CHECK_PREV(elm, field); \ if (LIST_NEXT((elm), field) != NULL) \ LIST_NEXT((elm), field)->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = LIST_NEXT((elm), field); \ TRASHIT(*oldnext); \ TRASHIT(*oldprev); \ } while (0) #define LIST_SWAP(head1, head2, type, field) do { \ QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \ LIST_FIRST((head1)) = LIST_FIRST((head2)); \ LIST_FIRST((head2)) = swap_tmp; \ if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ swap_tmp->field.le_prev = &LIST_FIRST((head1)); \ if ((swap_tmp = LIST_FIRST((head2))) != NULL) \ swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ } while (0) #define LIST_END(head) NULL /* * Tail queue declarations. */ #define TAILQ_HEAD(name, type) \ struct name { \ struct type *tqh_first; /* first element */ \ struct type **tqh_last; /* addr of last next element */ \ TRACEBUF \ } #define TAILQ_CLASS_HEAD(name, type) \ struct name { \ class type *tqh_first; /* first element */ \ class type **tqh_last; /* addr of last next element */ \ TRACEBUF \ } #define TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER } #define TAILQ_ENTRY(type) \ struct { \ struct type *tqe_next; /* next element */ \ struct type **tqe_prev; /* address of previous next element */ \ TRACEBUF \ } #define TAILQ_CLASS_ENTRY(type) \ struct { \ class type *tqe_next; /* next element */ \ class type **tqe_prev; /* address of previous next element */ \ TRACEBUF \ } /* * Tail queue functions. */ #if 0 /* disabled by -frewrite-includes */ #if (defined(_KERNEL) && defined(INVARIANTS)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 662 "/usr/include/sys/queue.h" 3 4 /* * QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME) * * If the tailq is non-empty, validates that the first element of the tailq * points back at 'head.' */ #define QMD_TAILQ_CHECK_HEAD(head, field) do { \ if (!TAILQ_EMPTY(head) && \ TAILQ_FIRST((head))->field.tqe_prev != \ &TAILQ_FIRST((head))) \ panic("Bad tailq head %p first->prev != head", (head)); \ } while (0) /* * QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME) * * Validates that the tail of the tailq is a pointer to pointer to NULL. */ #define QMD_TAILQ_CHECK_TAIL(head, field) do { \ if (*(head)->tqh_last != NULL) \ panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ } while (0) /* * QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME) * * If an element follows 'elm' in the tailq, validates that the next element * points back at 'elm.' */ #define QMD_TAILQ_CHECK_NEXT(elm, field) do { \ if (TAILQ_NEXT((elm), field) != NULL && \ TAILQ_NEXT((elm), field)->field.tqe_prev != \ &((elm)->field.tqe_next)) \ panic("Bad link elm %p next->prev != elm", (elm)); \ } while (0) /* * QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME) * * Validates that the previous element (or head of the tailq) points to 'elm.' */ #define QMD_TAILQ_CHECK_PREV(elm, field) do { \ if (*(elm)->field.tqe_prev != (elm)) \ panic("Bad link elm %p prev->next != elm", (elm)); \ } while (0) #else # 708 "/usr/include/sys/queue.h" 3 4 #define QMD_TAILQ_CHECK_HEAD(head, field) #define QMD_TAILQ_CHECK_TAIL(head, headname) #define QMD_TAILQ_CHECK_NEXT(elm, field) #define QMD_TAILQ_CHECK_PREV(elm, field) #endif /* (_KERNEL && INVARIANTS) */ # 713 "/usr/include/sys/queue.h" 3 4 #define TAILQ_CONCAT(head1, head2, field) do { \ if (!TAILQ_EMPTY(head2)) { \ *(head1)->tqh_last = (head2)->tqh_first; \ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ (head1)->tqh_last = (head2)->tqh_last; \ TAILQ_INIT((head2)); \ QMD_TRACE_HEAD(head1); \ QMD_TRACE_HEAD(head2); \ } \ } while (0) #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_FOREACH(var, head, field) \ for ((var) = TAILQ_FIRST((head)); \ (var); \ (var) = TAILQ_NEXT((var), field)) #define TAILQ_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ (var); \ (var) = TAILQ_NEXT((var), field)) #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = TAILQ_FIRST((head)); \ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = TAILQ_LAST((head), headname); \ (var); \ (var) = TAILQ_PREV((var), headname, field)) #define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ (var); \ (var) = TAILQ_PREV((var), headname, field)) #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ for ((var) = TAILQ_LAST((head), headname); \ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define TAILQ_INIT(head) do { \ TAILQ_FIRST((head)) = NULL; \ (head)->tqh_last = &TAILQ_FIRST((head)); \ QMD_TRACE_HEAD(head); \ } while (0) #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ QMD_TAILQ_CHECK_NEXT(listelm, field); \ if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ TAILQ_NEXT((elm), field)->field.tqe_prev = \ &TAILQ_NEXT((elm), field); \ else { \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ QMD_TRACE_HEAD(head); \ } \ TAILQ_NEXT((listelm), field) = (elm); \ (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ QMD_TRACE_ELEM(&(elm)->field); \ QMD_TRACE_ELEM(&(listelm)->field); \ } while (0) #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ QMD_TAILQ_CHECK_PREV(listelm, field); \ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ TAILQ_NEXT((elm), field) = (listelm); \ *(listelm)->field.tqe_prev = (elm); \ (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ QMD_TRACE_ELEM(&(elm)->field); \ QMD_TRACE_ELEM(&(listelm)->field); \ } while (0) #define TAILQ_INSERT_HEAD(head, elm, field) do { \ QMD_TAILQ_CHECK_HEAD(head, field); \ if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ TAILQ_FIRST((head))->field.tqe_prev = \ &TAILQ_NEXT((elm), field); \ else \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ TAILQ_FIRST((head)) = (elm); \ (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ QMD_TRACE_HEAD(head); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) #define TAILQ_INSERT_TAIL(head, elm, field) do { \ QMD_TAILQ_CHECK_TAIL(head, field); \ TAILQ_NEXT((elm), field) = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ QMD_TRACE_HEAD(head); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) #define TAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) /* * The FAST function is fast in that it causes no data access other * then the access to the head. The standard LAST function above * will cause a data access of both the element you want and * the previous element. FAST is very useful for instances when * you may want to prefetch the last data element. */ #define TAILQ_LAST_FAST(head, type, field) \ (TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next)) #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) #define TAILQ_PREV_FAST(elm, head, type, field) \ ((elm)->field.tqe_prev == &(head)->tqh_first ? NULL : \ __containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next)) #define TAILQ_REMOVE(head, elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ QMD_TAILQ_CHECK_NEXT(elm, field); \ QMD_TAILQ_CHECK_PREV(elm, field); \ if ((TAILQ_NEXT((elm), field)) != NULL) \ TAILQ_NEXT((elm), field)->field.tqe_prev = \ (elm)->field.tqe_prev; \ else { \ (head)->tqh_last = (elm)->field.tqe_prev; \ QMD_TRACE_HEAD(head); \ } \ *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ TRASHIT(*oldnext); \ TRASHIT(*oldprev); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) #define TAILQ_SWAP(head1, head2, type, field) do { \ QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \ QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \ (head1)->tqh_first = (head2)->tqh_first; \ (head1)->tqh_last = (head2)->tqh_last; \ (head2)->tqh_first = swap_first; \ (head2)->tqh_last = swap_last; \ if ((swap_first = (head1)->tqh_first) != NULL) \ swap_first->field.tqe_prev = &(head1)->tqh_first; \ else \ (head1)->tqh_last = &(head1)->tqh_first; \ if ((swap_first = (head2)->tqh_first) != NULL) \ swap_first->field.tqe_prev = &(head2)->tqh_first; \ else \ (head2)->tqh_last = &(head2)->tqh_first; \ } while (0) #define TAILQ_END(head) NULL #endif /* !_SYS_QUEUE_H_ */ # 883 "/usr/include/sys/queue.h" 3 4 # 40 "/usr/include/sys/mount.h" 2 3 4 #ifdef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/sys/mount.h" 3 4 # 42 "/usr/include/sys/mount.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/usr/include/sys/mount.h" 3 4 # 43 "/usr/include/sys/mount.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/sys/mount.h" 3 4 # 44 "/usr/include/sys/mount.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/sys/mount.h" 3 4 # 45 "/usr/include/sys/mount.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/sys/mount.h" 3 4 # 46 "/usr/include/sys/mount.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 46 "/usr/include/sys/mount.h" 3 4 # 47 "/usr/include/sys/mount.h" 3 4 #endif # 48 "/usr/include/sys/mount.h" 3 4 /* * NOTE: When changing statfs structure, mount structure, MNT_* flags or * MNTK_* flags also update DDB show mount command in vfs_subr.c. */ typedef struct fsid { int32_t val[2]; } fsid_t; /* filesystem id type */ #define fsidcmp(a, b) memcmp((a), (b), sizeof(fsid_t)) /* * File identifier. * These are unique per filesystem on a single machine. * * Note that the offset of fid_data is 4 bytes, so care must be taken to avoid * undefined behavior accessing unaligned fields within an embedded struct. */ #define MAXFIDSZ 16 struct fid { u_short fid_len; /* length of data in bytes */ u_short fid_data0; /* force longword alignment */ char fid_data[MAXFIDSZ]; /* data (variable length) */ }; /* * filesystem statistics */ #define MFSNAMELEN 16 /* length of type name including null */ #define MNAMELEN 1024 /* size of on/from name bufs */ #define STATFS_VERSION 0x20140518 /* current version number */ struct statfs { uint32_t f_version; /* structure version number */ uint32_t f_type; /* type of filesystem */ uint64_t f_flags; /* copy of mount exported flags */ uint64_t f_bsize; /* filesystem fragment size */ uint64_t f_iosize; /* optimal transfer block size */ uint64_t f_blocks; /* total data blocks in filesystem */ uint64_t f_bfree; /* free blocks in filesystem */ int64_t f_bavail; /* free blocks avail to non-superuser */ uint64_t f_files; /* total file nodes in filesystem */ int64_t f_ffree; /* free nodes avail to non-superuser */ uint64_t f_syncwrites; /* count of sync writes since mount */ uint64_t f_asyncwrites; /* count of async writes since mount */ uint64_t f_syncreads; /* count of sync reads since mount */ uint64_t f_asyncreads; /* count of async reads since mount */ uint32_t f_nvnodelistsize; /* # of vnodes */ uint32_t f_spare0; /* unused spare */ uint64_t f_spare[9]; /* unused spare */ uint32_t f_namemax; /* maximum filename length */ uid_t f_owner; /* user that mounted the filesystem */ fsid_t f_fsid; /* filesystem id */ char f_charspare[80]; /* spare string space */ char f_fstypename[MFSNAMELEN]; /* filesystem type name */ char f_mntfromname[MNAMELEN]; /* mounted filesystem */ char f_mntonname[MNAMELEN]; /* directory on which mounted */ }; #if 0 /* disabled by -frewrite-includes */ #if defined(_WANT_FREEBSD11_STATFS) || defined(_KERNEL) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 107 "/usr/include/sys/mount.h" 3 4 #define FREEBSD11_STATFS_VERSION 0x20030518 /* current version number */ struct freebsd11_statfs { uint32_t f_version; /* structure version number */ uint32_t f_type; /* type of filesystem */ uint64_t f_flags; /* copy of mount exported flags */ uint64_t f_bsize; /* filesystem fragment size */ uint64_t f_iosize; /* optimal transfer block size */ uint64_t f_blocks; /* total data blocks in filesystem */ uint64_t f_bfree; /* free blocks in filesystem */ int64_t f_bavail; /* free blocks avail to non-superuser */ uint64_t f_files; /* total file nodes in filesystem */ int64_t f_ffree; /* free nodes avail to non-superuser */ uint64_t f_syncwrites; /* count of sync writes since mount */ uint64_t f_asyncwrites; /* count of async writes since mount */ uint64_t f_syncreads; /* count of sync reads since mount */ uint64_t f_asyncreads; /* count of async reads since mount */ uint64_t f_spare[10]; /* unused spare */ uint32_t f_namemax; /* maximum filename length */ uid_t f_owner; /* user that mounted the filesystem */ fsid_t f_fsid; /* filesystem id */ char f_charspare[80]; /* spare string space */ char f_fstypename[16]; /* filesystem type name */ char f_mntfromname[88]; /* mounted filesystem */ char f_mntonname[88]; /* directory on which mounted */ }; #endif /* _WANT_FREEBSD11_STATFS || _KERNEL */ # 133 "/usr/include/sys/mount.h" 3 4 #ifdef _KERNEL #define OMFSNAMELEN 16 /* length of fs type name, including null */ #define OMNAMELEN (88 - 2 * sizeof(long)) /* size of on/from name bufs */ /* XXX getfsstat.2 is out of date with write and read counter changes here. */ /* XXX statfs.2 is out of date with read counter changes here. */ struct ostatfs { long f_spare2; /* placeholder */ long f_bsize; /* fundamental filesystem block size */ long f_iosize; /* optimal transfer block size */ long f_blocks; /* total data blocks in filesystem */ long f_bfree; /* free blocks in fs */ long f_bavail; /* free blocks avail to non-superuser */ long f_files; /* total file nodes in filesystem */ long f_ffree; /* free file nodes in fs */ fsid_t f_fsid; /* filesystem id */ uid_t f_owner; /* user that mounted the filesystem */ int f_type; /* type of filesystem */ int f_flags; /* copy of mount exported flags */ long f_syncwrites; /* count of sync writes since mount */ long f_asyncwrites; /* count of async writes since mount */ char f_fstypename[OMFSNAMELEN]; /* fs type name */ char f_mntonname[OMNAMELEN]; /* directory on which mounted */ long f_syncreads; /* count of sync reads since mount */ long f_asyncreads; /* count of async reads since mount */ short f_spares1; /* unused spare */ char f_mntfromname[OMNAMELEN];/* mounted filesystem */ short f_spares2; /* unused spare */ /* * XXX on machines where longs are aligned to 8-byte boundaries, there * is an unnamed int32_t here. This spare was after the apparent end * of the struct until we bit off the read counters from f_mntonname. */ long f_spare[2]; /* unused spare */ }; #endif /* _KERNEL */ # 170 "/usr/include/sys/mount.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(_WANT_MOUNT) || defined(_KERNEL) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 172 "/usr/include/sys/mount.h" 3 4 TAILQ_HEAD(vnodelst, vnode); /* Mount options list */ TAILQ_HEAD(vfsoptlist, vfsopt); struct vfsopt { TAILQ_ENTRY(vfsopt) link; char *name; void *value; int len; int pos; int seen; }; struct mount_pcpu { int mntp_thread_in_ops; int mntp_ref; int mntp_lockref; int mntp_writeopcount; }; _Static_assert(sizeof(struct mount_pcpu) == 16, "the struct is allocated from pcpu 16 zone"); /* * Structure for tracking a stacked filesystem mounted above another * filesystem. This is expected to be stored in the upper FS' per-mount data. * * Lock reference: * i - lower mount interlock * c - constant from node initialization */ struct mount_upper_node { struct mount *mp; /* (c) mount object for upper FS */ TAILQ_ENTRY(mount_upper_node) mnt_upper_link; /* (i) position in uppers list */ }; /* * Structure per mounted filesystem. Each mounted filesystem has an * array of operations and an instance record. The filesystems are * put on a doubly linked list. * * Lock reference: * l - mnt_listmtx * m - mountlist_mtx * i - interlock * v - vnode freelist mutex * d - deferred unmount list mutex * * Unmarked fields are considered stable as long as a ref is held. * */ struct mount { int mnt_vfs_ops; /* (i) pending vfs ops */ int mnt_kern_flag; /* (i) kernel only flags */ uint64_t mnt_flag; /* (i) flags shared with user */ struct mount_pcpu *mnt_pcpu; /* per-CPU data */ struct vnode *mnt_rootvnode; struct vnode *mnt_vnodecovered; /* vnode we mounted on */ struct vfsops *mnt_op; /* operations on fs */ struct vfsconf *mnt_vfc; /* configuration info */ struct mtx __aligned(CACHE_LINE_SIZE) mnt_mtx; /* mount structure interlock */ int mnt_gen; /* struct mount generation */ #define mnt_startzero mnt_list TAILQ_ENTRY(mount) mnt_list; /* (m) mount list */ struct vnode *mnt_syncer; /* syncer vnode */ int mnt_ref; /* (i) Reference count */ struct vnodelst mnt_nvnodelist; /* (i) list of vnodes */ int mnt_nvnodelistsize; /* (i) # of vnodes */ int mnt_writeopcount; /* (i) write syscalls pending */ struct vfsoptlist *mnt_opt; /* current mount options */ struct vfsoptlist *mnt_optnew; /* new options passed to fs */ struct statfs mnt_stat; /* cache of filesystem stats */ struct ucred *mnt_cred; /* credentials of mounter */ void * mnt_data; /* private data */ time_t mnt_time; /* last time written*/ int mnt_iosize_max; /* max size for clusters, etc */ struct netexport *mnt_export; /* export list */ struct label *mnt_label; /* MAC label for the fs */ u_int mnt_hashseed; /* Random seed for vfs_hash */ int mnt_lockref; /* (i) Lock reference count */ int mnt_secondary_writes; /* (i) # of secondary writes */ int mnt_secondary_accwrites;/* (i) secondary wr. starts */ struct thread *mnt_susp_owner; /* (i) thread owning suspension */ #define mnt_endzero mnt_gjprovider char *mnt_gjprovider; /* gjournal provider name */ struct mtx mnt_listmtx; struct vnodelst mnt_lazyvnodelist; /* (l) list of lazy vnodes */ int mnt_lazyvnodelistsize; /* (l) # of lazy vnodes */ int mnt_upper_pending; /* (i) # of pending ops on mnt_uppers */ struct lock mnt_explock; /* vfs_export walkers lock */ TAILQ_HEAD(, mount_upper_node) mnt_uppers; /* (i) upper mounts over us */ TAILQ_HEAD(, mount_upper_node) mnt_notify; /* (i) upper mounts for notification */ STAILQ_ENTRY(mount) mnt_taskqueue_link; /* (d) our place in deferred unmount list */ uint64_t mnt_taskqueue_flags; /* (d) unmount flags passed from taskqueue */ unsigned int mnt_unmount_retries; /* (d) # of failed deferred unmount attempts */ }; #endif /* _WANT_MOUNT || _KERNEL */ # 269 "/usr/include/sys/mount.h" 3 4 #ifdef _KERNEL /* * Definitions for MNT_VNODE_FOREACH_ALL. */ struct vnode *__mnt_vnode_next_all(struct vnode **mvp, struct mount *mp); struct vnode *__mnt_vnode_first_all(struct vnode **mvp, struct mount *mp); void __mnt_vnode_markerfree_all(struct vnode **mvp, struct mount *mp); #define MNT_VNODE_FOREACH_ALL(vp, mp, mvp) \ for (vp = __mnt_vnode_first_all(&(mvp), (mp)); \ (vp) != NULL; vp = __mnt_vnode_next_all(&(mvp), (mp))) #define MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp) \ do { \ MNT_ILOCK(mp); \ __mnt_vnode_markerfree_all(&(mvp), (mp)); \ /* MNT_IUNLOCK(mp); -- done in above function */ \ mtx_assert(MNT_MTX(mp), MA_NOTOWNED); \ } while (0) /* * Definitions for MNT_VNODE_FOREACH_LAZY. */ typedef int mnt_lazy_cb_t(struct vnode *, void *); struct vnode *__mnt_vnode_next_lazy(struct vnode **mvp, struct mount *mp, mnt_lazy_cb_t *cb, void *cbarg); struct vnode *__mnt_vnode_first_lazy(struct vnode **mvp, struct mount *mp, mnt_lazy_cb_t *cb, void *cbarg); void __mnt_vnode_markerfree_lazy(struct vnode **mvp, struct mount *mp); #define MNT_VNODE_FOREACH_LAZY(vp, mp, mvp, cb, cbarg) \ for (vp = __mnt_vnode_first_lazy(&(mvp), (mp), (cb), (cbarg)); \ (vp) != NULL; \ vp = __mnt_vnode_next_lazy(&(mvp), (mp), (cb), (cbarg))) #define MNT_VNODE_FOREACH_LAZY_ABORT(mp, mvp) \ __mnt_vnode_markerfree_lazy(&(mvp), (mp)) #define MNT_ILOCK(mp) mtx_lock(&(mp)->mnt_mtx) #define MNT_ITRYLOCK(mp) mtx_trylock(&(mp)->mnt_mtx) #define MNT_IUNLOCK(mp) mtx_unlock(&(mp)->mnt_mtx) #define MNT_MTX(mp) (&(mp)->mnt_mtx) #define MNT_REF(mp) do { \ mtx_assert(MNT_MTX(mp), MA_OWNED); \ mp->mnt_ref++; \ } while (0) #define MNT_REL(mp) do { \ mtx_assert(MNT_MTX(mp), MA_OWNED); \ (mp)->mnt_ref--; \ if ((mp)->mnt_vfs_ops && (mp)->mnt_ref < 0) \ vfs_dump_mount_counters(mp); \ if ((mp)->mnt_ref == 0 && (mp)->mnt_vfs_ops) \ wakeup((mp)); \ } while (0) #endif /* _KERNEL */ # 327 "/usr/include/sys/mount.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(_WANT_MNTOPTNAMES) || defined(_KERNEL) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 329 "/usr/include/sys/mount.h" 3 4 struct mntoptnames { uint64_t o_opt; const char *o_name; }; #define MNTOPT_NAMES \ { MNT_ASYNC, "asynchronous" }, \ { MNT_EXPORTED, "NFS exported" }, \ { MNT_LOCAL, "local" }, \ { MNT_NOATIME, "noatime" }, \ { MNT_NOEXEC, "noexec" }, \ { MNT_NOSUID, "nosuid" }, \ { MNT_NOSYMFOLLOW, "nosymfollow" }, \ { MNT_QUOTA, "with quotas" }, \ { MNT_RDONLY, "read-only" }, \ { MNT_SYNCHRONOUS, "synchronous" }, \ { MNT_UNION, "union" }, \ { MNT_NOCLUSTERR, "noclusterr" }, \ { MNT_NOCLUSTERW, "noclusterw" }, \ { MNT_SUIDDIR, "suiddir" }, \ { MNT_SOFTDEP, "soft-updates" }, \ { MNT_SUJ, "journaled soft-updates" }, \ { MNT_MULTILABEL, "multilabel" }, \ { MNT_ACLS, "acls" }, \ { MNT_NFS4ACLS, "nfsv4acls" }, \ { MNT_GJOURNAL, "gjournal" }, \ { MNT_AUTOMOUNTED, "automounted" }, \ { MNT_VERIFIED, "verified" }, \ { MNT_UNTRUSTED, "untrusted" }, \ { MNT_NOCOVER, "nocover" }, \ { MNT_EMPTYDIR, "emptydir" }, \ { MNT_UPDATE, "update" }, \ { MNT_DELEXPORT, "delexport" }, \ { MNT_RELOAD, "reload" }, \ { MNT_FORCE, "force" }, \ { MNT_SNAPSHOT, "snapshot" }, \ { 0, NULL } #endif # 366 "/usr/include/sys/mount.h" 3 4 /* * User specifiable flags, stored in mnt_flag. */ #define MNT_RDONLY 0x0000000000000001ULL /* read only filesystem */ #define MNT_SYNCHRONOUS 0x0000000000000002ULL /* fs written synchronously */ #define MNT_NOEXEC 0x0000000000000004ULL /* can't exec from filesystem */ #define MNT_NOSUID 0x0000000000000008ULL /* don't honor setuid fs bits */ #define MNT_NFS4ACLS 0x0000000000000010ULL /* enable NFS version 4 ACLs */ #define MNT_UNION 0x0000000000000020ULL /* union with underlying fs */ #define MNT_ASYNC 0x0000000000000040ULL /* fs written asynchronously */ #define MNT_SUIDDIR 0x0000000000100000ULL /* special SUID dir handling */ #define MNT_SOFTDEP 0x0000000000200000ULL /* using soft updates */ #define MNT_NOSYMFOLLOW 0x0000000000400000ULL /* do not follow symlinks */ #define MNT_GJOURNAL 0x0000000002000000ULL /* GEOM journal support enabled */ #define MNT_MULTILABEL 0x0000000004000000ULL /* MAC support for objects */ #define MNT_ACLS 0x0000000008000000ULL /* ACL support enabled */ #define MNT_NOATIME 0x0000000010000000ULL /* dont update file access time */ #define MNT_NOCLUSTERR 0x0000000040000000ULL /* disable cluster read */ #define MNT_NOCLUSTERW 0x0000000080000000ULL /* disable cluster write */ #define MNT_SUJ 0x0000000100000000ULL /* using journaled soft updates */ #define MNT_AUTOMOUNTED 0x0000000200000000ULL /* mounted by automountd(8) */ #define MNT_UNTRUSTED 0x0000000800000000ULL /* filesys metadata untrusted */ /* * NFS export related mount flags. */ #define MNT_EXRDONLY 0x0000000000000080ULL /* exported read only */ #define MNT_EXPORTED 0x0000000000000100ULL /* filesystem is exported */ #define MNT_DEFEXPORTED 0x0000000000000200ULL /* exported to the world */ #define MNT_EXPORTANON 0x0000000000000400ULL /* anon uid mapping for all */ #define MNT_EXKERB 0x0000000000000800ULL /* exported with Kerberos */ #define MNT_EXPUBLIC 0x0000000020000000ULL /* public export (WebNFS) */ #define MNT_EXTLS 0x0000004000000000ULL /* require TLS */ #define MNT_EXTLSCERT 0x0000008000000000ULL /* require TLS with client cert */ #define MNT_EXTLSCERTUSER 0x0000010000000000ULL /* require TLS with user cert */ /* * Flags set by internal operations, but visible to the user. */ #define MNT_LOCAL 0x0000000000001000ULL /* filesystem is stored locally */ #define MNT_QUOTA 0x0000000000002000ULL /* quotas are enabled on fs */ #define MNT_ROOTFS 0x0000000000004000ULL /* identifies the root fs */ #define MNT_USER 0x0000000000008000ULL /* mounted by a user */ #define MNT_IGNORE 0x0000000000800000ULL /* do not show entry in df */ #define MNT_VERIFIED 0x0000000400000000ULL /* filesystem is verified */ /* * Mask of flags that are visible to statfs(). * XXX I think that this could now become (~(MNT_CMDFLAGS)) * but the 'mount' program may need changing to handle this. */ #define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \ MNT_NOSUID | MNT_UNION | MNT_SUJ | \ MNT_ASYNC | MNT_EXRDONLY | MNT_EXPORTED | \ MNT_DEFEXPORTED | MNT_EXPORTANON| MNT_EXKERB | \ MNT_LOCAL | MNT_USER | MNT_QUOTA | \ MNT_ROOTFS | MNT_NOATIME | MNT_NOCLUSTERR| \ MNT_NOCLUSTERW | MNT_SUIDDIR | MNT_SOFTDEP | \ MNT_IGNORE | MNT_EXPUBLIC | MNT_NOSYMFOLLOW | \ MNT_GJOURNAL | MNT_MULTILABEL | MNT_ACLS | \ MNT_NFS4ACLS | MNT_AUTOMOUNTED | MNT_VERIFIED | \ MNT_UNTRUSTED) /* Mask of flags that can be updated. */ #define MNT_UPDATEMASK (MNT_NOSUID | MNT_NOEXEC | \ MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | \ MNT_NOATIME | \ MNT_NOSYMFOLLOW | MNT_IGNORE | \ MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR | \ MNT_ACLS | MNT_USER | MNT_NFS4ACLS | \ MNT_AUTOMOUNTED | MNT_UNTRUSTED) /* * External filesystem command modifier flags. * Unmount can use the MNT_FORCE flag. * XXX: These are not STATES and really should be somewhere else. * XXX: MNT_BYFSID and MNT_NONBUSY collide with MNT_ACLS and MNT_MULTILABEL, * but because MNT_ACLS and MNT_MULTILABEL are only used for mount(2), * and MNT_BYFSID and MNT_NONBUSY are only used for unmount(2), * it's harmless. */ #define MNT_UPDATE 0x0000000000010000ULL /* not real mount, just update */ #define MNT_DELEXPORT 0x0000000000020000ULL /* delete export host lists */ #define MNT_RELOAD 0x0000000000040000ULL /* reload filesystem data */ #define MNT_FORCE 0x0000000000080000ULL /* force unmount or readonly */ #define MNT_SNAPSHOT 0x0000000001000000ULL /* snapshot the filesystem */ #define MNT_NONBUSY 0x0000000004000000ULL /* check vnode use counts. */ #define MNT_BYFSID 0x0000000008000000ULL /* specify filesystem by ID. */ #define MNT_NOCOVER 0x0000001000000000ULL /* Do not cover a mount point */ #define MNT_EMPTYDIR 0x0000002000000000ULL /* Only mount on empty dir */ #define MNT_RECURSE 0x0000100000000000ULL /* recursively unmount uppers */ #define MNT_DEFERRED 0x0000200000000000ULL /* unmount in async context */ #define MNT_CMDFLAGS (MNT_UPDATE | MNT_DELEXPORT | MNT_RELOAD | \ MNT_FORCE | MNT_SNAPSHOT | MNT_NONBUSY | \ MNT_BYFSID | MNT_NOCOVER | MNT_EMPTYDIR | \ MNT_RECURSE | MNT_DEFERRED) /* * Internal filesystem control flags stored in mnt_kern_flag. * * MNTK_UNMOUNT locks the mount entry so that name lookup cannot * proceed past the mount point. This keeps the subtree stable during * mounts and unmounts. When non-forced unmount flushes all vnodes * from the mp queue, the MNTK_UNMOUNT flag prevents insmntque() from * queueing new vnodes. * * MNTK_UNMOUNTF permits filesystems to detect a forced unmount while * dounmount() is still waiting to lock the mountpoint. This allows * the filesystem to cancel operations that might otherwise deadlock * with the unmount attempt (used by NFS). */ #define MNTK_UNMOUNTF 0x00000001 /* forced unmount in progress */ #define MNTK_ASYNC 0x00000002 /* filtered async flag */ #define MNTK_SOFTDEP 0x00000004 /* async disabled by softdep */ #define MNTK_NOMSYNC 0x00000008 /* don't do msync */ #define MNTK_DRAINING 0x00000010 /* lock draining is happening */ #define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */ #define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */ #define MNTK_SHARED_WRITES 0x00000080 /* Allow shared locking for writes */ #define MNTK_NO_IOPF 0x00000100 /* Disallow page faults during reads and writes. Filesystem shall properly handle i/o state on EFAULT. */ #define MNTK_RECURSE 0x00000200 /* pending recursive unmount */ #define MNTK_UPPER_WAITER 0x00000400 /* waiting to drain MNTK_UPPER_PENDING */ /* UNUSED 0x00000800 */ #define MNTK_UNLOCKED_INSMNTQUE 0x00001000 /* fs does not lock the vnode for insmntque */ #define MNTK_UNMAPPED_BUFS 0x00002000 #define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */ /* UNUSED 0x00008000 */ #define MNTK_VMSETSIZE_BUG 0x00010000 #define MNTK_UNIONFS 0x00020000 /* A hack for F_ISUNIONSTACK */ #define MNTK_FPLOOKUP 0x00040000 /* fast path lookup is supported */ #define MNTK_SUSPEND_ALL 0x00080000 /* Suspended by all-fs suspension */ #define MNTK_TASKQUEUE_WAITER 0x00100000 /* Waiting on unmount taskqueue */ /* UNUSED 0x00200000 */ /* UNUSED 0x00400000 */ #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ #define MNTK_SUSPEND 0x08000000 /* request write suspension */ #define MNTK_SUSPEND2 0x04000000 /* block secondary writes */ #define MNTK_SUSPENDED 0x10000000 /* write operations are suspended */ #define MNTK_NULL_NOCACHE 0x20000000 /* auto disable cache for nullfs mounts over this fs */ #define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */ /* UNUSED 0x80000000 */ #ifdef _KERNEL static inline int MNT_SHARED_WRITES(struct mount *mp) { return (mp != NULL && (mp->mnt_kern_flag & MNTK_SHARED_WRITES) != 0); } static inline int MNT_EXTENDED_SHARED(struct mount *mp) { return (mp != NULL && (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED) != 0); } #endif # 529 "/usr/include/sys/mount.h" 3 4 /* * Sysctl CTL_VFS definitions. * * Second level identifier specifies which filesystem. Second level * identifier VFS_VFSCONF returns information about all filesystems. * Second level identifier VFS_GENERIC is non-terminal. */ #define VFS_VFSCONF 0 /* get configured filesystems */ #define VFS_GENERIC 0 /* generic filesystem information */ /* * Third level identifiers for VFS_GENERIC are given below; third * level identifiers for specific filesystems are given in their * mount specific header files. */ #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */ #define VFS_CONF 2 /* struct: vfsconf for filesystem given as next argument */ /* * Flags for various system call interfaces. * * waitfor flags to vfs_sync() and getfsstat() */ #define MNT_WAIT 1 /* synchronously wait for I/O to complete */ #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */ #define MNT_LAZY 3 /* push data not written by filesystem syncer */ #define MNT_SUSPEND 4 /* Suspend file system after sync */ /* * Generic file handle */ struct fhandle { fsid_t fh_fsid; /* Filesystem id of mount point */ struct fid fh_fid; /* Filesys specific id */ }; typedef struct fhandle fhandle_t; /* * Old export arguments without security flavor list */ struct oexport_args { int ex_flags; /* export related flags */ uid_t ex_root; /* mapping for root uid */ struct xucred ex_anon; /* mapping for anonymous user */ struct sockaddr *ex_addr; /* net address to which exported */ u_char ex_addrlen; /* and the net address length */ struct sockaddr *ex_mask; /* mask of valid bits in saddr */ u_char ex_masklen; /* and the smask length */ char *ex_indexfile; /* index file for WebNFS URLs */ }; /* * Not quite so old export arguments with 32bit ex_flags and xucred ex_anon. */ #define MAXSECFLAVORS 5 struct o2export_args { int ex_flags; /* export related flags */ uid_t ex_root; /* mapping for root uid */ struct xucred ex_anon; /* mapping for anonymous user */ struct sockaddr *ex_addr; /* net address to which exported */ u_char ex_addrlen; /* and the net address length */ struct sockaddr *ex_mask; /* mask of valid bits in saddr */ u_char ex_masklen; /* and the smask length */ char *ex_indexfile; /* index file for WebNFS URLs */ int ex_numsecflavors; /* security flavor count */ int ex_secflavors[MAXSECFLAVORS]; /* list of security flavors */ }; /* * Export arguments for local filesystem mount calls. */ struct export_args { uint64_t ex_flags; /* export related flags */ uid_t ex_root; /* mapping for root uid */ uid_t ex_uid; /* mapping for anonymous user */ int ex_ngroups; gid_t *ex_groups; struct sockaddr *ex_addr; /* net address to which exported */ u_char ex_addrlen; /* and the net address length */ struct sockaddr *ex_mask; /* mask of valid bits in saddr */ u_char ex_masklen; /* and the smask length */ char *ex_indexfile; /* index file for WebNFS URLs */ int ex_numsecflavors; /* security flavor count */ int ex_secflavors[MAXSECFLAVORS]; /* list of security flavors */ }; /* * Structure holding information for a publicly exported filesystem * (WebNFS). Currently the specs allow just for one such filesystem. */ struct nfs_public { int np_valid; /* Do we hold valid information */ fhandle_t np_handle; /* Filehandle for pub fs (internal) */ struct mount *np_mount; /* Mountpoint of exported fs */ char *np_index; /* Index file */ }; /* * Filesystem configuration information. One of these exists for each * type of filesystem supported by the kernel. These are searched at * mount time to identify the requested filesystem. * * XXX: Never change the first two arguments! */ struct vfsconf { u_int vfc_version; /* ABI version number */ char vfc_name[MFSNAMELEN]; /* filesystem type name */ struct vfsops *vfc_vfsops; /* filesystem operations vector */ struct vfsops *vfc_vfsops_sd; /* ... signal-deferred */ int vfc_typenum; /* historic filesystem type number */ int vfc_refcount; /* number mounted of this type */ int vfc_flags; /* permanent flags */ int vfc_prison_flag; /* prison allow.mount.* flag */ struct vfsoptdecl *vfc_opts; /* mount options */ TAILQ_ENTRY(vfsconf) vfc_list; /* list of vfscons */ }; /* Userland version of the struct vfsconf. */ struct xvfsconf { struct vfsops *vfc_vfsops; /* filesystem operations vector */ char vfc_name[MFSNAMELEN]; /* filesystem type name */ int vfc_typenum; /* historic filesystem type number */ int vfc_refcount; /* number mounted of this type */ int vfc_flags; /* permanent flags */ struct vfsconf *vfc_next; /* next in list */ }; #ifndef BURN_BRIDGES struct ovfsconf { void *vfc_vfsops; char vfc_name[32]; int vfc_index; int vfc_refcount; int vfc_flags; }; #endif # 666 "/usr/include/sys/mount.h" 3 4 /* * NB: these flags refer to IMPLEMENTATION properties, not properties of * any actual mounts; i.e., it does not make sense to change the flags. */ #define VFCF_STATIC 0x00010000 /* statically compiled into kernel */ #define VFCF_NETWORK 0x00020000 /* may get data over the network */ #define VFCF_READONLY 0x00040000 /* writes are not implemented */ #define VFCF_SYNTHETIC 0x00080000 /* data does not represent real files */ #define VFCF_LOOPBACK 0x00100000 /* aliases some other mounted FS */ #define VFCF_UNICODE 0x00200000 /* stores file names as Unicode */ #define VFCF_JAIL 0x00400000 /* can be mounted from within a jail */ #define VFCF_DELEGADMIN 0x00800000 /* supports delegated administration */ #define VFCF_SBDRY 0x01000000 /* Stop at Boundary: defer stop requests to kernel->user (AST) transition */ typedef uint32_t fsctlop_t; struct vfsidctl { int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ fsid_t vc_fsid; /* fsid to operate on */ char vc_fstypename[MFSNAMELEN]; /* type of fs 'nfs' or '*' */ fsctlop_t vc_op; /* operation VFS_CTL_* (below) */ void *vc_ptr; /* pointer to data structure */ size_t vc_len; /* sizeof said structure */ u_int32_t vc_spare[12]; /* spare (must be zero) */ }; /* vfsidctl API version. */ #define VFS_CTL_VERS1 0x01 /* * New style VFS sysctls, do not reuse/conflict with the namespace for * private sysctls. * All "global" sysctl ops have the 33rd bit set: * 0x...1.... * Private sysctl ops should have the 33rd bit unset. */ #define VFS_CTL_QUERY 0x00010001 /* anything wrong? (vfsquery) */ #define VFS_CTL_TIMEO 0x00010002 /* set timeout for vfs notification */ #define VFS_CTL_NOLOCKS 0x00010003 /* disable file locking */ struct vfsquery { u_int32_t vq_flags; u_int32_t vq_spare[31]; }; /* vfsquery flags */ #define VQ_NOTRESP 0x0001 /* server down */ #define VQ_NEEDAUTH 0x0002 /* server bad auth */ #define VQ_LOWDISK 0x0004 /* we're low on space */ #define VQ_MOUNT 0x0008 /* new filesystem arrived */ #define VQ_UNMOUNT 0x0010 /* filesystem has left */ #define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */ #define VQ_ASSIST 0x0040 /* filesystem needs assistance from external program */ #define VQ_NOTRESPLOCK 0x0080 /* server lockd down */ #define VQ_FLAG0100 0x0100 /* placeholder */ #define VQ_FLAG0200 0x0200 /* placeholder */ #define VQ_FLAG0400 0x0400 /* placeholder */ #define VQ_FLAG0800 0x0800 /* placeholder */ #define VQ_FLAG1000 0x1000 /* placeholder */ #define VQ_FLAG2000 0x2000 /* placeholder */ #define VQ_FLAG4000 0x4000 /* placeholder */ #define VQ_FLAG8000 0x8000 /* placeholder */ #ifdef _KERNEL /* Point a sysctl request at a vfsidctl's data. */ #define VCTLTOREQ(vc, req) \ do { \ (req)->newptr = (vc)->vc_ptr; \ (req)->newlen = (vc)->vc_len; \ (req)->newidx = 0; \ } while (0) #endif # 742 "/usr/include/sys/mount.h" 3 4 struct iovec; struct uio; #ifdef _KERNEL /* * vfs_busy specific flags and mask. */ #define MBF_NOWAIT 0x01 #define MBF_MNTLSTLOCK 0x02 #define MBF_MASK (MBF_NOWAIT | MBF_MNTLSTLOCK) #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_MOUNT); MALLOC_DECLARE(M_STATFS); #endif # 759 "/usr/include/sys/mount.h" 3 4 extern int maxvfsconf; /* highest defined filesystem type */ TAILQ_HEAD(vfsconfhead, vfsconf); extern struct vfsconfhead vfsconf; /* * Operations supported on mounted filesystem. */ struct mount_args; struct nameidata; struct sysctl_req; struct mntarg; /* * N.B., vfs_cmount is the ancient vfsop invoked by the old mount(2) syscall. * The new way is vfs_mount. * * vfs_cmount implementations typically translate arguments from their * respective old per-FS structures into the key-value list supported by * nmount(2), then use kernel_mount(9) to mimic nmount(2) from kernelspace. * * Filesystems with mounters that use nmount(2) do not need to and should not * implement vfs_cmount. Hopefully a future cleanup can remove vfs_cmount and * mount(2) entirely. */ typedef int vfs_cmount_t(struct mntarg *ma, void *data, uint64_t flags); typedef int vfs_unmount_t(struct mount *mp, int mntflags); typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp); typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg, bool *mp_busy); typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp); typedef int vfs_sync_t(struct mount *mp, int waitfor); typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags, struct vnode **vpp); typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp); typedef int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam, uint64_t *extflagsp, struct ucred **credanonp, int *numsecflavors, int *secflavors); typedef int vfs_init_t(struct vfsconf *); typedef int vfs_uninit_t(struct vfsconf *); typedef int vfs_extattrctl_t(struct mount *mp, int cmd, struct vnode *filename_vp, int attrnamespace, const char *attrname); typedef int vfs_mount_t(struct mount *mp); typedef int vfs_sysctl_t(struct mount *mp, fsctlop_t op, struct sysctl_req *req); typedef void vfs_susp_clean_t(struct mount *mp); typedef void vfs_notify_lowervp_t(struct mount *mp, struct vnode *lowervp); typedef void vfs_purge_t(struct mount *mp); struct sbuf; typedef int vfs_report_lockf_t(struct mount *mp, struct sbuf *sb); struct vfsops { vfs_mount_t *vfs_mount; vfs_cmount_t *vfs_cmount; vfs_unmount_t *vfs_unmount; vfs_root_t *vfs_root; vfs_root_t *vfs_cachedroot; vfs_quotactl_t *vfs_quotactl; vfs_statfs_t *vfs_statfs; vfs_sync_t *vfs_sync; vfs_vget_t *vfs_vget; vfs_fhtovp_t *vfs_fhtovp; vfs_checkexp_t *vfs_checkexp; vfs_init_t *vfs_init; vfs_uninit_t *vfs_uninit; vfs_extattrctl_t *vfs_extattrctl; vfs_sysctl_t *vfs_sysctl; vfs_susp_clean_t *vfs_susp_clean; vfs_notify_lowervp_t *vfs_reclaim_lowervp; vfs_notify_lowervp_t *vfs_unlink_lowervp; vfs_purge_t *vfs_purge; vfs_report_lockf_t *vfs_report_lockf; vfs_mount_t *vfs_spare[6]; /* spares for ABI compat */ }; vfs_statfs_t __vfs_statfs; #define VFS_MOUNT(MP) ({ \ int _rc; \ \ TSRAW(curthread, TS_ENTER, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\ _rc = (*(MP)->mnt_op->vfs_mount)(MP); \ TSRAW(curthread, TS_EXIT, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\ _rc; }) #define VFS_UNMOUNT(MP, FORCE) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_unmount)(MP, FORCE); \ _rc; }) #define VFS_ROOT(MP, FLAGS, VPP) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_root)(MP, FLAGS, VPP); \ _rc; }) #define VFS_CACHEDROOT(MP, FLAGS, VPP) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_cachedroot)(MP, FLAGS, VPP); \ _rc; }) #define VFS_QUOTACTL(MP, C, U, A, MP_BUSY) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, MP_BUSY); \ _rc; }) #define VFS_STATFS(MP, SBP) ({ \ int _rc; \ \ _rc = __vfs_statfs((MP), (SBP)); \ _rc; }) #define VFS_SYNC(MP, WAIT) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_sync)(MP, WAIT); \ _rc; }) #define VFS_VGET(MP, INO, FLAGS, VPP) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP); \ _rc; }) #define VFS_FHTOVP(MP, FIDP, FLAGS, VPP) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, FLAGS, VPP); \ _rc; }) #define VFS_CHECKEXP(MP, NAM, EXFLG, CRED, NUMSEC, SEC) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED, NUMSEC,\ SEC); \ _rc; }) #define VFS_EXTATTRCTL(MP, C, FN, NS, N) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N); \ _rc; }) #define VFS_SYSCTL(MP, OP, REQ) ({ \ int _rc; \ \ _rc = (*(MP)->mnt_op->vfs_sysctl)(MP, OP, REQ); \ _rc; }) #define VFS_SUSP_CLEAN(MP) do { \ if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \ (*(MP)->mnt_op->vfs_susp_clean)(MP); \ } \ } while (0) #define VFS_RECLAIM_LOWERVP(MP, VP) do { \ if (*(MP)->mnt_op->vfs_reclaim_lowervp != NULL) { \ (*(MP)->mnt_op->vfs_reclaim_lowervp)((MP), (VP)); \ } \ } while (0) #define VFS_UNLINK_LOWERVP(MP, VP) do { \ if (*(MP)->mnt_op->vfs_unlink_lowervp != NULL) { \ (*(MP)->mnt_op->vfs_unlink_lowervp)((MP), (VP)); \ } \ } while (0) #define VFS_PURGE(MP) do { \ if (*(MP)->mnt_op->vfs_purge != NULL) { \ (*(MP)->mnt_op->vfs_purge)(MP); \ } \ } while (0) #define VFS_KNOTE_LOCKED(vp, hint) do \ { \ VN_KNOTE((vp), (hint), KNF_LISTLOCKED); \ } while (0) #define VFS_KNOTE_UNLOCKED(vp, hint) do \ { \ VN_KNOTE((vp), (hint), 0); \ } while (0) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 947 "/usr/include/sys/mount.h" 3 4 # 948 "/usr/include/sys/mount.h" 3 4 /* * Version numbers. */ #define VFS_VERSION_00 0x19660120 #define VFS_VERSION_01 0x20121030 #define VFS_VERSION_02 0x20180504 #define VFS_VERSION VFS_VERSION_02 #define VFS_SET(vfsops, fsname, flags) \ static struct vfsconf fsname ## _vfsconf = { \ .vfc_version = VFS_VERSION, \ .vfc_name = #fsname, \ .vfc_vfsops = &vfsops, \ .vfc_typenum = -1, \ .vfc_flags = flags, \ }; \ static moduledata_t fsname ## _mod = { \ #fsname, \ vfs_modevent, \ & fsname ## _vfsconf \ }; \ DECLARE_MODULE(fsname, fsname ## _mod, SI_SUB_VFS, SI_ORDER_MIDDLE) enum vfs_notify_upper_type { VFS_NOTIFY_UPPER_RECLAIM, VFS_NOTIFY_UPPER_UNLINK, }; /* * exported vnode operations */ int dounmount(struct mount *, uint64_t, struct thread *); int kernel_mount(struct mntarg *ma, uint64_t flags); struct mntarg *mount_arg(struct mntarg *ma, const char *name, const void *val, int len); struct mntarg *mount_argb(struct mntarg *ma, int flag, const char *name); struct mntarg *mount_argf(struct mntarg *ma, const char *name, const char *fmt, ...); struct mntarg *mount_argsu(struct mntarg *ma, const char *name, const void *val, int len); void statfs_scale_blocks(struct statfs *sf, long max_size); struct vfsconf *vfs_byname(const char *); struct vfsconf *vfs_byname_kld(const char *, struct thread *td, int *); void vfs_mount_destroy(struct mount *); void vfs_event_signal(fsid_t *, u_int32_t, intptr_t); void vfs_freeopts(struct vfsoptlist *opts); void vfs_deleteopt(struct vfsoptlist *opts, const char *name); int vfs_buildopts(struct uio *auio, struct vfsoptlist **options); int vfs_flagopt(struct vfsoptlist *opts, const char *name, uint64_t *w, uint64_t val); int vfs_getopt(struct vfsoptlist *, const char *, void **, int *); int vfs_getopt_pos(struct vfsoptlist *opts, const char *name); int vfs_getopt_size(struct vfsoptlist *opts, const char *name, off_t *value); char *vfs_getopts(struct vfsoptlist *, const char *, int *error); int vfs_copyopt(struct vfsoptlist *, const char *, void *, int); int vfs_filteropt(struct vfsoptlist *, const char **legal); void vfs_opterror(struct vfsoptlist *opts, const char *fmt, ...); int vfs_scanopt(struct vfsoptlist *opts, const char *name, const char *fmt, ...); int vfs_setopt(struct vfsoptlist *opts, const char *name, void *value, int len); int vfs_setopt_part(struct vfsoptlist *opts, const char *name, void *value, int len); int vfs_setopts(struct vfsoptlist *opts, const char *name, const char *value); int vfs_setpublicfs /* set publicly exported fs */ (struct mount *, struct netexport *, struct export_args *); void vfs_periodic(struct mount *, int); int vfs_busy(struct mount *, int); int vfs_export /* process mount export info */ (struct mount *, struct export_args *); void vfs_allocate_syncvnode(struct mount *); void vfs_deallocate_syncvnode(struct mount *); int vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions); void vfs_getnewfsid(struct mount *); struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ struct mount *vfs_busyfs(fsid_t *); int vfs_modevent(module_t, int, void *); void vfs_mount_error(struct mount *, const char *, ...); void vfs_mountroot(void); /* mount our root filesystem */ void vfs_mountedfrom(struct mount *, const char *from); void vfs_notify_upper(struct vnode *, enum vfs_notify_upper_type); struct mount *vfs_ref_from_vp(struct vnode *); void vfs_ref(struct mount *); void vfs_rel(struct mount *); struct mount *vfs_mount_alloc(struct vnode *, struct vfsconf *, const char *, struct ucred *); int vfs_suser(struct mount *, struct thread *); void vfs_unbusy(struct mount *); void vfs_unmountall(void); struct mount *vfs_register_upper_from_vp(struct vnode *, struct mount *ump, struct mount_upper_node *); void vfs_register_for_notification(struct mount *, struct mount *, struct mount_upper_node *); void vfs_unregister_for_notification(struct mount *, struct mount_upper_node *); void vfs_unregister_upper(struct mount *, struct mount_upper_node *); int vfs_remount_ro(struct mount *mp); int vfs_report_lockf(struct mount *mp, struct sbuf *sb); extern TAILQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */ extern struct mtx_padalign mountlist_mtx; extern struct nfs_public nfs_pub; extern struct sx vfsconf_sx; #define vfsconf_lock() sx_xlock(&vfsconf_sx) #define vfsconf_unlock() sx_xunlock(&vfsconf_sx) #define vfsconf_slock() sx_slock(&vfsconf_sx) #define vfsconf_sunlock() sx_sunlock(&vfsconf_sx) struct vnode *mntfs_allocvp(struct mount *, struct vnode *); void mntfs_freevp(struct vnode *); /* * Declarations for these vfs default operations are located in * kern/vfs_default.c. They will be automatically used to replace * null entries in VFS ops tables when registering a new filesystem * type in the global table. */ vfs_root_t vfs_stdroot; vfs_quotactl_t vfs_stdquotactl; vfs_statfs_t vfs_stdstatfs; vfs_sync_t vfs_stdsync; vfs_sync_t vfs_stdnosync; vfs_vget_t vfs_stdvget; vfs_fhtovp_t vfs_stdfhtovp; vfs_checkexp_t vfs_stdcheckexp; vfs_init_t vfs_stdinit; vfs_uninit_t vfs_stduninit; vfs_extattrctl_t vfs_stdextattrctl; vfs_sysctl_t vfs_stdsysctl; void syncer_suspend(void); void syncer_resume(void); struct vnode *vfs_cache_root_clear(struct mount *); void vfs_cache_root_set(struct mount *, struct vnode *); void vfs_op_barrier_wait(struct mount *); void vfs_op_enter(struct mount *); void vfs_op_exit_locked(struct mount *); void vfs_op_exit(struct mount *); #ifdef DIAGNOSTIC void vfs_assert_mount_counters(struct mount *); void vfs_dump_mount_counters(struct mount *); #else # 1094 "/usr/include/sys/mount.h" 3 4 #define vfs_assert_mount_counters(mp) do { } while (0) #define vfs_dump_mount_counters(mp) do { } while (0) #endif # 1097 "/usr/include/sys/mount.h" 3 4 enum mount_counter { MNT_COUNT_REF, MNT_COUNT_LOCKREF, MNT_COUNT_WRITEOPCOUNT }; int vfs_mount_fetch_counter(struct mount *, enum mount_counter); void suspend_all_fs(void); void resume_all_fs(void); /* * Code transitioning mnt_vfs_ops to > 0 issues IPIs until it observes * all CPUs not executing code enclosed by thread_in_ops_pcpu variable. * * This provides an invariant that by the time the last CPU is observed not * executing, everyone else entering will see the counter > 0 and exit. * * Note there is no barrier between vfs_ops and the rest of the code in the * section. It is not necessary as the writer has to wait for everyone to drain * before making any changes or only make changes safe while the section is * executed. */ #define vfs_mount_pcpu(mp) zpcpu_get(mp->mnt_pcpu) #define vfs_mount_pcpu_remote(mp, cpu) zpcpu_get_cpu(mp->mnt_pcpu, cpu) #define vfs_op_thread_entered(mp) ({ \ MPASS(curthread->td_critnest > 0); \ struct mount_pcpu *_mpcpu = vfs_mount_pcpu(mp); \ _mpcpu->mntp_thread_in_ops == 1; \ }) #define vfs_op_thread_enter_crit(mp, _mpcpu) ({ \ bool _retval_crit = true; \ MPASS(curthread->td_critnest > 0); \ _mpcpu = vfs_mount_pcpu(mp); \ MPASS(mpcpu->mntp_thread_in_ops == 0); \ _mpcpu->mntp_thread_in_ops = 1; \ atomic_interrupt_fence(); \ if (__predict_false(mp->mnt_vfs_ops > 0)) { \ vfs_op_thread_exit_crit(mp, _mpcpu); \ _retval_crit = false; \ } \ _retval_crit; \ }) #define vfs_op_thread_enter(mp, _mpcpu) ({ \ bool _retval; \ critical_enter(); \ _retval = vfs_op_thread_enter_crit(mp, _mpcpu); \ if (__predict_false(!_retval)) \ critical_exit(); \ _retval; \ }) #define vfs_op_thread_exit_crit(mp, _mpcpu) do { \ MPASS(_mpcpu == vfs_mount_pcpu(mp)); \ MPASS(_mpcpu->mntp_thread_in_ops == 1); \ atomic_interrupt_fence(); \ _mpcpu->mntp_thread_in_ops = 0; \ } while (0) #define vfs_op_thread_exit(mp, _mpcpu) do { \ vfs_op_thread_exit_crit(mp, _mpcpu); \ critical_exit(); \ } while (0) #define vfs_mp_count_add_pcpu(_mpcpu, count, val) do { \ MPASS(_mpcpu->mntp_thread_in_ops == 1); \ _mpcpu->mntp_##count += val; \ } while (0) #define vfs_mp_count_sub_pcpu(_mpcpu, count, val) do { \ MPASS(_mpcpu->mntp_thread_in_ops == 1); \ _mpcpu->mntp_##count -= val; \ } while (0) #else /* !_KERNEL */ # 1171 "/usr/include/sys/mount.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 1172 "/usr/include/sys/mount.h" 3 4 # 1173 "/usr/include/sys/mount.h" 3 4 struct stat; __BEGIN_DECLS int fhlink(struct fhandle *, const char *); int fhlinkat(struct fhandle *, int, const char *); int fhopen(const struct fhandle *, int); int fhreadlink(struct fhandle *, char *, size_t); int fhstat(const struct fhandle *, struct stat *); int fhstatfs(const struct fhandle *, struct statfs *); int fstatfs(int, struct statfs *); int getfh(const char *, fhandle_t *); int getfhat(int, char *, struct fhandle *, int); int getfsstat(struct statfs *, long, int); int getmntinfo(struct statfs **, int); int lgetfh(const char *, fhandle_t *); int mount(const char *, const char *, int, void *); int nmount(struct iovec *, unsigned int, int); int statfs(const char *, struct statfs *); int unmount(const char *, int); /* C library stuff */ int getvfsbyname(const char *, struct xvfsconf *); __END_DECLS #endif /* _KERNEL */ # 1199 "/usr/include/sys/mount.h" 3 4 #endif /* !_SYS_MOUNT_H_ */ # 1201 "/usr/include/sys/mount.h" 3 4 # 273 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #ifdef __ANDROID__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 274 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 275 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif /* __ANDROID__ */ # 276 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 277 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 277 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/sys/sysctl.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Karels at Berkeley Software Design, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 * $FreeBSD$ */ #ifndef _SYS_SYSCTL_H_ #define _SYS_SYSCTL_H_ #ifdef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/usr/include/sys/sysctl.h" 3 4 # 43 "/usr/include/sys/sysctl.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/sys/sysctl.h" 3 4 # 44 "/usr/include/sys/sysctl.h" 3 4 #endif # 45 "/usr/include/sys/sysctl.h" 3 4 /* * Definitions for sysctl call. The sysctl call uses a hierarchical name * for objects that can be examined or modified. The name is expressed as * a sequence of integers. Like a file path name, the meaning of each * component depends on its place in the hierarchy. The top-level and kern * identifiers are defined here, and other identifiers are defined in the * respective subsystem header files. * * Each subsystem defined by sysctl defines a list of variables for that * subsystem. Each name is either a node with further levels defined below it, * or it is a leaf of some particular type given below. Each sysctl level * defines a set of name/type pairs to be used by sysctl(8) in manipulating the * subsystem. */ #define CTL_MAXNAME 24 /* largest number of components supported */ #define CTLTYPE 0xf /* mask for the type */ #define CTLTYPE_NODE 1 /* name is a node */ #define CTLTYPE_INT 2 /* name describes an integer */ #define CTLTYPE_STRING 3 /* name describes a string */ #define CTLTYPE_S64 4 /* name describes a signed 64-bit number */ #define CTLTYPE_OPAQUE 5 /* name describes a structure */ #define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ #define CTLTYPE_UINT 6 /* name describes an unsigned integer */ #define CTLTYPE_LONG 7 /* name describes a long */ #define CTLTYPE_ULONG 8 /* name describes an unsigned long */ #define CTLTYPE_U64 9 /* name describes an unsigned 64-bit number */ #define CTLTYPE_U8 0xa /* name describes an unsigned 8-bit number */ #define CTLTYPE_U16 0xb /* name describes an unsigned 16-bit number */ #define CTLTYPE_S8 0xc /* name describes a signed 8-bit number */ #define CTLTYPE_S16 0xd /* name describes a signed 16-bit number */ #define CTLTYPE_S32 0xe /* name describes a signed 32-bit number */ #define CTLTYPE_U32 0xf /* name describes an unsigned 32-bit number */ #define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ #define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ #define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) #define CTLFLAG_DORMANT 0x20000000 /* This sysctl is not active yet */ #define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ #define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ #define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ #define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */ #define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */ #define CTLMASK_SECURE 0x00F00000 /* Secure level */ #define CTLFLAG_TUN 0x00080000 /* Default value is loaded from getenv() */ #define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN) #define CTLFLAG_RWTUN (CTLFLAG_RW|CTLFLAG_TUN) #define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */ #define CTLFLAG_VNET 0x00020000 /* Prisons with vnet can fiddle */ #define CTLFLAG_DYING 0x00010000 /* Oid is being removed */ #define CTLFLAG_CAPRD 0x00008000 /* Can be read in capability mode */ #define CTLFLAG_CAPWR 0x00004000 /* Can be written in capability mode */ #define CTLFLAG_STATS 0x00002000 /* Statistics, not a tuneable */ #define CTLFLAG_NOFETCH 0x00001000 /* Don't fetch tunable from getenv() */ #define CTLFLAG_CAPRW (CTLFLAG_CAPRD|CTLFLAG_CAPWR) /* * This is transient flag to be used until all sysctl handlers are converted * to not lock Giant. * One, and only one of CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT is required * for SYSCTL_PROC and SYSCTL_NODE. */ #define CTLFLAG_NEEDGIANT 0x00000800 /* Handler require Giant */ /* * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1. * * Secure when the securelevel is raised to at least N. */ #define CTLSHIFT_SECURE 20 #define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE)) #define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE)) #define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE)) /* * USE THIS instead of a hardwired number from the categories below * to get dynamically assigned sysctl entries using the linker-set * technology. This is the way nearly all new sysctl variables should * be implemented. * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, ""); */ #define OID_AUTO (-1) /* * The starting number for dynamically-assigned entries. WARNING! * ALL static sysctl entries should have numbers LESS than this! */ #define CTL_AUTO_START 0x100 #ifdef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 136 "/usr/include/sys/sysctl.h" 3 4 # 137 "/usr/include/sys/sysctl.h" 3 4 #ifdef KLD_MODULE /* XXX allow overspecification of type in external kernel modules */ #define SYSCTL_CT_ASSERT_MASK CTLTYPE #else # 142 "/usr/include/sys/sysctl.h" 3 4 #define SYSCTL_CT_ASSERT_MASK 0 #endif # 144 "/usr/include/sys/sysctl.h" 3 4 #define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \ intmax_t arg2, struct sysctl_req *req /* definitions for sysctl_req 'lock' member */ #define REQ_UNWIRED 1 #define REQ_WIRED 2 /* definitions for sysctl_req 'flags' member */ #ifdef COMPAT_FREEBSD32 #define SCTL_MASK32 1 /* 32 bit emulation */ #endif # 156 "/usr/include/sys/sysctl.h" 3 4 /* * This describes the access space for a sysctl request. This is needed * so that we can use the interface from the kernel or from user-space. */ struct thread; struct sysctl_req { struct thread *td; /* used for access checking */ int lock; /* wiring state */ void *oldptr; size_t oldlen; size_t oldidx; int (*oldfunc)(struct sysctl_req *, const void *, size_t); const void *newptr; size_t newlen; size_t newidx; int (*newfunc)(struct sysctl_req *, void *, size_t); size_t validlen; int flags; }; struct sysctl_oid; /* RB Tree handling */ RB_HEAD(sysctl_oid_list, sysctl_oid); /* * This describes one "oid" in the MIB tree. Potentially more nodes can * be hidden behind it, expanded by the handler. */ struct sysctl_oid { struct sysctl_oid_list oid_children; struct sysctl_oid_list* oid_parent; RB_ENTRY(sysctl_oid) oid_link; /* Sort key for all siblings, and lookup key for userland */ int oid_number; u_int oid_kind; void *oid_arg1; intmax_t oid_arg2; /* Must be unique amongst all siblings. */ const char *oid_name; int (*oid_handler)(SYSCTL_HANDLER_ARGS); const char *oid_fmt; int oid_refcnt; u_int oid_running; const char *oid_descr; const char *oid_label; }; static inline int cmp_sysctl_oid(struct sysctl_oid *a, struct sysctl_oid *b) { if (a->oid_number > b->oid_number) return (1); else if (a->oid_number < b->oid_number) return (-1); else return (0); } RB_PROTOTYPE(sysctl_oid_list, sysctl_oid, oid_link, cmp_sysctl_oid); #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) #define SYSCTL_OUT_STR(r, p) (r->oldfunc)(r, p, strlen(p) + 1) int sysctl_handle_bool(SYSCTL_HANDLER_ARGS); int sysctl_handle_8(SYSCTL_HANDLER_ARGS); int sysctl_handle_16(SYSCTL_HANDLER_ARGS); int sysctl_handle_32(SYSCTL_HANDLER_ARGS); int sysctl_handle_64(SYSCTL_HANDLER_ARGS); int sysctl_handle_int(SYSCTL_HANDLER_ARGS); int sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS); int sysctl_handle_long(SYSCTL_HANDLER_ARGS); int sysctl_handle_string(SYSCTL_HANDLER_ARGS); int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS); int sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS); int sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS); int sysctl_handle_uma_zone_max(SYSCTL_HANDLER_ARGS); int sysctl_handle_uma_zone_cur(SYSCTL_HANDLER_ARGS); int sysctl_msec_to_sbintime(SYSCTL_HANDLER_ARGS); int sysctl_usec_to_sbintime(SYSCTL_HANDLER_ARGS); int sysctl_sec_to_timeval(SYSCTL_HANDLER_ARGS); int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS); int sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS); int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS); /* * These functions are used to add/remove an oid from the mib. */ void sysctl_register_oid(struct sysctl_oid *oidp); void sysctl_register_disabled_oid(struct sysctl_oid *oidp); void sysctl_enable_oid(struct sysctl_oid *oidp); void sysctl_unregister_oid(struct sysctl_oid *oidp); /* Declare a static oid to allow child oids to be added to it. */ #define SYSCTL_DECL(name) \ extern struct sysctl_oid sysctl__##name /* Hide these in macros. */ #define SYSCTL_CHILDREN(oid_ptr) (&(oid_ptr)->oid_children) #define SYSCTL_PARENT(oid_ptr) \ (((oid_ptr)->oid_parent != &sysctl__children) ? \ __containerof((oid_ptr)->oid_parent, struct sysctl_oid, \ oid_children) : (struct sysctl_oid *)NULL) #define SYSCTL_STATIC_CHILDREN(oid_name) (&sysctl__##oid_name.oid_children) /* === Structs and macros related to context handling. === */ /* All dynamically created sysctls can be tracked in a context list. */ struct sysctl_ctx_entry { struct sysctl_oid *entry; TAILQ_ENTRY(sysctl_ctx_entry) link; }; TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define SYSCTL_NODE_CHILDREN(parent, name) \ sysctl__##parent##_##name.oid_children #ifndef NO_SYSCTL_DESCR #define __DESCR(d) d #else # 282 "/usr/include/sys/sysctl.h" 3 4 #define __DESCR(d) "" #endif # 284 "/usr/include/sys/sysctl.h" 3 4 #ifdef notyet #define SYSCTL_ENFORCE_FLAGS(x) \ _Static_assert((((x) & CTLFLAG_MPSAFE) != 0) ^ (((x) & CTLFLAG_NEEDGIANT) != 0), \ "Has to be either CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT") #else # 290 "/usr/include/sys/sysctl.h" 3 4 #define SYSCTL_ENFORCE_FLAGS(x) #endif # 292 "/usr/include/sys/sysctl.h" 3 4 /* This macro is only for internal use */ #define SYSCTL_OID_RAW(id, parent_child_head, nbr, name, kind, a1, a2, handler, fmt, descr, label) \ struct sysctl_oid id = { \ .oid_parent = (parent_child_head), \ .oid_children = RB_INITIALIZER(&id.oid_children), \ .oid_number = (nbr), \ .oid_kind = (kind), \ .oid_arg1 = (a1), \ .oid_arg2 = (a2), \ .oid_name = (name), \ .oid_handler = (handler), \ .oid_fmt = (fmt), \ .oid_descr = __DESCR(descr), \ .oid_label = (label), \ }; \ DATA_SET(sysctl_set, id); \ SYSCTL_ENFORCE_FLAGS(kind) /* This constructs a static "raw" MIB oid. */ #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ SYSCTL_OID_WITH_LABEL(parent, nbr, name, kind, a1, a2, \ handler, fmt, descr, NULL) #define SYSCTL_OID_WITH_LABEL(parent, nbr, name, kind, a1, a2, handler, fmt, descr, label) \ static SYSCTL_OID_RAW(sysctl__##parent##_##name, \ SYSCTL_CHILDREN(&sysctl__##parent), \ nbr, #name, kind, a1, a2, handler, fmt, descr, label) /* This constructs a global "raw" MIB oid. */ #define SYSCTL_OID_GLOBAL(parent, nbr, name, kind, a1, a2, handler, fmt, descr, label) \ SYSCTL_OID_RAW(sysctl__##parent##_##name, \ SYSCTL_CHILDREN(&sysctl__##parent), \ nbr, #name, kind, a1, a2, handler, fmt, descr, label) #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ ({ \ SYSCTL_ENFORCE_FLAGS(kind); \ sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2,handler, \ fmt, __DESCR(descr), NULL); \ }) /* This constructs a root node from which other nodes can hang. */ #define SYSCTL_ROOT_NODE(nbr, name, access, handler, descr) \ SYSCTL_OID_RAW(sysctl___##name, &sysctl__children, \ nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \ handler, "N", descr, NULL); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE) /* This constructs a node from which other oids can hang. */ #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ SYSCTL_NODE_WITH_LABEL(parent, nbr, name, access, handler, descr, NULL) #define SYSCTL_NODE_WITH_LABEL(parent, nbr, name, access, handler, descr, label) \ SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access), \ NULL, 0, handler, "N", descr, label); \ SYSCTL_ENFORCE_FLAGS(access); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE) #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ SYSCTL_ADD_NODE_WITH_LABEL(ctx, parent, nbr, name, access, \ handler, descr, NULL) #define SYSCTL_ADD_NODE_WITH_LABEL(ctx, parent, nbr, name, access, handler, descr, label) \ ({ \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \ SYSCTL_ENFORCE_FLAGS(access); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ NULL, 0, handler, "N", __DESCR(descr), label); \ }) #define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr) \ ({ \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \ SYSCTL_ENFORCE_FLAGS(access); \ sysctl_add_oid(ctx, &sysctl__children, nbr, name, \ CTLTYPE_NODE|(access), \ NULL, 0, handler, "N", __DESCR(descr), NULL); \ }) /* Oid for a string. len can be 0 to indicate '\0' termination. */ #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_STRING | CTLFLAG_MPSAFE | (access), \ arg, len, sysctl_handle_string, "A", descr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING) #define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ ({ \ char *__arg = (arg); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_STRING | CTLFLAG_MPSAFE | (access), \ __arg, len, sysctl_handle_string, "A", __DESCR(descr), \ NULL); \ }) /* Oid for a constant '\0' terminated string. */ #define SYSCTL_CONST_STRING(parent, nbr, name, access, arg, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING | CTLFLAG_MPSAFE | (access),\ __DECONST(char *, arg), 0, sysctl_handle_string, "A", descr); \ CTASSERT(!(access & CTLFLAG_WR)); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING) #define SYSCTL_ADD_CONST_STRING(ctx, parent, nbr, name, access, arg, descr) \ ({ \ char *__arg = __DECONST(char *, arg); \ CTASSERT(!(access & CTLFLAG_WR)); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING | \ CTLFLAG_MPSAFE | (access), __arg, 0, sysctl_handle_string, "A",\ __DESCR(descr), NULL); \ }) /* Oid for a bool. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_BOOL_PTR ((bool *)NULL) #define SYSCTL_BOOL(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_bool, "CU", descr); \ CTASSERT(((access) & CTLTYPE) == 0 && \ sizeof(bool) == sizeof(*(ptr))) #define SYSCTL_ADD_BOOL(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ bool *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_bool, "CU", __DESCR(descr), \ NULL); \ }) /* Oid for a signed 8-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_S8_PTR ((int8_t *)NULL) #define SYSCTL_S8(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S8 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_8, "C", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S8) && \ sizeof(int8_t) == sizeof(*(ptr))) #define SYSCTL_ADD_S8(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ int8_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S8); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S8 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_8, "C", __DESCR(descr), NULL); \ }) /* Oid for an unsigned 8-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_U8_PTR ((uint8_t *)NULL) #define SYSCTL_U8(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_8, "CU", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U8) && \ sizeof(uint8_t) == sizeof(*(ptr))) #define SYSCTL_ADD_U8(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ uint8_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U8); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_8, "CU", __DESCR(descr), NULL); \ }) /* Oid for a signed 16-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_S16_PTR ((int16_t *)NULL) #define SYSCTL_S16(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S16 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_16, "S", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S16) && \ sizeof(int16_t) == sizeof(*(ptr))) #define SYSCTL_ADD_S16(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ int16_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S16); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S16 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_16, "S", __DESCR(descr), NULL); \ }) /* Oid for an unsigned 16-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_U16_PTR ((uint16_t *)NULL) #define SYSCTL_U16(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U16 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_16, "SU", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U16) && \ sizeof(uint16_t) == sizeof(*(ptr))) #define SYSCTL_ADD_U16(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ uint16_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U16); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U16 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_16, "SU", __DESCR(descr), NULL); \ }) /* Oid for a signed 32-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_S32_PTR ((int32_t *)NULL) #define SYSCTL_S32(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S32 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_32, "I", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S32) && \ sizeof(int32_t) == sizeof(*(ptr))) #define SYSCTL_ADD_S32(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ int32_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S32); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S32 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_32, "I", __DESCR(descr), NULL); \ }) /* Oid for an unsigned 32-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_U32_PTR ((uint32_t *)NULL) #define SYSCTL_U32(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U32 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_32, "IU", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U32) && \ sizeof(uint32_t) == sizeof(*(ptr))) #define SYSCTL_ADD_U32(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ uint32_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U32); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U32 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_32, "IU", __DESCR(descr), NULL); \ }) /* Oid for a signed 64-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_S64_PTR ((int64_t *)NULL) #define SYSCTL_S64(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_64, "Q", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) && \ sizeof(int64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_S64(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ int64_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_64, "Q", __DESCR(descr), NULL); \ }) /* Oid for an unsigned 64-bit int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_U64_PTR ((uint64_t *)NULL) #define SYSCTL_U64(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_64, "QU", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \ sizeof(uint64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_U64(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ uint64_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_64, "QU", __DESCR(descr), NULL); \ }) /* Oid for an int. If ptr is SYSCTL_NULL_INT_PTR, val is returned. */ #define SYSCTL_NULL_INT_PTR ((int *)NULL) #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_INT_WITH_LABEL(parent, nbr, name, access, ptr, val, descr, NULL) #define SYSCTL_INT_WITH_LABEL(parent, nbr, name, access, ptr, val, descr, label) \ SYSCTL_OID_WITH_LABEL(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_int, "I", descr, label); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) && \ sizeof(int) == sizeof(*(ptr))) #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ int *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_int, "I", __DESCR(descr), NULL); \ }) /* Oid for an unsigned int. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_UINT_PTR ((unsigned *)NULL) #define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_int, "IU", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT) && \ sizeof(unsigned) == sizeof(*(ptr))) #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ unsigned *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_int, "IU", __DESCR(descr), NULL); \ }) /* Oid for a long. The pointer must be non NULL. */ #define SYSCTL_NULL_LONG_PTR ((long *)NULL) #define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_long, "L", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG) && \ sizeof(long) == sizeof(*(ptr))) #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ long *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_long, "L", __DESCR(descr), NULL); \ }) /* Oid for an unsigned long. The pointer must be non NULL. */ #define SYSCTL_NULL_ULONG_PTR ((unsigned long *)NULL) #define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_long, "LU", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG) && \ sizeof(unsigned long) == sizeof(*(ptr))) #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ unsigned long *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_long, "LU", __DESCR(descr), NULL); \ }) /* Oid for a quad. The pointer must be non NULL. */ #define SYSCTL_NULL_QUAD_PTR ((int64_t *)NULL) #define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_64, "Q", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) && \ sizeof(int64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ int64_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_64, "Q", __DESCR(descr), NULL); \ }) #define SYSCTL_NULL_UQUAD_PTR ((uint64_t *)NULL) #define SYSCTL_UQUAD(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_64, "QU", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \ sizeof(uint64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ uint64_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_64, "QU", __DESCR(descr), NULL); \ }) /* Oid for a CPU dependent variable */ #define SYSCTL_ADD_UAUTO(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ struct sysctl_oid *__ret; \ CTASSERT((sizeof(uint64_t) == sizeof(*(ptr)) || \ sizeof(unsigned) == sizeof(*(ptr))) && \ ((access) & CTLTYPE) == 0); \ if (sizeof(uint64_t) == sizeof(*(ptr))) { \ __ret = sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ (ptr), 0, sysctl_handle_64, "QU", \ __DESCR(descr), NULL); \ } else { \ __ret = sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ (ptr), 0, sysctl_handle_int, "IU", \ __DESCR(descr), NULL); \ } \ __ret; \ }) /* Oid for a 64-bit unsigned counter(9). The pointer must be non NULL. */ #define SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access), \ (ptr), 0, sysctl_handle_counter_u64, "QU", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \ sizeof(counter_u64_t) == sizeof(*(ptr)) && \ sizeof(uint64_t) == sizeof(**(ptr))) #define SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ counter_u64_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access), \ __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr), \ NULL); \ }) /* Oid for an array of counter(9)s. The pointer and length must be non zero. */ #define SYSCTL_COUNTER_U64_ARRAY(parent, nbr, name, access, ptr, len, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access), \ (ptr), (len), sysctl_handle_counter_u64_array, "S", descr); \ CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) && \ sizeof(counter_u64_t) == sizeof(*(ptr)) && \ sizeof(uint64_t) == sizeof(**(ptr))) #define SYSCTL_ADD_COUNTER_U64_ARRAY(ctx, parent, nbr, name, access, \ ptr, len, descr) \ ({ \ counter_u64_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access), \ __ptr, len, sysctl_handle_counter_u64_array, "S", \ __DESCR(descr), NULL); \ }) /* Oid for an opaque object. Specified by a pointer and a length. */ #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \ ptr, len, sysctl_handle_opaque, fmt, descr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) #define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr) \ ({ \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \ ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr), NULL); \ }) /* Oid for a struct. Specified by a pointer and a type. */ #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \ ptr, sizeof(struct type), sysctl_handle_opaque, \ "S," #type, descr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) #define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \ ({ \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \ (ptr), sizeof(struct type), \ sysctl_handle_opaque, "S," #type, __DESCR(descr), NULL); \ }) /* Oid for a procedure. Specified by a pointer and an arg. */ #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ SYSCTL_OID(parent, nbr, name, (access), \ ptr, arg, handler, fmt, descr); \ CTASSERT(((access) & CTLTYPE) != 0) #define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ ({ \ CTASSERT(((access) & CTLTYPE) != 0); \ SYSCTL_ENFORCE_FLAGS(access); \ sysctl_add_oid(ctx, parent, nbr, name, (access), \ (ptr), (arg), (handler), (fmt), __DESCR(descr), NULL); \ }) /* Oid to handle limits on uma(9) zone specified by pointer. */ #define SYSCTL_UMA_MAX(parent, nbr, name, access, ptr, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ (ptr), 0, sysctl_handle_uma_zone_max, "I", descr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) #define SYSCTL_ADD_UMA_MAX(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ uma_zone_t __ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_uma_zone_max, "I", __DESCR(descr), \ NULL); \ }) /* Oid to obtain current use of uma(9) zone specified by pointer. */ #define SYSCTL_UMA_CUR(parent, nbr, name, access, ptr, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ (ptr), 0, sysctl_handle_uma_zone_cur, "I", descr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) #define SYSCTL_ADD_UMA_CUR(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ uma_zone_t __ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ __ptr, 0, sysctl_handle_uma_zone_cur, "I", __DESCR(descr), \ NULL); \ }) /* OID expressing a sbintime_t as microseconds */ #define SYSCTL_SBINTIME_USEC(parent, nbr, name, access, ptr, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ (ptr), 0, sysctl_usec_to_sbintime, "Q", descr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) #define SYSCTL_ADD_SBINTIME_USEC(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ sbintime_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ __ptr, 0, sysctl_usec_to_sbintime, "Q", __DESCR(descr), \ NULL); \ }) /* OID expressing a sbintime_t as milliseconds */ #define SYSCTL_SBINTIME_MSEC(parent, nbr, name, access, ptr, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ (ptr), 0, sysctl_msec_to_sbintime, "Q", descr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) #define SYSCTL_ADD_SBINTIME_MSEC(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ sbintime_t *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ __ptr, 0, sysctl_msec_to_sbintime, "Q", __DESCR(descr), \ NULL); \ }) /* OID expressing a struct timeval as seconds */ #define SYSCTL_TIMEVAL_SEC(parent, nbr, name, access, ptr, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ (ptr), 0, sysctl_sec_to_timeval, "I", descr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) #define SYSCTL_ADD_TIMEVAL_SEC(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ struct timeval *__ptr = (ptr); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ __ptr, 0, sysctl_sec_to_timeval, "I", __DESCR(descr), \ NULL); \ }) #define SYSCTL_FOREACH(oidp, list) \ RB_FOREACH(oidp, sysctl_oid_list, list) /* * A macro to generate a read-only sysctl to indicate the presence of optional * kernel features. */ #define FEATURE(name, desc) \ SYSCTL_INT_WITH_LABEL(_kern_features, OID_AUTO, name, \ CTLFLAG_RD | CTLFLAG_CAPRD, SYSCTL_NULL_INT_PTR, 1, desc, "feature") #endif /* _KERNEL */ # 933 "/usr/include/sys/sysctl.h" 3 4 /* * Top-level identifiers */ #define CTL_SYSCTL 0 /* "magic" numbers */ #define CTL_KERN 1 /* "high kernel": proc, limits */ #define CTL_VM 2 /* virtual memory */ #define CTL_VFS 3 /* filesystem, mount type is next */ #define CTL_NET 4 /* network, see socket.h */ #define CTL_DEBUG 5 /* debugging parameters */ #define CTL_HW 6 /* generic cpu/io */ #define CTL_MACHDEP 7 /* machine dependent */ #define CTL_USER 8 /* user-level */ #define CTL_P1003_1B 9 /* POSIX 1003.1B */ /* * CTL_SYSCTL identifiers */ #define CTL_SYSCTL_DEBUG 0 /* printf all nodes */ #define CTL_SYSCTL_NAME 1 /* string name of OID */ #define CTL_SYSCTL_NEXT 2 /* next OID, honoring CTLFLAG_SKIP */ #define CTL_SYSCTL_NAME2OID 3 /* int array of name */ #define CTL_SYSCTL_OIDFMT 4 /* OID's kind and format */ #define CTL_SYSCTL_OIDDESCR 5 /* OID's description */ #define CTL_SYSCTL_OIDLABEL 6 /* aggregation label */ #define CTL_SYSCTL_NEXTNOSKIP 7 /* next OID, ignoring CTLFLAG_SKIP */ /* * CTL_KERN identifiers */ #define KERN_OSTYPE 1 /* string: system version */ #define KERN_OSRELEASE 2 /* string: system release */ #define KERN_OSREV 3 /* int: system revision */ #define KERN_VERSION 4 /* string: compile time info */ #define KERN_MAXVNODES 5 /* int: max vnodes */ #define KERN_MAXPROC 6 /* int: max processes */ #define KERN_MAXFILES 7 /* int: max open files */ #define KERN_ARGMAX 8 /* int: max arguments to exec */ #define KERN_SECURELVL 9 /* int: system security level */ #define KERN_HOSTNAME 10 /* string: hostname */ #define KERN_HOSTID 11 /* int: host identifier */ #define KERN_CLOCKRATE 12 /* struct: struct clockrate */ #define KERN_VNODE 13 /* struct: vnode structures */ #define KERN_PROC 14 /* struct: process entries */ #define KERN_FILE 15 /* struct: file entries */ #define KERN_PROF 16 /* node: kernel profiling info */ #define KERN_POSIX1 17 /* int: POSIX.1 version */ #define KERN_NGROUPS 18 /* int: # of supplemental group ids */ #define KERN_JOB_CONTROL 19 /* int: is job control available */ #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ #define KERN_BOOTTIME 21 /* struct: time kernel was booted */ #define KERN_NISDOMAINNAME 22 /* string: YP domain name */ #define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */ #define KERN_OSRELDATE 24 /* int: kernel release date */ #define KERN_NTP_PLL 25 /* node: NTP PLL control */ #define KERN_BOOTFILE 26 /* string: name of booted kernel */ #define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */ #define KERN_MAXPROCPERUID 28 /* int: max processes per uid */ #define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */ #define KERN_IPC 30 /* node: anything related to IPC */ #define KERN_DUMMY 31 /* unused */ #define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ #define KERN_USRSTACK 33 /* int: address of USRSTACK */ #define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */ #define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */ #define KERN_HOSTUUID 36 /* string: host UUID identifier */ #define KERN_ARND 37 /* int: from arc4rand() */ #define KERN_MAXPHYS 38 /* int: MAXPHYS value */ #define KERN_LOCKF 39 /* struct: lockf reports */ /* * KERN_PROC subtypes */ #define KERN_PROC_ALL 0 /* everything */ #define KERN_PROC_PID 1 /* by process id */ #define KERN_PROC_PGRP 2 /* by process group id */ #define KERN_PROC_SESSION 3 /* by session of pid */ #define KERN_PROC_TTY 4 /* by controlling tty */ #define KERN_PROC_UID 5 /* by effective uid */ #define KERN_PROC_RUID 6 /* by real uid */ #define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */ #define KERN_PROC_PROC 8 /* only return procs */ #define KERN_PROC_SV_NAME 9 /* get syscall vector name */ #define KERN_PROC_RGID 10 /* by real group id */ #define KERN_PROC_GID 11 /* by effective group id */ #define KERN_PROC_PATHNAME 12 /* path to executable */ #define KERN_PROC_OVMMAP 13 /* Old VM map entries for process */ #define KERN_PROC_OFILEDESC 14 /* Old file descriptors for process */ #define KERN_PROC_KSTACK 15 /* Kernel stacks for process */ #define KERN_PROC_INC_THREAD 0x10 /* * modifier for pid, pgrp, tty, * uid, ruid, gid, rgid and proc * This effectively uses 16-31 */ #define KERN_PROC_VMMAP 32 /* VM map entries for process */ #define KERN_PROC_FILEDESC 33 /* File descriptors for process */ #define KERN_PROC_GROUPS 34 /* process groups */ #define KERN_PROC_ENV 35 /* get environment */ #define KERN_PROC_AUXV 36 /* get ELF auxiliary vector */ #define KERN_PROC_RLIMIT 37 /* process resource limits */ #define KERN_PROC_PS_STRINGS 38 /* get ps_strings location */ #define KERN_PROC_UMASK 39 /* process umask */ #define KERN_PROC_OSREL 40 /* osreldate for process binary */ #define KERN_PROC_SIGTRAMP 41 /* signal trampoline location */ #define KERN_PROC_CWD 42 /* process current working directory */ #define KERN_PROC_NFDS 43 /* number of open file descriptors */ #define KERN_PROC_SIGFASTBLK 44 /* address of fastsigblk magic word */ #define KERN_PROC_VM_LAYOUT 45 /* virtual address space layout info */ /* * KERN_IPC identifiers */ #define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */ #define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */ #define KIPC_SOMAXCONN 3 /* int: max length of connection q */ #define KIPC_MAX_LINKHDR 4 /* int: max length of link header */ #define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */ #define KIPC_MAX_HDR 6 /* int: max total length of headers */ #define KIPC_MAX_DATALEN 7 /* int: max length of data? */ /* * CTL_HW identifiers */ #define HW_MACHINE 1 /* string: machine class */ #define HW_MODEL 2 /* string: specific machine model */ #define HW_NCPU 3 /* int: number of cpus */ #define HW_BYTEORDER 4 /* int: machine byte order */ #define HW_PHYSMEM 5 /* int: total memory */ #define HW_USERMEM 6 /* int: non-kernel memory */ #define HW_PAGESIZE 7 /* int: software page size */ #define HW_DISKNAMES 8 /* strings: disk drive names */ #define HW_DISKSTATS 9 /* struct: diskstats[] */ #define HW_FLOATINGPT 10 /* int: has HW floating point? */ #define HW_MACHINE_ARCH 11 /* string: machine architecture */ #define HW_REALMEM 12 /* int: 'real' memory */ /* * CTL_USER definitions */ #define USER_CS_PATH 1 /* string: _CS_PATH */ #define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */ #define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */ #define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */ #define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */ #define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */ #define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */ #define USER_LINE_MAX 8 /* int: LINE_MAX */ #define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */ #define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */ #define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */ #define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */ #define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */ #define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */ #define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */ #define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */ #define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */ #define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */ #define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */ #define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */ #define USER_LOCALBASE 21 /* string: _PATH_LOCALBASE */ #define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */ #define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */ #define CTL_P1003_1B_MEMLOCK 3 /* boolean */ #define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */ #define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */ #define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */ #define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */ #define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */ #define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */ #define CTL_P1003_1B_SEMAPHORES 10 /* boolean */ #define CTL_P1003_1B_FSYNC 11 /* boolean */ #define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */ #define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */ #define CTL_P1003_1B_TIMERS 14 /* boolean */ #define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */ #define CTL_P1003_1B_AIO_MAX 16 /* int */ #define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */ #define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */ #define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */ #define CTL_P1003_1B_PAGESIZE 20 /* int */ #define CTL_P1003_1B_RTSIG_MAX 21 /* int */ #define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */ #define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */ #define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */ #define CTL_P1003_1B_TIMER_MAX 25 /* int */ #ifdef _KERNEL #define CTL_P1003_1B_MAXID 26 /* * Declare some common oids. */ extern struct sysctl_oid_list sysctl__children; SYSCTL_DECL(_kern); SYSCTL_DECL(_kern_features); SYSCTL_DECL(_kern_ipc); SYSCTL_DECL(_kern_proc); SYSCTL_DECL(_kern_sched); SYSCTL_DECL(_kern_sched_stats); SYSCTL_DECL(_sysctl); SYSCTL_DECL(_vm); SYSCTL_DECL(_vm_stats); SYSCTL_DECL(_vm_stats_misc); SYSCTL_DECL(_vfs); SYSCTL_DECL(_net); SYSCTL_DECL(_debug); SYSCTL_DECL(_debug_sizeof); SYSCTL_DECL(_dev); SYSCTL_DECL(_hw); SYSCTL_DECL(_hw_bus); SYSCTL_DECL(_hw_bus_devices); SYSCTL_DECL(_machdep); SYSCTL_DECL(_machdep_mitigations); SYSCTL_DECL(_user); SYSCTL_DECL(_compat); SYSCTL_DECL(_regression); SYSCTL_DECL(_security); SYSCTL_DECL(_security_bsd); extern char machine[]; extern char osrelease[]; extern char ostype[]; extern char kern_ident[]; /* Dynamic oid handling */ struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, int nbr, const char *name, int kind, void *arg1, intmax_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr, const char *label); int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del, int recurse); void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name); int sysctl_move_oid(struct sysctl_oid *oidp, struct sysctl_oid_list *parent); int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse); int sysctl_ctx_init(struct sysctl_ctx_list *clist); int sysctl_ctx_free(struct sysctl_ctx_list *clist); struct sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist, struct sysctl_oid *oidp); struct sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist, struct sysctl_oid *oidp); int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist, struct sysctl_oid *oidp); int kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval, int flags); int kernel_sysctlbyname(struct thread *td, char *name, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval, int flags); int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, const void *new, size_t newlen, size_t *retval, int flags); int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, int *nindx, struct sysctl_req *req); void sysctl_wlock(void); void sysctl_wunlock(void); int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); int kern___sysctlbyname(struct thread *td, const char *name, size_t namelen, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval, int flags, bool inkernel); struct sbuf; struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int, struct sysctl_req *); #else /* !_KERNEL */ # 1200 "/usr/include/sys/sysctl.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 1200 "/usr/include/sys/sysctl.h" 3 4 # 1201 "/usr/include/sys/sysctl.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 1201 "/usr/include/sys/sysctl.h" 3 4 # 1202 "/usr/include/sys/sysctl.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 1206 "/usr/include/sys/sysctl.h" 3 4 __BEGIN_DECLS int sysctl(const int *, unsigned int, void *, size_t *, const void *, size_t); int sysctlbyname(const char *, void *, size_t *, const void *, size_t); int sysctlnametomib(const char *, int *, size_t *); __END_DECLS #endif /* _KERNEL */ # 1213 "/usr/include/sys/sysctl.h" 3 4 #endif /* !_SYS_SYSCTL_H_ */ # 1215 "/usr/include/sys/sysctl.h" 3 4 # 278 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 278 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 279 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 280 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 280 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/sys/socket.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)socket.h 8.4 (Berkeley) 2/21/94 * $FreeBSD$ */ #ifndef _SYS_SOCKET_H_ #define _SYS_SOCKET_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/socket.h" 3 4 # 39 "/usr/include/sys/socket.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/socket.h" 3 4 # 40 "/usr/include/sys/socket.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/sys/socket.h" 3 4 # 1 "/usr/include/sys/_iovec.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)uio.h 8.5 (Berkeley) 2/22/94 * $FreeBSD$ */ #ifndef _SYS__IOVEC_H_ #define _SYS__IOVEC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/_iovec.h" 3 4 # 39 "/usr/include/sys/_iovec.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 44 "/usr/include/sys/_iovec.h" 3 4 struct iovec { void *iov_base; /* Base address. */ size_t iov_len; /* Length. */ }; #endif /* !_SYS__IOVEC_H_ */ # 51 "/usr/include/sys/_iovec.h" 3 4 # 41 "/usr/include/sys/socket.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/sys/socket.h" 3 4 # 1 "/usr/include/machine/_align.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_align.h" 3 4 # 7 "/usr/include/machine/_align.h" 3 4 # 42 "/usr/include/sys/socket.h" 2 3 4 /* * Definitions related to sockets: types, address families, options. */ /* * Data types. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 51 "/usr/include/sys/socket.h" 3 4 #ifndef _GID_T_DECLARED typedef __gid_t gid_t; #define _GID_T_DECLARED #endif # 55 "/usr/include/sys/socket.h" 3 4 #ifndef _OFF_T_DECLARED typedef __off_t off_t; #define _OFF_T_DECLARED #endif # 60 "/usr/include/sys/socket.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif # 65 "/usr/include/sys/socket.h" 3 4 #endif # 66 "/usr/include/sys/socket.h" 3 4 #ifndef _SA_FAMILY_T_DECLARED typedef __sa_family_t sa_family_t; #define _SA_FAMILY_T_DECLARED #endif # 71 "/usr/include/sys/socket.h" 3 4 #ifndef _SOCKLEN_T_DECLARED typedef __socklen_t socklen_t; #define _SOCKLEN_T_DECLARED #endif # 76 "/usr/include/sys/socket.h" 3 4 #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif # 81 "/usr/include/sys/socket.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 83 "/usr/include/sys/socket.h" 3 4 #ifndef _UID_T_DECLARED typedef __uid_t uid_t; #define _UID_T_DECLARED #endif # 87 "/usr/include/sys/socket.h" 3 4 #endif # 88 "/usr/include/sys/socket.h" 3 4 #ifndef _UINT32_T_DECLARED typedef __uint32_t uint32_t; #define _UINT32_T_DECLARED #endif # 93 "/usr/include/sys/socket.h" 3 4 #ifndef _UINTPTR_T_DECLARED typedef __uintptr_t uintptr_t; #define _UINTPTR_T_DECLARED #endif # 98 "/usr/include/sys/socket.h" 3 4 /* * Types */ #define SOCK_STREAM 1 /* stream socket */ #define SOCK_DGRAM 2 /* datagram socket */ #define SOCK_RAW 3 /* raw-protocol interface */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 106 "/usr/include/sys/socket.h" 3 4 #define SOCK_RDM 4 /* reliably-delivered message */ #endif # 108 "/usr/include/sys/socket.h" 3 4 #define SOCK_SEQPACKET 5 /* sequenced packet stream */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 111 "/usr/include/sys/socket.h" 3 4 /* * Creation flags, OR'ed into socket() and socketpair() type argument. */ #define SOCK_CLOEXEC 0x10000000 #define SOCK_NONBLOCK 0x20000000 #ifdef _KERNEL /* * Flags for accept1(), kern_accept4() and solisten_dequeue, in addition * to SOCK_CLOEXEC and SOCK_NONBLOCK. */ #define ACCEPT4_INHERIT 0x1 #define ACCEPT4_COMPAT 0x2 #endif /* _KERNEL */ # 124 "/usr/include/sys/socket.h" 3 4 #endif /* __BSD_VISIBLE */ # 125 "/usr/include/sys/socket.h" 3 4 /* * Option flags per-socket. */ #define SO_DEBUG 0x00000001 /* turn on debugging info recording */ #define SO_ACCEPTCONN 0x00000002 /* socket has had listen() */ #define SO_REUSEADDR 0x00000004 /* allow local address reuse */ #define SO_KEEPALIVE 0x00000008 /* keep connections alive */ #define SO_DONTROUTE 0x00000010 /* just use interface addresses */ #define SO_BROADCAST 0x00000020 /* permit sending of broadcast msgs */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 136 "/usr/include/sys/socket.h" 3 4 #define SO_USELOOPBACK 0x00000040 /* bypass hardware when possible */ #endif # 138 "/usr/include/sys/socket.h" 3 4 #define SO_LINGER 0x00000080 /* linger on close if data present */ #define SO_OOBINLINE 0x00000100 /* leave received OOB data in line */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 141 "/usr/include/sys/socket.h" 3 4 #define SO_REUSEPORT 0x00000200 /* allow local address & port reuse */ #define SO_TIMESTAMP 0x00000400 /* timestamp received dgram traffic */ #define SO_NOSIGPIPE 0x00000800 /* no SIGPIPE from EPIPE */ #define SO_ACCEPTFILTER 0x00001000 /* there is an accept filter */ #define SO_BINTIME 0x00002000 /* timestamp received dgram traffic */ #endif # 147 "/usr/include/sys/socket.h" 3 4 #define SO_NO_OFFLOAD 0x00004000 /* socket cannot be offloaded */ #define SO_NO_DDP 0x00008000 /* disable direct data placement */ #define SO_REUSEPORT_LB 0x00010000 /* reuse with load balancing */ #define SO_RERROR 0x00020000 /* keep track of receive errors */ /* * Additional options, not kept in so_options. */ #define SO_SNDBUF 0x1001 /* send buffer size */ #define SO_RCVBUF 0x1002 /* receive buffer size */ #define SO_SNDLOWAT 0x1003 /* send low-water mark */ #define SO_RCVLOWAT 0x1004 /* receive low-water mark */ #define SO_SNDTIMEO 0x1005 /* send timeout */ #define SO_RCVTIMEO 0x1006 /* receive timeout */ #define SO_ERROR 0x1007 /* get error status and clear */ #define SO_TYPE 0x1008 /* get socket type */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 164 "/usr/include/sys/socket.h" 3 4 #define SO_LABEL 0x1009 /* socket's MAC label */ #define SO_PEERLABEL 0x1010 /* socket's peer's MAC label */ #define SO_LISTENQLIMIT 0x1011 /* socket's backlog limit */ #define SO_LISTENQLEN 0x1012 /* socket's complete queue length */ #define SO_LISTENINCQLEN 0x1013 /* socket's incomplete queue length */ #define SO_SETFIB 0x1014 /* use this FIB to route */ #define SO_USER_COOKIE 0x1015 /* user cookie (dummynet etc.) */ #define SO_PROTOCOL 0x1016 /* get socket protocol (Linux name) */ #define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */ #define SO_TS_CLOCK 0x1017 /* clock type used for SO_TIMESTAMP */ #define SO_MAX_PACING_RATE 0x1018 /* socket's max TX pacing rate (Linux name) */ #define SO_DOMAIN 0x1019 /* get socket domain */ #endif # 177 "/usr/include/sys/socket.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 179 "/usr/include/sys/socket.h" 3 4 #define SO_TS_REALTIME_MICRO 0 /* microsecond resolution, realtime */ #define SO_TS_BINTIME 1 /* sub-nanosecond resolution, realtime */ #define SO_TS_REALTIME 2 /* nanosecond resolution, realtime */ #define SO_TS_MONOTONIC 3 /* nanosecond resolution, monotonic */ #define SO_TS_DEFAULT SO_TS_REALTIME_MICRO #define SO_TS_CLOCK_MAX SO_TS_MONOTONIC #endif # 186 "/usr/include/sys/socket.h" 3 4 /* * Space reserved for new socket options added by third-party vendors. * This range applies to all socket option levels. New socket options * in FreeBSD should always use an option value less than SO_VENDOR. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 193 "/usr/include/sys/socket.h" 3 4 #define SO_VENDOR 0x80000000 #endif # 195 "/usr/include/sys/socket.h" 3 4 /* * Structure used for manipulating linger option. */ struct linger { int l_onoff; /* option on/off */ int l_linger; /* linger time */ }; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 205 "/usr/include/sys/socket.h" 3 4 struct accept_filter_arg { char af_name[16]; char af_arg[256-16]; }; #endif # 210 "/usr/include/sys/socket.h" 3 4 /* * Level number for (get/set)sockopt() to apply to socket itself. */ #define SOL_SOCKET 0xffff /* options for socket level */ /* * Address families. */ #define AF_UNSPEC 0 /* unspecified */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 221 "/usr/include/sys/socket.h" 3 4 #define AF_LOCAL AF_UNIX /* local to host (pipes, portals) */ #endif # 223 "/usr/include/sys/socket.h" 3 4 #define AF_UNIX 1 /* standardized name for AF_LOCAL */ #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 226 "/usr/include/sys/socket.h" 3 4 #define AF_IMPLINK 3 /* arpanet imp addresses */ #define AF_PUP 4 /* pup protocols: e.g. BSP */ #define AF_CHAOS 5 /* mit CHAOS protocols */ #define AF_NETBIOS 6 /* SMB protocols */ #define AF_ISO 7 /* ISO protocols */ #define AF_OSI AF_ISO #define AF_ECMA 8 /* European computer manufacturers */ #define AF_DATAKIT 9 /* datakit protocols */ #define AF_CCITT 10 /* CCITT protocols, X.25 etc */ #define AF_SNA 11 /* IBM SNA */ #define AF_DECnet 12 /* DECnet */ #define AF_DLI 13 /* DEC Direct data link interface */ #define AF_LAT 14 /* LAT */ #define AF_HYLINK 15 /* NSC Hyperchannel */ #define AF_APPLETALK 16 /* Apple Talk */ #define AF_ROUTE 17 /* Internal Routing Protocol */ #define AF_LINK 18 /* Link layer interface */ #define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ #define AF_COIP 20 /* connection-oriented IP, aka ST II */ #define AF_CNT 21 /* Computer Network Technology */ #define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ #define AF_IPX 23 /* Novell Internet Protocol */ #define AF_SIP 24 /* Simple Internet Protocol */ #define pseudo_AF_PIP 25 /* Help Identify PIP packets */ #define AF_ISDN 26 /* Integrated Services Digital Network*/ #define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ #define pseudo_AF_KEY 27 /* Internal key-management function */ #endif # 254 "/usr/include/sys/socket.h" 3 4 #define AF_INET6 28 /* IPv6 */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 256 "/usr/include/sys/socket.h" 3 4 #define AF_NATM 29 /* native ATM access */ #define AF_ATM 30 /* ATM */ #define pseudo_AF_HDRCMPLT 31 /* Used by BPF to not rewrite headers * in interface output routine */ #define AF_NETGRAPH 32 /* Netgraph sockets */ #define AF_SLOW 33 /* 802.3ad slow protocol */ #define AF_SCLUSTER 34 /* Sitara cluster protocol */ #define AF_ARP 35 #define AF_BLUETOOTH 36 /* Bluetooth sockets */ #define AF_IEEE80211 37 /* IEEE 802.11 protocol */ #define AF_NETLINK 38 /* Netlink protocol */ #define AF_INET_SDP 40 /* OFED Socket Direct Protocol ipv4 */ #define AF_INET6_SDP 42 /* OFED Socket Direct Protocol ipv6 */ #define AF_HYPERV 43 /* HyperV sockets */ #define AF_DIVERT 44 /* divert(4) */ #define AF_MAX 44 /* * When allocating a new AF_ constant, please only allocate * even numbered constants for FreeBSD until 134 as odd numbered AF_ * constants 39-133 are now reserved for vendors. */ #define AF_VENDOR00 39 #define AF_VENDOR01 41 #define AF_VENDOR03 45 #define AF_VENDOR04 47 #define AF_VENDOR05 49 #define AF_VENDOR06 51 #define AF_VENDOR07 53 #define AF_VENDOR08 55 #define AF_VENDOR09 57 #define AF_VENDOR10 59 #define AF_VENDOR11 61 #define AF_VENDOR12 63 #define AF_VENDOR13 65 #define AF_VENDOR14 67 #define AF_VENDOR15 69 #define AF_VENDOR16 71 #define AF_VENDOR17 73 #define AF_VENDOR18 75 #define AF_VENDOR19 77 #define AF_VENDOR20 79 #define AF_VENDOR21 81 #define AF_VENDOR22 83 #define AF_VENDOR23 85 #define AF_VENDOR24 87 #define AF_VENDOR25 89 #define AF_VENDOR26 91 #define AF_VENDOR27 93 #define AF_VENDOR28 95 #define AF_VENDOR29 97 #define AF_VENDOR30 99 #define AF_VENDOR31 101 #define AF_VENDOR32 103 #define AF_VENDOR33 105 #define AF_VENDOR34 107 #define AF_VENDOR35 109 #define AF_VENDOR36 111 #define AF_VENDOR37 113 #define AF_VENDOR38 115 #define AF_VENDOR39 117 #define AF_VENDOR40 119 #define AF_VENDOR41 121 #define AF_VENDOR42 123 #define AF_VENDOR43 125 #define AF_VENDOR44 127 #define AF_VENDOR45 129 #define AF_VENDOR46 131 #define AF_VENDOR47 133 #endif # 326 "/usr/include/sys/socket.h" 3 4 /* * Structure used by kernel to store most * addresses. */ struct sockaddr { unsigned char sa_len; /* total length */ sa_family_t sa_family; /* address family */ char sa_data[14]; /* actually longer; address value */ }; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 337 "/usr/include/sys/socket.h" 3 4 #define SOCK_MAXADDRLEN 255 /* longest possible addresses */ /* * Structure used by kernel to pass protocol * information in raw sockets. */ struct sockproto { unsigned short sp_family; /* address family */ unsigned short sp_protocol; /* protocol */ }; #endif # 348 "/usr/include/sys/socket.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 349 "/usr/include/sys/socket.h" 3 4 # 1 "/usr/include/sys/_sockaddr_storage.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)socket.h 8.4 (Berkeley) 2/21/94 * $FreeBSD$ */ #ifndef _SYS__SOCKADDR_STORAGE_H_ #define _SYS__SOCKADDR_STORAGE_H_ /* * RFC 2553: protocol-independent placeholder for socket addresses */ #define _SS_MAXSIZE 128U #define _SS_ALIGNSIZE (sizeof(__int64_t)) #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \ sizeof(sa_family_t)) #define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \ sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) struct sockaddr_storage { unsigned char ss_len; /* address length */ sa_family_t ss_family; /* address family */ char __ss_pad1[_SS_PAD1SIZE]; __int64_t __ss_align; /* force desired struct alignment */ char __ss_pad2[_SS_PAD2SIZE]; }; #endif /* !_SYS__SOCKADDR_STORAGE_H_ */ # 57 "/usr/include/sys/_sockaddr_storage.h" 3 4 # 350 "/usr/include/sys/socket.h" 2 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 352 "/usr/include/sys/socket.h" 3 4 /* * Protocol families, same as address families for now. */ #define PF_UNSPEC AF_UNSPEC #define PF_LOCAL AF_LOCAL #define PF_UNIX PF_LOCAL /* backward compatibility */ #define PF_INET AF_INET #define PF_IMPLINK AF_IMPLINK #define PF_PUP AF_PUP #define PF_CHAOS AF_CHAOS #define PF_NETBIOS AF_NETBIOS #define PF_ISO AF_ISO #define PF_OSI AF_ISO #define PF_ECMA AF_ECMA #define PF_DATAKIT AF_DATAKIT #define PF_CCITT AF_CCITT #define PF_SNA AF_SNA #define PF_DECnet AF_DECnet #define PF_DLI AF_DLI #define PF_LAT AF_LAT #define PF_HYLINK AF_HYLINK #define PF_APPLETALK AF_APPLETALK #define PF_ROUTE AF_ROUTE #define PF_LINK AF_LINK #define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ #define PF_COIP AF_COIP #define PF_CNT AF_CNT #define PF_SIP AF_SIP #define PF_IPX AF_IPX #define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */ #define PF_PIP pseudo_AF_PIP #define PF_ISDN AF_ISDN #define PF_KEY pseudo_AF_KEY #define PF_INET6 AF_INET6 #define PF_NATM AF_NATM #define PF_ATM AF_ATM #define PF_NETGRAPH AF_NETGRAPH #define PF_SLOW AF_SLOW #define PF_SCLUSTER AF_SCLUSTER #define PF_ARP AF_ARP #define PF_BLUETOOTH AF_BLUETOOTH #define PF_IEEE80211 AF_IEEE80211 #define PF_NETLINK AF_NETLINK #define PF_INET_SDP AF_INET_SDP #define PF_INET6_SDP AF_INET6_SDP #define PF_DIVERT AF_DIVERT #define PF_MAX AF_MAX /* * Definitions for network related sysctl, CTL_NET. * * Second level is protocol family. * Third level is protocol number. * * Further levels are defined by the individual families. */ /* * PF_ROUTE - Routing table * * Three additional levels are defined: * Fourth: address family, 0 is wildcard * Fifth: type of info, defined below * Sixth: flag(s) to mask with for NET_RT_FLAGS */ #define NET_RT_DUMP 1 /* dump; may limit to a.f. */ #define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ #define NET_RT_IFLIST 3 /* survey interface list */ #define NET_RT_IFMALIST 4 /* return multicast address list */ #define NET_RT_IFLISTL 5 /* Survey interface list, using 'l'en * versions of msghdr structs. */ #define NET_RT_NHOP 6 /* dump routing nexthops */ #define NET_RT_NHGRP 7 /* dump routing nexthop groups */ #endif /* __BSD_VISIBLE */ # 427 "/usr/include/sys/socket.h" 3 4 /* * Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* * Message header for recvmsg and sendmsg calls. * Used value-result for recvmsg, value only for sendmsg. */ struct msghdr { void *msg_name; /* optional address */ socklen_t msg_namelen; /* size of address */ struct iovec *msg_iov; /* scatter/gather array */ int msg_iovlen; /* # elements in msg_iov */ void *msg_control; /* ancillary data, see below */ socklen_t msg_controllen; /* ancillary data buffer len */ int msg_flags; /* flags on received message */ }; #define MSG_OOB 0x00000001 /* process out-of-band data */ #define MSG_PEEK 0x00000002 /* peek at incoming message */ #define MSG_DONTROUTE 0x00000004 /* send without using routing tables */ #define MSG_EOR 0x00000008 /* data completes record */ #define MSG_TRUNC 0x00000010 /* data discarded before delivery */ #define MSG_CTRUNC 0x00000020 /* control data lost before delivery */ #define MSG_WAITALL 0x00000040 /* wait for full request or error */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 455 "/usr/include/sys/socket.h" 3 4 #define MSG_DONTWAIT 0x00000080 /* this message should be nonblocking */ #define MSG_EOF 0x00000100 /* data completes connection */ /* 0x00000200 unused */ /* 0x00000400 unused */ /* 0x00000800 unused */ /* 0x00001000 unused */ #define MSG_NOTIFICATION 0x00002000 /* SCTP notification */ #define MSG_NBIO 0x00004000 /* FIONBIO mode, used by fifofs */ #define MSG_COMPAT 0x00008000 /* used in sendit() */ #endif # 465 "/usr/include/sys/socket.h" 3 4 #ifdef _KERNEL #define MSG_SOCALLBCK 0x00010000 /* for use by socket callbacks - soreceive (TCP) */ #endif # 468 "/usr/include/sys/socket.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 469 "/usr/include/sys/socket.h" 3 4 #define MSG_NOSIGNAL 0x00020000 /* do not generate SIGPIPE on EOF */ #endif # 471 "/usr/include/sys/socket.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 472 "/usr/include/sys/socket.h" 3 4 #define MSG_CMSG_CLOEXEC 0x00040000 /* make received fds close-on-exec */ #define MSG_WAITFORONE 0x00080000 /* for recvmmsg() */ #endif # 475 "/usr/include/sys/socket.h" 3 4 #ifdef _KERNEL #define MSG_MORETOCOME 0x00100000 /* additional data pending */ #define MSG_TLSAPPDATA 0x00200000 /* do not soreceive() alert rec. (TLS) */ #endif # 479 "/usr/include/sys/socket.h" 3 4 /* * Header for ancillary data objects in msg_control buffer. * Used for additional information with/about a datagram * not expressible by flags. The format is a sequence * of message elements headed by cmsghdr structures. */ struct cmsghdr { socklen_t cmsg_len; /* data byte count, including hdr */ int cmsg_level; /* originating protocol */ int cmsg_type; /* protocol-specific type */ /* followed by u_char cmsg_data[]; */ }; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 494 "/usr/include/sys/socket.h" 3 4 /* * While we may have more groups than this, the cmsgcred struct must * be able to fit in an mbuf and we have historically supported a * maximum of 16 groups. */ #define CMGROUP_MAX 16 /* * Credentials structure, used to verify the identity of a peer * process that has sent us a message. This is allocated by the * peer process but filled in by the kernel. This prevents the * peer from lying about its identity. (Note that cmcred_groups[0] * is the effective GID.) */ struct cmsgcred { pid_t cmcred_pid; /* PID of sending process */ uid_t cmcred_uid; /* real UID of sending process */ uid_t cmcred_euid; /* effective UID of sending process */ gid_t cmcred_gid; /* real GID of sending process */ short cmcred_ngroups; /* number or groups */ gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ }; /* * Socket credentials (LOCAL_CREDS). */ struct sockcred { uid_t sc_uid; /* real user id */ uid_t sc_euid; /* effective user id */ gid_t sc_gid; /* real group id */ gid_t sc_egid; /* effective group id */ int sc_ngroups; /* number of supplemental groups */ gid_t sc_groups[1]; /* variable length */ }; /* * Compute size of a sockcred structure with groups. */ #define SOCKCREDSIZE(ngrps) \ (sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1))) /* * Socket credentials (LOCAL_CREDS_PERSISTENT). */ struct sockcred2 { int sc_version; /* version of this structure */ pid_t sc_pid; /* PID of sending process */ uid_t sc_uid; /* real user id */ uid_t sc_euid; /* effective user id */ gid_t sc_gid; /* real group id */ gid_t sc_egid; /* effective group id */ int sc_ngroups; /* number of supplemental groups */ gid_t sc_groups[1]; /* variable length */ }; #define SOCKCRED2SIZE(ngrps) \ (sizeof(struct sockcred2) + (sizeof(gid_t) * ((ngrps) - 1))) #endif /* __BSD_VISIBLE */ # 552 "/usr/include/sys/socket.h" 3 4 /* given pointer to struct cmsghdr, return pointer to data */ #define CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \ _ALIGN(sizeof(struct cmsghdr))) /* given pointer to struct cmsghdr, return pointer to next cmsghdr */ #define CMSG_NXTHDR(mhdr, cmsg) \ ((char *)(cmsg) == (char *)0 ? CMSG_FIRSTHDR(mhdr) : \ ((char *)(cmsg) + _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len) + \ _ALIGN(sizeof(struct cmsghdr)) > \ (char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \ (struct cmsghdr *)0 : \ (struct cmsghdr *)(void *)((char *)(cmsg) + \ _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len))) /* * RFC 2292 requires to check msg_controllen, in case that the kernel returns * an empty list for some reasons. */ #define CMSG_FIRSTHDR(mhdr) \ ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ (struct cmsghdr *)(mhdr)->msg_control : \ (struct cmsghdr *)0) #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 577 "/usr/include/sys/socket.h" 3 4 /* RFC 2292 additions */ #define CMSG_SPACE(l) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l)) #define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l)) #endif # 581 "/usr/include/sys/socket.h" 3 4 #ifdef _KERNEL #define CMSG_ALIGN(n) _ALIGN(n) #endif # 585 "/usr/include/sys/socket.h" 3 4 /* "Socket"-level control message types: */ #define SCM_RIGHTS 0x01 /* access rights (array of int) */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 589 "/usr/include/sys/socket.h" 3 4 #define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ #define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ #define SCM_BINTIME 0x04 /* timestamp (struct bintime) */ #define SCM_REALTIME 0x05 /* timestamp (struct timespec) */ #define SCM_MONOTONIC 0x06 /* timestamp (struct timespec) */ #define SCM_TIME_INFO 0x07 /* timestamp info */ #define SCM_CREDS2 0x08 /* process creds (struct sockcred2) */ struct sock_timestamp_info { __uint32_t st_info_flags; __uint32_t st_info_pad0; __uint64_t st_info_rsv[7]; }; #define ST_INFO_HW 0x0001 /* SCM_TIMESTAMP was hw */ #define ST_INFO_HW_HPREC 0x0002 /* SCM_TIMESTAMP was hw-assisted on entrance */ #endif # 607 "/usr/include/sys/socket.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 609 "/usr/include/sys/socket.h" 3 4 /* * 4.3 compat sockaddr, move to compat file later */ struct osockaddr { unsigned short sa_family; /* address family */ char sa_data[14]; /* up to 14 bytes of direct address */ }; /* * 4.3-compat message header (move to compat file later). */ struct omsghdr { char *msg_name; /* optional address */ int msg_namelen; /* size of address */ struct iovec *msg_iov; /* scatter/gather array */ int msg_iovlen; /* # elements in msg_iov */ char *msg_accrights; /* access rights sent/received */ int msg_accrightslen; }; #endif # 629 "/usr/include/sys/socket.h" 3 4 /* * howto arguments for shutdown(2), specified by Posix.1g. */ #define SHUT_RD 0 /* shut down the reading side */ #define SHUT_WR 1 /* shut down the writing side */ #define SHUT_RDWR 2 /* shut down both sides */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 638 "/usr/include/sys/socket.h" 3 4 /* for SCTP */ /* we cheat and use the SHUT_XX defines for these */ #define PRU_FLUSH_RD SHUT_RD #define PRU_FLUSH_WR SHUT_WR #define PRU_FLUSH_RDWR SHUT_RDWR #endif # 644 "/usr/include/sys/socket.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 646 "/usr/include/sys/socket.h" 3 4 /* * sendfile(2) header/trailer struct */ struct sf_hdtr { struct iovec *headers; /* pointer to an array of header struct iovec's */ int hdr_cnt; /* number of header iovec's */ struct iovec *trailers; /* pointer to an array of trailer struct iovec's */ int trl_cnt; /* number of trailer iovec's */ }; /* * Sendfile-specific flag(s) */ #define SF_NODISKIO 0x00000001 #define SF_MNOWAIT 0x00000002 /* obsolete */ #define SF_SYNC 0x00000004 #define SF_USER_READAHEAD 0x00000008 #define SF_NOCACHE 0x00000010 #define SF_FLAGS(rh, flags) (((rh) << 16) | (flags)) #ifdef _KERNEL #define SF_READAHEAD(flags) ((flags) >> 16) #endif /* _KERNEL */ # 669 "/usr/include/sys/socket.h" 3 4 /* * Sendmmsg/recvmmsg specific structure(s) */ struct mmsghdr { struct msghdr msg_hdr; /* message header */ ssize_t msg_len; /* message length */ }; #endif /* __BSD_VISIBLE */ # 678 "/usr/include/sys/socket.h" 3 4 #ifndef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 681 "/usr/include/sys/socket.h" 3 4 # 682 "/usr/include/sys/socket.h" 3 4 __BEGIN_DECLS int accept(int, struct sockaddr * __restrict, socklen_t * __restrict); int bind(int, const struct sockaddr *, socklen_t); int connect(int, const struct sockaddr *, socklen_t); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 688 "/usr/include/sys/socket.h" 3 4 int accept4(int, struct sockaddr * __restrict, socklen_t * __restrict, int); int bindat(int, int, const struct sockaddr *, socklen_t); int connectat(int, int, const struct sockaddr *, socklen_t); #endif # 692 "/usr/include/sys/socket.h" 3 4 int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict); int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict); int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict); int listen(int, int); ssize_t recv(int, void *, size_t, int); ssize_t recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict); ssize_t recvmsg(int, struct msghdr *, int); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 700 "/usr/include/sys/socket.h" 3 4 struct timespec; ssize_t recvmmsg(int, struct mmsghdr * __restrict, size_t, int, const struct timespec * __restrict); #endif # 704 "/usr/include/sys/socket.h" 3 4 ssize_t send(int, const void *, size_t, int); ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); ssize_t sendmsg(int, const struct msghdr *, int); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 709 "/usr/include/sys/socket.h" 3 4 int sendfile(int, int, off_t, size_t, struct sf_hdtr *, off_t *, int); ssize_t sendmmsg(int, struct mmsghdr * __restrict, size_t, int); int setfib(int); #endif # 713 "/usr/include/sys/socket.h" 3 4 int setsockopt(int, int, int, const void *, socklen_t); int shutdown(int, int); int sockatmark(int); int socket(int, int, int); int socketpair(int, int, int, int *); __END_DECLS #endif /* !_KERNEL */ # 721 "/usr/include/sys/socket.h" 3 4 #ifdef _KERNEL struct socket; struct inpcb *so_sotoinpcb(struct socket *so); struct sockbuf *so_sockbuf_snd(struct socket *); struct sockbuf *so_sockbuf_rcv(struct socket *); int so_state_get(const struct socket *); void so_state_set(struct socket *, int); int so_options_get(const struct socket *); void so_options_set(struct socket *, int); int so_error_get(const struct socket *); void so_error_set(struct socket *, int); int so_linger_get(const struct socket *); void so_linger_set(struct socket *, int); struct protosw *so_protosw_get(const struct socket *); void so_protosw_set(struct socket *, struct protosw *); void so_sorwakeup_locked(struct socket *so); void so_sowwakeup_locked(struct socket *so); void so_sorwakeup(struct socket *so); void so_sowwakeup(struct socket *so); void so_lock(struct socket *so); void so_unlock(struct socket *so); #endif /* _KERNEL */ # 754 "/usr/include/sys/socket.h" 3 4 #endif /* !_SYS_SOCKET_H_ */ # 755 "/usr/include/sys/socket.h" 3 4 # 281 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 281 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 282 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 282 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/sys/mman.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)mman.h 8.2 (Berkeley) 1/9/95 * $FreeBSD$ */ #ifndef _SYS_MMAN_H_ #define _SYS_MMAN_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/mman.h" 3 4 # 39 "/usr/include/sys/mman.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/mman.h" 3 4 # 40 "/usr/include/sys/mman.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 42 "/usr/include/sys/mman.h" 3 4 /* * Inheritance for minherit() */ #define INHERIT_SHARE 0 #define INHERIT_COPY 1 #define INHERIT_NONE 2 #define INHERIT_ZERO 3 #endif # 50 "/usr/include/sys/mman.h" 3 4 /* * Protections are chosen from these bits, or-ed together */ #define PROT_NONE 0x00 /* no permissions */ #define PROT_READ 0x01 /* pages can be read */ #define PROT_WRITE 0x02 /* pages can be written */ #define PROT_EXEC 0x04 /* pages can be executed */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 59 "/usr/include/sys/mman.h" 3 4 #define _PROT_ALL (PROT_READ | PROT_WRITE | PROT_EXEC) #define PROT_EXTRACT(prot) ((prot) & _PROT_ALL) #define _PROT_MAX_SHIFT 16 #define PROT_MAX(prot) ((prot) << _PROT_MAX_SHIFT) #define PROT_MAX_EXTRACT(prot) (((prot) >> _PROT_MAX_SHIFT) & _PROT_ALL) #endif # 66 "/usr/include/sys/mman.h" 3 4 /* * Flags contain sharing type and options. * Sharing types; choose one. */ #define MAP_SHARED 0x0001 /* share changes */ #define MAP_PRIVATE 0x0002 /* changes are private */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 74 "/usr/include/sys/mman.h" 3 4 #define MAP_COPY MAP_PRIVATE /* Obsolete */ #endif # 76 "/usr/include/sys/mman.h" 3 4 /* * Other flags */ #define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 83 "/usr/include/sys/mman.h" 3 4 #define MAP_RESERVED0020 0x0020 /* previously unimplemented MAP_RENAME */ #define MAP_RESERVED0040 0x0040 /* previously unimplemented MAP_NORESERVE */ #define MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */ #define MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */ #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ #define MAP_STACK 0x0400 /* region grows down, like a stack */ #define MAP_NOSYNC 0x0800 /* page to but do not sync underlying file */ /* * Mapping type */ #define MAP_FILE 0x0000 /* map from file (default) */ #define MAP_ANON 0x1000 /* allocated from memory, swap space */ #ifndef _KERNEL #define MAP_ANONYMOUS MAP_ANON /* For compatibility. */ #endif /* !_KERNEL */ # 99 "/usr/include/sys/mman.h" 3 4 /* * Extended flags */ #define MAP_GUARD 0x00002000 /* reserve but don't map address range */ #define MAP_EXCL 0x00004000 /* for MAP_FIXED, fail if address is used */ #define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */ #define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */ #ifdef __LP64__ #define MAP_32BIT 0x00080000 /* map in the low 2GB of address space */ #endif # 110 "/usr/include/sys/mman.h" 3 4 /* * Request specific alignment (n == log2 of the desired alignment). * * MAP_ALIGNED_SUPER requests optimal superpage alignment, but does * not enforce a specific alignment. */ #define MAP_ALIGNED(n) ((n) << MAP_ALIGNMENT_SHIFT) #define MAP_ALIGNMENT_SHIFT 24 #define MAP_ALIGNMENT_MASK MAP_ALIGNED(0xff) #define MAP_ALIGNED_SUPER MAP_ALIGNED(1) /* align on a superpage */ /* * Flags provided to shm_rename */ /* Don't overwrite dest, if it exists */ #define SHM_RENAME_NOREPLACE (1 << 0) /* Atomically swap src and dest */ #define SHM_RENAME_EXCHANGE (1 << 1) #endif /* __BSD_VISIBLE */ # 131 "/usr/include/sys/mman.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 133 "/usr/include/sys/mman.h" 3 4 /* * Process memory locking */ #define MCL_CURRENT 0x0001 /* Lock only current memory */ #define MCL_FUTURE 0x0002 /* Lock all future memory as well */ #endif # 139 "/usr/include/sys/mman.h" 3 4 /* * Error return from mmap() */ #define MAP_FAILED ((void *)-1) /* * msync() flags */ #define MS_SYNC 0x0000 /* msync synchronously */ #define MS_ASYNC 0x0001 /* return immediately */ #define MS_INVALIDATE 0x0002 /* invalidate all cached data */ /* * Advice to madvise */ #define _MADV_NORMAL 0 /* no further special treatment */ #define _MADV_RANDOM 1 /* expect random page references */ #define _MADV_SEQUENTIAL 2 /* expect sequential page references */ #define _MADV_WILLNEED 3 /* will need these pages */ #define _MADV_DONTNEED 4 /* dont need these pages */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 162 "/usr/include/sys/mman.h" 3 4 #define MADV_NORMAL _MADV_NORMAL #define MADV_RANDOM _MADV_RANDOM #define MADV_SEQUENTIAL _MADV_SEQUENTIAL #define MADV_WILLNEED _MADV_WILLNEED #define MADV_DONTNEED _MADV_DONTNEED #define MADV_FREE 5 /* dont need these pages, and junk contents */ #define MADV_NOSYNC 6 /* try to avoid flushes to physical media */ #define MADV_AUTOSYNC 7 /* revert to default flushing strategy */ #define MADV_NOCORE 8 /* do not include these pages in a core file */ #define MADV_CORE 9 /* revert to including pages in a core file */ #define MADV_PROTECT 10 /* protect process from pageout kill */ /* * Return bits from mincore */ #define MINCORE_INCORE 0x1 /* Page is incore */ #define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */ #define MINCORE_MODIFIED 0x4 /* Page has been modified by us */ #define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ #define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */ #define MINCORE_SUPER 0x60 /* Page is a "super" page */ #define MINCORE_PSIND(i) (((i) << 5) & MINCORE_SUPER) /* Page size */ /* * Anonymous object constant for shm_open(). */ #define SHM_ANON ((char *)1) /* * shmflags for shm_open2() */ #define SHM_ALLOW_SEALING 0x00000001 #define SHM_GROW_ON_WRITE 0x00000002 #define SHM_LARGEPAGE 0x00000004 #define SHM_LARGEPAGE_ALLOC_DEFAULT 0 #define SHM_LARGEPAGE_ALLOC_NOWAIT 1 #define SHM_LARGEPAGE_ALLOC_HARD 2 struct shm_largepage_conf { int psind; int alloc_policy; int pad[10]; }; /* * Flags for memfd_create(). */ #define MFD_CLOEXEC 0x00000001 #define MFD_ALLOW_SEALING 0x00000002 #define MFD_HUGETLB 0x00000004 #define MFD_HUGE_MASK 0xFC000000 #define MFD_HUGE_SHIFT 26 #define MFD_HUGE_64KB (16 << MFD_HUGE_SHIFT) #define MFD_HUGE_512KB (19 << MFD_HUGE_SHIFT) #define MFD_HUGE_1MB (20 << MFD_HUGE_SHIFT) #define MFD_HUGE_2MB (21 << MFD_HUGE_SHIFT) #define MFD_HUGE_8MB (23 << MFD_HUGE_SHIFT) #define MFD_HUGE_16MB (24 << MFD_HUGE_SHIFT) #define MFD_HUGE_32MB (25 << MFD_HUGE_SHIFT) #define MFD_HUGE_256MB (28 << MFD_HUGE_SHIFT) #define MFD_HUGE_512MB (29 << MFD_HUGE_SHIFT) #define MFD_HUGE_1GB (30 << MFD_HUGE_SHIFT) #define MFD_HUGE_2GB (31 << MFD_HUGE_SHIFT) #define MFD_HUGE_16GB (34 << MFD_HUGE_SHIFT) #endif /* __BSD_VISIBLE */ # 231 "/usr/include/sys/mman.h" 3 4 /* * XXX missing POSIX_TYPED_MEM_* macros and * posix_typed_mem_info structure. */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 237 "/usr/include/sys/mman.h" 3 4 #define POSIX_MADV_NORMAL _MADV_NORMAL #define POSIX_MADV_RANDOM _MADV_RANDOM #define POSIX_MADV_SEQUENTIAL _MADV_SEQUENTIAL #define POSIX_MADV_WILLNEED _MADV_WILLNEED #define POSIX_MADV_DONTNEED _MADV_DONTNEED #endif # 243 "/usr/include/sys/mman.h" 3 4 #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; #define _MODE_T_DECLARED #endif # 248 "/usr/include/sys/mman.h" 3 4 #ifndef _OFF_T_DECLARED typedef __off_t off_t; #define _OFF_T_DECLARED #endif # 253 "/usr/include/sys/mman.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 258 "/usr/include/sys/mman.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_WANT_FILE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 260 "/usr/include/sys/mman.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 260 "/usr/include/sys/mman.h" 3 4 # 261 "/usr/include/sys/mman.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 261 "/usr/include/sys/mman.h" 3 4 # 262 "/usr/include/sys/mman.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 262 "/usr/include/sys/mman.h" 3 4 # 263 "/usr/include/sys/mman.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 263 "/usr/include/sys/mman.h" 3 4 # 264 "/usr/include/sys/mman.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 264 "/usr/include/sys/mman.h" 3 4 # 265 "/usr/include/sys/mman.h" 3 4 struct file; struct shmfd { vm_ooffset_t shm_size; vm_object_t shm_object; int shm_refs; uid_t shm_uid; gid_t shm_gid; mode_t shm_mode; int shm_kmappings; /* * Values maintained solely to make this a better-behaved file * descriptor for fstat() to run on. */ struct timespec shm_atime; struct timespec shm_mtime; struct timespec shm_ctime; struct timespec shm_birthtime; ino_t shm_ino; struct label *shm_label; /* MAC label */ const char *shm_path; struct rangelock shm_rl; struct mtx shm_mtx; int shm_flags; int shm_seals; /* largepage config */ int shm_lp_psind; int shm_lp_alloc_policy; }; #endif # 301 "/usr/include/sys/mman.h" 3 4 #ifdef _KERNEL struct prison; int shm_map(struct file *fp, size_t size, off_t offset, void **memp); int shm_unmap(struct file *fp, void *mem, size_t size); int shm_access(struct shmfd *shmfd, struct ucred *ucred, int flags); struct shmfd *shm_alloc(struct ucred *ucred, mode_t mode, bool largepage); struct shmfd *shm_hold(struct shmfd *shmfd); void shm_drop(struct shmfd *shmfd); int shm_dotruncate(struct shmfd *shmfd, off_t length); bool shm_largepage(struct shmfd *shmfd); void shm_remove_prison(struct prison *pr); extern struct fileops shm_ops; #define MAP_32BIT_MAX_ADDR ((vm_offset_t)1 << 31) #else /* !_KERNEL */ # 321 "/usr/include/sys/mman.h" 3 4 __BEGIN_DECLS /* * XXX not yet implemented: posix_mem_offset(), posix_typed_mem_get_info(), * posix_typed_mem_open(). */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 328 "/usr/include/sys/mman.h" 3 4 int getpagesizes(size_t *, int); int madvise(void *, size_t, int); int mincore(const void *, size_t, char *); int minherit(void *, size_t, int); #endif # 333 "/usr/include/sys/mman.h" 3 4 int mlock(const void *, size_t); #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void * mmap(void *, size_t, int, int, int, off_t); #endif # 338 "/usr/include/sys/mman.h" 3 4 int mprotect(void *, size_t, int); int msync(void *, size_t, int); int munlock(const void *, size_t); int munmap(void *, size_t); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 343 "/usr/include/sys/mman.h" 3 4 int posix_madvise(void *, size_t, int); #endif # 345 "/usr/include/sys/mman.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 346 "/usr/include/sys/mman.h" 3 4 int mlockall(int); int munlockall(void); int shm_open(const char *, int, mode_t); int shm_unlink(const char *); #endif # 351 "/usr/include/sys/mman.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 352 "/usr/include/sys/mman.h" 3 4 int memfd_create(const char *, unsigned int); int shm_create_largepage(const char *, int, int, int, mode_t); int shm_rename(const char *, const char *, int); #endif # 356 "/usr/include/sys/mman.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 359 "/usr/include/sys/mman.h" 3 4 #endif /* !_SYS_MMAN_H_ */ # 361 "/usr/include/sys/mman.h" 3 4 # 283 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 283 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/netinet/in.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)in.h 8.3 (Berkeley) 1/3/94 * $FreeBSD$ */ #ifndef _NETINET_IN_H_ #define _NETINET_IN_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/netinet/in.h" 3 4 # 39 "/usr/include/netinet/in.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/netinet/in.h" 3 4 # 40 "/usr/include/netinet/in.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/netinet/in.h" 3 4 # 1 "/usr/include/machine/endian.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/endian.h" 3 4 # 7 "/usr/include/machine/endian.h" 3 4 # 41 "/usr/include/netinet/in.h" 2 3 4 /* Protocols common to RFC 1700, POSIX, and X/Open. */ #define IPPROTO_IP 0 /* dummy for IP */ #define IPPROTO_ICMP 1 /* control message protocol */ #define IPPROTO_TCP 6 /* tcp */ #define IPPROTO_UDP 17 /* user datagram protocol */ #define INADDR_ANY ((in_addr_t)0x00000000) #define INADDR_BROADCAST ((in_addr_t)0xffffffff) /* must be masked */ #ifndef _UINT8_T_DECLARED typedef __uint8_t uint8_t; #define _UINT8_T_DECLARED #endif # 55 "/usr/include/netinet/in.h" 3 4 #ifndef _UINT16_T_DECLARED typedef __uint16_t uint16_t; #define _UINT16_T_DECLARED #endif # 60 "/usr/include/netinet/in.h" 3 4 #ifndef _UINT32_T_DECLARED typedef __uint32_t uint32_t; #define _UINT32_T_DECLARED #endif # 65 "/usr/include/netinet/in.h" 3 4 #ifndef _IN_ADDR_T_DECLARED typedef uint32_t in_addr_t; #define _IN_ADDR_T_DECLARED #endif # 70 "/usr/include/netinet/in.h" 3 4 #ifndef _IN_PORT_T_DECLARED typedef uint16_t in_port_t; #define _IN_PORT_T_DECLARED #endif # 75 "/usr/include/netinet/in.h" 3 4 #ifndef _SA_FAMILY_T_DECLARED typedef __sa_family_t sa_family_t; #define _SA_FAMILY_T_DECLARED #endif # 80 "/usr/include/netinet/in.h" 3 4 /* Internet address (a structure for historical reasons). */ #ifndef _STRUCT_IN_ADDR_DECLARED struct in_addr { in_addr_t s_addr; }; #define _STRUCT_IN_ADDR_DECLARED #endif # 88 "/usr/include/netinet/in.h" 3 4 #ifndef _SOCKLEN_T_DECLARED typedef __socklen_t socklen_t; #define _SOCKLEN_T_DECLARED #endif # 93 "/usr/include/netinet/in.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 94 "/usr/include/netinet/in.h" 3 4 # 95 "/usr/include/netinet/in.h" 3 4 /* Socket address, internet style. */ struct sockaddr_in { uint8_t sin_len; sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; char sin_zero[8]; }; #if 0 /* disabled by -frewrite-includes */ #if !defined(_KERNEL) && __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 106 "/usr/include/netinet/in.h" 3 4 #ifndef _BYTEORDER_PROTOTYPED #define _BYTEORDER_PROTOTYPED __BEGIN_DECLS uint32_t htonl(uint32_t); uint16_t htons(uint16_t); uint32_t ntohl(uint32_t); uint16_t ntohs(uint16_t); __END_DECLS #endif # 116 "/usr/include/netinet/in.h" 3 4 #ifndef _BYTEORDER_FUNC_DEFINED #define _BYTEORDER_FUNC_DEFINED #define htonl(x) __htonl(x) #define htons(x) __htons(x) #define ntohl(x) __ntohl(x) #define ntohs(x) __ntohs(x) #endif # 124 "/usr/include/netinet/in.h" 3 4 #endif /* !_KERNEL && __POSIX_VISIBLE >= 200112 */ # 126 "/usr/include/netinet/in.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 128 "/usr/include/netinet/in.h" 3 4 #define IPPROTO_IPV6 41 /* IP6 header */ #define IPPROTO_RAW 255 /* raw IP packet */ #define INET_ADDRSTRLEN 16 #endif # 132 "/usr/include/netinet/in.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 134 "/usr/include/netinet/in.h" 3 4 /* * Constants and structures defined by the internet system, * Per RFC 790, September 1981, and numerous additions. */ /* * Protocols (RFC 1700) */ #define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ #define IPPROTO_IGMP 2 /* group mgmt protocol */ #define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ #define IPPROTO_IPV4 4 /* IPv4 encapsulation */ #define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */ #define IPPROTO_ST 7 /* Stream protocol II */ #define IPPROTO_EGP 8 /* exterior gateway protocol */ #define IPPROTO_PIGP 9 /* private interior gateway */ #define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */ #define IPPROTO_NVPII 11 /* network voice protocol*/ #define IPPROTO_PUP 12 /* pup */ #define IPPROTO_ARGUS 13 /* Argus */ #define IPPROTO_EMCON 14 /* EMCON */ #define IPPROTO_XNET 15 /* Cross Net Debugger */ #define IPPROTO_CHAOS 16 /* Chaos*/ #define IPPROTO_MUX 18 /* Multiplexing */ #define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */ #define IPPROTO_HMP 20 /* Host Monitoring */ #define IPPROTO_PRM 21 /* Packet Radio Measurement */ #define IPPROTO_IDP 22 /* xns idp */ #define IPPROTO_TRUNK1 23 /* Trunk-1 */ #define IPPROTO_TRUNK2 24 /* Trunk-2 */ #define IPPROTO_LEAF1 25 /* Leaf-1 */ #define IPPROTO_LEAF2 26 /* Leaf-2 */ #define IPPROTO_RDP 27 /* Reliable Data */ #define IPPROTO_IRTP 28 /* Reliable Transaction */ #define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ #define IPPROTO_BLT 30 /* Bulk Data Transfer */ #define IPPROTO_NSP 31 /* Network Services */ #define IPPROTO_INP 32 /* Merit Internodal */ #define IPPROTO_DCCP 33 /* Datagram Congestion Control Protocol */ #define IPPROTO_3PC 34 /* Third Party Connect */ #define IPPROTO_IDPR 35 /* InterDomain Policy Routing */ #define IPPROTO_XTP 36 /* XTP */ #define IPPROTO_DDP 37 /* Datagram Delivery */ #define IPPROTO_CMTP 38 /* Control Message Transport */ #define IPPROTO_TPXX 39 /* TP++ Transport */ #define IPPROTO_IL 40 /* IL transport protocol */ #define IPPROTO_SDRP 42 /* Source Demand Routing */ #define IPPROTO_ROUTING 43 /* IP6 routing header */ #define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ #define IPPROTO_IDRP 45 /* InterDomain Routing*/ #define IPPROTO_RSVP 46 /* resource reservation */ #define IPPROTO_GRE 47 /* General Routing Encap. */ #define IPPROTO_MHRP 48 /* Mobile Host Routing */ #define IPPROTO_BHA 49 /* BHA */ #define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */ #define IPPROTO_AH 51 /* IP6 Auth Header */ #define IPPROTO_INLSP 52 /* Integ. Net Layer Security */ #define IPPROTO_SWIPE 53 /* IP with encryption */ #define IPPROTO_NHRP 54 /* Next Hop Resolution */ #define IPPROTO_MOBILE 55 /* IP Mobility */ #define IPPROTO_TLSP 56 /* Transport Layer Security */ #define IPPROTO_SKIP 57 /* SKIP */ #define IPPROTO_ICMPV6 58 /* ICMP6 */ #define IPPROTO_NONE 59 /* IP6 no next header */ #define IPPROTO_DSTOPTS 60 /* IP6 destination option */ #define IPPROTO_AHIP 61 /* any host internal protocol */ #define IPPROTO_CFTP 62 /* CFTP */ #define IPPROTO_HELLO 63 /* "hello" routing protocol */ #define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */ #define IPPROTO_KRYPTOLAN 65 /* Kryptolan */ #define IPPROTO_RVD 66 /* Remote Virtual Disk */ #define IPPROTO_IPPC 67 /* Pluribus Packet Core */ #define IPPROTO_ADFS 68 /* Any distributed FS */ #define IPPROTO_SATMON 69 /* Satnet Monitoring */ #define IPPROTO_VISA 70 /* VISA Protocol */ #define IPPROTO_IPCV 71 /* Packet Core Utility */ #define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */ #define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */ #define IPPROTO_WSN 74 /* Wang Span Network */ #define IPPROTO_PVP 75 /* Packet Video Protocol */ #define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */ #define IPPROTO_ND 77 /* Sun net disk proto (temp.) */ #define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */ #define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */ #define IPPROTO_EON 80 /* ISO cnlp */ #define IPPROTO_VMTP 81 /* VMTP */ #define IPPROTO_SVMTP 82 /* Secure VMTP */ #define IPPROTO_VINES 83 /* Banyon VINES */ #define IPPROTO_TTP 84 /* TTP */ #define IPPROTO_IGP 85 /* NSFNET-IGP */ #define IPPROTO_DGP 86 /* dissimilar gateway prot. */ #define IPPROTO_TCF 87 /* TCF */ #define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */ #define IPPROTO_OSPFIGP 89 /* OSPFIGP */ #define IPPROTO_SRPC 90 /* Strite RPC protocol */ #define IPPROTO_LARP 91 /* Locus Address Resoloution */ #define IPPROTO_MTP 92 /* Multicast Transport */ #define IPPROTO_AX25 93 /* AX.25 Frames */ #define IPPROTO_IPEIP 94 /* IP encapsulated in IP */ #define IPPROTO_MICP 95 /* Mobile Int.ing control */ #define IPPROTO_SCCSP 96 /* Semaphore Comm. security */ #define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */ #define IPPROTO_ENCAP 98 /* encapsulation header */ #define IPPROTO_APES 99 /* any private encr. scheme */ #define IPPROTO_GMTP 100 /* GMTP*/ #define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */ #define IPPROTO_SCTP 132 /* SCTP */ #define IPPROTO_MH 135 /* IPv6 Mobility Header */ #define IPPROTO_UDPLITE 136 /* UDP-Lite */ #define IPPROTO_HIP 139 /* IP6 Host Identity Protocol */ #define IPPROTO_SHIM6 140 /* IP6 Shim6 Protocol */ /* 101-254: Partly Unassigned */ #define IPPROTO_PIM 103 /* Protocol Independent Mcast */ #define IPPROTO_CARP 112 /* CARP */ #define IPPROTO_PGM 113 /* PGM */ #define IPPROTO_MPLS 137 /* MPLS-in-IP */ #define IPPROTO_PFSYNC 240 /* PFSYNC */ #define IPPROTO_RESERVED_253 253 /* Reserved */ #define IPPROTO_RESERVED_254 254 /* Reserved */ /* 255: Reserved */ /* BSD Private, local use, namespace incursion, no longer used */ #define IPPROTO_OLD_DIVERT 254 /* OLD divert pseudo-proto */ #define IPPROTO_MAX 256 /* last return value of *_input(), meaning "all job for this pkt is done". */ #define IPPROTO_DONE 257 /* Only used internally, so can be outside the range of valid IP protocols. */ #define IPPROTO_DIVERT 258 /* divert pseudo-protocol */ #define IPPROTO_SEND 259 /* SeND pseudo-protocol */ /* * Defined to avoid confusion. The master value is defined by * PROTO_SPACER in sys/protosw.h. */ #define IPPROTO_SPACER 32767 /* spacer for loadable protos */ /* * Local port number conventions: * * When a user does a bind(2) or connect(2) with a port number of zero, * a non-conflicting local port address is chosen. * The default range is IPPORT_HIFIRSTAUTO through * IPPORT_HILASTAUTO, although that is settable by sysctl. * * A user may set the IPPROTO_IP option IP_PORTRANGE to change this * default assignment range. * * The value IP_PORTRANGE_DEFAULT causes the default behavior. * * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers * into the "high" range. These are reserved for client outbound connections * which do not want to be filtered by any firewalls. * * The value IP_PORTRANGE_LOW changes the range to the "low" are * that is (by convention) restricted to privileged processes. This * convention is based on "vouchsafe" principles only. It is only secure * if you trust the remote host to restrict these ports. * * The default range of ports and the high range can be changed by * sysctl(3). (net.inet.ip.portrange.{hi,low,}{first,last}) * * Changing those values has bad security implications if you are * using a stateless firewall that is allowing packets outside of that * range in order to allow transparent outgoing connections. * * Such a firewall configuration will generally depend on the use of these * default values. If you change them, you may find your Security * Administrator looking for you with a heavy object. * * For a slightly more orthodox text view on this: * * ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers * * port numbers are divided into three ranges: * * 0 - 1023 Well Known Ports * 1024 - 49151 Registered Ports * 49152 - 65535 Dynamic and/or Private Ports * */ /* * Ports < IPPORT_RESERVED are reserved for * privileged processes (e.g. root). (IP_PORTRANGE_LOW) */ #define IPPORT_RESERVED 1024 /* * Default local port range, used by IP_PORTRANGE_DEFAULT */ #define IPPORT_EPHEMERALFIRST 10000 #define IPPORT_EPHEMERALLAST 65535 /* * Dynamic port range, used by IP_PORTRANGE_HIGH. */ #define IPPORT_HIFIRSTAUTO 49152 #define IPPORT_HILASTAUTO 65535 /* * Scanning for a free reserved port return a value below IPPORT_RESERVED, * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was * 512, but that conflicts with some well-known-services that firewalls may * have a fit if we use. */ #define IPPORT_RESERVEDSTART 600 #define IPPORT_MAX 65535 /* * Historical definitions of bits in internet address integers * (pre-CIDR). Class A/B/C are long obsolete, and now deprecated. * Hide these definitions from the kernel unless IN_HISTORICAL_NETS * is defined. Provide the historical definitions to user level for now. */ #ifndef _KERNEL #define IN_HISTORICAL_NETS #endif # 353 "/usr/include/netinet/in.h" 3 4 #ifdef IN_HISTORICAL_NETS #define IN_CLASSA(i) (((in_addr_t)(i) & 0x80000000) == 0) #define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_HOST 0x00ffffff #define IN_CLASSA_MAX 128 #define IN_CLASSB(i) (((in_addr_t)(i) & 0xc0000000) == 0x80000000) #define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_HOST 0x0000ffff #define IN_CLASSB_MAX 65536 #define IN_CLASSC(i) (((in_addr_t)(i) & 0xe0000000) == 0xc0000000) #define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_HOST 0x000000ff #endif /* IN_HISTORICAL_NETS */ # 371 "/usr/include/netinet/in.h" 3 4 #define IN_NETMASK_DEFAULT 0xffffff00 /* mask when forced to guess */ #define IN_MULTICAST(i) (((in_addr_t)(i) & 0xf0000000) == 0xe0000000) #ifdef IN_HISTORICAL_NETS #define IN_CLASSD(i) IN_MULTICAST(i) #define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ #define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ #define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ #endif /* IN_HISTORICAL_NETS */ # 381 "/usr/include/netinet/in.h" 3 4 #define IN_EXPERIMENTAL(i) (((in_addr_t)(i) & 0xf0000000) == 0xf0000000) #define IN_BADCLASS(i) (((in_addr_t)(i) & 0xf0000000) == 0xf0000000) #define IN_LINKLOCAL(i) (((in_addr_t)(i) & 0xffff0000) == 0xa9fe0000) #ifdef _KERNEL #define IN_LOOPBACK(i) \ (((in_addr_t)(i) & V_in_loopback_mask) == 0x7f000000) #define IN_LOOPBACK_MASK_DFLT 0xff000000 #else # 391 "/usr/include/netinet/in.h" 3 4 #define IN_LOOPBACK(i) (((in_addr_t)(i) & 0xff000000) == 0x7f000000) #endif # 393 "/usr/include/netinet/in.h" 3 4 #define IN_ZERONET(i) (((in_addr_t)(i) & 0xff000000) == 0) #define IN_PRIVATE(i) ((((in_addr_t)(i) & 0xff000000) == 0x0a000000) || \ (((in_addr_t)(i) & 0xfff00000) == 0xac100000) || \ (((in_addr_t)(i) & 0xffff0000) == 0xc0a80000)) #define IN_LOCAL_GROUP(i) (((in_addr_t)(i) & 0xffffff00) == 0xe0000000) #define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i)) #define INADDR_LOOPBACK ((in_addr_t)0x7f000001) #ifndef _KERNEL #define INADDR_NONE ((in_addr_t)0xffffffff) /* -1 return */ #endif # 407 "/usr/include/netinet/in.h" 3 4 #define INADDR_UNSPEC_GROUP ((in_addr_t)0xe0000000) /* 224.0.0.0 */ #define INADDR_ALLHOSTS_GROUP ((in_addr_t)0xe0000001) /* 224.0.0.1 */ #define INADDR_ALLRTRS_GROUP ((in_addr_t)0xe0000002) /* 224.0.0.2 */ #define INADDR_ALLRPTS_GROUP ((in_addr_t)0xe0000016) /* 224.0.0.22, IGMPv3 */ #define INADDR_CARP_GROUP ((in_addr_t)0xe0000012) /* 224.0.0.18 */ #define INADDR_PFSYNC_GROUP ((in_addr_t)0xe00000f0) /* 224.0.0.240 */ #define INADDR_ALLMDNS_GROUP ((in_addr_t)0xe00000fb) /* 224.0.0.251 */ #define INADDR_MAX_LOCAL_GROUP ((in_addr_t)0xe00000ff) /* 224.0.0.255 */ #ifdef IN_HISTORICAL_NETS #define IN_LOOPBACKNET 127 /* official! */ #endif /* IN_HISTORICAL_NETS */ # 420 "/usr/include/netinet/in.h" 3 4 #define IN_RFC3021_MASK ((in_addr_t)0xfffffffe) #ifdef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 424 "/usr/include/netinet/in.h" 3 4 # 425 "/usr/include/netinet/in.h" 3 4 VNET_DECLARE(bool, ip_allow_net0); VNET_DECLARE(bool, ip_allow_net240); /* Address space reserved for loopback */ VNET_DECLARE(uint32_t, in_loopback_mask); #define V_ip_allow_net0 VNET(ip_allow_net0) #define V_ip_allow_net240 VNET(ip_allow_net240) #define V_in_loopback_mask VNET(in_loopback_mask) #endif # 434 "/usr/include/netinet/in.h" 3 4 /* * Options for use with [gs]etsockopt at the IP level. * First word of comment is data type; bool is stored in int. */ #define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ #define IP_HDRINCL 2 /* int; header is included with data */ #define IP_TOS 3 /* int; IP type of service and preced. */ #define IP_TTL 4 /* int; IP time to live */ #define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ #define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ #define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ #define IP_SENDSRCADDR IP_RECVDSTADDR /* cmsg_type to set src addr */ #define IP_RETOPTS 8 /* ip_opts; set/get IP options */ #define IP_MULTICAST_IF 9 /* struct in_addr *or* struct ip_mreqn; * set/get IP multicast i/f */ #define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ #define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ #define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ #define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ #define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ #define IP_RSVP_ON 15 /* enable RSVP in kernel */ #define IP_RSVP_OFF 16 /* disable RSVP in kernel */ #define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ #define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ #define IP_PORTRANGE 19 /* int; range to choose for unspec port */ #define IP_RECVIF 20 /* bool; receive reception if w/dgram */ /* for IPSEC */ #define IP_IPSEC_POLICY 21 /* int; set/get security policy */ /* unused; was IP_FAITH */ #define IP_ONESBCAST 23 /* bool: send all-ones broadcast */ #define IP_BINDANY 24 /* bool: allow bind to any address */ #define IP_BINDMULTI 25 /* bool: allow multiple listeners on a tuple */ #define IP_RSS_LISTEN_BUCKET 26 /* int; set RSS listen bucket */ #define IP_ORIGDSTADDR 27 /* bool: receive IP dst addr/port w/dgram */ #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR /* * Options for controlling the firewall and dummynet. * Historical options (from 40 to 64) will eventually be * replaced by only two options, IP_FW3 and IP_DUMMYNET3. */ #define IP_FW_TABLE_ADD 40 /* add entry */ #define IP_FW_TABLE_DEL 41 /* delete entry */ #define IP_FW_TABLE_FLUSH 42 /* flush table */ #define IP_FW_TABLE_GETSIZE 43 /* get table size */ #define IP_FW_TABLE_LIST 44 /* list table contents */ #define IP_FW3 48 /* generic ipfw v.3 sockopts */ #define IP_DUMMYNET3 49 /* generic dummynet v.3 sockopts */ #define IP_FW_ADD 50 /* add a firewall rule to chain */ #define IP_FW_DEL 51 /* delete a firewall rule from chain */ #define IP_FW_FLUSH 52 /* flush firewall rule chain */ #define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */ #define IP_FW_GET 54 /* get entire firewall rule chain */ #define IP_FW_RESETLOG 55 /* reset logging counters */ #define IP_FW_NAT_CFG 56 /* add/config a nat rule */ #define IP_FW_NAT_DEL 57 /* delete a nat rule */ #define IP_FW_NAT_GET_CONFIG 58 /* get configuration of a nat rule */ #define IP_FW_NAT_GET_LOG 59 /* get log of a nat rule */ #define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */ #define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */ #define IP_DUMMYNET_FLUSH 62 /* flush dummynet */ #define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */ #define IP_RECVTTL 65 /* bool; receive IP TTL w/dgram */ #define IP_MINTTL 66 /* minimum TTL for packet or drop */ #define IP_DONTFRAG 67 /* don't fragment packet */ #define IP_RECVTOS 68 /* bool; receive IP TOS w/dgram */ /* IPv4 Source Filter Multicast API [RFC3678] */ #define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */ #define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */ #define IP_BLOCK_SOURCE 72 /* block a source */ #define IP_UNBLOCK_SOURCE 73 /* unblock a source */ /* The following option is private; do not use it from user applications. */ #define IP_MSFILTER 74 /* set/get filter list */ /* The following option deals with the 802.1Q Ethernet Priority Code Point */ #define IP_VLAN_PCP 75 /* int; set/get PCP used for packet, */ /* -1 use interface default */ /* Protocol Independent Multicast API [RFC3678] */ #define MCAST_JOIN_GROUP 80 /* join an any-source group */ #define MCAST_LEAVE_GROUP 81 /* leave all sources for group */ #define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */ #define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */ #define MCAST_BLOCK_SOURCE 84 /* block a source */ #define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */ /* Flow and RSS definitions */ #define IP_FLOWID 90 /* get flow id for the given socket/inp */ #define IP_FLOWTYPE 91 /* get flow type (M_HASHTYPE) */ #define IP_RSSBUCKETID 92 /* get RSS flowid -> bucket mapping */ #define IP_RECVFLOWID 93 /* bool; receive IP flowid/flowtype w/ datagram */ #define IP_RECVRSSBUCKETID 94 /* bool; receive IP RSS bucket id w/ datagram */ /* * Defaults and limits for options */ #define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ #define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ /* * Limit for IPv4 multicast memberships */ #define IP_MAX_MEMBERSHIPS 4095 /* * Default resource limits for IPv4 multicast source filtering. * These may be modified by sysctl. */ #define IP_MAX_GROUP_SRC_FILTER 512 /* sources per group */ #define IP_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */ #define IP_MAX_SOCK_MUTE_FILTER 128 /* XXX no longer used */ /* * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */ struct ip_mreq { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_interface; /* local IP address of interface */ }; /* * Modified argument structure for IP_MULTICAST_IF, obtained from Linux. * This is used to specify an interface index for multicast sends, as * the IPv4 legacy APIs do not support this (unless IP_SENDIF is available). */ struct ip_mreqn { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_address; /* local IP address of interface */ int imr_ifindex; /* Interface index; cast to uint32_t */ }; /* * Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678] */ struct ip_mreq_source { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_sourceaddr; /* IP address of source */ struct in_addr imr_interface; /* local IP address of interface */ }; /* * Argument structures for Protocol-Independent Multicast Source * Filter APIs. [RFC3678] */ struct group_req { uint32_t gr_interface; /* interface index */ struct sockaddr_storage gr_group; /* group address */ }; struct group_source_req { uint32_t gsr_interface; /* interface index */ struct sockaddr_storage gsr_group; /* group address */ struct sockaddr_storage gsr_source; /* source address */ }; #ifndef __MSFILTERREQ_DEFINED #define __MSFILTERREQ_DEFINED /* * The following structure is private; do not use it from user applications. * It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between * the RFC 3678 libc functions and the kernel. */ struct __msfilterreq { uint32_t msfr_ifindex; /* interface index */ uint32_t msfr_fmode; /* filter mode for group */ uint32_t msfr_nsrcs; /* # of sources in msfr_srcs */ struct sockaddr_storage msfr_group; /* group address */ struct sockaddr_storage *msfr_srcs; /* pointer to the first member * of a contiguous array of * sources to filter in full. */ }; #endif # 615 "/usr/include/netinet/in.h" 3 4 struct sockaddr; /* * Advanced (Full-state) APIs [RFC3678] * The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter(). * We use uint32_t here to be consistent. */ int setipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t, uint32_t, struct in_addr *); int getipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *, uint32_t *, struct in_addr *); int setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, uint32_t, uint32_t, struct sockaddr_storage *); int getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, uint32_t *, uint32_t *, struct sockaddr_storage *); /* * Filter modes; also used to represent per-socket filter mode internally. */ #define MCAST_UNDEFINED 0 /* fmode: not yet defined */ #define MCAST_INCLUDE 1 /* fmode: include these source(s) */ #define MCAST_EXCLUDE 2 /* fmode: exclude these source(s) */ /* * Argument for IP_PORTRANGE: * - which range to search when port is unspecified at bind() or connect() */ #define IP_PORTRANGE_DEFAULT 0 /* default range */ #define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ #define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ /* * Identifiers for IP sysctl nodes */ #define IPCTL_FORWARDING 1 /* act as router */ #define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ #define IPCTL_DEFTTL 3 /* default TTL */ #ifdef notyet #define IPCTL_DEFMTU 4 /* default MTU */ #endif # 656 "/usr/include/netinet/in.h" 3 4 /* IPCTL_RTEXPIRE 5 deprecated */ /* IPCTL_RTMINEXPIRE 6 deprecated */ /* IPCTL_RTMAXCACHE 7 deprecated */ #define IPCTL_SOURCEROUTE 8 /* may perform source routes */ #define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */ #define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */ #define IPCTL_INTRQDROPS 11 /* number of netisr q drops */ #define IPCTL_STATS 12 /* ipstat structure */ #define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */ #define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */ /* 15, unused, was: IPCTL_KEEPFAITH */ #define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */ #define IPCTL_INTRDQMAXLEN 17 /* max length of direct netisr queue */ #define IPCTL_INTRDQDROPS 18 /* number of direct netisr q drops */ #endif /* __BSD_VISIBLE */ # 672 "/usr/include/netinet/in.h" 3 4 #ifdef _KERNEL struct ifnet; struct mbuf; /* forward declarations for Standard C */ struct in_ifaddr; int in_broadcast(struct in_addr, struct ifnet *); int in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *); int in_canforward(struct in_addr); int in_localaddr(struct in_addr); bool in_localip(struct in_addr); bool in_localip_fib(struct in_addr, uint16_t); int in_ifhasaddr(struct ifnet *, struct in_addr); struct in_ifaddr *in_findlocal(uint32_t, bool); int inet_aton(const char *, struct in_addr *); /* in libkern */ char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern */ int inet_pton(int af, const char *, void *); /* in libkern */ void in_ifdetach(struct ifnet *); #define in_hosteq(s, t) ((s).s_addr == (t).s_addr) #define in_nullhost(x) ((x).s_addr == INADDR_ANY) #define in_allhosts(x) ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP)) #define satosin(sa) ((struct sockaddr_in *)(sa)) #define sintosa(sin) ((struct sockaddr *)(sin)) #define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) #endif /* _KERNEL */ # 700 "/usr/include/netinet/in.h" 3 4 /* INET6 stuff */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 703 "/usr/include/netinet/in.h" 3 4 #define __KAME_NETINET_IN_H_INCLUDED_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 704 "/usr/include/netinet/in.h" 3 4 # 1 "/usr/include/netinet6/in6.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)in.h 8.3 (Berkeley) 1/3/94 * $FreeBSD$ */ #ifndef __KAME_NETINET_IN_H_INCLUDED_ #error "do not include netinet6/in6.h directly, include netinet/in.h. see RFC2553" #endif # 69 "/usr/include/netinet6/in6.h" 3 4 #ifndef _NETINET6_IN6_H_ #define _NETINET6_IN6_H_ /* * Identification of the network protocol stack * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE * has the table of implementation/integration differences. */ #define __KAME__ #define __KAME_VERSION "FreeBSD" /* * IPv6 port allocation rules should mirror the IPv4 rules and are controlled * by the net.inet.ip.portrange sysctl tree. The following defines exist * for compatibility with userland applications that need them. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 87 "/usr/include/netinet6/in6.h" 3 4 #define IPV6PORT_RESERVED 1024 #define IPV6PORT_ANONMIN 49152 #define IPV6PORT_ANONMAX 65535 #define IPV6PORT_RESERVEDMIN 600 #define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1) #endif # 93 "/usr/include/netinet6/in6.h" 3 4 /* * IPv6 address */ struct in6_addr { union { uint8_t __u6_addr8[16]; uint16_t __u6_addr16[8]; uint32_t __u6_addr32[4]; } __u6_addr; /* 128-bit IP6 address */ }; #define s6_addr __u6_addr.__u6_addr8 #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_STANDALONE) /* XXX nonstandard */ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 107 "/usr/include/netinet6/in6.h" 3 4 #define s6_addr8 __u6_addr.__u6_addr8 #define s6_addr16 __u6_addr.__u6_addr16 #define s6_addr32 __u6_addr.__u6_addr32 #endif # 111 "/usr/include/netinet6/in6.h" 3 4 #define INET6_ADDRSTRLEN 46 /* * XXX missing POSIX.1-2001 macro IPPROTO_IPV6. */ /* * Socket address for IPv6 */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 122 "/usr/include/netinet6/in6.h" 3 4 #define SIN6_LEN #endif # 124 "/usr/include/netinet6/in6.h" 3 4 struct sockaddr_in6 { uint8_t sin6_len; /* length of this struct */ sa_family_t sin6_family; /* AF_INET6 */ in_port_t sin6_port; /* Transport layer port # */ uint32_t sin6_flowinfo; /* IP6 flow information */ struct in6_addr sin6_addr; /* IP6 address */ uint32_t sin6_scope_id; /* scope zone index */ }; /* * Local definition for masks */ #ifdef _KERNEL /* XXX nonstandard */ #define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}} #define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} #define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} #define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}} #define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}} #endif # 148 "/usr/include/netinet6/in6.h" 3 4 #ifdef _KERNEL extern const struct sockaddr_in6 sa6_any; extern const struct in6_addr in6mask0; extern const struct in6_addr in6mask32; extern const struct in6_addr in6mask64; extern const struct in6_addr in6mask96; extern const struct in6_addr in6mask128; #endif /* _KERNEL */ # 158 "/usr/include/netinet6/in6.h" 3 4 /* * Macros started with IPV6_ADDR is KAME local */ #ifdef _KERNEL /* XXX nonstandard */ #if 0 /* disabled by -frewrite-includes */ #if _BYTE_ORDER == _BIG_ENDIAN #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 164 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_ADDR_INT32_ONE 1 #define IPV6_ADDR_INT32_TWO 2 #define IPV6_ADDR_INT32_MNL 0xff010000 #define IPV6_ADDR_INT32_MLL 0xff020000 #define IPV6_ADDR_INT32_SMP 0x0000ffff #define IPV6_ADDR_INT16_ULL 0xfe80 #define IPV6_ADDR_INT16_USL 0xfec0 #define IPV6_ADDR_INT16_MLL 0xff02 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif _BYTE_ORDER == _LITTLE_ENDIAN #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 173 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_ADDR_INT32_ONE 0x01000000 #define IPV6_ADDR_INT32_TWO 0x02000000 #define IPV6_ADDR_INT32_MNL 0x000001ff #define IPV6_ADDR_INT32_MLL 0x000002ff #define IPV6_ADDR_INT32_SMP 0xffff0000 #define IPV6_ADDR_INT16_ULL 0x80fe #define IPV6_ADDR_INT16_USL 0xc0fe #define IPV6_ADDR_INT16_MLL 0x02ff #endif # 182 "/usr/include/netinet6/in6.h" 3 4 #endif # 183 "/usr/include/netinet6/in6.h" 3 4 /* * Definition of some useful macros to handle IP6 addresses */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 188 "/usr/include/netinet6/in6.h" 3 4 #define IN6ADDR_ANY_INIT \ {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} #define IN6ADDR_LOOPBACK_INIT \ {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} #define IN6ADDR_NODELOCAL_ALLNODES_INIT \ {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} #define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \ {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} #define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} #define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}} #define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \ {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}} #endif # 210 "/usr/include/netinet6/in6.h" 3 4 extern const struct in6_addr in6addr_any; extern const struct in6_addr in6addr_loopback; #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 214 "/usr/include/netinet6/in6.h" 3 4 extern const struct in6_addr in6addr_nodelocal_allnodes; extern const struct in6_addr in6addr_linklocal_allnodes; extern const struct in6_addr in6addr_linklocal_allrouters; extern const struct in6_addr in6addr_linklocal_allv2routers; #endif # 219 "/usr/include/netinet6/in6.h" 3 4 /* * Equality */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 224 "/usr/include/netinet6/in6.h" 3 4 #define IN6_ARE_ADDR_EQUAL(a, b) \ (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) #endif # 227 "/usr/include/netinet6/in6.h" 3 4 /* * Unspecified */ #define IN6_IS_ADDR_UNSPECIFIED(a) \ ((a)->__u6_addr.__u6_addr32[0] == 0 && \ (a)->__u6_addr.__u6_addr32[1] == 0 && \ (a)->__u6_addr.__u6_addr32[2] == 0 && \ (a)->__u6_addr.__u6_addr32[3] == 0) /* * Loopback */ #define IN6_IS_ADDR_LOOPBACK(a) \ ((a)->__u6_addr.__u6_addr32[0] == 0 && \ (a)->__u6_addr.__u6_addr32[1] == 0 && \ (a)->__u6_addr.__u6_addr32[2] == 0 && \ (a)->__u6_addr.__u6_addr32[3] == ntohl(1)) /* * IPv4 compatible */ #define IN6_IS_ADDR_V4COMPAT(a) \ ((a)->__u6_addr.__u6_addr32[0] == 0 && \ (a)->__u6_addr.__u6_addr32[1] == 0 && \ (a)->__u6_addr.__u6_addr32[2] == 0 && \ (a)->__u6_addr.__u6_addr32[3] != 0 && \ (a)->__u6_addr.__u6_addr32[3] != ntohl(1)) /* * Mapped */ #define IN6_IS_ADDR_V4MAPPED(a) \ ((a)->__u6_addr.__u6_addr32[0] == 0 && \ (a)->__u6_addr.__u6_addr32[1] == 0 && \ (a)->__u6_addr.__u6_addr32[2] == ntohl(0x0000ffff)) /* * KAME Scope Values */ #ifdef _KERNEL /* XXX nonstandard */ #define IPV6_ADDR_SCOPE_NODELOCAL 0x01 #define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 #define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 #define IPV6_ADDR_SCOPE_SITELOCAL 0x05 #define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ #define IPV6_ADDR_SCOPE_GLOBAL 0x0e #else # 276 "/usr/include/netinet6/in6.h" 3 4 #define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 #define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 #define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 #define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 #define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ #define __IPV6_ADDR_SCOPE_GLOBAL 0x0e #endif # 283 "/usr/include/netinet6/in6.h" 3 4 /* * Unicast Scope * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373). */ #define IN6_IS_ADDR_LINKLOCAL(a) \ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) #define IN6_IS_ADDR_SITELOCAL(a) \ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) /* * Multicast */ #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) #ifdef _KERNEL /* XXX nonstandard */ #define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) #else # 301 "/usr/include/netinet6/in6.h" 3 4 #define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) #endif # 303 "/usr/include/netinet6/in6.h" 3 4 /* * Multicast Scope */ #ifdef _KERNEL /* refers nonstandard items */ #define IN6_IS_ADDR_MC_NODELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL)) #define IN6_IS_ADDR_MC_INTFACELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL)) #define IN6_IS_ADDR_MC_LINKLOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL)) #define IN6_IS_ADDR_MC_SITELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL)) #define IN6_IS_ADDR_MC_ORGLOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL)) #define IN6_IS_ADDR_MC_GLOBAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL)) #else # 327 "/usr/include/netinet6/in6.h" 3 4 #define IN6_IS_ADDR_MC_NODELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL)) #define IN6_IS_ADDR_MC_LINKLOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL)) #define IN6_IS_ADDR_MC_SITELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL)) #define IN6_IS_ADDR_MC_ORGLOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL)) #define IN6_IS_ADDR_MC_GLOBAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) #endif # 343 "/usr/include/netinet6/in6.h" 3 4 #ifdef _KERNEL /* nonstandard */ /* * KAME Scope */ #define IN6_IS_SCOPE_LINKLOCAL(a) \ ((IN6_IS_ADDR_LINKLOCAL(a)) || \ (IN6_IS_ADDR_MC_LINKLOCAL(a))) #define IN6_IS_SCOPE_EMBED(a) \ ((IN6_IS_ADDR_LINKLOCAL(a)) || \ (IN6_IS_ADDR_MC_LINKLOCAL(a)) || \ (IN6_IS_ADDR_MC_INTFACELOCAL(a))) #define IFA6_IS_DEPRECATED(a) \ ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \ (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \ (a)->ia6_lifetime.ia6t_pltime) #define IFA6_IS_INVALID(a) \ ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \ (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \ (a)->ia6_lifetime.ia6t_vltime) #endif /* _KERNEL */ # 365 "/usr/include/netinet6/in6.h" 3 4 /* * IP6 route structure */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 370 "/usr/include/netinet6/in6.h" 3 4 struct nhop_object; struct route_in6 { struct nhop_object *ro_nh; struct llentry *ro_lle; /* * ro_prepend and ro_plen are only used for bpf to pass in a * preformed header. They are not cacheable. */ char *ro_prepend; uint16_t ro_plen; uint16_t ro_flags; uint16_t ro_mtu; /* saved ro_rt mtu */ uint16_t spare; struct sockaddr_in6 ro_dst; }; #endif # 386 "/usr/include/netinet6/in6.h" 3 4 #ifdef _KERNEL #define MTAG_ABI_IPV6 1444287380 /* IPv6 ABI */ #define IPV6_TAG_DIRECT 0 /* direct-dispatch IPv6 */ #endif /* _KERNEL */ # 391 "/usr/include/netinet6/in6.h" 3 4 /* * Options for use with [gs]etsockopt at the IPV6 level. * First word of comment is data type; bool is stored in int. */ /* no hdrincl */ #if 0 /* disabled by -frewrite-includes */ #if 0 /* the followings are relic in IPv4 and hence are disabled */ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 398 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */ #define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */ #define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */ #define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */ #define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */ #endif # 404 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */ #define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */ #define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */ #define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */ #define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */ #define IPV6_JOIN_GROUP 12 /* ipv6_mreq; join a group membership */ #define IPV6_LEAVE_GROUP 13 /* ipv6_mreq; leave a group membership */ #define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */ #define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */ /* RFC2292 options */ #ifdef _KERNEL #define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */ #define IPV6_2292HOPLIMIT 20 /* bool; hop limit */ #define IPV6_2292NEXTHOP 21 /* bool; next hop addr */ #define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */ #define IPV6_2292DSTOPTS 23 /* bool; destinaion option */ #define IPV6_2292RTHDR 24 /* bool; routing header */ #define IPV6_2292PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */ #endif # 423 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */ #define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */ #ifndef _KERNEL #define IPV6_BINDV6ONLY IPV6_V6ONLY #endif # 429 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */ /* 29; unused; was IPV6_FAITH */ #if 0 /* disabled by -frewrite-includes */ #if 1 /* IPV6FIREWALL */ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 433 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_FW_ADD 30 /* add a firewall rule to chain */ #define IPV6_FW_DEL 31 /* delete a firewall rule from chain */ #define IPV6_FW_FLUSH 32 /* flush firewall rule chain */ #define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */ #define IPV6_FW_GET 34 /* get entire firewall rule chain */ #endif # 439 "/usr/include/netinet6/in6.h" 3 4 /* new socket options introduced in RFC3542 */ #define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */ #define IPV6_RECVPKTINFO 36 /* bool; recv if, dst addr */ #define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */ #define IPV6_RECVRTHDR 38 /* bool; recv routing header */ #define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */ #define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */ #ifdef _KERNEL #define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */ #endif # 451 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */ #define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */ #define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt), 4 bytes int; MTU notification (cmsg) */ #if 0 /* disabled by -frewrite-includes */ #if 0 /*obsoleted during 2292bis -> 3542*/ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 458 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_REACHCONF 45 /* no data; ND reachability confirm (cmsg only/not in of RFC3542) */ #endif # 461 "/usr/include/netinet6/in6.h" 3 4 /* more new socket options introduced in RFC3542 */ #define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */ #define IPV6_HOPLIMIT 47 /* int; send hop limit */ #define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */ #define IPV6_HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */ #define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */ #define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */ #if 0 /* disabled by -frewrite-includes */ #if 0 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 470 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_PKTOPTIONS 52 /* buf/cmsghdr; set/get IPv6 options */ /* obsoleted by RFC3542 */ #endif # 473 "/usr/include/netinet6/in6.h" 3 4 #define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */ #define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */ #define IPV6_TCLASS 61 /* int; send traffic class value */ #define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */ #define IPV6_PREFER_TEMPADDR 63 /* int; prefer temporary addresses as * the source address. */ #define IPV6_BINDANY 64 /* bool: allow bind to any address */ #define IPV6_BINDMULTI 65 /* bool; allow multibind to same addr/port */ #define IPV6_RSS_LISTEN_BUCKET 66 /* int; set RSS listen bucket */ #define IPV6_FLOWID 67 /* int; flowid of given socket */ #define IPV6_FLOWTYPE 68 /* int; flowtype of given socket */ #define IPV6_RSSBUCKETID 69 /* int; RSS bucket ID of given socket */ #define IPV6_RECVFLOWID 70 /* bool; receive IP6 flowid/flowtype w/ datagram */ #define IPV6_RECVRSSBUCKETID 71 /* bool; receive IP6 RSS bucket id w/ datagram */ #define IPV6_ORIGDSTADDR 72 /* bool: allow getting dstaddr /port info */ #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR /* * The following option is private; do not use it from user applications. * It is deliberately defined to the same value as IP_MSFILTER. */ #define IPV6_MSFILTER 74 /* struct __msfilterreq; * set/get multicast source filter list. */ /* The following option deals with the 802.1Q Ethernet Priority Code Point */ #define IPV6_VLAN_PCP 75 /* int; set/get PCP used for packet, */ /* -1 use interface default */ /* to define items, should talk with KAME guys first, for *BSD compatibility */ #define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */ #define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */ #define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */ /* * Defaults and limits for options */ #define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */ #define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ /* * Limit for IPv6 multicast memberships */ #define IPV6_MAX_MEMBERSHIPS 4095 /* * Default resource limits for IPv6 multicast source filtering. * These may be modified by sysctl. */ #define IPV6_MAX_GROUP_SRC_FILTER 512 /* sources per group */ #define IPV6_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */ /* * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. */ struct ipv6_mreq { struct in6_addr ipv6mr_multiaddr; unsigned int ipv6mr_interface; }; /* * IPV6_PKTINFO: Packet information(RFC2292 sec 5) */ struct in6_pktinfo { struct in6_addr ipi6_addr; /* src/dst IPv6 address */ unsigned int ipi6_ifindex; /* send/recv interface index */ }; /* * Control structure for IPV6_RECVPATHMTU socket option. */ struct ip6_mtuinfo { struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */ uint32_t ip6m_mtu; }; /* * Argument for IPV6_PORTRANGE: * - which range to search when port is unspecified at bind() or connect() */ #define IPV6_PORTRANGE_DEFAULT 0 /* default range */ #define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ #define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 567 "/usr/include/netinet6/in6.h" 3 4 /* * Definitions for inet6 sysctl operations. * * Third level is protocol number. * Fourth level is desired variable within that protocol. */ #define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */ /* * Names for IP sysctl objects */ #define IPV6CTL_FORWARDING 1 /* act as router */ #define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/ #define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */ #ifdef notyet #define IPV6CTL_DEFMTU 4 /* default MTU */ #endif # 584 "/usr/include/netinet6/in6.h" 3 4 #define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */ #define IPV6CTL_STATS 6 /* stats */ #define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */ #define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */ #define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */ #define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */ #define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */ #define IPV6CTL_ACCEPT_RTADV 12 /* 13; unused; was: IPV6CTL_KEEPFAITH */ #define IPV6CTL_LOG_INTERVAL 14 #define IPV6CTL_HDRNESTLIMIT 15 #define IPV6CTL_DAD_COUNT 16 #define IPV6CTL_AUTO_FLOWLABEL 17 #define IPV6CTL_DEFMCASTHLIM 18 #define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */ #define IPV6CTL_KAME_VERSION 20 #define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */ #define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */ #if 0 /* disabled by -frewrite-includes */ #if 0 /* obsolete */ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 603 "/usr/include/netinet6/in6.h" 3 4 #define IPV6CTL_MAPPED_ADDR 23 #endif # 605 "/usr/include/netinet6/in6.h" 3 4 #define IPV6CTL_V6ONLY 24 /* IPV6CTL_RTEXPIRE 25 deprecated */ /* IPV6CTL_RTMINEXPIRE 26 deprecated */ /* IPV6CTL_RTMAXCACHE 27 deprecated */ #define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */ #define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */ #define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */ #define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */ #define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */ #define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */ #define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */ #define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */ #define IPV6CTL_MAXFRAGS 41 /* max fragments */ #if 0 /* disabled by -frewrite-includes */ #if 0 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 621 "/usr/include/netinet6/in6.h" 3 4 #define IPV6CTL_IFQ 42 /* ip6intrq node */ #define IPV6CTL_ISATAPRTR 43 /* isatap router */ #endif # 624 "/usr/include/netinet6/in6.h" 3 4 #define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for multicast? */ /* New entries should be added here from current IPV6CTL_MAXID value. */ /* to define items, should talk with KAME guys first, for *BSD compatibility */ #define IPV6CTL_STEALTH 45 #define ICMPV6CTL_ND6_ONLINKNSRFC4861 47 #define IPV6CTL_NO_RADR 48 /* No defroute from RA */ #define IPV6CTL_NORBIT_RAIF 49 /* Disable R-bit in NA on RA * receiving IF. */ #define IPV6CTL_RFC6204W3 50 /* Accept defroute even when forwarding enabled */ #define IPV6CTL_INTRQMAXLEN 51 /* max length of IPv6 netisr queue */ #define IPV6CTL_INTRDQMAXLEN 52 /* max length of direct IPv6 netisr * queue */ #define IPV6CTL_MAXFRAGSPERPACKET 53 /* Max fragments per packet */ #define IPV6CTL_MAXFRAGBUCKETSIZE 54 /* Max reassembly queues per bucket */ #define IPV6CTL_MAXID 55 #endif /* __BSD_VISIBLE */ # 643 "/usr/include/netinet6/in6.h" 3 4 /* * Since both netinet/ and netinet6/ call into netipsec/ and netpfil/, * the protocol specific mbuf flags are shared between them. */ #define M_FASTFWD_OURS M_PROTO1 /* changed dst to local */ #define M_IP6_NEXTHOP M_PROTO2 /* explicit ip nexthop */ #define M_IP_NEXTHOP M_PROTO2 /* explicit ip nexthop */ #define M_SKIP_FIREWALL M_PROTO3 /* skip firewall processing */ #define M_AUTHIPHDR M_PROTO4 #define M_DECRYPTED M_PROTO5 #define M_LOOP M_PROTO6 #define M_AUTHIPDGM M_PROTO7 #define M_RTALERT_MLD M_PROTO8 #define M_FRAGMENTED M_PROTO9 /* contained fragment header */ #ifdef _KERNEL struct cmsghdr; struct ip6_hdr; int in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t); int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t); int in6_cksum_partial(struct mbuf *, u_int8_t, u_int32_t, u_int32_t, u_int32_t); int in6_localaddr(struct in6_addr *); int in6_localip(struct in6_addr *); bool in6_localip_fib(struct in6_addr *, uint16_t); int in6_ifhasaddr(struct ifnet *, struct in6_addr *); int in6_addrscope(const struct in6_addr *); char *ip6_sprintf(char *, const struct in6_addr *); struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *); extern void in6_if_up(struct ifnet *); struct sockaddr; void in6_sin6_2_sin(struct sockaddr_in *sin, struct sockaddr_in6 *sin6); void in6_sin_2_v4mapsin6(struct sockaddr_in *sin, struct sockaddr_in6 *sin6); void in6_sin6_2_sin_in_sock(struct sockaddr *nam); void in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam); extern void addrsel_policy_init(void); #define satosin6(sa) ((struct sockaddr_in6 *)(sa)) #define sin6tosa(sin6) ((struct sockaddr *)(sin6)) #define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) #endif /* _KERNEL */ # 690 "/usr/include/netinet6/in6.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 695 "/usr/include/netinet6/in6.h" 3 4 #ifndef _SOCKLEN_T_DECLARED typedef __socklen_t socklen_t; #define _SOCKLEN_T_DECLARED #endif # 700 "/usr/include/netinet6/in6.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 702 "/usr/include/netinet6/in6.h" 3 4 __BEGIN_DECLS struct cmsghdr; extern int inet6_option_space(int); extern int inet6_option_init(void *, struct cmsghdr **, int); extern int inet6_option_append(struct cmsghdr *, const uint8_t *, int, int); extern uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int); extern int inet6_option_next(const struct cmsghdr *, uint8_t **); extern int inet6_option_find(const struct cmsghdr *, uint8_t **, int); extern size_t inet6_rthdr_space(int, int); extern struct cmsghdr *inet6_rthdr_init(void *, int); extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *, unsigned int); extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int); #if 0 /* disabled by -frewrite-includes */ #if 0 /* not implemented yet */ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 720 "/usr/include/netinet6/in6.h" 3 4 extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *); #endif # 722 "/usr/include/netinet6/in6.h" 3 4 extern int inet6_rthdr_segments(const struct cmsghdr *); extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int); extern int inet6_rthdr_getflags(const struct cmsghdr *, int); extern int inet6_opt_init(void *, socklen_t); extern int inet6_opt_append(void *, socklen_t, int, uint8_t, socklen_t, uint8_t, void **); extern int inet6_opt_finish(void *, socklen_t, int); extern int inet6_opt_set_val(void *, int, void *, socklen_t); extern int inet6_opt_next(void *, socklen_t, int, uint8_t *, socklen_t *, void **); extern int inet6_opt_find(void *, socklen_t, int, uint8_t, socklen_t *, void **); extern int inet6_opt_get_val(void *, int, void *, socklen_t); extern socklen_t inet6_rth_space(int, int); extern void *inet6_rth_init(void *, socklen_t, int, int); extern int inet6_rth_add(void *, const struct in6_addr *); extern int inet6_rth_reverse(const void *, void *); extern int inet6_rth_segments(const void *); extern struct in6_addr *inet6_rth_getaddr(const void *, int); __END_DECLS #endif /* __BSD_VISIBLE */ # 746 "/usr/include/netinet6/in6.h" 3 4 #endif /* !_NETINET6_IN6_H_ */ # 748 "/usr/include/netinet6/in6.h" 3 4 # 705 "/usr/include/netinet/in.h" 2 3 4 #undef __KAME_NETINET_IN_H_INCLUDED_ #endif # 707 "/usr/include/netinet/in.h" 3 4 #endif /* !_NETINET_IN_H_*/ # 709 "/usr/include/netinet/in.h" 3 4 # 284 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #endif # 285 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifdef __BLOCKS__ #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 288 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 288 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" 1 // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // #ifndef _BLOCK_PRIVATE_H_ #define _BLOCK_PRIVATE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 14 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" # 15 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 15 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" # 16 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 16 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" # 1 "/usr/include/stdio.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stdio.h 8.5 (Berkeley) 4/29/95 * $FreeBSD$ */ #ifndef _STDIO_H_ #define _STDIO_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/stdio.h" 3 4 # 42 "/usr/include/stdio.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/usr/include/stdio.h" 3 4 # 43 "/usr/include/stdio.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/stdio.h" 3 4 # 44 "/usr/include/stdio.h" 3 4 __NULLABILITY_PRAGMA_PUSH typedef __off_t fpos_t; #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 53 "/usr/include/stdio.h" 3 4 #ifndef _RSIZE_T_DEFINED #define _RSIZE_T_DEFINED typedef size_t rsize_t; #endif # 58 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 60 "/usr/include/stdio.h" 3 4 #ifndef _OFF_T_DECLARED #define _OFF_T_DECLARED typedef __off_t off_t; #endif # 64 "/usr/include/stdio.h" 3 4 #ifndef _SSIZE_T_DECLARED #define _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #endif # 68 "/usr/include/stdio.h" 3 4 #endif # 69 "/usr/include/stdio.h" 3 4 #ifndef _OFF64_T_DECLARED #define _OFF64_T_DECLARED typedef __off64_t off64_t; #endif # 74 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 76 "/usr/include/stdio.h" 3 4 #ifndef _VA_LIST_DECLARED typedef __va_list va_list; #define _VA_LIST_DECLARED #endif # 80 "/usr/include/stdio.h" 3 4 #endif # 81 "/usr/include/stdio.h" 3 4 #define _FSTDIO /* Define for new stdio with functions. */ /* * NB: to fit things in six character monocase externals, the stdio * code uses the prefix `__s' for stdio objects, typically followed * by a three-character attempt at a mnemonic. */ /* stdio buffers */ struct __sbuf { unsigned char *_base; int _size; }; /* * stdio state variables. * * The following always hold: * * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), * _lbfsize is -_bf._size, else _lbfsize is 0 * if _flags&__SRD, _w is 0 * if _flags&__SWR, _r is 0 * * This ensures that the getc and putc macros (or inline functions) never * try to write or read from a file that is in `read' or `write' mode. * (Moreover, they can, and do, automatically switch from read mode to * write mode, and back, on "r+" and "w+" files.) * * _lbfsize is used only to make the inline line-buffered output stream * code as compact as possible. * * _ub, _up, and _ur are used when ungetc() pushes back more characters * than fit in the current _bf, or when ungetc() pushes back a character * that does not match the previous one in _bf. When this happens, * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. * * Certain members of __sFILE are accessed directly via macros or * inline functions. To preserve ABI compat, these members must not * be disturbed. These members are marked below with (*). */ struct __sFILE { unsigned char *_p; /* (*) current position in (some) buffer */ int _r; /* (*) read space left for getc() */ int _w; /* (*) write space left for putc() */ short _flags; /* (*) flags, below; this FILE is free if 0 */ short _file; /* (*) fileno, if Unix descriptor, else -1 */ struct __sbuf _bf; /* (*) the buffer (at least 1 byte, if !NULL) */ int _lbfsize; /* (*) 0 or -_bf._size, for inline putc */ /* operations */ void *_cookie; /* (*) cookie passed to io functions */ int (* _Nullable _close)(void *); int (* _Nullable _read)(void *, char *, int); fpos_t (* _Nullable _seek)(void *, fpos_t, int); int (* _Nullable _write)(void *, const char *, int); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ unsigned char *_up; /* saved _p when _p is doing ungetc data */ int _ur; /* saved _r when _r is counting ungetc data */ /* tricks to meet minimum requirements even when malloc() fails */ unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ unsigned char _nbuf[1]; /* guarantee a getc() buffer */ /* separate buffer for fgetln() when line crosses buffer boundary */ struct __sbuf _lb; /* buffer for fgetln() */ /* Unix stdio files get aligned to block boundaries on fseek() */ int _blksize; /* stat.st_blksize (may be != _bf._size) */ fpos_t _offset; /* current lseek offset */ struct pthread_mutex *_fl_mutex; /* used for MT-safety */ struct pthread *_fl_owner; /* current owner */ int _fl_count; /* recursive lock count */ int _orientation; /* orientation for fwide() */ __mbstate_t _mbstate; /* multibyte conversion state */ int _flags2; /* additional flags */ }; #ifndef _STDFILE_DECLARED #define _STDFILE_DECLARED typedef struct __sFILE FILE; #endif # 167 "/usr/include/stdio.h" 3 4 #ifndef _STDSTREAM_DECLARED __BEGIN_DECLS extern FILE *__stdinp; extern FILE *__stdoutp; extern FILE *__stderrp; __END_DECLS #define _STDSTREAM_DECLARED #endif # 175 "/usr/include/stdio.h" 3 4 #define __SLBF 0x0001 /* line buffered */ #define __SNBF 0x0002 /* unbuffered */ #define __SRD 0x0004 /* OK to read */ #define __SWR 0x0008 /* OK to write */ /* RD and WR are never simultaneously asserted */ #define __SRW 0x0010 /* open for reading & writing */ #define __SEOF 0x0020 /* found EOF */ #define __SERR 0x0040 /* found error */ #define __SMBF 0x0080 /* _bf._base is from malloc */ #define __SAPP 0x0100 /* fdopen()ed in append mode */ #define __SSTR 0x0200 /* this is an sprintf/snprintf string */ #define __SOPT 0x0400 /* do fseek() optimization */ #define __SNPT 0x0800 /* do not do fseek() optimization */ #define __SOFF 0x1000 /* set iff _offset is in fact correct */ #define __SMOD 0x2000 /* true => fgetln modified _p text */ #define __SALC 0x4000 /* allocate string space dynamically */ #define __SIGN 0x8000 /* ignore this file in _fwalk */ #define __S2OAP 0x0001 /* O_APPEND mode is set */ /* * The following three definitions are for ANSI C, which took them * from System V, which brilliantly took internal interface macros and * made them official arguments to setvbuf(), without renaming them. * Hence, these ugly _IOxxx names are *supposed* to appear in user code. * * Although numbered as their counterparts above, the implementation * does not rely on this. */ #define _IOFBF 0 /* setvbuf should set fully buffered */ #define _IOLBF 1 /* setvbuf should set line buffered */ #define _IONBF 2 /* setvbuf should set unbuffered */ #define BUFSIZ 1024 /* size of buffer used by setbuf */ #define EOF (-1) /* * FOPEN_MAX is a minimum maximum, and is the number of streams that * stdio can provide without attempting to allocate further resources * (which could fail). Do not use this for anything. */ /* must be == _POSIX_STREAM_MAX */ #ifndef FOPEN_MAX #define FOPEN_MAX 20 /* must be <= OPEN_MAX */ #endif # 221 "/usr/include/stdio.h" 3 4 #define FILENAME_MAX 1024 /* must be <= PATH_MAX */ /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 225 "/usr/include/stdio.h" 3 4 #define P_tmpdir "/tmp/" #endif # 227 "/usr/include/stdio.h" 3 4 #define L_tmpnam 1024 /* XXX must be == PATH_MAX */ #define TMP_MAX 308915776 #ifndef SEEK_SET #define SEEK_SET 0 /* set file offset to offset */ #endif # 233 "/usr/include/stdio.h" 3 4 #ifndef SEEK_CUR #define SEEK_CUR 1 /* set file offset to current plus offset */ #endif # 236 "/usr/include/stdio.h" 3 4 #ifndef SEEK_END #define SEEK_END 2 /* set file offset to EOF plus offset */ #endif # 239 "/usr/include/stdio.h" 3 4 #define stdin __stdinp #define stdout __stdoutp #define stderr __stderrp __BEGIN_DECLS #ifdef _XLOCALE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 246 "/usr/include/stdio.h" 3 4 # 247 "/usr/include/stdio.h" 3 4 #endif # 248 "/usr/include/stdio.h" 3 4 /* * Functions defined in ANSI C standard. */ void clearerr(FILE *); int fclose(FILE *); int feof(FILE *); int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); int fgetpos(FILE * __restrict, fpos_t * __restrict); char *fgets(char * __restrict, int, FILE * __restrict); FILE *fopen(const char * __restrict, const char * __restrict); int fprintf(FILE * __restrict, const char * __restrict, ...); int fputc(int, FILE *); int fputs(const char * __restrict, FILE * __restrict); size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict); int fscanf(FILE * __restrict, const char * __restrict, ...); int fseek(FILE *, long, int); int fsetpos(FILE *, const fpos_t *); long ftell(FILE *); size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict); int getc(FILE *); int getchar(void); #if 0 /* disabled by -frewrite-includes */ #if __EXT1_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 273 "/usr/include/stdio.h" 3 4 char *gets_s(char *, rsize_t); #endif # 275 "/usr/include/stdio.h" 3 4 void perror(const char *); int printf(const char * __restrict, ...); int putc(int, FILE *); int putchar(int); int puts(const char *); int remove(const char *); int rename(const char *, const char *); void rewind(FILE *); int scanf(const char * __restrict, ...); void setbuf(FILE * __restrict, char * __restrict); int setvbuf(FILE * __restrict, char * __restrict, int, size_t); int sprintf(char * __restrict, const char * __restrict, ...); int sscanf(const char * __restrict, const char * __restrict, ...); FILE *tmpfile(void); char *tmpnam(char *); int ungetc(int, FILE *); int vfprintf(FILE * __restrict, const char * __restrict, __va_list); int vprintf(const char * __restrict, __va_list); int vsprintf(char * __restrict, const char * __restrict, __va_list); #if 0 /* disabled by -frewrite-includes */ #if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 298 "/usr/include/stdio.h" 3 4 int snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); int vsnprintf(char * __restrict, size_t, const char * __restrict, __va_list) __printflike(3, 0); #endif # 303 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __ISO_C_VISIBLE >= 1999 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 304 "/usr/include/stdio.h" 3 4 int vfscanf(FILE * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); int vscanf(const char * __restrict, __va_list) __scanflike(1, 0); int vsscanf(const char * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); #endif # 310 "/usr/include/stdio.h" 3 4 /* * Functions defined in all versions of POSIX 1003.1. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 315 "/usr/include/stdio.h" 3 4 #define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ #endif # 317 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 319 "/usr/include/stdio.h" 3 4 #define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ char *ctermid(char *); FILE *fdopen(int, const char *); int fileno(FILE *); #endif /* __POSIX_VISIBLE */ # 325 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199209 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 327 "/usr/include/stdio.h" 3 4 int pclose(FILE *); FILE *popen(const char *, const char *); #endif # 330 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 332 "/usr/include/stdio.h" 3 4 int ftrylockfile(FILE *); void flockfile(FILE *); void funlockfile(FILE *); /* * These are normally used through macros as defined below, but POSIX * requires functions as well. */ int getc_unlocked(FILE *); int getchar_unlocked(void); int putc_unlocked(int, FILE *); int putchar_unlocked(int); #endif # 345 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 346 "/usr/include/stdio.h" 3 4 void clearerr_unlocked(FILE *); int feof_unlocked(FILE *); int ferror_unlocked(FILE *); int fflush_unlocked(FILE *); int fileno_unlocked(FILE *); int fputc_unlocked(int, FILE *); int fputs_unlocked(const char * __restrict, FILE * __restrict); size_t fread_unlocked(void * __restrict, size_t, size_t, FILE * __restrict); size_t fwrite_unlocked(const void * __restrict, size_t, size_t, FILE * __restrict); #endif # 357 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 359 "/usr/include/stdio.h" 3 4 int fseeko(FILE *, __off_t, int); __off_t ftello(FILE *); #endif # 362 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 364 "/usr/include/stdio.h" 3 4 int getw(FILE *); int putw(int, FILE *); #endif /* BSD or X/Open before issue 6 */ # 367 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 369 "/usr/include/stdio.h" 3 4 char *tempnam(const char *, const char *); #endif # 371 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 373 "/usr/include/stdio.h" 3 4 FILE *fmemopen(void * __restrict, size_t, const char * __restrict); ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); FILE *open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * __restrict, __va_list) __printflike(2, 0); /* _WITH_GETLINE to allow pre 11 sources to build on 11+ systems */ ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); int dprintf(int, const char * __restrict, ...) __printflike(2, 3); #endif /* __POSIX_VISIBLE >= 200809 */ # 383 "/usr/include/stdio.h" 3 4 /* * Routines that are purely local. */ #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 388 "/usr/include/stdio.h" 3 4 int asprintf(char **, const char *, ...) __printflike(2, 3); char *ctermid_r(char *); void fcloseall(void); int fdclose(FILE *, int *); char *fgetln(FILE *, size_t *); const char *fmtcheck(const char *, const char *) __format_arg(2); int fpurge(FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char **, const char *, __va_list) __printflike(2, 0); /* * The system error table contains messages for the first sys_nerr * positive errno values. Use strerror() or strerror_r() from * instead. */ extern const int sys_nerr; extern const char * const sys_errlist[]; /* * Stdio function-access interface. */ FILE *funopen(const void *, int (* _Nullable)(void *, char *, int), int (* _Nullable)(void *, const char *, int), fpos_t (* _Nullable)(void *, fpos_t, int), int (* _Nullable)(void *)); #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) typedef __ssize_t cookie_read_function_t(void *, char *, size_t); typedef __ssize_t cookie_write_function_t(void *, const char *, size_t); typedef int cookie_seek_function_t(void *, off64_t *, int); typedef int cookie_close_function_t(void *); typedef struct { cookie_read_function_t *read; cookie_write_function_t *write; cookie_seek_function_t *seek; cookie_close_function_t *close; } cookie_io_functions_t; FILE *fopencookie(void *, const char *, cookie_io_functions_t); /* * Portability hacks. See . */ #ifndef _FTRUNCATE_DECLARED #define _FTRUNCATE_DECLARED int ftruncate(int, __off_t); #endif # 438 "/usr/include/stdio.h" 3 4 #ifndef _LSEEK_DECLARED #define _LSEEK_DECLARED __off_t lseek(int, __off_t, int); #endif # 442 "/usr/include/stdio.h" 3 4 #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void *mmap(void *, size_t, int, int, int, __off_t); #endif # 446 "/usr/include/stdio.h" 3 4 #ifndef _TRUNCATE_DECLARED #define _TRUNCATE_DECLARED int truncate(const char *, __off_t); #endif # 450 "/usr/include/stdio.h" 3 4 #endif /* __BSD_VISIBLE */ # 451 "/usr/include/stdio.h" 3 4 /* * Functions internal to the implementation. */ int __srget(FILE *); int __swbuf(int, FILE *); /* * The __sfoo macros are here so that we can * define function versions in the C library. */ #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) #if 0 /* disabled by -frewrite-includes */ #if defined(__GNUC__) && defined(__STDC__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 464 "/usr/include/stdio.h" 3 4 static __inline int __sputc(int _c, FILE *_p) { if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) return (*_p->_p++ = _c); else return (__swbuf(_c, _p)); } #else # 471 "/usr/include/stdio.h" 3 4 /* * This has been tuned to generate reasonable code on the vax using pcc. */ #define __sputc(c, p) \ (--(p)->_w < 0 ? \ (p)->_w >= (p)->_lbfsize ? \ (*(p)->_p = (c)), *(p)->_p != '\n' ? \ (int)*(p)->_p++ : \ __swbuf('\n', p) : \ __swbuf((int)(c), p) : \ (*(p)->_p = (c), (int)*(p)->_p++)) #endif # 483 "/usr/include/stdio.h" 3 4 #ifndef __LIBC_ISTHREADED_DECLARED #define __LIBC_ISTHREADED_DECLARED extern int __isthreaded; #endif # 488 "/usr/include/stdio.h" 3 4 #ifndef __cplusplus #define __sfeof(p) (((p)->_flags & __SEOF) != 0) #define __sferror(p) (((p)->_flags & __SERR) != 0) #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) #define __sfileno(p) ((p)->_file) #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p)) #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p)) #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p)) #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 502 "/usr/include/stdio.h" 3 4 #define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) #endif # 504 "/usr/include/stdio.h" 3 4 #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp)) #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) #define getchar() getc(stdin) #define putchar(x) putc(x, stdout) #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 512 "/usr/include/stdio.h" 3 4 /* * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 * B.8.2.7 for the rationale behind the *_unlocked() macros. */ #define clearerr_unlocked(p) __sclearerr(p) #define feof_unlocked(p) __sfeof(p) #define ferror_unlocked(p) __sferror(p) #define fileno_unlocked(p) __sfileno(p) #define fputc_unlocked(s, p) __sputc(s, p) #endif # 522 "/usr/include/stdio.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 523 "/usr/include/stdio.h" 3 4 #define getc_unlocked(fp) __sgetc(fp) #define putc_unlocked(x, fp) __sputc(x, fp) #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked(x, stdout) #endif # 529 "/usr/include/stdio.h" 3 4 #endif /* __cplusplus */ # 530 "/usr/include/stdio.h" 3 4 __END_DECLS __NULLABILITY_PRAGMA_POP #endif /* !_STDIO_H_ */ # 535 "/usr/include/stdio.h" 3 4 # 17 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "Block.h" #endif /* expanded by -frewrite-includes */ # 18 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" 1 // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // #ifndef _Block_H_ #define _Block_H_ #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 15 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" #if 0 /* disabled by -frewrite-includes */ # if defined(BlocksRuntime_STATIC) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 16 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" # define BLOCK_ABI # else # 18 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" #if 0 /* disabled by -frewrite-includes */ # if defined(BlocksRuntime_EXPORTS) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 19 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" # define BLOCK_ABI __declspec(dllexport) # else # 21 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" # define BLOCK_ABI __declspec(dllimport) # endif # 23 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" # endif # 24 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" #else # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" # define BLOCK_ABI __attribute__((__visibility__("default"))) #endif # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(BLOCK_EXPORT) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 29 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" #if 0 /* disabled by -frewrite-includes */ # if defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" # define BLOCK_EXPORT extern "C" BLOCK_ABI # else # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" # define BLOCK_EXPORT extern BLOCK_ABI # endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" #endif # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" #if 0 /* disabled by -frewrite-includes */ #if __cplusplus #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" extern "C" { #endif # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" // Create a heap based copy of a Block or simply add a reference to an existing one. // This must be paired with Block_release to recover memory, even when running // under Objective-C Garbage Collection. BLOCK_EXPORT void *_Block_copy(const void *aBlock); // Lose the reference, and if heap based and last reference, recover the memory BLOCK_EXPORT void _Block_release(const void *aBlock); // Used by the compiler. Do not call this function yourself. BLOCK_EXPORT void _Block_object_assign(void *, const void *, const int); // Used by the compiler. Do not call this function yourself. BLOCK_EXPORT void _Block_object_dispose(const void *, const int); // Used by the compiler. Do not use these variables yourself. #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 56 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" extern void * _NSConcreteGlobalBlock[32]; extern void * _NSConcreteStackBlock[32]; #else # 59 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" BLOCK_EXPORT void * _NSConcreteGlobalBlock[32]; BLOCK_EXPORT void * _NSConcreteStackBlock[32]; #endif # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" #if 0 /* disabled by -frewrite-includes */ #if __cplusplus #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" } #endif # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" // Type correct macros #define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__))) #define Block_release(...) _Block_release((const void *)(__VA_ARGS__)) #endif # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block.h" # 19 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" 2 #if 0 /* disabled by -frewrite-includes */ #if __cplusplus #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 21 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" extern "C" { #endif # 23 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" // Values for Block_layout->flags to describe block objects enum { BLOCK_DEALLOCATING = (0x0001), // runtime BLOCK_REFCOUNT_MASK = (0xfffe), // runtime BLOCK_NEEDS_FREE = (1 << 24), // runtime BLOCK_HAS_COPY_DISPOSE = (1 << 25), // compiler BLOCK_HAS_CTOR = (1 << 26), // compiler: helpers have C++ code BLOCK_IS_GC = (1 << 27), // runtime BLOCK_IS_GLOBAL = (1 << 28), // compiler BLOCK_USE_STRET = (1 << 29), // compiler: undefined if !BLOCK_HAS_SIGNATURE BLOCK_HAS_SIGNATURE = (1 << 30), // compiler BLOCK_HAS_EXTENDED_LAYOUT=(1 << 31) // compiler }; #define BLOCK_DESCRIPTOR_1 1 struct Block_descriptor_1 { unsigned long int reserved; unsigned long int size; }; #define BLOCK_DESCRIPTOR_2 1 struct Block_descriptor_2 { // requires BLOCK_HAS_COPY_DISPOSE void (*copy)(void *dst, const void *src); void (*dispose)(const void *); }; #define BLOCK_DESCRIPTOR_3 1 struct Block_descriptor_3 { // requires BLOCK_HAS_SIGNATURE const char *signature; const char *layout; // contents depend on BLOCK_HAS_EXTENDED_LAYOUT }; struct Block_layout { void *isa; volatile int32_t flags; // contains ref count int32_t reserved; void (*invoke)(void *, ...); struct Block_descriptor_1 *descriptor; // imported variables }; // Values for Block_byref->flags to describe __block variables enum { // Byref refcount must use the same bits as Block_layout's refcount. // BLOCK_DEALLOCATING = (0x0001), // runtime // BLOCK_REFCOUNT_MASK = (0xfffe), // runtime BLOCK_BYREF_LAYOUT_MASK = (0xf << 28), // compiler BLOCK_BYREF_LAYOUT_EXTENDED = ( 1 << 28), // compiler BLOCK_BYREF_LAYOUT_NON_OBJECT = ( 2 << 28), // compiler BLOCK_BYREF_LAYOUT_STRONG = ( 3 << 28), // compiler BLOCK_BYREF_LAYOUT_WEAK = ( 4 << 28), // compiler BLOCK_BYREF_LAYOUT_UNRETAINED = ( 5 << 28), // compiler BLOCK_BYREF_IS_GC = ( 1 << 27), // runtime BLOCK_BYREF_HAS_COPY_DISPOSE = ( 1 << 25), // compiler BLOCK_BYREF_NEEDS_FREE = ( 1 << 24), // runtime }; struct Block_byref { void *isa; struct Block_byref *forwarding; volatile int32_t flags; // contains ref count uint32_t size; }; struct Block_byref_2 { // requires BLOCK_BYREF_HAS_COPY_DISPOSE void (*byref_keep)(struct Block_byref *dst, struct Block_byref *src); void (*byref_destroy)(struct Block_byref *); }; struct Block_byref_3 { // requires BLOCK_BYREF_LAYOUT_EXTENDED const char *layout; }; // Extended layout encoding. // Values for Block_descriptor_3->layout with BLOCK_HAS_EXTENDED_LAYOUT // and for Block_byref_3->layout with BLOCK_BYREF_LAYOUT_EXTENDED // If the layout field is less than 0x1000, then it is a compact encoding // of the form 0xXYZ: X strong pointers, then Y byref pointers, // then Z weak pointers. // If the layout field is 0x1000 or greater, it points to a // string of layout bytes. Each byte is of the form 0xPN. // Operator P is from the list below. Value N is a parameter for the operator. // Byte 0x00 terminates the layout; remaining block data is non-pointer bytes. enum { BLOCK_LAYOUT_ESCAPE = 0, // N=0 halt, rest is non-pointer. N!=0 reserved. BLOCK_LAYOUT_NON_OBJECT_BYTES = 1, // N bytes non-objects BLOCK_LAYOUT_NON_OBJECT_WORDS = 2, // N words non-objects BLOCK_LAYOUT_STRONG = 3, // N words strong pointers BLOCK_LAYOUT_BYREF = 4, // N words byref pointers BLOCK_LAYOUT_WEAK = 5, // N words weak pointers BLOCK_LAYOUT_UNRETAINED = 6, // N words unretained pointers BLOCK_LAYOUT_UNKNOWN_WORDS_7 = 7, // N words, reserved BLOCK_LAYOUT_UNKNOWN_WORDS_8 = 8, // N words, reserved BLOCK_LAYOUT_UNKNOWN_WORDS_9 = 9, // N words, reserved BLOCK_LAYOUT_UNKNOWN_WORDS_A = 0xA, // N words, reserved BLOCK_LAYOUT_UNUSED_B = 0xB, // unspecified, reserved BLOCK_LAYOUT_UNUSED_C = 0xC, // unspecified, reserved BLOCK_LAYOUT_UNUSED_D = 0xD, // unspecified, reserved BLOCK_LAYOUT_UNUSED_E = 0xE, // unspecified, reserved BLOCK_LAYOUT_UNUSED_F = 0xF, // unspecified, reserved }; // Runtime support functions used by compiler when generating copy/dispose helpers // Values for _Block_object_assign() and _Block_object_dispose() parameters enum { // see function implementation for a more complete description of these fields and combinations BLOCK_FIELD_IS_OBJECT = 3, // id, NSObject, __attribute__((NSObject)), block, ... BLOCK_FIELD_IS_BLOCK = 7, // a block variable BLOCK_FIELD_IS_BYREF = 8, // the on stack structure holding the __block variable BLOCK_FIELD_IS_WEAK = 16, // declared __weak, only used in byref copy helpers BLOCK_BYREF_CALLER = 128, // called from __block (byref) copy/dispose support routines. }; enum { BLOCK_ALL_COPY_DISPOSE_FLAGS = BLOCK_FIELD_IS_OBJECT | BLOCK_FIELD_IS_BLOCK | BLOCK_FIELD_IS_BYREF | BLOCK_FIELD_IS_WEAK | BLOCK_BYREF_CALLER }; // Runtime entry point called by compiler when assigning objects inside copy helper routines BLOCK_EXPORT void _Block_object_assign(void *destAddr, const void *object, const int flags); // BLOCK_FIELD_IS_BYREF is only used from within block copy helpers // runtime entry point called by the compiler when disposing of objects inside dispose helper routine BLOCK_EXPORT void _Block_object_dispose(const void *object, const int flags); // Other support functions // runtime entry to get total size of a closure BLOCK_EXPORT size_t Block_size(void *aBlock); // indicates whether block was compiled with compiler that sets the ABI related metadata bits BLOCK_EXPORT bool _Block_has_signature(void *aBlock); // returns TRUE if return value of block is on the stack, FALSE otherwise BLOCK_EXPORT bool _Block_use_stret(void *aBlock); // Returns a string describing the block's parameter and return types. // The encoding scheme is the same as Objective-C @encode. // Returns NULL for blocks compiled with some compilers. BLOCK_EXPORT const char * _Block_signature(void *aBlock); // Returns a string describing the block's GC layout. // This uses the GC skip/scan encoding. // May return NULL. BLOCK_EXPORT const char * _Block_layout(void *aBlock); // Returns a string describing the block's layout. // This uses the "extended layout" form described above. // May return NULL. BLOCK_EXPORT const char * _Block_extended_layout(void *aBlock); // Callable only from the ARR weak subsystem while in exclusion zone BLOCK_EXPORT bool _Block_tryRetain(const void *aBlock); // Callable only from the ARR weak subsystem while in exclusion zone BLOCK_EXPORT bool _Block_isDeallocating(const void *aBlock); // the raw data space for runtime classes for blocks // class+meta used for stack, malloc, and collectable based blocks BLOCK_EXPORT void * _NSConcreteMallocBlock[32]; BLOCK_EXPORT void * _NSConcreteAutoBlock[32]; BLOCK_EXPORT void * _NSConcreteFinalizingBlock[32]; BLOCK_EXPORT void * _NSConcreteWeakBlockVariable[32]; // declared in Block.h // BLOCK_EXPORT void * _NSConcreteGlobalBlock[32]; // BLOCK_EXPORT void * _NSConcreteStackBlock[32]; // the intercept routines that must be used under GC BLOCK_EXPORT void _Block_use_GC( void *(*alloc)(const unsigned long, const bool isOne, const bool isObject), void (*setHasRefcount)(const void *, const bool), void (*gc_assign_strong)(void *, void **), void (*gc_assign_weak)(const void *, void *), void (*gc_memmove)(void *, void *, unsigned long)); // earlier version, now simply transitional BLOCK_EXPORT void _Block_use_GC5( void *(*alloc)(const unsigned long, const bool isOne, const bool isObject), void (*setHasRefcount)(const void *, const bool), void (*gc_assign_strong)(void *, void **), void (*gc_assign_weak)(const void *, void *)); BLOCK_EXPORT void _Block_use_RR( void (*retain)(const void *), void (*release)(const void *)); struct Block_callbacks_RR { size_t size; // size == sizeof(struct Block_callbacks_RR) void (*retain)(const void *); void (*release)(const void *); void (*destructInstance)(const void *); }; typedef struct Block_callbacks_RR Block_callbacks_RR; BLOCK_EXPORT void _Block_use_RR2(const Block_callbacks_RR *callbacks); // make a collectable GC heap based Block. Not useful under non-GC. BLOCK_EXPORT void *_Block_copy_collectable(const void *aBlock); // thread-unsafe diagnostic BLOCK_EXPORT const char *_Block_dump(const void *block); // Obsolete // first layout struct Block_basic { void *isa; int Block_flags; // int32_t int Block_size; // XXX should be packed into Block_flags void (*Block_invoke)(void *); void (*Block_copy)(void *dst, void *src); // iff BLOCK_HAS_COPY_DISPOSE void (*Block_dispose)(void *); // iff BLOCK_HAS_COPY_DISPOSE //long params[0]; // where const imports, __block storage references, etc. get laid down } __attribute__((deprecated)); #if 0 /* disabled by -frewrite-includes */ #if __cplusplus #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 260 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" } #endif # 262 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" #endif # 265 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/BlocksRuntime/Block_private.h" # 289 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #else # 290 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include "BlocksRuntime/Block_private.h" #endif /* expanded by -frewrite-includes */ # 290 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 291 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // __has_include() # 292 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 292 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 293 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif /* __BLOCKS__ */ # 294 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 295 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/assert.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)assert.h 8.2 (Berkeley) 1/21/94 * $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/assert.h" 3 4 # 41 "/usr/include/assert.h" 3 4 /* * Unlike other ANSI header files, may usefully be included * multiple times, with and without NDEBUG defined. */ #undef assert #undef _assert #ifdef NDEBUG #define assert(e) ((void)0) #define _assert(e) ((void)0) #else # 54 "/usr/include/assert.h" 3 4 #define _assert(e) assert(e) #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) #endif /* NDEBUG */ # 59 "/usr/include/assert.h" 3 4 #ifndef _ASSERT_H_ #define _ASSERT_H_ /* * Static assertions. In principle we could define static_assert for * C++ older than C++11, but this breaks if _Static_assert is * implemented as a macro. * * C++ template parameters may contain commas, even if not enclosed in * parentheses, causing the _Static_assert macro to be invoked with more * than two parameters. */ #if 0 /* disabled by -frewrite-includes */ #if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 73 "/usr/include/assert.h" 3 4 #define static_assert _Static_assert #endif # 75 "/usr/include/assert.h" 3 4 __BEGIN_DECLS void __assert(const char *, const char *, int, const char *) __dead2; __END_DECLS #endif /* !_ASSERT_H_ */ # 81 "/usr/include/assert.h" 3 4 # 296 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 296 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/errno.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)errno.h 8.5 (Berkeley) 1/21/94 * $FreeBSD$ */ #ifndef _SYS_ERRNO_H_ #define _SYS_ERRNO_H_ #if 0 /* disabled by -frewrite-includes */ #if !defined(_KERNEL) && !defined(_STANDALONE) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 44 "/usr/include/errno.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/errno.h" 3 4 # 45 "/usr/include/errno.h" 3 4 __BEGIN_DECLS int * __error(void); __END_DECLS #define errno (* __error()) #endif # 50 "/usr/include/errno.h" 3 4 #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* Input/output error */ #define ENXIO 6 /* Device not configured */ #define E2BIG 7 /* Argument list too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file descriptor */ #define ECHILD 10 /* No child processes */ #define EDEADLK 11 /* Resource deadlock avoided */ /* 11 was EAGAIN */ #define ENOMEM 12 /* Cannot allocate memory */ #define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad address */ #ifndef _POSIX_SOURCE #define ENOTBLK 15 /* Block device required */ #endif # 69 "/usr/include/errno.h" 3 4 #define EBUSY 16 /* Device busy */ #define EEXIST 17 /* File exists */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* Operation not supported by device */ #define ENOTDIR 20 /* Not a directory */ #define EISDIR 21 /* Is a directory */ #define EINVAL 22 /* Invalid argument */ #define ENFILE 23 /* Too many open files in system */ #define EMFILE 24 /* Too many open files */ #define ENOTTY 25 /* Inappropriate ioctl for device */ #ifndef _POSIX_SOURCE #define ETXTBSY 26 /* Text file busy */ #endif # 82 "/usr/include/errno.h" 3 4 #define EFBIG 27 /* File too large */ #define ENOSPC 28 /* No space left on device */ #define ESPIPE 29 /* Illegal seek */ #define EROFS 30 /* Read-only filesystem */ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ /* math software */ #define EDOM 33 /* Numerical argument out of domain */ #define ERANGE 34 /* Result too large */ /* non-blocking and interrupt i/o */ #define EAGAIN 35 /* Resource temporarily unavailable */ #ifndef _POSIX_SOURCE #define EWOULDBLOCK EAGAIN /* Operation would block */ #define EINPROGRESS 36 /* Operation now in progress */ #define EALREADY 37 /* Operation already in progress */ /* ipc/network software -- argument errors */ #define ENOTSOCK 38 /* Socket operation on non-socket */ #define EDESTADDRREQ 39 /* Destination address required */ #define EMSGSIZE 40 /* Message too long */ #define EPROTOTYPE 41 /* Protocol wrong type for socket */ #define ENOPROTOOPT 42 /* Protocol not available */ #define EPROTONOSUPPORT 43 /* Protocol not supported */ #define ESOCKTNOSUPPORT 44 /* Socket type not supported */ #define EOPNOTSUPP 45 /* Operation not supported */ #define ENOTSUP EOPNOTSUPP /* Operation not supported */ #define EPFNOSUPPORT 46 /* Protocol family not supported */ #define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ #define EADDRINUSE 48 /* Address already in use */ #define EADDRNOTAVAIL 49 /* Can't assign requested address */ /* ipc/network software -- operational errors */ #define ENETDOWN 50 /* Network is down */ #define ENETUNREACH 51 /* Network is unreachable */ #define ENETRESET 52 /* Network dropped connection on reset */ #define ECONNABORTED 53 /* Software caused connection abort */ #define ECONNRESET 54 /* Connection reset by peer */ #define ENOBUFS 55 /* No buffer space available */ #define EISCONN 56 /* Socket is already connected */ #define ENOTCONN 57 /* Socket is not connected */ #define ESHUTDOWN 58 /* Can't send after socket shutdown */ #define ETOOMANYREFS 59 /* Too many references: can't splice */ #define ETIMEDOUT 60 /* Operation timed out */ #define ECONNREFUSED 61 /* Connection refused */ #define ELOOP 62 /* Too many levels of symbolic links */ #endif /* _POSIX_SOURCE */ # 131 "/usr/include/errno.h" 3 4 #define ENAMETOOLONG 63 /* File name too long */ /* should be rearranged */ #ifndef _POSIX_SOURCE #define EHOSTDOWN 64 /* Host is down */ #define EHOSTUNREACH 65 /* No route to host */ #endif /* _POSIX_SOURCE */ # 138 "/usr/include/errno.h" 3 4 #define ENOTEMPTY 66 /* Directory not empty */ /* quotas & mush */ #ifndef _POSIX_SOURCE #define EPROCLIM 67 /* Too many processes */ #define EUSERS 68 /* Too many users */ #define EDQUOT 69 /* Disc quota exceeded */ /* Network File System */ #define ESTALE 70 /* Stale NFS file handle */ #define EREMOTE 71 /* Too many levels of remote in path */ #define EBADRPC 72 /* RPC struct is bad */ #define ERPCMISMATCH 73 /* RPC version wrong */ #define EPROGUNAVAIL 74 /* RPC prog. not avail */ #define EPROGMISMATCH 75 /* Program version wrong */ #define EPROCUNAVAIL 76 /* Bad procedure for program */ #endif /* _POSIX_SOURCE */ # 155 "/usr/include/errno.h" 3 4 #define ENOLCK 77 /* No locks available */ #define ENOSYS 78 /* Function not implemented */ #ifndef _POSIX_SOURCE #define EFTYPE 79 /* Inappropriate file type or format */ #define EAUTH 80 /* Authentication error */ #define ENEEDAUTH 81 /* Need authenticator */ #define EIDRM 82 /* Identifier removed */ #define ENOMSG 83 /* No message of desired type */ #define EOVERFLOW 84 /* Value too large to be stored in data type */ #define ECANCELED 85 /* Operation canceled */ #define EILSEQ 86 /* Illegal byte sequence */ #define ENOATTR 87 /* Attribute not found */ #define EDOOFUS 88 /* Programming error */ #endif /* _POSIX_SOURCE */ # 172 "/usr/include/errno.h" 3 4 #define EBADMSG 89 /* Bad message */ #define EMULTIHOP 90 /* Multihop attempted */ #define ENOLINK 91 /* Link has been severed */ #define EPROTO 92 /* Protocol error */ #ifndef _POSIX_SOURCE #define ENOTCAPABLE 93 /* Capabilities insufficient */ #define ECAPMODE 94 /* Not permitted in capability mode */ #define ENOTRECOVERABLE 95 /* State not recoverable */ #define EOWNERDEAD 96 /* Previous owner died */ #define EINTEGRITY 97 /* Integrity check failed */ #endif /* _POSIX_SOURCE */ # 185 "/usr/include/errno.h" 3 4 #ifndef _POSIX_SOURCE #define ELAST 97 /* Must be equal largest errno */ #endif /* _POSIX_SOURCE */ # 189 "/usr/include/errno.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO) || defined(_STANDALONE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 191 "/usr/include/errno.h" 3 4 /* pseudo-errors returned inside kernel to modify return to process */ #define ERESTART (-1) /* restart syscall */ #define EJUSTRETURN (-2) /* don't modify regs, just return */ #define ENOIOCTL (-3) /* ioctl not handled by this layer */ #define EDIRIOCTL (-4) /* do direct ioctl in GEOM */ #define ERELOOKUP (-5) /* retry the directory lookup */ #endif # 198 "/usr/include/errno.h" 3 4 #ifndef _KERNEL #if 0 /* disabled by -frewrite-includes */ #if __EXT1_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 201 "/usr/include/errno.h" 3 4 /* ISO/IEC 9899:2011 K.3.2.2 */ #ifndef _ERRNO_T_DEFINED #define _ERRNO_T_DEFINED typedef int errno_t; #endif # 206 "/usr/include/errno.h" 3 4 #endif /* __EXT1_VISIBLE */ # 207 "/usr/include/errno.h" 3 4 #endif # 208 "/usr/include/errno.h" 3 4 #endif # 210 "/usr/include/errno.h" 3 4 # 297 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* disabled by -frewrite-includes */ #if HAVE_FCNTL_H #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 298 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 298 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 299 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 300 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 300 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/limits.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)limits.h 8.2 (Berkeley) 1/4/94 * $FreeBSD$ */ #ifndef _LIMITS_H_ #define _LIMITS_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/limits.h" 3 4 # 39 "/usr/include/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 41 "/usr/include/limits.h" 3 4 #define _POSIX_ARG_MAX 4096 #define _POSIX_LINK_MAX 8 #define _POSIX_MAX_CANON 255 #define _POSIX_MAX_INPUT 255 #define _POSIX_NAME_MAX 14 #define _POSIX_PIPE_BUF 512 #define _POSIX_SSIZE_MAX 32767 #define _POSIX_STREAM_MAX 8 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 51 "/usr/include/limits.h" 3 4 #define _POSIX_CHILD_MAX 25 #define _POSIX_NGROUPS_MAX 8 #define _POSIX_OPEN_MAX 20 #define _POSIX_PATH_MAX 256 #define _POSIX_TZNAME_MAX 6 #else # 57 "/usr/include/limits.h" 3 4 #define _POSIX_CHILD_MAX 6 #define _POSIX_NGROUPS_MAX 0 #define _POSIX_OPEN_MAX 16 #define _POSIX_PATH_MAX 255 #define _POSIX_TZNAME_MAX 3 #endif # 63 "/usr/include/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 65 "/usr/include/limits.h" 3 4 #define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ #define BC_DIM_MAX 2048 /* max array elements in bc(1) */ #define BC_SCALE_MAX 99 /* max scale value in bc(1) */ #define BC_STRING_MAX 1000 /* max const string length in bc(1) */ #define CHARCLASS_NAME_MAX 14 /* max character class name size */ #define COLL_WEIGHTS_MAX 10 /* max weights for order keyword */ #define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ #define LINE_MAX 2048 /* max bytes in an input line */ #define RE_DUP_MAX 255 /* max RE's in interval notation */ #define _POSIX2_BC_BASE_MAX 99 #define _POSIX2_BC_DIM_MAX 2048 #define _POSIX2_BC_SCALE_MAX 99 #define _POSIX2_BC_STRING_MAX 1000 #define _POSIX2_CHARCLASS_NAME_MAX 14 #define _POSIX2_COLL_WEIGHTS_MAX 2 #define _POSIX2_EQUIV_CLASS_MAX 2 #define _POSIX2_EXPR_NEST_MAX 32 #define _POSIX2_LINE_MAX 2048 #define _POSIX2_RE_DUP_MAX 255 #endif # 86 "/usr/include/limits.h" 3 4 #endif # 87 "/usr/include/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199309 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 89 "/usr/include/limits.h" 3 4 #define _POSIX_AIO_LISTIO_MAX 2 #define _POSIX_AIO_MAX 1 #define _POSIX_DELAYTIMER_MAX 32 #define _POSIX_MQ_OPEN_MAX 8 #define _POSIX_MQ_PRIO_MAX 32 #define _POSIX_RTSIG_MAX 8 #define _POSIX_SEM_NSEMS_MAX 256 #define _POSIX_SEM_VALUE_MAX 32767 #define _POSIX_SIGQUEUE_MAX 32 #define _POSIX_TIMER_MAX 32 #define _POSIX_CLOCKRES_MIN 20000000 #endif # 102 "/usr/include/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 104 "/usr/include/limits.h" 3 4 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 #define _POSIX_THREAD_KEYS_MAX 128 #define _POSIX_THREAD_THREADS_MAX 64 #endif # 108 "/usr/include/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 110 "/usr/include/limits.h" 3 4 #define _POSIX_HOST_NAME_MAX 255 #define _POSIX_LOGIN_NAME_MAX 9 #define _POSIX_SS_REPL_MAX 4 #define _POSIX_SYMLINK_MAX 255 #define _POSIX_SYMLOOP_MAX 8 #define _POSIX_TRACE_EVENT_NAME_MAX 30 #define _POSIX_TRACE_NAME_MAX 8 #define _POSIX_TRACE_SYS_MAX 8 #define _POSIX_TRACE_USER_EVENT_MAX 32 #define _POSIX_TTY_NAME_MAX 9 #define _POSIX_RE_DUP_MAX _POSIX2_RE_DUP_MAX #endif # 123 "/usr/include/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 125 "/usr/include/limits.h" 3 4 #define NL_ARGMAX 4096 /* max # of position args for printf */ #define NL_MSGMAX 32767 #define NL_SETMAX 255 #define NL_TEXTMAX 2048 #endif # 130 "/usr/include/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 132 "/usr/include/limits.h" 3 4 #define _XOPEN_IOV_MAX 16 #define _XOPEN_NAME_MAX 255 #define _XOPEN_PATH_MAX 1024 #define PASS_MAX 128 /* _PASSWORD_LEN from */ #define NL_LANGMAX 31 /* max LANG name length */ #define NL_NMAX 1 #endif # 140 "/usr/include/limits.h" 3 4 #define MB_LEN_MAX 6 /* 31-bit UTF-8 */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 143 "/usr/include/limits.h" 3 4 # 144 "/usr/include/limits.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 146 "/usr/include/limits.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 146 "/usr/include/limits.h" 3 4 # 147 "/usr/include/limits.h" 3 4 #endif # 148 "/usr/include/limits.h" 3 4 #endif /* !_LIMITS_H_ */ # 150 "/usr/include/limits.h" 3 4 # 301 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 301 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/search.h" 1 3 4 /*- * Written by J.T. Conklin * Public domain. * * $NetBSD: search.h,v 1.16 2005/02/03 04:39:32 perry Exp $ * $FreeBSD$ */ #ifndef _SEARCH_H_ #define _SEARCH_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 12 "/usr/include/search.h" 3 4 # 13 "/usr/include/search.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 13 "/usr/include/search.h" 3 4 # 14 "/usr/include/search.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 19 "/usr/include/search.h" 3 4 typedef struct entry { char *key; void *data; } ENTRY; typedef enum { FIND, ENTER } ACTION; typedef enum { preorder, postorder, endorder, leaf } VISIT; #ifdef _SEARCH_PRIVATE typedef struct __posix_tnode { void *key; struct __posix_tnode *llink, *rlink; signed char balance; } posix_tnode; struct que_elem { struct que_elem *next; struct que_elem *prev; }; #else # 48 "/usr/include/search.h" 3 4 typedef void posix_tnode; #endif # 50 "/usr/include/search.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 52 "/usr/include/search.h" 3 4 struct hsearch_data { struct __hsearch *__hsearch; }; #endif # 56 "/usr/include/search.h" 3 4 __BEGIN_DECLS int hcreate(size_t); void hdestroy(void); ENTRY *hsearch(ENTRY, ACTION); void insque(void *, void *); void *lfind(const void *, const void *, size_t *, size_t, int (*)(const void *, const void *)); void *lsearch(const void *, void *, size_t *, size_t, int (*)(const void *, const void *)); void remque(void *); void *tdelete(const void * __restrict, posix_tnode ** __restrict, int (*)(const void *, const void *)); posix_tnode * tfind(const void *, posix_tnode * const *, int (*)(const void *, const void *)); posix_tnode * tsearch(const void *, posix_tnode **, int (*)(const void *, const void *)); void twalk(const posix_tnode *, void (*)(const posix_tnode *, VISIT, int)); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 78 "/usr/include/search.h" 3 4 int hcreate_r(size_t, struct hsearch_data *); void hdestroy_r(struct hsearch_data *); int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *); #endif # 82 "/usr/include/search.h" 3 4 __END_DECLS #endif /* !_SEARCH_H_ */ # 86 "/usr/include/search.h" 3 4 # 302 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* disabled by -frewrite-includes */ #if USE_POSIX_SEM #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 303 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 303 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/semaphore.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 David Xu * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ /* semaphore.h: POSIX 1003.1b semaphores */ #ifndef _SEMAPHORE_H_ #define _SEMAPHORE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/semaphore.h" 3 4 # 38 "/usr/include/semaphore.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/semaphore.h" 3 4 # 39 "/usr/include/semaphore.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/semaphore.h" 3 4 # 1 "/usr/include/sys/_umtx.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010, David Xu * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ * */ #ifndef _SYS__UMTX_H_ #define _SYS__UMTX_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/sys/_umtx.h" 3 4 # 36 "/usr/include/sys/_umtx.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/sys/_umtx.h" 3 4 # 37 "/usr/include/sys/_umtx.h" 3 4 struct umtx { volatile unsigned long u_owner; /* Owner of the mutex. */ }; struct umutex { volatile __lwpid_t m_owner; /* Owner of the mutex */ __uint32_t m_flags; /* Flags of the mutex */ __uint32_t m_ceilings[2]; /* Priority protect ceiling */ __uintptr_t m_rb_lnk; /* Robust linkage */ #ifndef __LP64__ __uint32_t m_pad; #endif # 50 "/usr/include/sys/_umtx.h" 3 4 __uint32_t m_spare[2]; }; struct ucond { volatile __uint32_t c_has_waiters; /* Has waiters in kernel */ __uint32_t c_flags; /* Flags of the condition variable */ __uint32_t c_clockid; /* Clock id */ __uint32_t c_spare[1]; /* Spare space */ }; struct urwlock { volatile __int32_t rw_state; __uint32_t rw_flags; __uint32_t rw_blocked_readers; __uint32_t rw_blocked_writers; __uint32_t rw_spare[4]; }; struct _usem { volatile __uint32_t _has_waiters; volatile __uint32_t _count; __uint32_t _flags; }; struct _usem2 { volatile __uint32_t _count; /* Waiters flag in high bit. */ __uint32_t _flags; }; struct _umtx_time { struct timespec _timeout; __uint32_t _flags; __uint32_t _clockid; }; #endif /* !_SYS__UMTX_H_ */ # 86 "/usr/include/sys/_umtx.h" 3 4 # 40 "/usr/include/semaphore.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/semaphore.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_limits.h" 3 4 # 7 "/usr/include/machine/_limits.h" 3 4 # 42 "/usr/include/semaphore.h" 2 3 4 struct _sem { __uint32_t _magic; struct _usem2 _kern; __uint32_t _padding; /* Preserve structure size */ }; typedef struct _sem sem_t; #define SEM_FAILED ((sem_t *)0) #define SEM_VALUE_MAX __INT_MAX struct timespec; __BEGIN_DECLS #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 58 "/usr/include/semaphore.h" 3 4 int sem_clockwait_np(sem_t * __restrict, __clockid_t, int, const struct timespec *, struct timespec *); #endif # 61 "/usr/include/semaphore.h" 3 4 int sem_close(sem_t *); int sem_destroy(sem_t *); int sem_getvalue(sem_t * __restrict, int * __restrict); int sem_init(sem_t *, int, unsigned int); sem_t *sem_open(const char *, int, ...); int sem_post(sem_t *); int sem_timedwait(sem_t * __restrict, const struct timespec * __restrict); int sem_trywait(sem_t *); int sem_unlink(const char *); int sem_wait(sem_t *); __END_DECLS #endif /* !_SEMAPHORE_H_ */ # 74 "/usr/include/semaphore.h" 3 4 # 304 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #endif # 305 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 305 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/signal.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)signal.h 8.3 (Berkeley) 3/30/94 * $FreeBSD$ */ #ifndef _SIGNAL_H_ #define _SIGNAL_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/signal.h" 3 4 # 39 "/usr/include/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/signal.h" 3 4 # 40 "/usr/include/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/signal.h" 3 4 # 41 "/usr/include/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 42 "/usr/include/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/usr/include/signal.h" 3 4 # 1 "/usr/include/machine/ucontext.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/ucontext.h" 3 4 # 1 "/usr/include/x86/ucontext.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2003 Peter Wemm * Copyright (c) 1999 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _X86_UCONTEXT_H_ #define _X86_UCONTEXT_H_ #ifdef __i386__ /* Keep _MC_* values similar to amd64 */ #define _MC_HASSEGS 0x1 #define _MC_HASBASES 0x2 #define _MC_HASFPXSTATE 0x4 #define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE) typedef struct __mcontext { /* * The definition of mcontext_t must match the layout of * struct sigcontext after the sc_mask member. This is so * that we can support sigcontext and ucontext_t at the same * time. */ __register_t mc_onstack; /* XXX - sigcontext compat. */ __register_t mc_gs; /* machine state (struct trapframe) */ __register_t mc_fs; __register_t mc_es; __register_t mc_ds; __register_t mc_edi; __register_t mc_esi; __register_t mc_ebp; __register_t mc_isp; __register_t mc_ebx; __register_t mc_edx; __register_t mc_ecx; __register_t mc_eax; __register_t mc_trapno; __register_t mc_err; __register_t mc_eip; __register_t mc_cs; __register_t mc_eflags; __register_t mc_esp; __register_t mc_ss; int mc_len; /* sizeof(mcontext_t) */ #define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */ #define _MC_FPFMT_387 0x10001 #define _MC_FPFMT_XMM 0x10002 int mc_fpformat; #define _MC_FPOWNED_NONE 0x20000 /* FP state not used */ #define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */ #define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */ int mc_ownedfp; __register_t mc_flags; /* * See for the internals of mc_fpstate[]. */ int mc_fpstate[128] __aligned(16); __register_t mc_fsbase; __register_t mc_gsbase; __register_t mc_xfpustate; __register_t mc_xfpustate_len; int mc_spare2[4]; } mcontext_t; #endif /* __i386__ */ # 96 "/usr/include/x86/ucontext.h" 3 4 #ifdef __amd64__ /* * mc_flags bits. Shall be in sync with TF_XXX. */ #define _MC_HASSEGS 0x1 #define _MC_HASBASES 0x2 #define _MC_HASFPXSTATE 0x4 #define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE) typedef struct __mcontext { /* * The definition of mcontext_t must match the layout of * struct sigcontext after the sc_mask member. This is so * that we can support sigcontext and ucontext_t at the same * time. */ __register_t mc_onstack; /* XXX - sigcontext compat. */ __register_t mc_rdi; /* machine state (struct trapframe) */ __register_t mc_rsi; __register_t mc_rdx; __register_t mc_rcx; __register_t mc_r8; __register_t mc_r9; __register_t mc_rax; __register_t mc_rbx; __register_t mc_rbp; __register_t mc_r10; __register_t mc_r11; __register_t mc_r12; __register_t mc_r13; __register_t mc_r14; __register_t mc_r15; __uint32_t mc_trapno; __uint16_t mc_fs; __uint16_t mc_gs; __register_t mc_addr; __uint32_t mc_flags; __uint16_t mc_es; __uint16_t mc_ds; __register_t mc_err; __register_t mc_rip; __register_t mc_cs; __register_t mc_rflags; __register_t mc_rsp; __register_t mc_ss; long mc_len; /* sizeof(mcontext_t) */ #define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */ #define _MC_FPFMT_XMM 0x10002 long mc_fpformat; #define _MC_FPOWNED_NONE 0x20000 /* FP state not used */ #define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */ #define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */ long mc_ownedfp; /* * See for the internals of mc_fpstate[]. */ long mc_fpstate[64] __aligned(16); __register_t mc_fsbase; __register_t mc_gsbase; __register_t mc_xfpustate; __register_t mc_xfpustate_len; long mc_spare[4]; } mcontext_t; #endif /* __amd64__ */ # 166 "/usr/include/x86/ucontext.h" 3 4 #endif /* !_X86_UCONTEXT_H_ */ # 168 "/usr/include/x86/ucontext.h" 3 4 # 7 "/usr/include/machine/ucontext.h" 2 3 4 # 43 "/usr/include/signal.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/include/signal.h" 3 4 # 1 "/usr/include/sys/_ucontext.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1999 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__UCONTEXT_H_ #define _SYS__UCONTEXT_H_ typedef struct __ucontext { /* * Keep the order of the first two fields. Also, * keep them the first two fields in the structure. * This way we can have a union with struct * sigcontext and ucontext_t. This allows us to * support them both at the same time. * note: the union is not defined, though. */ __sigset_t uc_sigmask; mcontext_t uc_mcontext; struct __ucontext *uc_link; struct __stack_t uc_stack; int uc_flags; int __spare__[4]; } ucontext_t; #endif /* _SYS__UCONTEXT_H */ # 55 "/usr/include/sys/_ucontext.h" 3 4 # 44 "/usr/include/signal.h" 2 3 4 #endif # 45 "/usr/include/signal.h" 3 4 __NULLABILITY_PRAGMA_PUSH #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 49 "/usr/include/signal.h" 3 4 /* * XXX should enlarge these, if only to give empty names instead of bounds * errors for large signal numbers. */ extern const char * const sys_signame[NSIG]; extern const char * const sys_siglist[NSIG]; extern const int sys_nsig; #endif # 57 "/usr/include/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 59 "/usr/include/signal.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif # 63 "/usr/include/signal.h" 3 4 #endif # 64 "/usr/include/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 66 "/usr/include/signal.h" 3 4 struct pthread; /* XXX */ typedef struct pthread *__pthread_t; #if 0 /* disabled by -frewrite-includes */ #if !defined(_PTHREAD_T_DECLARED) && __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 69 "/usr/include/signal.h" 3 4 typedef __pthread_t pthread_t; #define _PTHREAD_T_DECLARED #endif # 72 "/usr/include/signal.h" 3 4 #endif /* __POSIX_VISIBLE || __XSI_VISIBLE */ # 73 "/usr/include/signal.h" 3 4 __BEGIN_DECLS int raise(int); #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 78 "/usr/include/signal.h" 3 4 int kill(__pid_t, int); int pthread_kill(__pthread_t, int); int pthread_sigmask(int, const __sigset_t * __restrict, __sigset_t * __restrict); int sigaction(int, const struct sigaction * __restrict, struct sigaction * __restrict); int sigaddset(sigset_t *, int); int sigdelset(sigset_t *, int); int sigemptyset(sigset_t *); int sigfillset(sigset_t *); int sigismember(const sigset_t *, int); int sigpending(sigset_t * _Nonnull); int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict); int sigsuspend(const sigset_t * _Nonnull); int sigwait(const sigset_t * _Nonnull __restrict, int * _Nonnull __restrict); #endif # 95 "/usr/include/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 97 "/usr/include/signal.h" 3 4 int sigqueue(__pid_t, int, const union sigval); struct timespec; int sigtimedwait(const sigset_t * __restrict, siginfo_t * __restrict, const struct timespec * __restrict); int sigwaitinfo(const sigset_t * __restrict, siginfo_t * __restrict); #endif # 104 "/usr/include/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 106 "/usr/include/signal.h" 3 4 int killpg(__pid_t, int); int sigaltstack(const stack_t * __restrict, stack_t * __restrict); int sighold(int); int sigignore(int); int sigpause(int); int sigrelse(int); void (* _Nullable sigset(int, void (* _Nullable)(int)))(int); int xsi_sigpause(int); #endif # 115 "/usr/include/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE >= 600 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 117 "/usr/include/signal.h" 3 4 int siginterrupt(int, int); #endif # 119 "/usr/include/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 121 "/usr/include/signal.h" 3 4 void psignal(int, const char *); #endif # 123 "/usr/include/signal.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 125 "/usr/include/signal.h" 3 4 int sigandset(sigset_t *dest, const sigset_t *left, const sigset_t *right); int sigblock(int); int sigisemptyset(const sigset_t *set); int sigorset(sigset_t *dest, const sigset_t *left, const sigset_t *right); int sigreturn(const struct __ucontext *); int sigsetmask(int); int sigstack(const struct sigstack *, struct sigstack *); int sigvec(int, struct sigvec *, struct sigvec *); #endif # 134 "/usr/include/signal.h" 3 4 __END_DECLS __NULLABILITY_PRAGMA_POP #endif /* !_SIGNAL_H_ */ # 138 "/usr/include/signal.h" 3 4 # 306 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 306 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/stdarg.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/stdarg.h" 3 4 # 7 "/usr/include/stdarg.h" 3 4 # 307 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 307 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 308 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 308 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 309 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 309 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 310 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 310 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/stdlib.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 * $FreeBSD$ */ #ifndef _STDLIB_H_ #define _STDLIB_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/stdlib.h" 3 4 # 39 "/usr/include/stdlib.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/stdlib.h" 3 4 # 40 "/usr/include/stdlib.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/stdlib.h" 3 4 # 41 "/usr/include/stdlib.h" 3 4 __NULLABILITY_PRAGMA_PUSH #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 45 "/usr/include/stdlib.h" 3 4 #ifndef _RUNE_T_DECLARED typedef __rune_t rune_t; #define _RUNE_T_DECLARED #endif # 49 "/usr/include/stdlib.h" 3 4 #endif # 50 "/usr/include/stdlib.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 55 "/usr/include/stdlib.h" 3 4 #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 61 "/usr/include/stdlib.h" 3 4 #endif # 62 "/usr/include/stdlib.h" 3 4 typedef struct { int quot; /* quotient */ int rem; /* remainder */ } div_t; typedef struct { long quot; long rem; } ldiv_t; #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 /* * I.e., INT_MAX; rand(3) returns a signed integer but must produce output in * the range [0, RAND_MAX], so half of the possible output range is unused. */ #define RAND_MAX 0x7fffffff __BEGIN_DECLS #ifdef _XLOCALE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 84 "/usr/include/stdlib.h" 3 4 # 85 "/usr/include/stdlib.h" 3 4 #endif # 86 "/usr/include/stdlib.h" 3 4 extern int __mb_cur_max; extern int ___mb_cur_max(void); #define MB_CUR_MAX ((size_t)___mb_cur_max()) _Noreturn void abort(void); int abs(int) __pure2; int atexit(void (* _Nonnull)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void * _Nonnull, const void *)); void *calloc(size_t, size_t) __malloc_like __result_use_check __alloc_size2(1, 2); div_t div(int, int) __pure2; _Noreturn void exit(int); void free(void *); char *getenv(const char *); long labs(long) __pure2; ldiv_t ldiv(long, long) __pure2; void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1); int mblen(const char *, size_t); size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); void qsort(void *, size_t, size_t, int (* _Nonnull)(const void *, const void *)); int rand(void); void *realloc(void *, size_t) __result_use_check __alloc_size(2); void srand(unsigned); double strtod(const char * __restrict, char ** __restrict); float strtof(const char * __restrict, char ** __restrict); long strtol(const char * __restrict, char ** __restrict, int); long double strtold(const char * __restrict, char ** __restrict); unsigned long strtoul(const char * __restrict, char ** __restrict, int); int system(const char *); int wctomb(char *, wchar_t); size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); /* * Functions added in C99 which we make conditionally available in the * BSD^C89 namespace if the compiler supports `long long'. * The #if test is more complicated than it ought to be because * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long' * is not supported in the compilation environment (which therefore means * that it can't really be ISO C99). * * (The only other extension made by C99 in thie header is _Exit().) */ #if 0 /* disabled by -frewrite-includes */ #if __ISO_C_VISIBLE >= 1999 || defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 137 "/usr/include/stdlib.h" 3 4 #ifdef __LONG_LONG_SUPPORTED /* LONGLONG */ typedef struct { long long quot; long long rem; } lldiv_t; /* LONGLONG */ long long atoll(const char *); /* LONGLONG */ long long llabs(long long) __pure2; /* LONGLONG */ lldiv_t lldiv(long long, long long) __pure2; /* LONGLONG */ long long strtoll(const char * __restrict, char ** __restrict, int); /* LONGLONG */ unsigned long long strtoull(const char * __restrict, char ** __restrict, int); #endif /* __LONG_LONG_SUPPORTED */ # 159 "/usr/include/stdlib.h" 3 4 _Noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ # 162 "/usr/include/stdlib.h" 3 4 /* * If we're in a mode greater than C99, expose C11 functions. */ #if 0 /* disabled by -frewrite-includes */ #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 167 "/usr/include/stdlib.h" 3 4 void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1) __alloc_size(2); int at_quick_exit(void (*)(void)); _Noreturn void quick_exit(int); #endif /* __ISO_C_VISIBLE >= 2011 */ # 173 "/usr/include/stdlib.h" 3 4 /* * Extensions made by POSIX relative to C. */ #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 177 "/usr/include/stdlib.h" 3 4 char *realpath(const char * __restrict, char * __restrict); #endif # 179 "/usr/include/stdlib.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 199506 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 180 "/usr/include/stdlib.h" 3 4 int rand_r(unsigned *); /* (TSF) */ #endif # 182 "/usr/include/stdlib.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200112 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 183 "/usr/include/stdlib.h" 3 4 int posix_memalign(void **, size_t, size_t); /* (ADV) */ int setenv(const char *, const char *, int); int unsetenv(const char *); #endif # 187 "/usr/include/stdlib.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 189 "/usr/include/stdlib.h" 3 4 int getsubopt(char **, char *const *, char **); #ifndef _MKDTEMP_DECLARED char *mkdtemp(char *); #define _MKDTEMP_DECLARED #endif # 194 "/usr/include/stdlib.h" 3 4 #ifndef _MKSTEMP_DECLARED int mkstemp(char *); #define _MKSTEMP_DECLARED #endif # 198 "/usr/include/stdlib.h" 3 4 #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ # 199 "/usr/include/stdlib.h" 3 4 /* * The only changes to the XSI namespace in revision 6 were the deletion * of the ttyslot() and valloc() functions, which FreeBSD never declared * in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which * FreeBSD also does not have, and mktemp(), are to be deleted. */ #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 207 "/usr/include/stdlib.h" 3 4 /* XXX XSI requires pollution from here. We'd rather not. */ long a64l(const char *); double drand48(void); /* char *ecvt(double, int, int * __restrict, int * __restrict); */ double erand48(unsigned short[3]); /* char *fcvt(double, int, int * __restrict, int * __restrict); */ /* char *gcvt(double, int, int * __restrict, int * __restrict); */ char *initstate(unsigned int, char *, size_t); long jrand48(unsigned short[3]); char *l64a(long); void lcong48(unsigned short[7]); long lrand48(void); #if 0 /* disabled by -frewrite-includes */ #if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 220 "/usr/include/stdlib.h" 3 4 char *mktemp(char *); #define _MKTEMP_DECLARED #endif # 223 "/usr/include/stdlib.h" 3 4 long mrand48(void); long nrand48(unsigned short[3]); int putenv(char *); long random(void); unsigned short *seed48(unsigned short[3]); char *setstate(/* const */ char *); void srand48(long); void srandom(unsigned int); #endif /* __XSI_VISIBLE */ # 233 "/usr/include/stdlib.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __XSI_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 235 "/usr/include/stdlib.h" 3 4 int grantpt(int); int posix_openpt(int); char *ptsname(int); int unlockpt(int); #endif /* __XSI_VISIBLE */ # 240 "/usr/include/stdlib.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 241 "/usr/include/stdlib.h" 3 4 /* ptsname_r will be included in POSIX issue 8 */ int ptsname_r(int, char *, size_t); #endif # 244 "/usr/include/stdlib.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 246 "/usr/include/stdlib.h" 3 4 extern const char *malloc_conf; extern void (*malloc_message)(void *, const char *); /* * The alloca() function can't be implemented in C, and on some * platforms it can't be implemented at all as a callable function. * The GNU C compiler provides a built-in alloca() which we can use. * On platforms where alloca() is not in libc, programs which use it * will fail to link when compiled with non-GNU compilers. */ #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ >= 2 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 257 "/usr/include/stdlib.h" 3 4 #undef alloca /* some GNU bits try to get cute and define this on their own */ #define alloca(sz) __builtin_alloca(sz) #endif # 260 "/usr/include/stdlib.h" 3 4 void abort2(const char *, int, void **) __dead2; __uint32_t arc4random(void); void arc4random_buf(void *, size_t); __uint32_t arc4random_uniform(__uint32_t); #ifdef __BLOCKS__ int atexit_b(void (^ _Nonnull)(void)); void *bsearch_b(const void *, const void *, size_t, size_t, int (^ _Nonnull)(const void *, const void *)); #endif # 273 "/usr/include/stdlib.h" 3 4 char *getbsize(int *, long *); /* getcap(3) functions */ char *cgetcap(char *, const char *, int); int cgetclose(void); int cgetent(char **, char **, const char *); int cgetfirst(char **, char **); int cgetmatch(const char *, const char *); int cgetnext(char **, char **); int cgetnum(char *, const char *, long *); int cgetset(const char *); int cgetstr(char *, const char *, char **); int cgetustr(char *, const char *, char **); int clearenv(void); int daemon(int, int); int daemonfd(int, int); char *devname(__dev_t, __mode_t); char *devname_r(__dev_t, __mode_t, char *, int); char *fdevname(int); char *fdevname_r(int, char *, int); int getloadavg(double [], int); const char * getprogname(void); int heapsort(void *, size_t, size_t, int (* _Nonnull)(const void *, const void *)); #ifdef __BLOCKS__ int heapsort_b(void *, size_t, size_t, int (^ _Nonnull)(const void *, const void *)); void qsort_b(void *, size_t, size_t, int (^ _Nonnull)(const void *, const void *)); #endif # 306 "/usr/include/stdlib.h" 3 4 int l64a_r(long, char *, int); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); #ifdef __BLOCKS__ int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *)); #endif # 311 "/usr/include/stdlib.h" 3 4 int mkostemp(char *, int); int mkostemps(char *, int, int); int mkostempsat(int, char *, int, int); void qsort_r(void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); int radixsort(const unsigned char **, int, const unsigned char *, unsigned); void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size2(2, 3); void *reallocf(void *, size_t) __result_use_check __alloc_size(2); int rpmatch(const char *); void setprogname(const char *); int sradixsort(const unsigned char **, int, const unsigned char *, unsigned); void srandomdev(void); long long strtonum(const char *, long long, long long, const char **); /* Deprecated interfaces, to be removed. */ __int64_t strtoq(const char *, char **, int); __uint64_t strtouq(const char *, char **, int); /* * In FreeBSD 14, the prototype of qsort_r() was modified to comply with * POSIX. The standardized qsort_r()'s order of last two parameters was * changed, and the comparator function is now taking thunk as its last * parameter, and both are different from the ones expected by the historical * FreeBSD qsort_r() interface. * * Apply a workaround where we explicitly link against the historical * interface, qsort_r@FBSD_1.0, in case when qsort_r() is called with * the last parameter with a function pointer that exactly matches the * historical FreeBSD qsort_r() comparator signature, so applications * written for the historical interface can continue to work without * modification. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__generic) || defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 350 "/usr/include/stdlib.h" 3 4 void __qsort_r_compat(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); __sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0); #endif # 354 "/usr/include/stdlib.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(__generic) && !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 355 "/usr/include/stdlib.h" 3 4 #define qsort_r(base, nel, width, arg4, arg5) \ __generic(arg5, int (*)(void *, const void *, const void *), \ __qsort_r_compat, qsort_r)(base, nel, width, arg4, arg5) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 359 "/usr/include/stdlib.h" 3 4 __END_DECLS extern "C++" { static inline void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *)) { __qsort_r_compat(base, nmemb, size, thunk, compar); } } __BEGIN_DECLS #endif # 368 "/usr/include/stdlib.h" 3 4 extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* __BSD_VISIBLE */ # 371 "/usr/include/stdlib.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __EXT1_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 373 "/usr/include/stdlib.h" 3 4 #ifndef _RSIZE_T_DEFINED #define _RSIZE_T_DEFINED typedef size_t rsize_t; #endif # 378 "/usr/include/stdlib.h" 3 4 #ifndef _ERRNO_T_DEFINED #define _ERRNO_T_DEFINED typedef int errno_t; #endif # 383 "/usr/include/stdlib.h" 3 4 /* K.3.6 */ typedef void (*constraint_handler_t)(const char * __restrict, void * __restrict, errno_t); /* K.3.6.1.1 */ constraint_handler_t set_constraint_handler_s(constraint_handler_t handler); /* K.3.6.1.2 */ _Noreturn void abort_handler_s(const char * __restrict, void * __restrict, errno_t); /* K3.6.1.3 */ void ignore_handler_s(const char * __restrict, void * __restrict, errno_t); /* K.3.6.3.2 */ errno_t qsort_s(void *, rsize_t, rsize_t, int (*)(const void *, const void *, void *), void *); #endif /* __EXT1_VISIBLE */ # 398 "/usr/include/stdlib.h" 3 4 __END_DECLS __NULLABILITY_PRAGMA_POP #endif /* !_STDLIB_H_ */ # 403 "/usr/include/stdlib.h" 3 4 # 311 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 311 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 312 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 313 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 313 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 314 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 315 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 316 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 316 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 317 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 317 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 318 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 319 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 319 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/inttypes.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _INTTYPES_H_ #define _INTTYPES_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/include/inttypes.h" 3 4 # 1 "/usr/include/machine/_inttypes.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_inttypes.h" 3 4 # 1 "/usr/include/x86/_inttypes.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-NetBSD * * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Klaus Klein. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ * $FreeBSD$ */ #ifndef _MACHINE_INTTYPES_H_ #define _MACHINE_INTTYPES_H_ /* * Macros for format specifiers. */ #ifdef __LP64__ #define __PRI64 "l" #define __PRIptr "l" #else # 46 "/usr/include/x86/_inttypes.h" 3 4 #define __PRI64 "ll" #define __PRIptr #endif # 49 "/usr/include/x86/_inttypes.h" 3 4 /* fprintf(3) macros for signed integers. */ #define PRId8 "d" /* int8_t */ #define PRId16 "d" /* int16_t */ #define PRId32 "d" /* int32_t */ #define PRId64 __PRI64"d" /* int64_t */ #define PRIdLEAST8 "d" /* int_least8_t */ #define PRIdLEAST16 "d" /* int_least16_t */ #define PRIdLEAST32 "d" /* int_least32_t */ #define PRIdLEAST64 __PRI64"d" /* int_least64_t */ #define PRIdFAST8 "d" /* int_fast8_t */ #define PRIdFAST16 "d" /* int_fast16_t */ #define PRIdFAST32 "d" /* int_fast32_t */ #define PRIdFAST64 __PRI64"d" /* int_fast64_t */ #define PRIdMAX "jd" /* intmax_t */ #define PRIdPTR __PRIptr"d" /* intptr_t */ #define PRIi8 "i" /* int8_t */ #define PRIi16 "i" /* int16_t */ #define PRIi32 "i" /* int32_t */ #define PRIi64 __PRI64"i" /* int64_t */ #define PRIiLEAST8 "i" /* int_least8_t */ #define PRIiLEAST16 "i" /* int_least16_t */ #define PRIiLEAST32 "i" /* int_least32_t */ #define PRIiLEAST64 __PRI64"i" /* int_least64_t */ #define PRIiFAST8 "i" /* int_fast8_t */ #define PRIiFAST16 "i" /* int_fast16_t */ #define PRIiFAST32 "i" /* int_fast32_t */ #define PRIiFAST64 __PRI64"i" /* int_fast64_t */ #define PRIiMAX "ji" /* intmax_t */ #define PRIiPTR __PRIptr"i" /* intptr_t */ /* fprintf(3) macros for unsigned integers. */ #define PRIo8 "o" /* uint8_t */ #define PRIo16 "o" /* uint16_t */ #define PRIo32 "o" /* uint32_t */ #define PRIo64 __PRI64"o" /* uint64_t */ #define PRIoLEAST8 "o" /* uint_least8_t */ #define PRIoLEAST16 "o" /* uint_least16_t */ #define PRIoLEAST32 "o" /* uint_least32_t */ #define PRIoLEAST64 __PRI64"o" /* uint_least64_t */ #define PRIoFAST8 "o" /* uint_fast8_t */ #define PRIoFAST16 "o" /* uint_fast16_t */ #define PRIoFAST32 "o" /* uint_fast32_t */ #define PRIoFAST64 __PRI64"o" /* uint_fast64_t */ #define PRIoMAX "jo" /* uintmax_t */ #define PRIoPTR __PRIptr"o" /* uintptr_t */ #define PRIu8 "u" /* uint8_t */ #define PRIu16 "u" /* uint16_t */ #define PRIu32 "u" /* uint32_t */ #define PRIu64 __PRI64"u" /* uint64_t */ #define PRIuLEAST8 "u" /* uint_least8_t */ #define PRIuLEAST16 "u" /* uint_least16_t */ #define PRIuLEAST32 "u" /* uint_least32_t */ #define PRIuLEAST64 __PRI64"u" /* uint_least64_t */ #define PRIuFAST8 "u" /* uint_fast8_t */ #define PRIuFAST16 "u" /* uint_fast16_t */ #define PRIuFAST32 "u" /* uint_fast32_t */ #define PRIuFAST64 __PRI64"u" /* uint_fast64_t */ #define PRIuMAX "ju" /* uintmax_t */ #define PRIuPTR __PRIptr"u" /* uintptr_t */ #define PRIx8 "x" /* uint8_t */ #define PRIx16 "x" /* uint16_t */ #define PRIx32 "x" /* uint32_t */ #define PRIx64 __PRI64"x" /* uint64_t */ #define PRIxLEAST8 "x" /* uint_least8_t */ #define PRIxLEAST16 "x" /* uint_least16_t */ #define PRIxLEAST32 "x" /* uint_least32_t */ #define PRIxLEAST64 __PRI64"x" /* uint_least64_t */ #define PRIxFAST8 "x" /* uint_fast8_t */ #define PRIxFAST16 "x" /* uint_fast16_t */ #define PRIxFAST32 "x" /* uint_fast32_t */ #define PRIxFAST64 __PRI64"x" /* uint_fast64_t */ #define PRIxMAX "jx" /* uintmax_t */ #define PRIxPTR __PRIptr"x" /* uintptr_t */ #define PRIX8 "X" /* uint8_t */ #define PRIX16 "X" /* uint16_t */ #define PRIX32 "X" /* uint32_t */ #define PRIX64 __PRI64"X" /* uint64_t */ #define PRIXLEAST8 "X" /* uint_least8_t */ #define PRIXLEAST16 "X" /* uint_least16_t */ #define PRIXLEAST32 "X" /* uint_least32_t */ #define PRIXLEAST64 __PRI64"X" /* uint_least64_t */ #define PRIXFAST8 "X" /* uint_fast8_t */ #define PRIXFAST16 "X" /* uint_fast16_t */ #define PRIXFAST32 "X" /* uint_fast32_t */ #define PRIXFAST64 __PRI64"X" /* uint_fast64_t */ #define PRIXMAX "jX" /* uintmax_t */ #define PRIXPTR __PRIptr"X" /* uintptr_t */ /* fscanf(3) macros for signed integers. */ #define SCNd8 "hhd" /* int8_t */ #define SCNd16 "hd" /* int16_t */ #define SCNd32 "d" /* int32_t */ #define SCNd64 __PRI64"d" /* int64_t */ #define SCNdLEAST8 "hhd" /* int_least8_t */ #define SCNdLEAST16 "hd" /* int_least16_t */ #define SCNdLEAST32 "d" /* int_least32_t */ #define SCNdLEAST64 __PRI64"d" /* int_least64_t */ #define SCNdFAST8 "d" /* int_fast8_t */ #define SCNdFAST16 "d" /* int_fast16_t */ #define SCNdFAST32 "d" /* int_fast32_t */ #define SCNdFAST64 __PRI64"d" /* int_fast64_t */ #define SCNdMAX "jd" /* intmax_t */ #define SCNdPTR __PRIptr"d" /* intptr_t */ #define SCNi8 "hhi" /* int8_t */ #define SCNi16 "hi" /* int16_t */ #define SCNi32 "i" /* int32_t */ #define SCNi64 __PRI64"i" /* int64_t */ #define SCNiLEAST8 "hhi" /* int_least8_t */ #define SCNiLEAST16 "hi" /* int_least16_t */ #define SCNiLEAST32 "i" /* int_least32_t */ #define SCNiLEAST64 __PRI64"i" /* int_least64_t */ #define SCNiFAST8 "i" /* int_fast8_t */ #define SCNiFAST16 "i" /* int_fast16_t */ #define SCNiFAST32 "i" /* int_fast32_t */ #define SCNiFAST64 __PRI64"i" /* int_fast64_t */ #define SCNiMAX "ji" /* intmax_t */ #define SCNiPTR __PRIptr"i" /* intptr_t */ /* fscanf(3) macros for unsigned integers. */ #define SCNo8 "hho" /* uint8_t */ #define SCNo16 "ho" /* uint16_t */ #define SCNo32 "o" /* uint32_t */ #define SCNo64 __PRI64"o" /* uint64_t */ #define SCNoLEAST8 "hho" /* uint_least8_t */ #define SCNoLEAST16 "ho" /* uint_least16_t */ #define SCNoLEAST32 "o" /* uint_least32_t */ #define SCNoLEAST64 __PRI64"o" /* uint_least64_t */ #define SCNoFAST8 "o" /* uint_fast8_t */ #define SCNoFAST16 "o" /* uint_fast16_t */ #define SCNoFAST32 "o" /* uint_fast32_t */ #define SCNoFAST64 __PRI64"o" /* uint_fast64_t */ #define SCNoMAX "jo" /* uintmax_t */ #define SCNoPTR __PRIptr"o" /* uintptr_t */ #define SCNu8 "hhu" /* uint8_t */ #define SCNu16 "hu" /* uint16_t */ #define SCNu32 "u" /* uint32_t */ #define SCNu64 __PRI64"u" /* uint64_t */ #define SCNuLEAST8 "hhu" /* uint_least8_t */ #define SCNuLEAST16 "hu" /* uint_least16_t */ #define SCNuLEAST32 "u" /* uint_least32_t */ #define SCNuLEAST64 __PRI64"u" /* uint_least64_t */ #define SCNuFAST8 "u" /* uint_fast8_t */ #define SCNuFAST16 "u" /* uint_fast16_t */ #define SCNuFAST32 "u" /* uint_fast32_t */ #define SCNuFAST64 __PRI64"u" /* uint_fast64_t */ #define SCNuMAX "ju" /* uintmax_t */ #define SCNuPTR __PRIptr"u" /* uintptr_t */ #define SCNx8 "hhx" /* uint8_t */ #define SCNx16 "hx" /* uint16_t */ #define SCNx32 "x" /* uint32_t */ #define SCNx64 __PRI64"x" /* uint64_t */ #define SCNxLEAST8 "hhx" /* uint_least8_t */ #define SCNxLEAST16 "hx" /* uint_least16_t */ #define SCNxLEAST32 "x" /* uint_least32_t */ #define SCNxLEAST64 __PRI64"x" /* uint_least64_t */ #define SCNxFAST8 "x" /* uint_fast8_t */ #define SCNxFAST16 "x" /* uint_fast16_t */ #define SCNxFAST32 "x" /* uint_fast32_t */ #define SCNxFAST64 __PRI64"x" /* uint_fast64_t */ #define SCNxMAX "jx" /* uintmax_t */ #define SCNxPTR __PRIptr"x" /* uintptr_t */ #endif /* !_MACHINE_INTTYPES_H_ */ # 224 "/usr/include/x86/_inttypes.h" 3 4 # 7 "/usr/include/machine/_inttypes.h" 2 3 4 # 35 "/usr/include/inttypes.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/inttypes.h" 3 4 # 36 "/usr/include/inttypes.h" 3 4 #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 42 "/usr/include/inttypes.h" 3 4 #endif # 43 "/usr/include/inttypes.h" 3 4 typedef struct { intmax_t quot; /* Quotient. */ intmax_t rem; /* Remainder. */ } imaxdiv_t; __BEGIN_DECLS #ifdef _XLOCALE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 51 "/usr/include/inttypes.h" 3 4 # 52 "/usr/include/inttypes.h" 3 4 #endif # 53 "/usr/include/inttypes.h" 3 4 intmax_t imaxabs(intmax_t) __pure2; imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2; intmax_t strtoimax(const char * __restrict, char ** __restrict, int); uintmax_t strtoumax(const char * __restrict, char ** __restrict, int); intmax_t wcstoimax(const wchar_t * __restrict, wchar_t ** __restrict, int); uintmax_t wcstoumax(const wchar_t * __restrict, wchar_t ** __restrict, int); __END_DECLS #endif /* !_INTTYPES_H_ */ # 65 "/usr/include/inttypes.h" 3 4 # 320 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 /* More #includes at EOF (dependent on the contents of internal.h) ... */ __BEGIN_DECLS /* SPI for Libsystem-internal use */ DISPATCH_EXPORT DISPATCH_NOTHROW void libdispatch_init(void); #if 0 /* disabled by -frewrite-includes */ #if !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 328 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_prepare(void); DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_parent(void); DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void); #endif # 332 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" // Abort on uncaught exceptions thrown from client callouts rdar://8577499 #if 0 /* disabled by -frewrite-includes */ #if !defined(DISPATCH_USE_CLIENT_CALLOUT) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 335 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_CLIENT_CALLOUT 1 #endif # 337 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_ALLOW_NON_LEAF_RETARGET 1 /* The "_debug" library build */ #ifndef DISPATCH_DEBUG #define DISPATCH_DEBUG 0 #endif # 344 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_PROFILE #define DISPATCH_PROFILE 0 #endif # 348 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if (TARGET_OS_OSX || DISPATCH_DEBUG || DISPATCH_PROFILE) && \ !defined(DISPATCH_USE_DTRACE) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 351 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_DTRACE 1 #endif # 353 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DTRACE && (DISPATCH_INTROSPECTION || DISPATCH_DEBUG || \ DISPATCH_PROFILE) && !defined(DISPATCH_USE_DTRACE_INTROSPECTION) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 356 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_DTRACE_INTROSPECTION 1 #endif # 358 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_DEBUG_QOS #define DISPATCH_DEBUG_QOS DISPATCH_DEBUG #endif # 362 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__GNUC__) || defined(__clang__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 364 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_NOINLINE __attribute__((__noinline__)) #define DISPATCH_USED __attribute__((__used__)) #define DISPATCH_UNUSED __attribute__((__unused__)) #define DISPATCH_WEAK __attribute__((__weak__)) #define DISPATCH_OVERLOADABLE __attribute__((__overloadable__)) #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 370 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_PACKED __attribute__((__packed__)) #define DISPATCH_ALWAYS_INLINE_NDEBUG #else # 373 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_ALWAYS_INLINE_NDEBUG __attribute__((__always_inline__)) #endif # 375 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #else /* __GNUC__ */ # 376 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_NOINLINE #define DISPATCH_USED #define DISPATCH_UNUSED #define DISPATCH_WEAK #define DISPATCH_ALWAYS_INLINE_NDEBUG #endif /* __GNUC__ */ # 382 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_CONCAT(x,y) DISPATCH_CONCAT1(x,y) #define DISPATCH_CONCAT1(x,y) x ## y #define DISPATCH_COUNT_ARGS(...) DISPATCH_COUNT_ARGS1(, ## __VA_ARGS__, \ _8, _7, _6, _5, _4, _3, _2, _1, _0) #define DISPATCH_COUNT_ARGS1(z, a, b, c, d, e, f, g, h, cnt, ...) cnt #if 0 /* disabled by -frewrite-includes */ #if BYTE_ORDER == LITTLE_ENDIAN #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 391 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_STRUCT_LE_2(a, b) struct { a; b; } #define DISPATCH_STRUCT_LE_3(a, b, c) struct { a; b; c; } #define DISPATCH_STRUCT_LE_4(a, b, c, d) struct { a; b; c; d; } #else # 395 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_STRUCT_LE_2(a, b) struct { b; a; } #define DISPATCH_STRUCT_LE_3(a, b, c) struct { c; b; a; } #define DISPATCH_STRUCT_LE_4(a, b, c, d) struct { d; c; b; a; } #endif # 399 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(c_startic_assert) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 400 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_UNION_ASSERT(alias, st) \ _Static_assert(sizeof(struct { alias; }) == sizeof(st), "bogus union"); #else # 403 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_UNION_ASSERT(alias, st) #endif # 405 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_UNION_LE(alias, ...) \ DISPATCH_UNION_ASSERT(alias, DISPATCH_CONCAT(DISPATCH_STRUCT_LE, \ DISPATCH_COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)) \ union { alias; DISPATCH_CONCAT(DISPATCH_STRUCT_LE, \ DISPATCH_COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__); } // workaround 6368156 #ifdef NSEC_PER_SEC #undef NSEC_PER_SEC #endif # 415 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifdef USEC_PER_SEC #undef USEC_PER_SEC #endif # 418 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifdef NSEC_PER_USEC #undef NSEC_PER_USEC #endif # 421 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define NSEC_PER_SEC 1000000000ull #define USEC_PER_SEC 1000000ull #define NSEC_PER_USEC 1000ull #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 426 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else # 429 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define likely(x) (!!(x)) #define unlikely(x) (!!(x)) #endif // __GNUC__ # 432 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _LIST_IS_ENQUEUED(elm, field) \ ((elm)->field.le_prev != NULL) #define _LIST_MARK_NOT_ENQUEUED(elm, field) \ ((void)((elm)->field.le_prev = NULL)) #define _TAILQ_IS_ENQUEUED(elm, field) \ ((elm)->field.tqe_prev != NULL) #define _TAILQ_MARK_NOT_ENQUEUED(elm, field) \ ((void)((elm)->field.tqe_prev = NULL)) #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 443 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" // sys/queue.h debugging #undef TRASHIT #define TRASHIT(x) do {(x) = (void *)-1;} while (0) #else // DISPATCH_DEBUG # 447 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef TRASHIT #define TRASHIT(x) #endif # 450 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // DISPATCH_DEBUG # 451 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _LIST_TRASH_ENTRY(elm, field) do { \ TRASHIT((elm)->field.le_next); \ TRASHIT((elm)->field.le_prev); \ } while (0) #define _TAILQ_TRASH_ENTRY(elm, field) do { \ TRASHIT((elm)->field.tqe_next); \ TRASHIT((elm)->field.tqe_prev); \ } while (0) #define _TAILQ_TRASH_HEAD(head) do { \ TRASHIT((head)->tqh_first); \ TRASHIT((head)->tqh_last); \ } while (0) #define DISPATCH_MODE_STRICT (1U << 0) #define DISPATCH_MODE_NO_FAULTS (1U << 1) extern uint8_t _dispatch_mode; DISPATCH_EXPORT DISPATCH_NOINLINE DISPATCH_COLD void _dispatch_bug(size_t line, long val); #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 472 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" DISPATCH_NOINLINE DISPATCH_COLD void _dispatch_bug_mach_client(const char *msg, mach_msg_return_t kr); #endif // HAVE_MACH # 475 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" struct dispatch_unote_class_s; DISPATCH_NOINLINE DISPATCH_COLD void _dispatch_bug_kevent_client(const char *msg, const char *filter, const char *operation, int err, uint64_t ident, uint64_t udata, struct dispatch_unote_class_s *du); DISPATCH_NOINLINE DISPATCH_COLD void _dispatch_bug_kevent_vanished(struct dispatch_unote_class_s *du); DISPATCH_NOINLINE DISPATCH_COLD void _dispatch_bug_deprecated(const char *msg); DISPATCH_NOINLINE DISPATCH_NORETURN DISPATCH_COLD void _dispatch_abort(size_t line, long val); #if 0 /* disabled by -frewrite-includes */ #if !defined(DISPATCH_USE_OS_DEBUG_LOG) && DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 493 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 494 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_OS_DEBUG_LOG 1 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 495 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 496 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 497 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // DISPATCH_USE_OS_DEBUG_LOG # 498 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(DISPATCH_USE_SIMPLE_ASL) && !DISPATCH_USE_OS_DEBUG_LOG #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 500 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include(<_simple.h>) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 501 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_SIMPLE_ASL 1 #if 0 /* expanded by -frewrite-includes */ #include <_simple.h> #endif /* expanded by -frewrite-includes */ # 502 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 503 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 504 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // DISPATCH_USE_SIMPLE_ASL # 505 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !DISPATCH_USE_SIMPLE_ASL && !DISPATCH_USE_OS_DEBUG_LOG && !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 507 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 507 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/usr/include/syslog.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)syslog.h 8.1 (Berkeley) 6/2/93 * $FreeBSD$ */ #ifndef _SYS_SYSLOG_H_ #define _SYS_SYSLOG_H_ #define _PATH_LOG "/var/run/log" #define _PATH_LOG_PRIV "/var/run/logpriv" /* * priorities/facilities are encoded into a single 32-bit quantity, where the * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility * (0-big number). Both the priorities and the facilities map roughly * one-to-one to strings in the syslogd(8) source code. This mapping is * included in this file. * * priorities (these are ordered) */ #define LOG_EMERG 0 /* system is unusable */ #define LOG_ALERT 1 /* action must be taken immediately */ #define LOG_CRIT 2 /* critical conditions */ #define LOG_ERR 3 /* error conditions */ #define LOG_WARNING 4 /* warning conditions */ #define LOG_NOTICE 5 /* normal but significant condition */ #define LOG_INFO 6 /* informational */ #define LOG_DEBUG 7 /* debug-level messages */ #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ /* extract priority */ #define LOG_PRI(p) ((p) & LOG_PRIMASK) #define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) #ifdef SYSLOG_NAMES #define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ /* mark "facility" */ #define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0) typedef struct _code { const char *c_name; int c_val; } CODE; static const CODE prioritynames[] = { { "alert", LOG_ALERT, }, { "crit", LOG_CRIT, }, { "debug", LOG_DEBUG, }, { "emerg", LOG_EMERG, }, { "err", LOG_ERR, }, { "error", LOG_ERR, }, /* DEPRECATED */ { "info", LOG_INFO, }, { "none", INTERNAL_NOPRI, }, /* INTERNAL */ { "notice", LOG_NOTICE, }, { "panic", LOG_EMERG, }, /* DEPRECATED */ { "warn", LOG_WARNING, }, /* DEPRECATED */ { "warning", LOG_WARNING, }, { NULL, -1, } }; #endif # 89 "/usr/include/syslog.h" 3 4 /* facility codes */ #define LOG_KERN (0<<3) /* kernel messages */ #define LOG_USER (1<<3) /* random user-level messages */ #define LOG_MAIL (2<<3) /* mail system */ #define LOG_DAEMON (3<<3) /* system daemons */ #define LOG_AUTH (4<<3) /* authorization messages */ #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ #define LOG_LPR (6<<3) /* line printer subsystem */ #define LOG_NEWS (7<<3) /* network news subsystem */ #define LOG_UUCP (8<<3) /* UUCP subsystem */ #define LOG_CRON (9<<3) /* clock daemon */ #define LOG_AUTHPRIV (10<<3) /* authorization messages (private) */ /* Facility #10 clashes in DEC UNIX, where */ /* it's defined as LOG_MEGASAFE for AdvFS */ /* event logging. */ #define LOG_FTP (11<<3) /* ftp daemon */ #define LOG_NTP (12<<3) /* NTP subsystem */ #define LOG_SECURITY (13<<3) /* security subsystems (firewalling, etc.) */ #define LOG_CONSOLE (14<<3) /* /dev/console output */ /* other codes through 15 reserved for system use */ #define LOG_LOCAL0 (16<<3) /* reserved for local use */ #define LOG_LOCAL1 (17<<3) /* reserved for local use */ #define LOG_LOCAL2 (18<<3) /* reserved for local use */ #define LOG_LOCAL3 (19<<3) /* reserved for local use */ #define LOG_LOCAL4 (20<<3) /* reserved for local use */ #define LOG_LOCAL5 (21<<3) /* reserved for local use */ #define LOG_LOCAL6 (22<<3) /* reserved for local use */ #define LOG_LOCAL7 (23<<3) /* reserved for local use */ #define LOG_NFACILITIES 24 /* current number of facilities */ #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ /* facility of pri */ #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) #ifdef SYSLOG_NAMES static const CODE facilitynames[] = { { "auth", LOG_AUTH, }, { "authpriv", LOG_AUTHPRIV, }, { "console", LOG_CONSOLE, }, { "cron", LOG_CRON, }, { "daemon", LOG_DAEMON, }, { "ftp", LOG_FTP, }, { "kern", LOG_KERN, }, { "lpr", LOG_LPR, }, { "mail", LOG_MAIL, }, { "mark", INTERNAL_MARK, }, /* INTERNAL */ { "news", LOG_NEWS, }, { "ntp", LOG_NTP, }, { "security", LOG_SECURITY, }, { "syslog", LOG_SYSLOG, }, { "user", LOG_USER, }, { "uucp", LOG_UUCP, }, { "local0", LOG_LOCAL0, }, { "local1", LOG_LOCAL1, }, { "local2", LOG_LOCAL2, }, { "local3", LOG_LOCAL3, }, { "local4", LOG_LOCAL4, }, { "local5", LOG_LOCAL5, }, { "local6", LOG_LOCAL6, }, { "local7", LOG_LOCAL7, }, { NULL, -1, } }; #endif # 154 "/usr/include/syslog.h" 3 4 #ifdef _KERNEL #define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ #endif # 158 "/usr/include/syslog.h" 3 4 /* * arguments to setlogmask. */ #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ /* * Option flags for openlog. * * LOG_ODELAY no longer does anything. * LOG_NDELAY is the inverse of what it used to be. */ #define LOG_PID 0x01 /* log the pid with each message */ #define LOG_CONS 0x02 /* log on the console if errors in sending */ #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ #define LOG_NDELAY 0x08 /* don't delay open */ #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ #define LOG_PERROR 0x20 /* log to stderr as well */ #ifdef _KERNEL #else /* not _KERNEL */ # 181 "/usr/include/syslog.h" 3 4 /* * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two * places ( and ), so if we include one * of them here we may collide with the utility's includes. It's unreasonable * for utilities to have to include one of them to include syslog.h, so we get * __va_list from and use it. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 189 "/usr/include/syslog.h" 3 4 # 190 "/usr/include/syslog.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 190 "/usr/include/syslog.h" 3 4 # 191 "/usr/include/syslog.h" 3 4 __BEGIN_DECLS void closelog(void); void openlog(const char *, int, int); int setlogmask(int); void syslog(int, const char *, ...) __printflike(2, 3); #if 0 /* disabled by -frewrite-includes */ #if __BSD_VISIBLE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 198 "/usr/include/syslog.h" 3 4 void vsyslog(int, const char *, __va_list) __printflike(2, 0); #endif # 200 "/usr/include/syslog.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 203 "/usr/include/syslog.h" 3 4 #endif # 205 "/usr/include/syslog.h" 3 4 # 508 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #endif # 509 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_BAD_INPUT ((void *_Nonnull)0) #define DISPATCH_OUT_OF_MEMORY ((void *_Nonnull)0) #if 0 /* disabled by -frewrite-includes */ #if __has_attribute(diagnose_if) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 514 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_STATIC_ASSERT_IF(e) \ __attribute__((diagnose_if(e, "Assertion failed", "error"))) #else # 517 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_STATIC_ASSERT_IF(e) #endif // __has_attribute(diagnose_if) # 519 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_OS_DEBUG_LOG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 521 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_log(msg, ...) os_debug_log("libdispatch", msg, ## __VA_ARGS__) #else # 523 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" DISPATCH_EXPORT DISPATCH_NOINLINE DISPATCH_COLD __attribute__((__format__(__printf__,1,2))) void _dispatch_log(const char *msg, ...); #endif // DISPATCH_USE_OS_DEBUG_LOG # 527 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define dsnprintf(buf, siz, ...) \ ({ size_t _siz = siz; int _r = snprintf(buf, _siz, __VA_ARGS__); \ _r < 0 ? 0u : ((size_t)_r > _siz ? _siz : (size_t)_r); }) #if 0 /* disabled by -frewrite-includes */ #if __has_feature(c_static_assert) || __STDC_VERSION__ >= 201112L #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 533 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_static_assert(e, s, ...) _Static_assert(e, s) #else # 535 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_static_assert(e, s, ...) #endif # 537 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define dispatch_static_assert(e, ...) \ _dispatch_static_assert(e, ##__VA_ARGS__, #e) #define dispatch_assert_aliases(t1, t2, f) \ dispatch_static_assert(offsetof(struct t1,f) == offsetof(struct t2,f), \ #t1 "::" #f " and " #t2 "::" #f " should alias") /* * For reporting bugs within libdispatch when using the "_debug" version of the * library. */ DISPATCH_ALWAYS_INLINE static inline void _dispatch_assert(long e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e) { if (unlikely(DISPATCH_DEBUG && !e)) _dispatch_abort(line, e); } #define dispatch_assert(e) _dispatch_assert((long)(e), __LINE__) /* * A lot of API return zero upon success and not-zero on fail. Let's capture * and log the non-zero value */ DISPATCH_ALWAYS_INLINE static inline void _dispatch_assert_zero(long e, size_t line) DISPATCH_STATIC_ASSERT_IF(e) { if (unlikely(DISPATCH_DEBUG && e)) _dispatch_abort(line, e); } #define dispatch_assert_zero(e) _dispatch_assert_zero((long)(e), __LINE__) /* * For reporting bugs or impedance mismatches between libdispatch and external * subsystems. These do NOT abort(), and are always compiled into the product. * * In particular, we wrap all system-calls with assume() macros. */ DISPATCH_ALWAYS_INLINE static inline void _dispatch_assume(long e, size_t line) DISPATCH_STATIC_ASSERT_IF(!e) { if (unlikely(!e)) _dispatch_bug(line, e); } #define dispatch_assume(e) \ ({ __typeof__(e) _e = (e); _dispatch_assume((long)_e, __LINE__); _e; }) /* * A lot of API return zero upon success and not-zero on fail. Let's capture * and log the non-zero value */ DISPATCH_ALWAYS_INLINE static inline void _dispatch_assume_zero(long e, size_t line) DISPATCH_STATIC_ASSERT_IF(e) { if (unlikely(e)) _dispatch_bug(line, e); } #define dispatch_assume_zero(e) \ ({ __typeof__(e) _e = (e); _dispatch_assume_zero((long)_e, __LINE__); _e; }) /* Make sure the debug statments don't get too stale */ #define _dispatch_debug(x, args...) do { \ if (DISPATCH_DEBUG) { \ _dispatch_log("%u\t%p\t" x, __LINE__, \ (void *)_dispatch_thread_self(), ##args); \ } \ } while (0) #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 605 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" /* This is the private version of the deprecated dispatch_debug() */ DISPATCH_NONNULL2 DISPATCH_NOTHROW __attribute__((__format__(printf,2,3))) void _dispatch_object_debug(dispatch_object_t object, const char *message, ...); #else # 611 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_object_debug(object, message, ...) #endif // DISPATCH_DEBUG # 613 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifdef __BLOCKS__ #define _dispatch_Block_invoke(bb) \ ((dispatch_function_t)((struct Block_layout *)bb)->invoke) void *_dispatch_Block_copy(void *block); #if 0 /* disabled by -frewrite-includes */ #if __GNUC__ #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 620 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_Block_copy(x) ((__typeof__(x))_dispatch_Block_copy(x)) #endif # 622 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" void _dispatch_call_block_and_release(void *block); #endif /* __BLOCKS__ */ # 624 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" bool _dispatch_parse_bool(const char *v); bool _dispatch_getenv_bool(const char *env, bool default_v); void _dispatch_temporary_resource_shortage(void); void *_dispatch_calloc(size_t num_items, size_t size); const char *_dispatch_strdup_if_mutable(const char *str); void _dispatch_vtable_init(void); char *_dispatch_get_build(void); #if 0 /* disabled by -frewrite-includes */ #if !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 633 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" int _dispatch_sigmask(void); #endif # 635 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" uint64_t _dispatch_timeout(dispatch_time_t when); uint64_t _dispatch_time_nanoseconds_since_epoch(dispatch_time_t when); #define _DISPATCH_UNSAFE_FORK_MULTITHREADED ((uint8_t)1) #define _DISPATCH_UNSAFE_FORK_PROHIBIT ((uint8_t)2) extern uint8_t _dispatch_unsafe_fork; extern bool _dispatch_child_of_unsafe_fork; void _dispatch_fork_becomes_unsafe_slow(void); #define _dispatch_is_multithreaded_inline() \ ((_dispatch_unsafe_fork & _DISPATCH_UNSAFE_FORK_MULTITHREADED) != 0) DISPATCH_ALWAYS_INLINE static inline void _dispatch_fork_becomes_unsafe(void) { if (unlikely(!_dispatch_is_multithreaded_inline())) { _dispatch_fork_becomes_unsafe_slow(); DISPATCH_COMPILER_CAN_ASSUME(_dispatch_is_multithreaded_inline()); } } #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 659 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #undef DISPATCH_PERF_MON #define DISPATCH_PERF_MON 0 #endif # 662 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" /* #includes dependent on internal.h */ #if 0 /* expanded by -frewrite-includes */ #include "shims.h" #endif /* expanded by -frewrite-includes */ # 664 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_OS_SHIMS__ #define __DISPATCH_OS_SHIMS__ #if 0 /* disabled by -frewrite-includes */ #if !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #else // defined(_WIN32) # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include "shims/generic_win_stubs.h" #endif /* expanded by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #endif // defined(_WIN32) # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) || defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include "shims/generic_sys_queue.h" #endif /* expanded by -frewrite-includes */ # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #endif # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #ifdef __ANDROID__ #if 0 /* expanded by -frewrite-includes */ #include "shims/android_stubs.h" #endif /* expanded by -frewrite-includes */ # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #endif // __ANDROID__ # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if !HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include "shims/mach.h" #endif /* expanded by -frewrite-includes */ # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/mach.h" 1 /* * Copyright (c) 2018 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_SHIMS_MACH__ #define __DISPATCH_SHIMS_MACH__ /* * Stub out defines for some mach types and related macros */ typedef uint32_t mach_port_t; #define MACH_PORT_NULL (0) #define MACH_PORT_DEAD (-1) typedef uint32_t mach_error_t; typedef uint32_t mach_msg_return_t; typedef uint32_t mach_msg_bits_t; typedef void *dispatch_mach_msg_t; typedef uint64_t firehose_activity_id_t; typedef void *mach_msg_header_t; #endif # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/mach.h" # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #endif # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include "shims/target.h" #endif /* expanded by -frewrite-includes */ # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" 1 /* * Copyright (c) 2018 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ // These are the portable dispatch version requirements macros, isolated from // the rest of the C internal headers to be suitable for inclusion in MIG defs, // asm, etc. #ifndef __DISPATCH_SHIMS_TARGET__ #define __DISPATCH_SHIMS_TARGET__ #ifdef __APPLE__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_OSX #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # define DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(x) \ (__MAC_OS_X_VERSION_MIN_REQUIRED >= (x)) #if 0 /* disabled by -frewrite-includes */ # if !DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(101200) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # error "OS X hosts older than OS X 10.12 aren't supported anymore" # endif // !DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(101200) # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif TARGET_OS_SIMULATOR #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # define DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(x) \ (IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED >= (x)) #if 0 /* disabled by -frewrite-includes */ # if !DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(101200) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # error "Simulator hosts older than OS X 10.12 aren't supported anymore" # endif // !DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(101200) # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" #else # 51 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # define DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(x) 1 #if 0 /* disabled by -frewrite-includes */ # if __IPHONE_OS_VERSION_MIN_REQUIRED < 90000 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 53 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # error "iOS hosts older than iOS 9.0 aren't supported anymore" # endif # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" #endif # 56 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" #else // !__APPLE__ # 58 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" #define DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(x) 0 #endif // !__APPLE__ # 60 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" #endif // __DISPATCH_SHIMS_TARGET__ # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/target.h" # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_INTERNAL_WORKQUEUE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include "event/workqueue_internal.h" #endif /* expanded by -frewrite-includes */ # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/workqueue_internal.h" 1 /* * Copyright (c) 2017-2017 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_WORKQUEUE_INTERNAL__ #define __DISPATCH_WORKQUEUE_INTERNAL__ void _dispatch_workq_worker_register(dispatch_queue_global_t root_q); void _dispatch_workq_worker_unregister(dispatch_queue_global_t root_q); #if 0 /* disabled by -frewrite-includes */ #if defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/workqueue_internal.h" #define HAVE_DISPATCH_WORKQ_MONITORING 1 #else # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/workqueue_internal.h" #define HAVE_DISPATCH_WORKQ_MONITORING 0 #endif # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/workqueue_internal.h" #endif /* __DISPATCH_WORKQUEUE_INTERNAL__ */ # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/workqueue_internal.h" # 51 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif HAVE_PTHREAD_WORKQUEUES #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 53 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #else # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #error Unsupported configuration #endif # 56 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #ifndef DISPATCH_WORKQ_MAX_PTHREAD_COUNT #define DISPATCH_WORKQ_MAX_PTHREAD_COUNT 255 #endif # 60 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include "shims/hw_config.h" #endif /* expanded by -frewrite-includes */ # 61 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" 1 /* * Copyright (c) 2011-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_HW_CONFIG__ #define __DISPATCH_SHIMS_HW_CONFIG__ #ifdef __SIZEOF_POINTER__ #define DISPATCH_SIZEOF_PTR __SIZEOF_POINTER__ #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN64) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #define DISPATCH_SIZEOF_PTR 8 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #define DISPATCH_SIZEOF_PTR 4 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_MSC_VER) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #error "could not determine pointer size as a constant int for MSVC" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__LP64__) || defined(__LLP64__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #define DISPATCH_SIZEOF_PTR 8 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__ILP32__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #define DISPATCH_SIZEOF_PTR 4 #else # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #error "could not determine pointer size as a constant int" #endif // __SIZEOF_POINTER__ # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #define DISPATCH_CACHELINE_SIZE 64u #define ROUND_UP_TO_CACHELINE_SIZE(x) \ (((x) + (DISPATCH_CACHELINE_SIZE - 1u)) & \ ~(DISPATCH_CACHELINE_SIZE - 1u)) #define DISPATCH_CACHELINE_ALIGN \ __attribute__((__aligned__(DISPATCH_CACHELINE_SIZE))) typedef enum { _dispatch_hw_config_logical_cpus, _dispatch_hw_config_physical_cpus, _dispatch_hw_config_active_cpus, } _dispatch_hw_config_t; #if 0 /* disabled by -frewrite-includes */ #if !defined(DISPATCH_HAVE_HW_CONFIG_COMMPAGE) && \ defined(_COMM_PAGE_LOGICAL_CPUS) && \ defined(_COMM_PAGE_PHYSICAL_CPUS) && defined(_COMM_PAGE_ACTIVE_CPUS) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #define DISPATCH_HAVE_HW_CONFIG_COMMPAGE 1 #endif # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_HAVE_HW_CONFIG_COMMPAGE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" DISPATCH_ALWAYS_INLINE static inline uint32_t _dispatch_hw_get_config(_dispatch_hw_config_t c) { uintptr_t p; switch (c) { case _dispatch_hw_config_logical_cpus: p = _COMM_PAGE_LOGICAL_CPUS; break; case _dispatch_hw_config_physical_cpus: p = _COMM_PAGE_PHYSICAL_CPUS; break; case _dispatch_hw_config_active_cpus: p = _COMM_PAGE_ACTIVE_CPUS; break; } return *(uint8_t*)p; } #define dispatch_hw_config(c) \ _dispatch_hw_get_config(_dispatch_hw_config_##c) #define DISPATCH_HW_CONFIG() #define _dispatch_hw_config_init() #else // DISPATCH_HAVE_HW_CONFIG_COMMPAGE # 90 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" extern struct _dispatch_hw_configs_s { uint32_t logical_cpus; uint32_t physical_cpus; uint32_t active_cpus; } _dispatch_hw_config; #define DISPATCH_HW_CONFIG() struct _dispatch_hw_configs_s _dispatch_hw_config #define dispatch_hw_config(c) (_dispatch_hw_config.c) DISPATCH_ALWAYS_INLINE static inline uint32_t _dispatch_hw_get_config(_dispatch_hw_config_t c) { uint32_t val = 1; #if 0 /* disabled by -frewrite-includes */ #if defined(__linux__) && HAVE_SYSCONF #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 106 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" switch (c) { case _dispatch_hw_config_logical_cpus: case _dispatch_hw_config_physical_cpus: return (uint32_t)sysconf(_SC_NPROCESSORS_CONF); case _dispatch_hw_config_active_cpus: { #ifdef __USE_GNU // Prefer pthread_getaffinity_np because it considers // scheduler cpu affinity. This matters if the program // is restricted to a subset of the online cpus (eg via numactl). cpu_set_t cpuset; if (pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset) == 0) return (uint32_t)CPU_COUNT(&cpuset); #endif # 120 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" return (uint32_t)sysconf(_SC_NPROCESSORS_ONLN); } } #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 124 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" PSYSTEM_LOGICAL_PROCESSOR_INFORMATION slpiInfo = NULL; PSYSTEM_LOGICAL_PROCESSOR_INFORMATION slpiCurrent = NULL; DWORD dwProcessorLogicalCount = 0; DWORD dwProcessorPhysicalCount = 0; DWORD dwSize = 0; while (true) { DWORD dwResult; if (GetLogicalProcessorInformation(slpiInfo, &dwSize)) break; dwResult = GetLastError(); if (slpiInfo) free(slpiInfo); if (dwResult == ERROR_INSUFFICIENT_BUFFER) { slpiInfo = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)malloc(dwSize); dispatch_assert(slpiInfo); } else { slpiInfo = NULL; dwSize = 0; break; } } for (slpiCurrent = slpiInfo; dwSize >= sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); slpiCurrent++, dwSize -= sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION)) { switch (slpiCurrent->Relationship) { case RelationProcessorCore: ++dwProcessorPhysicalCount; dwProcessorLogicalCount += __popcnt64(slpiCurrent->ProcessorMask); break; #if 0 /* disabled by -frewrite-includes */ #if defined(DISPATCH_HAVE_EXTENDED_SLPI_20348) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 160 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" case RelationProcessorDie: #endif # 162 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" case RelationProcessorPackage: case RelationNumaNode: #if 0 /* disabled by -frewrite-includes */ #if defined(DISPATCH_HAVE_EXTENDED_SLPI_20348) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 165 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" case RelationNumaNodeEx: #endif # 167 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" case RelationCache: case RelationGroup: #if 0 /* disabled by -frewrite-includes */ #if defined(DISPATCH_HAVE_EXTENDED_SLPI_22000) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 170 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" case RelationProcessorModule: #endif # 172 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" case RelationAll: break; } } free(slpiInfo); switch (c) { case _dispatch_hw_config_logical_cpus: case _dispatch_hw_config_active_cpus: return dwProcessorLogicalCount; case _dispatch_hw_config_physical_cpus: return dwProcessorPhysicalCount; } #else # 187 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" const char *name = NULL; int r; #if 0 /* disabled by -frewrite-includes */ #if defined(__APPLE__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 190 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" switch (c) { case _dispatch_hw_config_logical_cpus: name = "hw.logicalcpu_max"; break; case _dispatch_hw_config_physical_cpus: name = "hw.physicalcpu_max"; break; case _dispatch_hw_config_active_cpus: name = "hw.activecpu"; break; } #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__FreeBSD__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 199 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" (void)c; name = "kern.smp.cpus"; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__OpenBSD__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 201 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" (void)c; #endif # 203 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" if (name) { size_t valsz = sizeof(val); #if 0 /* disabled by -frewrite-includes */ #if !defined(__OpenBSD__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 206 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" r = sysctlbyname(name, &val, &valsz, NULL, 0); (void)dispatch_assume_zero(r); #endif # 209 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" dispatch_assert(valsz == sizeof(uint32_t)); } else { #if 0 /* disabled by -frewrite-includes */ #if HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 212 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" r = (int)sysconf(_SC_NPROCESSORS_ONLN); if (r > 0) val = (uint32_t)r; #endif # 215 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" } #endif # 217 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" return val; } #define dispatch_hw_config_init(c) \ _dispatch_hw_get_config(_dispatch_hw_config_##c) static inline void _dispatch_hw_config_init(void) { dispatch_hw_config(logical_cpus) = dispatch_hw_config_init(logical_cpus); dispatch_hw_config(physical_cpus) = dispatch_hw_config_init(physical_cpus); dispatch_hw_config(active_cpus) = dispatch_hw_config_init(active_cpus); } #undef dispatch_hw_config_init #endif // DISPATCH_HAVE_HW_CONFIG_COMMPAGE # 234 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" #endif /* __DISPATCH_SHIMS_HW_CONFIG__ */ # 236 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/hw_config.h" # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "shims/priority.h" #endif /* expanded by -frewrite-includes */ # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" 1 /* * Copyright (c) 2008-2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_PRIORITY__ #define __DISPATCH_SHIMS_PRIORITY__ #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_QOS_H && __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #ifndef _PTHREAD_PRIORITY_OVERCOMMIT_FLAG #define _PTHREAD_PRIORITY_OVERCOMMIT_FLAG 0x80000000 #endif # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #ifndef _PTHREAD_PRIORITY_SCHED_PRI_FLAG #define _PTHREAD_PRIORITY_SCHED_PRI_FLAG 0x20000000 #endif # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #ifndef _PTHREAD_PRIORITY_FALLBACK_FLAG #define _PTHREAD_PRIORITY_FALLBACK_FLAG 0x04000000 #endif # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #ifndef _PTHREAD_PRIORITY_EVENT_MANAGER_FLAG #define _PTHREAD_PRIORITY_EVENT_MANAGER_FLAG 0x02000000 #endif # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #ifndef _PTHREAD_PRIORITY_NEEDS_UNBIND_FLAG #define _PTHREAD_PRIORITY_NEEDS_UNBIND_FLAG 0x01000000 #endif # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #else // HAVE_PTHREAD_QOS_H # 49 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" OS_ENUM(qos_class, unsigned int, QOS_CLASS_USER_INTERACTIVE = 0x21, QOS_CLASS_USER_INITIATED = 0x19, QOS_CLASS_DEFAULT = 0x15, QOS_CLASS_UTILITY = 0x11, QOS_CLASS_BACKGROUND = 0x09, QOS_CLASS_MAINTENANCE = 0x05, QOS_CLASS_UNSPECIFIED = 0x00, ); typedef unsigned long pthread_priority_t; #define QOS_MIN_RELATIVE_PRIORITY (-15) #define _PTHREAD_PRIORITY_FLAGS_MASK (~0xffffff) #define _PTHREAD_PRIORITY_QOS_CLASS_MASK 0x00ffff00 #define _PTHREAD_PRIORITY_QOS_CLASS_SHIFT (8ull) #define _PTHREAD_PRIORITY_PRIORITY_MASK 0x000000ff #define _PTHREAD_PRIORITY_OVERCOMMIT_FLAG 0x80000000 #define _PTHREAD_PRIORITY_SCHED_PRI_FLAG 0x20000000 #define _PTHREAD_PRIORITY_FALLBACK_FLAG 0x04000000 #define _PTHREAD_PRIORITY_EVENT_MANAGER_FLAG 0x02000000 #define _PTHREAD_PRIORITY_NEEDS_UNBIND_FLAG 0x01000000 #define _PTHREAD_PRIORITY_ENFORCE_FLAG 0x10000000 #endif // HAVE_PTHREAD_QOS_H # 72 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(POLICY_RR) && defined(SCHED_RR) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" #define POLICY_RR SCHED_RR #endif // !defined(POLICY_RR) && defined(SCHED_RR) # 76 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" typedef uint32_t dispatch_qos_t; typedef uint32_t dispatch_priority_t; #define DISPATCH_QOS_UNSPECIFIED ((dispatch_qos_t)0) #define DISPATCH_QOS_MAINTENANCE ((dispatch_qos_t)1) #define DISPATCH_QOS_BACKGROUND ((dispatch_qos_t)2) #define DISPATCH_QOS_UTILITY ((dispatch_qos_t)3) #define DISPATCH_QOS_DEFAULT ((dispatch_qos_t)4) #define DISPATCH_QOS_USER_INITIATED ((dispatch_qos_t)5) #define DISPATCH_QOS_USER_INTERACTIVE ((dispatch_qos_t)6) #define DISPATCH_QOS_MIN DISPATCH_QOS_MAINTENANCE #define DISPATCH_QOS_MAX DISPATCH_QOS_USER_INTERACTIVE #define DISPATCH_QOS_SATURATED ((dispatch_qos_t)15) #define DISPATCH_QOS_NBUCKETS (DISPATCH_QOS_MAX - DISPATCH_QOS_MIN + 1) #define DISPATCH_QOS_BUCKET(qos) ((int)((qos) - DISPATCH_QOS_MIN)) #define DISPATCH_QOS_FOR_BUCKET(bucket) ((dispatch_qos_t)((uint32_t)bucket + DISPATCH_QOS_MIN)) #define DISPATCH_PRIORITY_RELPRI_MASK ((dispatch_priority_t)0x000000ff) #define DISPATCH_PRIORITY_RELPRI_SHIFT 0 #define DISPATCH_PRIORITY_QOS_MASK ((dispatch_priority_t)0x00000f00) #define DISPATCH_PRIORITY_QOS_SHIFT 8 #define DISPATCH_PRIORITY_REQUESTED_MASK ((dispatch_priority_t)0x00000fff) #define DISPATCH_PRIORITY_FALLBACK_QOS_MASK ((dispatch_priority_t)0x0000f000) #define DISPATCH_PRIORITY_FALLBACK_QOS_SHIFT 12 #define DISPATCH_PRIORITY_OVERRIDE_MASK ((dispatch_priority_t)0x000f0000) #define DISPATCH_PRIORITY_OVERRIDE_SHIFT 16 #define DISPATCH_PRIORITY_FLAGS_MASK ((dispatch_priority_t)0xff000000) #define DISPATCH_PRIORITY_SATURATED_OVERRIDE DISPATCH_PRIORITY_OVERRIDE_MASK #define DISPATCH_PRIORITY_FLAG_OVERCOMMIT ((dispatch_priority_t)0x80000000) // _PTHREAD_PRIORITY_OVERCOMMIT_FLAG #define DISPATCH_PRIORITY_FLAG_FALLBACK ((dispatch_priority_t)0x04000000) // _PTHREAD_PRIORITY_FALLBACK_FLAG #define DISPATCH_PRIORITY_FLAG_MANAGER ((dispatch_priority_t)0x02000000) // _PTHREAD_PRIORITY_EVENT_MANAGER_FLAG #define DISPATCH_PRIORITY_PTHREAD_PRIORITY_FLAGS_MASK \ (DISPATCH_PRIORITY_FLAG_OVERCOMMIT | DISPATCH_PRIORITY_FLAG_FALLBACK | \ DISPATCH_PRIORITY_FLAG_MANAGER) // not passed to pthread #define DISPATCH_PRIORITY_FLAG_FLOOR ((dispatch_priority_t)0x40000000) // _PTHREAD_PRIORITY_INHERIT_FLAG #define DISPATCH_PRIORITY_FLAG_ENFORCE ((dispatch_priority_t)0x10000000) // _PTHREAD_PRIORITY_ENFORCE_FLAG #define DISPATCH_PRIORITY_FLAG_INHERITED ((dispatch_priority_t)0x20000000) DISPATCH_ALWAYS_INLINE static inline bool _dispatch_qos_class_valid(qos_class_t cls, int relpri) { switch ((unsigned int)cls) { case QOS_CLASS_MAINTENANCE: case QOS_CLASS_BACKGROUND: case QOS_CLASS_UTILITY: case QOS_CLASS_DEFAULT: case QOS_CLASS_USER_INITIATED: case QOS_CLASS_USER_INTERACTIVE: case QOS_CLASS_UNSPECIFIED: break; default: return false; } return QOS_MIN_RELATIVE_PRIORITY <= relpri && relpri <= 0; } #pragma mark dispatch_qos DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_qos_from_qos_class(qos_class_t cls) { switch ((unsigned int)cls) { case QOS_CLASS_USER_INTERACTIVE: return DISPATCH_QOS_USER_INTERACTIVE; case QOS_CLASS_USER_INITIATED: return DISPATCH_QOS_USER_INITIATED; case QOS_CLASS_DEFAULT: return DISPATCH_QOS_DEFAULT; case QOS_CLASS_UTILITY: return DISPATCH_QOS_UTILITY; case QOS_CLASS_BACKGROUND: return DISPATCH_QOS_BACKGROUND; case QOS_CLASS_MAINTENANCE: return DISPATCH_QOS_MAINTENANCE; default: return DISPATCH_QOS_UNSPECIFIED; } } DISPATCH_ALWAYS_INLINE static inline qos_class_t _dispatch_qos_to_qos_class(dispatch_qos_t qos) { switch (qos) { case DISPATCH_QOS_USER_INTERACTIVE: return QOS_CLASS_USER_INTERACTIVE; case DISPATCH_QOS_USER_INITIATED: return QOS_CLASS_USER_INITIATED; case DISPATCH_QOS_DEFAULT: return QOS_CLASS_DEFAULT; case DISPATCH_QOS_UTILITY: return QOS_CLASS_UTILITY; case DISPATCH_QOS_BACKGROUND: return QOS_CLASS_BACKGROUND; case DISPATCH_QOS_MAINTENANCE: return (qos_class_t)QOS_CLASS_MAINTENANCE; default: return QOS_CLASS_UNSPECIFIED; } } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_qos_from_queue_priority(intptr_t priority) { switch (priority) { case DISPATCH_QUEUE_PRIORITY_BACKGROUND: return DISPATCH_QOS_BACKGROUND; case DISPATCH_QUEUE_PRIORITY_NON_INTERACTIVE: return DISPATCH_QOS_UTILITY; case DISPATCH_QUEUE_PRIORITY_LOW: return DISPATCH_QOS_UTILITY; case DISPATCH_QUEUE_PRIORITY_DEFAULT: return DISPATCH_QOS_DEFAULT; case DISPATCH_QUEUE_PRIORITY_HIGH: return DISPATCH_QOS_USER_INITIATED; default: return _dispatch_qos_from_qos_class((qos_class_t)priority); } } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_qos_from_pp(pthread_priority_t pp) { pp &= _PTHREAD_PRIORITY_QOS_CLASS_MASK; pp >>= _PTHREAD_PRIORITY_QOS_CLASS_SHIFT; return (dispatch_qos_t)__builtin_ffs((int)pp); } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_qos_from_pp_unsafe(pthread_priority_t pp) { // this assumes we know there is a QOS and pp has been masked off properly pp >>= _PTHREAD_PRIORITY_QOS_CLASS_SHIFT; DISPATCH_COMPILER_CAN_ASSUME(pp); return (dispatch_qos_t)__builtin_ffs((int)pp); } DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_qos_to_pp(dispatch_qos_t qos) { pthread_priority_t pp; pp = 1ul << ((qos - 1) + _PTHREAD_PRIORITY_QOS_CLASS_SHIFT); return pp | _PTHREAD_PRIORITY_PRIORITY_MASK; } // including maintenance DISPATCH_ALWAYS_INLINE static inline bool _dispatch_qos_is_background(dispatch_qos_t qos) { return qos && qos <= DISPATCH_QOS_BACKGROUND; } #pragma mark dispatch_priority #define _dispatch_priority_make(qos, relpri) \ (qos ? ((((qos) << DISPATCH_PRIORITY_QOS_SHIFT) & DISPATCH_PRIORITY_QOS_MASK) | \ ((dispatch_priority_t)(relpri - 1) & DISPATCH_PRIORITY_RELPRI_MASK)) : 0) #define _dispatch_priority_make_override(qos) \ (((qos) << DISPATCH_PRIORITY_OVERRIDE_SHIFT) & \ DISPATCH_PRIORITY_OVERRIDE_MASK) #define _dispatch_priority_make_floor(qos) \ (qos ? (_dispatch_priority_make(qos) | DISPATCH_PRIORITY_FLAG_FLOOR) : 0) #define _dispatch_priority_make_fallback(qos) \ (qos ? ((((qos) << DISPATCH_PRIORITY_FALLBACK_QOS_SHIFT) & \ DISPATCH_PRIORITY_FALLBACK_QOS_MASK) | DISPATCH_PRIORITY_FLAG_FALLBACK) : 0) DISPATCH_ALWAYS_INLINE static inline int _dispatch_priority_relpri(dispatch_priority_t dbp) { if (dbp & DISPATCH_PRIORITY_QOS_MASK) { return (int8_t)(dbp & DISPATCH_PRIORITY_RELPRI_MASK) + 1; } return 0; } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_priority_qos(dispatch_priority_t dbp) { dbp &= DISPATCH_PRIORITY_QOS_MASK; return dbp >> DISPATCH_PRIORITY_QOS_SHIFT; } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_priority_fallback_qos(dispatch_priority_t dbp) { dbp &= DISPATCH_PRIORITY_FALLBACK_QOS_MASK; return dbp >> DISPATCH_PRIORITY_FALLBACK_QOS_SHIFT; } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_priority_override_qos(dispatch_priority_t dbp) { dbp &= DISPATCH_PRIORITY_OVERRIDE_MASK; return dbp >> DISPATCH_PRIORITY_OVERRIDE_SHIFT; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_priority_manually_selected(dispatch_priority_t pri) { return !(pri & DISPATCH_PRIORITY_FLAG_INHERITED) && (pri & (DISPATCH_PRIORITY_FLAG_FALLBACK | DISPATCH_PRIORITY_FLAG_FLOOR | DISPATCH_PRIORITY_REQUESTED_MASK)); } DISPATCH_ALWAYS_INLINE static inline dispatch_priority_t _dispatch_priority_from_pp_impl(pthread_priority_t pp, bool keep_flags) { dispatch_assert(!(pp & _PTHREAD_PRIORITY_SCHED_PRI_FLAG)); dispatch_priority_t dbp; if (keep_flags) { dbp = pp & (DISPATCH_PRIORITY_PTHREAD_PRIORITY_FLAGS_MASK | DISPATCH_PRIORITY_RELPRI_MASK); } else { dbp = pp & DISPATCH_PRIORITY_RELPRI_MASK; } dbp |= _dispatch_qos_from_pp(pp) << DISPATCH_PRIORITY_QOS_SHIFT; return dbp; } #define _dispatch_priority_from_pp(pp) \ _dispatch_priority_from_pp_impl(pp, true) #define _dispatch_priority_from_pp_strip_flags(pp) \ _dispatch_priority_from_pp_impl(pp, false) #define DISPATCH_PRIORITY_TO_PP_STRIP_FLAGS 0x1 #define DISPATCH_PRIORITY_TO_PP_PREFER_FALLBACK 0x2 DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_priority_to_pp_strip_flags(dispatch_priority_t dbp) { pthread_priority_t pp = dbp & DISPATCH_PRIORITY_RELPRI_MASK; dispatch_qos_t qos = _dispatch_priority_qos(dbp); if (qos) { pp |= (1ul << ((qos - 1) + _PTHREAD_PRIORITY_QOS_CLASS_SHIFT)); } return pp; } DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_priority_to_pp_prefer_fallback(dispatch_priority_t dbp) { pthread_priority_t pp; dispatch_qos_t qos; if (dbp & DISPATCH_PRIORITY_FLAG_FALLBACK) { pp = dbp & DISPATCH_PRIORITY_PTHREAD_PRIORITY_FLAGS_MASK; pp |= _PTHREAD_PRIORITY_PRIORITY_MASK; qos = _dispatch_priority_fallback_qos(dbp); } else { pp = dbp & (DISPATCH_PRIORITY_PTHREAD_PRIORITY_FLAGS_MASK | DISPATCH_PRIORITY_RELPRI_MASK); qos = _dispatch_priority_qos(dbp); if (unlikely(!qos)) return pp; } return pp | (1ul << ((qos - 1) + _PTHREAD_PRIORITY_QOS_CLASS_SHIFT)); } #endif // __DISPATCH_SHIMS_PRIORITY__ # 341 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/priority.h" # 63 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_NP_H #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/usr/include/pthread_np.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1996-98 John Birrell . * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _PTHREAD_NP_H_ #define _PTHREAD_NP_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/pthread_np.h" 3 4 # 37 "/usr/include/pthread_np.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/pthread_np.h" 3 4 # 38 "/usr/include/pthread_np.h" 3 4 /* * Non-POSIX type definitions: */ typedef void (*pthread_switch_routine_t)(pthread_t, pthread_t); /* * Non-POSIX thread function prototype definitions: */ __BEGIN_DECLS int pthread_attr_setcreatesuspend_np(pthread_attr_t *); int pthread_attr_get_np(pthread_t, pthread_attr_t *); int pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpuset_t *); int pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpuset_t *); void pthread_get_name_np(pthread_t, char *, size_t); int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *); int pthread_getthreadid_np(void); int pthread_main_np(void); int pthread_multi_np(void); int pthread_mutexattr_getkind_np(pthread_mutexattr_t); int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int); int pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count); int pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count); int pthread_mutex_getyieldloops_np(pthread_mutex_t *mutex, int *count); int pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count); int pthread_mutex_isowned_np(pthread_mutex_t *mutex); void pthread_resume_all_np(void); int pthread_resume_np(pthread_t); int pthread_peekjoin_np(pthread_t, void **); void pthread_set_name_np(pthread_t, const char *); int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *); int pthread_single_np(void); void pthread_suspend_all_np(void); int pthread_suspend_np(pthread_t); int pthread_switch_add_np(pthread_switch_routine_t); int pthread_switch_delete_np(pthread_switch_routine_t); int pthread_timedjoin_np(pthread_t, void **, const struct timespec *); __END_DECLS #endif # 78 "/usr/include/pthread_np.h" 3 4 # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #endif # 67 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 69 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 70 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #endif # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if !HAVE_DECL_FD_COPY #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define FD_COPY(f, t) (void)(*(t) = *(f)) #endif # 75 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_STRLCPY #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 78 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #else // that is, if !HAVE_STRLCPY # 79 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" size_t strlcpy(char *dst, const char *src, size_t size); #endif // HAVE_STRLCPY # 83 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #ifndef TAILQ_FOREACH_SAFE #define TAILQ_FOREACH_SAFE(var, head, field, temp) \ for ((var) = TAILQ_FIRST((head)); \ (var) && ((temp) = TAILQ_NEXT((var), field), 1); (var) = (temp)) #endif # 89 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if PTHREAD_WORKQUEUE_SPI_VERSION < 20140716 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 91 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" static inline int _pthread_workqueue_override_start_direct(mach_port_t thread, pthread_priority_t priority) { (void)thread; (void)priority; return 0; } #endif // PTHREAD_WORKQUEUE_SPI_VERSION < 20140716 # 99 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if PTHREAD_WORKQUEUE_SPI_VERSION < 20150319 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 101 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" static inline int _pthread_workqueue_override_start_direct_check_owner(mach_port_t thread, pthread_priority_t priority, mach_port_t *ulock_addr) { (void)ulock_addr; return _pthread_workqueue_override_start_direct(thread, priority); } #endif // PTHREAD_WORKQUEUE_SPI_VERSION < 20150319 # 109 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if PTHREAD_WORKQUEUE_SPI_VERSION < 20140707 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 111 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" static inline int _pthread_override_qos_class_start_direct(mach_port_t thread, pthread_priority_t priority) { (void)thread; (void)priority; return 0; } static inline int _pthread_override_qos_class_end_direct(mach_port_t thread) { (void)thread; return 0; } #endif // PTHREAD_WORKQUEUE_SPI_VERSION < 20140707 # 126 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if PTHREAD_WORKQUEUE_SPI_VERSION < 20150325 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 128 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" static inline int _pthread_qos_override_start_direct(mach_port_t thread, pthread_priority_t priority, void *resource) { (void)resource; return _pthread_override_qos_class_start_direct(thread, priority); } static inline int _pthread_qos_override_end_direct(mach_port_t thread, void *resource) { (void)resource; return _pthread_override_qos_class_end_direct(thread); } #endif // PTHREAD_WORKQUEUE_SPI_VERSION < 20150325 # 143 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if PTHREAD_WORKQUEUE_SPI_VERSION < 20160427 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 145 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define _PTHREAD_SET_SELF_WQ_KEVENT_UNBIND 0 #endif # 147 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if PTHREAD_WORKQUEUE_SPI_VERSION < 20160427 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 149 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" static inline bool _pthread_workqueue_should_narrow(pthread_priority_t priority) { (void)priority; return false; } #endif # 156 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_QOS_H && __has_include() && \ defined(PTHREAD_MAX_PARALLELISM_PHYSICAL) && \ DISPATCH_HAVE_HW_CONFIG_COMMPAGE && \ DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(101300) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 161 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define DISPATCH_USE_PTHREAD_QOS_MAX_PARALLELISM 1 #define DISPATCH_MAX_PARALLELISM_PHYSICAL PTHREAD_MAX_PARALLELISM_PHYSICAL #else # 164 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define DISPATCH_MAX_PARALLELISM_PHYSICAL 0x1 #endif # 166 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define DISPATCH_MAX_PARALLELISM_ACTIVE 0x2 _Static_assert(!(DISPATCH_MAX_PARALLELISM_PHYSICAL & DISPATCH_MAX_PARALLELISM_ACTIVE), "Overlapping parallelism flags"); DISPATCH_ALWAYS_INLINE static inline uint32_t _dispatch_qos_max_parallelism(dispatch_qos_t qos, unsigned long flags) { uint32_t p; int r = 0; if (qos) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_PTHREAD_QOS_MAX_PARALLELISM #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 179 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" r = pthread_qos_max_parallelism(_dispatch_qos_to_qos_class(qos), flags & PTHREAD_MAX_PARALLELISM_PHYSICAL); #endif # 182 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" } if (likely(r > 0)) { p = (uint32_t)r; } else { p = (flags & DISPATCH_MAX_PARALLELISM_PHYSICAL) ? dispatch_hw_config(physical_cpus) : dispatch_hw_config(logical_cpus); } if (flags & DISPATCH_MAX_PARALLELISM_ACTIVE) { uint32_t active_cpus = dispatch_hw_config(active_cpus); if ((flags & DISPATCH_MAX_PARALLELISM_PHYSICAL) && active_cpus < dispatch_hw_config(logical_cpus)) { active_cpus /= dispatch_hw_config(logical_cpus) / dispatch_hw_config(physical_cpus); } if (active_cpus < p) p = active_cpus; } return p; } #if 0 /* disabled by -frewrite-includes */ #if !HAVE_NORETURN_BUILTIN_TRAP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 203 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" /* * XXXRW: Work-around for possible clang bug in which __builtin_trap() is not * marked noreturn, leading to a build error as dispatch_main() *is* marked * noreturn. Mask by marking __builtin_trap() as noreturn locally. */ DISPATCH_NORETURN void __builtin_trap(void); #endif # 211 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_HW_CONFIG_UP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 213 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define OS_ATOMIC_UP 1 #else # 215 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define OS_ATOMIC_UP 0 #endif # 217 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #ifndef __OS_INTERNAL_ATOMIC__ #if 0 /* expanded by -frewrite-includes */ #include "shims/atomic.h" #endif /* expanded by -frewrite-includes */ # 220 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic.h" 1 /* * Copyright (c) 2008-2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_ATOMIC__ #define __DISPATCH_SHIMS_ATOMIC__ #if 0 /* disabled by -frewrite-includes */ #if !__has_extension(c_atomic) || !__has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic.h" #error libdispatch requires C11 with #endif # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic.h" // FreeBSD only defines _Bool in C mode. In C++ mode _Bool is not being defined. #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic.h" #define _Bool bool #endif # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic.h" # 1 "/usr/include/stdatomic.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 Ed Schouten * David Chisnall * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _STDATOMIC_H_ #define _STDATOMIC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/stdatomic.h" 3 4 # 36 "/usr/include/stdatomic.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/stdatomic.h" 3 4 # 37 "/usr/include/stdatomic.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if __has_extension(c_atomic) || __has_extension(cxx_atomic) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 39 "/usr/include/stdatomic.h" 3 4 #define __CLANG_ATOMICS #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __GNUC_PREREQ__(4, 7) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 41 "/usr/include/stdatomic.h" 3 4 #define __GNUC_ATOMICS #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__GNUC__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 43 "/usr/include/stdatomic.h" 3 4 #define __SYNC_ATOMICS #else # 45 "/usr/include/stdatomic.h" 3 4 #error "stdatomic.h does not support your compiler" #endif # 47 "/usr/include/stdatomic.h" 3 4 /* * 7.17.1 Atomic lock-free macros. */ #ifdef __GCC_ATOMIC_BOOL_LOCK_FREE #define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE #endif # 55 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_CHAR_LOCK_FREE #define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE #endif # 58 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_CHAR16_T_LOCK_FREE #define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE #endif # 61 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_CHAR32_T_LOCK_FREE #define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE #endif # 64 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_WCHAR_T_LOCK_FREE #define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE #endif # 67 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_SHORT_LOCK_FREE #define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE #endif # 70 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_INT_LOCK_FREE #define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE #endif # 73 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_LONG_LOCK_FREE #define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE #endif # 76 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_LLONG_LOCK_FREE #define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE #endif # 79 "/usr/include/stdatomic.h" 3 4 #ifdef __GCC_ATOMIC_POINTER_LOCK_FREE #define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE #endif # 82 "/usr/include/stdatomic.h" 3 4 /* * 7.17.2 Initialization. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__CLANG_ATOMICS) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 88 "/usr/include/stdatomic.h" 3 4 #define ATOMIC_VAR_INIT(value) (value) #define atomic_init(obj, value) __c11_atomic_init(obj, value) #else # 91 "/usr/include/stdatomic.h" 3 4 #define ATOMIC_VAR_INIT(value) { .__val = (value) } #define atomic_init(obj, value) ((void)((obj)->__val = (value))) #endif # 94 "/usr/include/stdatomic.h" 3 4 /* * Clang and recent GCC both provide predefined macros for the memory * orderings. If we are using a compiler that doesn't define them, use the * clang values - these will be ignored in the fallback path. */ #ifndef __ATOMIC_RELAXED #define __ATOMIC_RELAXED 0 #endif # 104 "/usr/include/stdatomic.h" 3 4 #ifndef __ATOMIC_CONSUME #define __ATOMIC_CONSUME 1 #endif # 107 "/usr/include/stdatomic.h" 3 4 #ifndef __ATOMIC_ACQUIRE #define __ATOMIC_ACQUIRE 2 #endif # 110 "/usr/include/stdatomic.h" 3 4 #ifndef __ATOMIC_RELEASE #define __ATOMIC_RELEASE 3 #endif # 113 "/usr/include/stdatomic.h" 3 4 #ifndef __ATOMIC_ACQ_REL #define __ATOMIC_ACQ_REL 4 #endif # 116 "/usr/include/stdatomic.h" 3 4 #ifndef __ATOMIC_SEQ_CST #define __ATOMIC_SEQ_CST 5 #endif # 119 "/usr/include/stdatomic.h" 3 4 /* * 7.17.3 Order and consistency. * * The memory_order_* constants that denote the barrier behaviour of the * atomic operations. */ typedef enum { memory_order_relaxed = __ATOMIC_RELAXED, memory_order_consume = __ATOMIC_CONSUME, memory_order_acquire = __ATOMIC_ACQUIRE, memory_order_release = __ATOMIC_RELEASE, memory_order_acq_rel = __ATOMIC_ACQ_REL, memory_order_seq_cst = __ATOMIC_SEQ_CST } memory_order; /* * 7.17.4 Fences. */ static __inline void atomic_thread_fence(memory_order __order __unused) { #ifdef __CLANG_ATOMICS __c11_atomic_thread_fence(__order); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__GNUC_ATOMICS) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 147 "/usr/include/stdatomic.h" 3 4 __atomic_thread_fence(__order); #else # 149 "/usr/include/stdatomic.h" 3 4 __sync_synchronize(); #endif # 151 "/usr/include/stdatomic.h" 3 4 } static __inline void atomic_signal_fence(memory_order __order __unused) { #ifdef __CLANG_ATOMICS __c11_atomic_signal_fence(__order); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__GNUC_ATOMICS) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 160 "/usr/include/stdatomic.h" 3 4 __atomic_signal_fence(__order); #else # 162 "/usr/include/stdatomic.h" 3 4 __asm volatile ("" ::: "memory"); #endif # 164 "/usr/include/stdatomic.h" 3 4 } #if 0 /* disabled by -frewrite-includes */ #if defined(__cplusplus) && !defined(_Bool) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 167 "/usr/include/stdatomic.h" 3 4 #define _Bool bool #define __bool_locally_defined #endif # 170 "/usr/include/stdatomic.h" 3 4 /* * 7.17.5 Lock-free property. */ #if 0 /* disabled by -frewrite-includes */ #if defined(_KERNEL) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 176 "/usr/include/stdatomic.h" 3 4 /* Atomics in kernelspace are always lock-free. */ #define atomic_is_lock_free(obj) \ ((void)(obj), (_Bool)1) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__CLANG_ATOMICS) || defined(__GNUC_ATOMICS) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 180 "/usr/include/stdatomic.h" 3 4 #define atomic_is_lock_free(obj) \ __atomic_is_lock_free(sizeof(*(obj)), obj) #else # 183 "/usr/include/stdatomic.h" 3 4 #define atomic_is_lock_free(obj) \ ((void)(obj), sizeof((obj)->__val) <= sizeof(void *)) #endif # 186 "/usr/include/stdatomic.h" 3 4 /* * 7.17.6 Atomic integer types. */ typedef _Atomic(_Bool) atomic_bool; typedef _Atomic(char) atomic_char; typedef _Atomic(signed char) atomic_schar; typedef _Atomic(unsigned char) atomic_uchar; typedef _Atomic(short) atomic_short; typedef _Atomic(unsigned short) atomic_ushort; typedef _Atomic(int) atomic_int; typedef _Atomic(unsigned int) atomic_uint; typedef _Atomic(long) atomic_long; typedef _Atomic(unsigned long) atomic_ulong; typedef _Atomic(long long) atomic_llong; typedef _Atomic(unsigned long long) atomic_ullong; typedef _Atomic(__char16_t) atomic_char16_t; typedef _Atomic(__char32_t) atomic_char32_t; typedef _Atomic(___wchar_t) atomic_wchar_t; typedef _Atomic(__int_least8_t) atomic_int_least8_t; typedef _Atomic(__uint_least8_t) atomic_uint_least8_t; typedef _Atomic(__int_least16_t) atomic_int_least16_t; typedef _Atomic(__uint_least16_t) atomic_uint_least16_t; typedef _Atomic(__int_least32_t) atomic_int_least32_t; typedef _Atomic(__uint_least32_t) atomic_uint_least32_t; typedef _Atomic(__int_least64_t) atomic_int_least64_t; typedef _Atomic(__uint_least64_t) atomic_uint_least64_t; typedef _Atomic(__int_fast8_t) atomic_int_fast8_t; typedef _Atomic(__uint_fast8_t) atomic_uint_fast8_t; typedef _Atomic(__int_fast16_t) atomic_int_fast16_t; typedef _Atomic(__uint_fast16_t) atomic_uint_fast16_t; typedef _Atomic(__int_fast32_t) atomic_int_fast32_t; typedef _Atomic(__uint_fast32_t) atomic_uint_fast32_t; typedef _Atomic(__int_fast64_t) atomic_int_fast64_t; typedef _Atomic(__uint_fast64_t) atomic_uint_fast64_t; typedef _Atomic(__intptr_t) atomic_intptr_t; typedef _Atomic(__uintptr_t) atomic_uintptr_t; typedef _Atomic(__size_t) atomic_size_t; typedef _Atomic(__ptrdiff_t) atomic_ptrdiff_t; typedef _Atomic(__intmax_t) atomic_intmax_t; typedef _Atomic(__uintmax_t) atomic_uintmax_t; /* * 7.17.7 Operations on atomic types. */ /* * Compiler-specific operations. */ #if 0 /* disabled by -frewrite-includes */ #if defined(__CLANG_ATOMICS) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 238 "/usr/include/stdatomic.h" 3 4 #define atomic_compare_exchange_strong_explicit(object, expected, \ desired, success, failure) \ __c11_atomic_compare_exchange_strong(object, expected, desired, \ success, failure) #define atomic_compare_exchange_weak_explicit(object, expected, \ desired, success, failure) \ __c11_atomic_compare_exchange_weak(object, expected, desired, \ success, failure) #define atomic_exchange_explicit(object, desired, order) \ __c11_atomic_exchange(object, desired, order) #define atomic_fetch_add_explicit(object, operand, order) \ __c11_atomic_fetch_add(object, operand, order) #define atomic_fetch_and_explicit(object, operand, order) \ __c11_atomic_fetch_and(object, operand, order) #define atomic_fetch_or_explicit(object, operand, order) \ __c11_atomic_fetch_or(object, operand, order) #define atomic_fetch_sub_explicit(object, operand, order) \ __c11_atomic_fetch_sub(object, operand, order) #define atomic_fetch_xor_explicit(object, operand, order) \ __c11_atomic_fetch_xor(object, operand, order) #define atomic_load_explicit(object, order) \ __c11_atomic_load(object, order) #define atomic_store_explicit(object, desired, order) \ __c11_atomic_store(object, desired, order) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__GNUC_ATOMICS) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 263 "/usr/include/stdatomic.h" 3 4 #define atomic_compare_exchange_strong_explicit(object, expected, \ desired, success, failure) \ __atomic_compare_exchange_n(object, expected, \ desired, 0, success, failure) #define atomic_compare_exchange_weak_explicit(object, expected, \ desired, success, failure) \ __atomic_compare_exchange_n(object, expected, \ desired, 1, success, failure) #define atomic_exchange_explicit(object, desired, order) \ __atomic_exchange_n(object, desired, order) #define atomic_fetch_add_explicit(object, operand, order) \ __atomic_fetch_add(object, operand, order) #define atomic_fetch_and_explicit(object, operand, order) \ __atomic_fetch_and(object, operand, order) #define atomic_fetch_or_explicit(object, operand, order) \ __atomic_fetch_or(object, operand, order) #define atomic_fetch_sub_explicit(object, operand, order) \ __atomic_fetch_sub(object, operand, order) #define atomic_fetch_xor_explicit(object, operand, order) \ __atomic_fetch_xor(object, operand, order) #define atomic_load_explicit(object, order) \ __atomic_load_n(object, order) #define atomic_store_explicit(object, desired, order) \ __atomic_store_n(object, desired, order) #else # 288 "/usr/include/stdatomic.h" 3 4 #define __atomic_apply_stride(object, operand) \ (((__typeof__((object)->__val))0) + (operand)) #define atomic_compare_exchange_strong_explicit(object, expected, \ desired, success, failure) __extension__ ({ \ __typeof__(expected) __ep = (expected); \ __typeof__(*__ep) __e = *__ep; \ (void)(success); (void)(failure); \ (_Bool)((*__ep = __sync_val_compare_and_swap(&(object)->__val, \ __e, desired)) == __e); \ }) #define atomic_compare_exchange_weak_explicit(object, expected, \ desired, success, failure) \ atomic_compare_exchange_strong_explicit(object, expected, \ desired, success, failure) #if 0 /* disabled by -frewrite-includes */ #if __has_builtin(__sync_swap) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 303 "/usr/include/stdatomic.h" 3 4 /* Clang provides a full-barrier atomic exchange - use it if available. */ #define atomic_exchange_explicit(object, desired, order) \ ((void)(order), __sync_swap(&(object)->__val, desired)) #else # 307 "/usr/include/stdatomic.h" 3 4 /* * __sync_lock_test_and_set() is only an acquire barrier in theory (although in * practice it is usually a full barrier) so we need an explicit barrier before * it. */ #define atomic_exchange_explicit(object, desired, order) \ __extension__ ({ \ __typeof__(object) __o = (object); \ __typeof__(desired) __d = (desired); \ (void)(order); \ __sync_synchronize(); \ __sync_lock_test_and_set(&(__o)->__val, __d); \ }) #endif # 321 "/usr/include/stdatomic.h" 3 4 #define atomic_fetch_add_explicit(object, operand, order) \ ((void)(order), __sync_fetch_and_add(&(object)->__val, \ __atomic_apply_stride(object, operand))) #define atomic_fetch_and_explicit(object, operand, order) \ ((void)(order), __sync_fetch_and_and(&(object)->__val, operand)) #define atomic_fetch_or_explicit(object, operand, order) \ ((void)(order), __sync_fetch_and_or(&(object)->__val, operand)) #define atomic_fetch_sub_explicit(object, operand, order) \ ((void)(order), __sync_fetch_and_sub(&(object)->__val, \ __atomic_apply_stride(object, operand))) #define atomic_fetch_xor_explicit(object, operand, order) \ ((void)(order), __sync_fetch_and_xor(&(object)->__val, operand)) #define atomic_load_explicit(object, order) \ ((void)(order), __sync_fetch_and_add(&(object)->__val, 0)) #define atomic_store_explicit(object, desired, order) \ ((void)atomic_exchange_explicit(object, desired, order)) #endif # 338 "/usr/include/stdatomic.h" 3 4 /* * Convenience functions. * * Don't provide these in kernel space. In kernel space, we should be * disciplined enough to always provide explicit barriers. */ #ifndef _KERNEL #define atomic_compare_exchange_strong(object, expected, desired) \ atomic_compare_exchange_strong_explicit(object, expected, \ desired, memory_order_seq_cst, memory_order_seq_cst) #define atomic_compare_exchange_weak(object, expected, desired) \ atomic_compare_exchange_weak_explicit(object, expected, \ desired, memory_order_seq_cst, memory_order_seq_cst) #define atomic_exchange(object, desired) \ atomic_exchange_explicit(object, desired, memory_order_seq_cst) #define atomic_fetch_add(object, operand) \ atomic_fetch_add_explicit(object, operand, memory_order_seq_cst) #define atomic_fetch_and(object, operand) \ atomic_fetch_and_explicit(object, operand, memory_order_seq_cst) #define atomic_fetch_or(object, operand) \ atomic_fetch_or_explicit(object, operand, memory_order_seq_cst) #define atomic_fetch_sub(object, operand) \ atomic_fetch_sub_explicit(object, operand, memory_order_seq_cst) #define atomic_fetch_xor(object, operand) \ atomic_fetch_xor_explicit(object, operand, memory_order_seq_cst) #define atomic_load(object) \ atomic_load_explicit(object, memory_order_seq_cst) #define atomic_store(object, desired) \ atomic_store_explicit(object, desired, memory_order_seq_cst) #endif /* !_KERNEL */ # 370 "/usr/include/stdatomic.h" 3 4 /* * 7.17.8 Atomic flag type and operations. * * XXX: Assume atomic_bool can be used as an atomic_flag. Is there some * kind of compiler built-in type we could use? */ typedef struct { atomic_bool __flag; } atomic_flag; #define ATOMIC_FLAG_INIT { ATOMIC_VAR_INIT(0) } static __inline _Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *__object, memory_order __order) { return (atomic_exchange_explicit(&__object->__flag, 1, __order)); } static __inline void atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order) { atomic_store_explicit(&__object->__flag, 0, __order); } #ifndef _KERNEL static __inline _Bool atomic_flag_test_and_set(volatile atomic_flag *__object) { return (atomic_flag_test_and_set_explicit(__object, memory_order_seq_cst)); } static __inline void atomic_flag_clear(volatile atomic_flag *__object) { atomic_flag_clear_explicit(__object, memory_order_seq_cst); } #endif /* !_KERNEL */ # 413 "/usr/include/stdatomic.h" 3 4 #ifdef __bool_locally_defined #undef _Bool #undef __bool_locally_defined #endif # 418 "/usr/include/stdatomic.h" 3 4 #endif /* !_STDATOMIC_H_ */ # 420 "/usr/include/stdatomic.h" 3 4 # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic.h" 2 #define memory_order_ordered memory_order_seq_cst #define memory_order_dependency memory_order_acquire #define os_atomic(type) type _Atomic #define _os_atomic_c11_atomic(p) \ ((__typeof__(*(p)) _Atomic *)(p)) // This removes the _Atomic and volatile qualifiers on the type of *p #define _os_atomic_basetypeof(p) \ __typeof__(atomic_load_explicit(_os_atomic_c11_atomic(p), memory_order_relaxed)) #define os_atomic_load(p, m) \ atomic_load_explicit(_os_atomic_c11_atomic(p), memory_order_##m) #define os_atomic_store(p, v, m) \ atomic_store_explicit(_os_atomic_c11_atomic(p), v, memory_order_##m) #define os_atomic_xchg(p, v, m) \ atomic_exchange_explicit(_os_atomic_c11_atomic(p), v, memory_order_##m) #define os_atomic_cmpxchg(p, e, v, m) \ ({ _os_atomic_basetypeof(p) _r = (e); \ atomic_compare_exchange_strong_explicit(_os_atomic_c11_atomic(p), \ &_r, v, memory_order_##m, memory_order_relaxed); }) #define os_atomic_cmpxchgv(p, e, v, g, m) \ ({ _os_atomic_basetypeof(p) _r = (e); _Bool _b = \ atomic_compare_exchange_strong_explicit(_os_atomic_c11_atomic(p), \ &_r, v, memory_order_##m, memory_order_relaxed); *(g) = _r; _b; }) #define os_atomic_cmpxchgvw(p, e, v, g, m) \ ({ _os_atomic_basetypeof(p) _r = (e); _Bool _b = \ atomic_compare_exchange_weak_explicit(_os_atomic_c11_atomic(p), \ &_r, v, memory_order_##m, memory_order_relaxed); *(g) = _r; _b; }) #define _os_atomic_c11_op(p, v, m, o, op) \ ({ _os_atomic_basetypeof(p) _v = (v), _r = \ atomic_fetch_##o##_explicit(_os_atomic_c11_atomic(p), _v, \ memory_order_##m); (__typeof__(_r))(_r op _v); }) #define _os_atomic_c11_op_orig(p, v, m, o, op) \ atomic_fetch_##o##_explicit(_os_atomic_c11_atomic(p), v, \ memory_order_##m) #define os_atomic_add(p, v, m) \ _os_atomic_c11_op((p), (v), m, add, +) #define os_atomic_add_orig(p, v, m) \ _os_atomic_c11_op_orig((p), (v), m, add, +) #define os_atomic_sub(p, v, m) \ _os_atomic_c11_op((p), (v), m, sub, -) #define os_atomic_sub_orig(p, v, m) \ _os_atomic_c11_op_orig((p), (v), m, sub, -) #define os_atomic_and(p, v, m) \ _os_atomic_c11_op((p), (v), m, and, &) #define os_atomic_and_orig(p, v, m) \ _os_atomic_c11_op_orig((p), (v), m, and, &) #define os_atomic_or(p, v, m) \ _os_atomic_c11_op((p), (v), m, or, |) #define os_atomic_or_orig(p, v, m) \ _os_atomic_c11_op_orig((p), (v), m, or, |) #define os_atomic_xor(p, v, m) \ _os_atomic_c11_op((p), (v), m, xor, ^) #define os_atomic_xor_orig(p, v, m) \ _os_atomic_c11_op_orig((p), (v), m, xor, ^) #define os_atomic_force_dependency_on(p, e) (p) #define os_atomic_load_with_dependency_on(p, e) \ os_atomic_load(os_atomic_force_dependency_on(p, e), relaxed) #define os_atomic_load_with_dependency_on2o(p, f, e) \ os_atomic_load_with_dependency_on(&(p)->f, e) #define os_atomic_thread_fence(m) atomic_thread_fence(memory_order_##m) #define os_atomic_load2o(p, f, m) \ os_atomic_load(&(p)->f, m) #define os_atomic_store2o(p, f, v, m) \ os_atomic_store(&(p)->f, (v), m) #define os_atomic_xchg2o(p, f, v, m) \ os_atomic_xchg(&(p)->f, (v), m) #define os_atomic_cmpxchg2o(p, f, e, v, m) \ os_atomic_cmpxchg(&(p)->f, (e), (v), m) #define os_atomic_cmpxchgv2o(p, f, e, v, g, m) \ os_atomic_cmpxchgv(&(p)->f, (e), (v), (g), m) #define os_atomic_cmpxchgvw2o(p, f, e, v, g, m) \ os_atomic_cmpxchgvw(&(p)->f, (e), (v), (g), m) #define os_atomic_add2o(p, f, v, m) \ os_atomic_add(&(p)->f, (v), m) #define os_atomic_add_orig2o(p, f, v, m) \ os_atomic_add_orig(&(p)->f, (v), m) #define os_atomic_sub2o(p, f, v, m) \ os_atomic_sub(&(p)->f, (v), m) #define os_atomic_sub_orig2o(p, f, v, m) \ os_atomic_sub_orig(&(p)->f, (v), m) #define os_atomic_and2o(p, f, v, m) \ os_atomic_and(&(p)->f, (v), m) #define os_atomic_and_orig2o(p, f, v, m) \ os_atomic_and_orig(&(p)->f, (v), m) #define os_atomic_or2o(p, f, v, m) \ os_atomic_or(&(p)->f, (v), m) #define os_atomic_or_orig2o(p, f, v, m) \ os_atomic_or_orig(&(p)->f, (v), m) #define os_atomic_xor2o(p, f, v, m) \ os_atomic_xor(&(p)->f, (v), m) #define os_atomic_xor_orig2o(p, f, v, m) \ os_atomic_xor_orig(&(p)->f, (v), m) #define os_atomic_inc(p, m) \ os_atomic_add((p), 1, m) #define os_atomic_inc_orig(p, m) \ os_atomic_add_orig((p), 1, m) #define os_atomic_inc2o(p, f, m) \ os_atomic_add2o(p, f, 1, m) #define os_atomic_inc_orig2o(p, f, m) \ os_atomic_add_orig2o(p, f, 1, m) #define os_atomic_dec(p, m) \ os_atomic_sub((p), 1, m) #define os_atomic_dec_orig(p, m) \ os_atomic_sub_orig((p), 1, m) #define os_atomic_dec2o(p, f, m) \ os_atomic_sub2o(p, f, 1, m) #define os_atomic_dec_orig2o(p, f, m) \ os_atomic_sub_orig2o(p, f, 1, m) #define os_atomic_rmw_loop(p, ov, nv, m, ...) ({ \ bool _result = false; \ __typeof__(p) _p = (p); \ ov = os_atomic_load(_p, relaxed); \ do { \ __VA_ARGS__; \ _result = os_atomic_cmpxchgvw(_p, ov, nv, &ov, m); \ } while (unlikely(!_result)); \ _result; \ }) #define os_atomic_rmw_loop2o(p, f, ov, nv, m, ...) \ os_atomic_rmw_loop(&(p)->f, ov, nv, m, __VA_ARGS__) #define os_atomic_rmw_loop_give_up_with_fence(m, expr) \ ({ os_atomic_thread_fence(m); expr; __builtin_unreachable(); }) #define os_atomic_rmw_loop_give_up(expr) \ os_atomic_rmw_loop_give_up_with_fence(relaxed, expr) #endif // __DISPATCH_SHIMS_ATOMIC__ # 175 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic.h" # 221 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #endif # 222 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define DISPATCH_ATOMIC64_ALIGN __attribute__((aligned(8))) #if 0 /* expanded by -frewrite-includes */ #include "shims/atomic_sfb.h" #endif /* expanded by -frewrite-includes */ # 224 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic_sfb.h" 1 /* * Copyright (c) 2012-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_ATOMIC_SFB__ #define __DISPATCH_SHIMS_ATOMIC_SFB__ #if 0 /* disabled by -frewrite-includes */ #if defined(__x86_64__) || defined(__i386__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic_sfb.h" // Returns UINT_MAX if all the bits in p were already set. DISPATCH_ALWAYS_INLINE static inline unsigned int os_atomic_set_first_bit(volatile unsigned long *p, unsigned int max) { unsigned long val, bit; if (max > (sizeof(val) * 8)) { __asm__ ( "1: \n\t" "mov %[_p], %[_val] \n\t" "not %[_val] \n\t" "bsf %[_val], %[_bit] \n\t" /* val is 0 => set zf */ "jz 2f \n\t" "lock \n\t" "bts %[_bit], %[_p] \n\t" /* cf = prev bit val */ "jc 1b \n\t" /* lost race, retry */ "jmp 3f \n\t" "2: \n\t" "mov %[_all_ones], %[_bit]" "\n\t" "3: \n\t" : [_p] "=m" (*p), [_val] "=&r" (val), [_bit] "=&r" (bit) : [_all_ones] "i" ((__typeof__(bit))UINT_MAX) : "memory", "cc"); } else { __asm__ ( "1: \n\t" "mov %[_p], %[_val] \n\t" "not %[_val] \n\t" "bsf %[_val], %[_bit] \n\t" /* val is 0 => set zf */ "jz 2f \n\t" "cmp %[_max], %[_bit] \n\t" "jg 2f \n\t" "lock \n\t" "bts %[_bit], %[_p] \n\t" /* cf = prev bit val */ "jc 1b \n\t" /* lost race, retry */ "jmp 3f \n\t" "2: \n\t" "mov %[_all_ones], %[_bit]" "\n\t" "3: \n\t" : [_p] "=m" (*p), [_val] "=&r" (val), [_bit] "=&r" (bit) : [_all_ones] "i" ((__typeof__(bit))UINT_MAX), [_max] "g" ((__typeof__(bit))max) : "memory", "cc"); } return (unsigned int)bit; } #else # 78 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic_sfb.h" #if 0 /* disabled by -frewrite-includes */ #if __clang__ && __clang_major__ < 5 // #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 80 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic_sfb.h" #define __builtin_ffs(x) __builtin_ffs((unsigned int)(x)) #endif # 82 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic_sfb.h" DISPATCH_ALWAYS_INLINE static inline unsigned int os_atomic_set_first_bit(volatile unsigned long *p, unsigned int max_index) { unsigned int index; unsigned long b, b_masked; os_atomic_rmw_loop(p, b, b_masked, relaxed, { // ffs returns 1 + index, or 0 if none set index = (unsigned int)__builtin_ffsl((long)~b); if (unlikely(index == 0)) { os_atomic_rmw_loop_give_up(return UINT_MAX); } index--; if (unlikely(index > max_index)) { os_atomic_rmw_loop_give_up(return UINT_MAX); } b_masked = b | (1UL << index); }); return index; } #endif # 107 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic_sfb.h" #endif // __DISPATCH_SHIMS_ATOMIC_SFB__ # 109 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/atomic_sfb.h" # 225 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "shims/tsd.h" #endif /* expanded by -frewrite-includes */ # 225 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_TSD__ #define __DISPATCH_SHIMS_TSD__ #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_MACHDEP_H #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #endif # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define DISPATCH_TSD_INLINE DISPATCH_ALWAYS_INLINE_NDEBUG #if 0 /* disabled by -frewrite-includes */ #if USE_APPLE_TSD_OPTIMIZATIONS && HAVE_PTHREAD_KEY_INIT_NP && \ !defined(DISPATCH_USE_DIRECT_TSD) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define DISPATCH_USE_DIRECT_TSD 1 #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #endif # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(OS_GS_RELATIVE) && (defined(__i386__) || defined(__x86_64__)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define OS_GS_RELATIVE __attribute__((address_space(256))) #endif # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #ifdef _os_tsd_get_base #ifdef OS_GS_RELATIVE typedef long dispatch_tsd_pair_t \ __attribute__((vector_size(sizeof(long) * 2), aligned(sizeof(long)))); #define _os_tsd_get_pair_address(k) \ (dispatch_tsd_pair_t OS_GS_RELATIVE *)((k) * sizeof(long)) #else # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" typedef struct { void *a; void *b; } dispatch_tsd_pair_t; #define _os_tsd_get_pair_address(k) \ (dispatch_tsd_pair_t *)(_os_tsd_get_base() + (k)) #endif # 58 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #endif // _os_tsd_get_base # 59 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #endif # 60 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define DISPATCH_TSD_DTOR_CC __stdcall #else # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define DISPATCH_TSD_DTOR_CC #endif # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DIRECT_TSD #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #ifndef __TSD_THREAD_QOS_CLASS #define __TSD_THREAD_QOS_CLASS 4 #endif # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #ifndef __TSD_RETURN_TO_KERNEL #define __TSD_RETURN_TO_KERNEL 5 #endif # 74 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #ifndef __TSD_MACH_SPECIAL_REPLY #define __TSD_MACH_SPECIAL_REPLY 8 #endif # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" static const unsigned long dispatch_priority_key = __TSD_THREAD_QOS_CLASS; static const unsigned long dispatch_r2k_key = __TSD_RETURN_TO_KERNEL; // dispatch_queue_key & dispatch_frame_key need to be contiguous // in that order, and queue_key to be an even number static const unsigned long dispatch_queue_key = __PTK_LIBDISPATCH_KEY0; static const unsigned long dispatch_frame_key = __PTK_LIBDISPATCH_KEY1; static const unsigned long dispatch_cache_key = __PTK_LIBDISPATCH_KEY2; static const unsigned long dispatch_context_key = __PTK_LIBDISPATCH_KEY3; static const unsigned long dispatch_pthread_root_queue_observer_hooks_key = __PTK_LIBDISPATCH_KEY4; static const unsigned long dispatch_basepri_key = __PTK_LIBDISPATCH_KEY5; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 92 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" static const unsigned long dispatch_introspection_key = __PTK_LIBDISPATCH_KEY6; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif DISPATCH_PERF_MON #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 94 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" static const unsigned long dispatch_bcounter_key = __PTK_LIBDISPATCH_KEY6; #endif # 96 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" static const unsigned long dispatch_wlh_key = __PTK_LIBDISPATCH_KEY7; static const unsigned long dispatch_voucher_key = __PTK_LIBDISPATCH_KEY8; static const unsigned long dispatch_deferred_items_key = __PTK_LIBDISPATCH_KEY9; DISPATCH_TSD_INLINE static inline void _dispatch_thread_key_create(const unsigned long *k, void (*d)(void *)) { if (!*k || !d) return; dispatch_assert_zero(pthread_key_init_np((int)*k, d)); } #if 0 /* disabled by -frewrite-includes */ #if 0 #elif DISPATCH_USE_THREAD_LOCAL_STORAGE #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 108 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" DISPATCH_TSD_INLINE static inline void _dispatch_thread_key_create(DWORD *k, void (DISPATCH_TSD_DTOR_CC *d)(void *)) { *k = FlsAlloc(d); dispatch_assert(*k != FLS_OUT_OF_INDEXES); } extern DWORD __dispatch_tsd_key; #else # 122 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" DISPATCH_TSD_INLINE static inline void _dispatch_thread_key_create(pthread_key_t *k, void (DISPATCH_TSD_DTOR_CC *d)(void *)) { dispatch_assert_zero(pthread_key_create(k, d)); } extern pthread_key_t __dispatch_tsd_key; #endif # 133 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" struct dispatch_tsd { #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 136 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" DWORD tid; #else # 138 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" pid_t tid; #endif # 140 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" void *dispatch_queue_key; void *dispatch_frame_key; void *dispatch_cache_key; void *dispatch_context_key; void *dispatch_pthread_root_queue_observer_hooks_key; void *dispatch_basepri_key; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 147 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" void *dispatch_introspection_key; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif DISPATCH_PERF_MON #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 149 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" void *dispatch_bcounter_key; #endif # 151 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" void *dispatch_priority_key; void *dispatch_r2k_key; void *dispatch_wlh_key; void *dispatch_voucher_key; void *dispatch_deferred_items_key; }; extern _Thread_local struct dispatch_tsd __dispatch_tsd; extern void libdispatch_tsd_init(void); extern void _libdispatch_tsd_cleanup(void *ctx); DISPATCH_ALWAYS_INLINE static inline struct dispatch_tsd * _dispatch_get_tsd_base(void) { if (unlikely(__dispatch_tsd.tid == 0)) { libdispatch_tsd_init(); } OS_COMPILER_CAN_ASSUME(__dispatch_tsd.tid != 0); return &__dispatch_tsd; } #define _dispatch_thread_getspecific(key) \ (_dispatch_get_tsd_base()->key) #define _dispatch_thread_setspecific(key, value) \ (void)(_dispatch_get_tsd_base()->key = (value)) #define _dispatch_thread_getspecific_pair(k1, p1, k2, p2) \ ( *(p1) = _dispatch_thread_getspecific(k1), \ *(p2) = _dispatch_thread_getspecific(k2) ) #define _dispatch_thread_getspecific_packed_pair(k1, k2, p) \ ( (p)[0] = _dispatch_thread_getspecific(k1), \ (p)[1] = _dispatch_thread_getspecific(k2) ) #define _dispatch_thread_setspecific_pair(k1, p1, k2, p2) \ ( _dispatch_thread_setspecific(k1,p1), \ _dispatch_thread_setspecific(k2,p2) ) #define _dispatch_thread_setspecific_packed_pair(k1, k2, p) \ ( _dispatch_thread_setspecific(k1,(p)[0]), \ _dispatch_thread_setspecific(k2,(p)[1]) ) #else # 196 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" extern pthread_key_t dispatch_priority_key; extern pthread_key_t dispatch_r2k_key; extern pthread_key_t dispatch_queue_key; extern pthread_key_t dispatch_frame_key; extern pthread_key_t dispatch_cache_key; extern pthread_key_t dispatch_context_key; extern pthread_key_t dispatch_pthread_root_queue_observer_hooks_key; extern pthread_key_t dispatch_basepri_key; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 205 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" extern pthread_key_t dispatch_introspection_key; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif DISPATCH_PERF_MON #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 207 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" extern pthread_key_t dispatch_bcounter_key; #endif # 209 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" extern pthread_key_t dispatch_wlh_key; extern pthread_key_t dispatch_voucher_key; extern pthread_key_t dispatch_deferred_items_key; DISPATCH_TSD_INLINE static inline void _dispatch_thread_key_create(pthread_key_t *k, void (*d)(void *)) { dispatch_assert_zero(pthread_key_create(k, d)); } #endif # 220 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #ifndef DISPATCH_USE_THREAD_LOCAL_STORAGE DISPATCH_TSD_INLINE static inline void _dispatch_thread_setspecific(pthread_key_t k, void *v) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DIRECT_TSD #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 227 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" if (_pthread_has_direct_tsd()) { (void)_pthread_setspecific_direct(k, v); } else { #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_SIMULATOR #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 231 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" (void)_pthread_setspecific_static(k, v); // rdar://26058142 #else # 233 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" __builtin_trap(); // unreachable #endif # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" } return; #endif # 238 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" dispatch_assert_zero(pthread_setspecific(k, v)); } DISPATCH_TSD_INLINE static inline void * _dispatch_thread_getspecific(pthread_key_t k) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DIRECT_TSD #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 246 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" if (_pthread_has_direct_tsd()) { return _pthread_getspecific_direct(k); } #endif # 250 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" return pthread_getspecific(k); } // this is used when loading a pair at once and the caller will want to // look at each component individually. // some platforms can load a pair of pointers efficiently that way (like arm) // intel doesn't, hence this degrades to two loads on intel DISPATCH_TSD_INLINE static inline void _dispatch_thread_getspecific_pair(pthread_key_t k1, void **p1, pthread_key_t k2, void **p2) { *p1 = _dispatch_thread_getspecific(k1); *p2 = _dispatch_thread_getspecific(k2); } // this is used for save/restore purposes // and the caller doesn't need to look at a specific component // this does SSE on intel, and SSE is bad at breaking/assembling components DISPATCH_TSD_INLINE static inline void _dispatch_thread_getspecific_packed_pair(pthread_key_t k1, pthread_key_t k2, void **p) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DIRECT_TSD && defined(_os_tsd_get_pair_address) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 275 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" dispatch_assert(k2 == k1 + 1); if (_pthread_has_direct_tsd()) { *(dispatch_tsd_pair_t *)p = *_os_tsd_get_pair_address(k1); return; } #endif # 281 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" p[0] = _dispatch_thread_getspecific(k1); p[1] = _dispatch_thread_getspecific(k2); } // this is used when storing a pair at once from separated components // some platforms can store a pair of pointers efficiently that way (like arm) // intel doesn't, hence this degrades to two stores on intel DISPATCH_TSD_INLINE static inline void _dispatch_thread_setspecific_pair(pthread_key_t k1, void *p1, pthread_key_t k2, void *p2) { _dispatch_thread_setspecific(k1, p1); _dispatch_thread_setspecific(k2, p2); } // this is used for save/restore purposes // and the caller doesn't need to look at a specific component // this does SSE on intel, and SSE is bad at breaking/assembling components DISPATCH_TSD_INLINE static inline void _dispatch_thread_setspecific_packed_pair(pthread_key_t k1, pthread_key_t k2, void **p) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DIRECT_TSD && defined(_os_tsd_get_pair_address) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 306 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" dispatch_assert(k2 == k1 + 1); if (_pthread_has_direct_tsd()) { *_os_tsd_get_pair_address(k1) = *(dispatch_tsd_pair_t *)p; return; } #endif # 312 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" _dispatch_thread_setspecific(k1, p[0]); _dispatch_thread_setspecific(k2, p[1]); } #endif # 316 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 318 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define _dispatch_thread_self() ((uintptr_t)GetCurrentThreadId()) #else # 320 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DIRECT_TSD #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 321 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define _dispatch_thread_self() ((uintptr_t)_dispatch_thread_getspecific( \ _PTHREAD_TSD_SLOT_PTHREAD_SELF)) #else # 324 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define _dispatch_thread_self() ((uintptr_t)pthread_self()) #endif # 326 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #endif # 327 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 329 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define _dispatch_thread_port() ((mach_port_t)0) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif !DISPATCH_USE_THREAD_LOCAL_STORAGE #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 331 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DIRECT_TSD #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 332 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define _dispatch_thread_port() ((mach_port_t)(uintptr_t)\ _dispatch_thread_getspecific(_PTHREAD_TSD_SLOT_MACH_THREAD_SELF)) #else # 335 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define _dispatch_thread_port() pthread_mach_thread_np(_dispatch_thread_self()) #endif # 337 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #endif # 338 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 340 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" #define _dispatch_get_thread_mig_reply_port() ((mach_port_t)(uintptr_t) \ _dispatch_thread_getspecific(_PTHREAD_TSD_SLOT_MIG_REPLY)) #define _dispatch_set_thread_mig_reply_port(p) ( \ _dispatch_thread_setspecific(_PTHREAD_TSD_SLOT_MIG_REPLY, \ (void*)(uintptr_t)(p))) #define _dispatch_get_thread_special_reply_port() ((mach_port_t)(uintptr_t) \ _dispatch_thread_getspecific(__TSD_MACH_SPECIAL_REPLY)) #define _dispatch_set_thread_special_reply_port(p) ( \ _dispatch_thread_setspecific(__TSD_MACH_SPECIAL_REPLY, \ (void*)(uintptr_t)(p))) #endif # 351 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" DISPATCH_TSD_INLINE DISPATCH_CONST static inline unsigned int _dispatch_cpu_number(void) { #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 357 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" return _os_cpu_number(); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__x86_64__) || defined(__i386__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 359 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" struct { uintptr_t p1, p2; } p; __asm__("sidt %[p]" : [p] "=&m" (p)); return (unsigned int)(p.p1 & 0xfff); #else # 363 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" // Not yet implemented. return 0; #endif # 366 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" } #undef DISPATCH_TSD_INLINE #endif # 371 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/tsd.h" # 226 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "shims/yield.h" #endif /* expanded by -frewrite-includes */ # 226 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" 1 /* * Copyright (c) 2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_YIELD__ #define __DISPATCH_SHIMS_YIELD__ #pragma mark - #pragma mark _dispatch_wait_until // _dispatch_wait_until() is used for cases when we're waiting on a thread to // finish a critical section that is a few instructions long and cannot fail // (IOW has a guarantee of making forward progress). // // Using _dispatch_wait_until() has two implications: // - there's a single waiter for the specified condition, // - the thing it is waiting on has a strong guarantee of forward progress // toward resolving the condition. // // For these reasons, we spin shortly for the likely case when the other thread // is on core and we just caught it in the inconsistency window. If the // condition we're waiting for doesn't resolve quickly, then we yield because // it's very likely the other thread that can unblock us is preempted, and we // need to wait for it to be scheduled again. // // Its typical client is the enqueuer/dequeuer starvation issue for the dispatch // enqueue algorithm where there is typically a 1-10 instruction gap between the // exchange at the tail and setting the head/prev pointer. #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_HW_CONFIG_UP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_wait_until(c) ({ \ __typeof__(c) _c; \ int _spins = 0; \ for (;;) { \ if (likely(_c = (c))) break; \ _spins++; \ _dispatch_preemption_yield(_spins); \ } \ _c; }) #else # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #ifndef DISPATCH_WAIT_SPINS_WFE #define DISPATCH_WAIT_SPINS_WFE 10 #endif # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #ifndef DISPATCH_WAIT_SPINS // #define DISPATCH_WAIT_SPINS 1024 #endif # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_wait_until(c) ({ \ __typeof__(c) _c; \ int _spins = -(DISPATCH_WAIT_SPINS); \ for (;;) { \ if (likely(_c = (c))) break; \ if (unlikely(_spins++ >= 0)) { \ _dispatch_preemption_yield(_spins); \ } else { \ dispatch_hardware_pause(); \ } \ } \ _c; }) #endif # 81 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" DISPATCH_NOT_TAIL_CALLED DISPATCH_EXPORT void *_dispatch_wait_for_enqueuer(void **ptr); #pragma mark - #pragma mark _dispatch_contention_wait_until #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_HW_CONFIG_UP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 89 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_contention_wait_until(c) false #else # 91 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #ifndef DISPATCH_CONTENTION_SPINS_MAX #define DISPATCH_CONTENTION_SPINS_MAX (128 - 1) #endif # 94 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #ifndef DISPATCH_CONTENTION_SPINS_MIN #define DISPATCH_CONTENTION_SPINS_MIN (32 - 1) #endif # 97 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 98 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_contention_spins() \ ((DISPATCH_CONTENTION_SPINS_MIN) + ((DISPATCH_CONTENTION_SPINS_MAX) - \ (DISPATCH_CONTENTION_SPINS_MIN)) / 2) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 102 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" // Use randomness to prevent threads from resonating at the same frequency and // permanently contending. Windows doesn't provide rand_r(), so use a simple // LCG. (msvcrt has rand_s(), but its security guarantees aren't optimal here.) #define _dispatch_contention_spins() ({ \ static os_atomic(unsigned int) _seed = 1; \ unsigned int _next = os_atomic_load(&_seed, relaxed); \ os_atomic_store(&_seed, _next * 1103515245 + 12345, relaxed); \ ((_next >> 24) & (DISPATCH_CONTENTION_SPINS_MAX)) | \ (DISPATCH_CONTENTION_SPINS_MIN); }) #else # 112 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" // Use randomness to prevent threads from resonating at the same // frequency and permanently contending. #define _dispatch_contention_spins() ({ \ ((unsigned int)rand() & (DISPATCH_CONTENTION_SPINS_MAX)) | \ (DISPATCH_CONTENTION_SPINS_MIN); }) #endif # 118 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_contention_wait_until(c) ({ \ bool _out = false; \ unsigned int _spins = _dispatch_contention_spins(); \ while (_spins--) { \ dispatch_hardware_pause(); \ if (likely(_out = (c))) break; \ }; _out; }) #endif # 126 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #pragma mark - #pragma mark dispatch_hardware_pause #if 0 /* disabled by -frewrite-includes */ #if defined(__x86_64__) || defined(__i386__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 131 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define dispatch_hardware_pause() __asm__("pause") #if 0 /* disabled by -frewrite-includes */ #if 0 #elif (defined(__arm__) && defined(_ARM_ARCH_7) && defined(__thumb__)) || \ defined(__arm64__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 134 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define dispatch_hardware_pause() __asm__("yield") #define dispatch_hardware_wfe() __asm__("wfe") #else # 137 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define dispatch_hardware_pause() __asm__("") #endif # 139 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #pragma mark - #pragma mark _dispatch_preemption_yield #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 144 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #if 0 /* disabled by -frewrite-includes */ #if defined(SWITCH_OPTION_OSLOCK_DEPRESS) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 145 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define DISPATCH_YIELD_THREAD_SWITCH_OPTION SWITCH_OPTION_OSLOCK_DEPRESS #else # 147 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define DISPATCH_YIELD_THREAD_SWITCH_OPTION SWITCH_OPTION_DEPRESS #endif # 149 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_preemption_yield(n) thread_switch(MACH_PORT_NULL, \ DISPATCH_YIELD_THREAD_SWITCH_OPTION, (mach_msg_timeout_t)(n)) #define _dispatch_preemption_yield_to(th, n) thread_switch(th, \ DISPATCH_YIELD_THREAD_SWITCH_OPTION, (mach_msg_timeout_t)(n)) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif HAVE_PTHREAD_YIELD_NP #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 154 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_preemption_yield(n) { (void)n; pthread_yield_np(); } #define _dispatch_preemption_yield_to(th, n) { (void)n; pthread_yield_np(); } #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 157 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_preemption_yield(n) { (void)n; Sleep(0); } #define _dispatch_preemption_yield_to(th, n) { (void)n; Sleep(0); } #else # 160 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_preemption_yield(n) { (void)n; sched_yield(); } #define _dispatch_preemption_yield_to(th, n) { (void)n; sched_yield(); } #endif // HAVE_MACH # 163 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #pragma mark - #pragma mark _dispatch_contention_usleep #ifndef DISPATCH_CONTENTION_USLEEP_START #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 169 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define DISPATCH_CONTENTION_USLEEP_START 1000 // Must be >= 1ms for Sleep() #else # 171 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define DISPATCH_CONTENTION_USLEEP_START 500 #endif # 173 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #endif # 174 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #ifndef DISPATCH_CONTENTION_USLEEP_MAX #define DISPATCH_CONTENTION_USLEEP_MAX 100000 #endif # 177 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 179 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #if 0 /* disabled by -frewrite-includes */ #if defined(SWITCH_OPTION_DISPATCH_CONTENTION) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 180 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_contention_usleep(u) thread_switch(MACH_PORT_NULL, \ SWITCH_OPTION_DISPATCH_CONTENTION, (u)) #else # 183 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_contention_usleep(u) thread_switch(MACH_PORT_NULL, \ SWITCH_OPTION_WAIT, (((u)-1)/1000)+1) #endif # 186 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #else # 187 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 188 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_contention_usleep(u) Sleep((u) / 1000) #else # 190 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #define _dispatch_contention_usleep(u) usleep((u)) #endif # 192 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #endif // HAVE_MACH # 193 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" #endif // __DISPATCH_SHIMS_YIELD__ # 195 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/yield.h" # 227 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "shims/lock.h" #endif /* expanded by -frewrite-includes */ # 227 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" 1 /* * Copyright (c) 2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_LOCK__ #define __DISPATCH_SHIMS_LOCK__ #pragma mark - platform macros DISPATCH_ENUM(dispatch_lock_options, uint32_t, DLOCK_LOCK_NONE = 0x00000000, DLOCK_LOCK_DATA_CONTENTION = 0x00010000, ); #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" typedef mach_port_t dispatch_tid; typedef uint32_t dispatch_lock; #define DLOCK_OWNER_MASK ((dispatch_lock)0xfffffffc) #define DLOCK_WAITERS_BIT ((dispatch_lock)0x00000001) #define DLOCK_FAILED_TRYLOCK_BIT ((dispatch_lock)0x00000002) #define DLOCK_OWNER_NULL ((dispatch_tid)MACH_PORT_NULL) #define _dispatch_tid_self() ((dispatch_tid)_dispatch_thread_port()) DISPATCH_ALWAYS_INLINE static inline dispatch_tid _dispatch_lock_owner(dispatch_lock lock_value) { if (lock_value & DLOCK_OWNER_MASK) { return lock_value | DLOCK_WAITERS_BIT | DLOCK_FAILED_TRYLOCK_BIT; } return DLOCK_OWNER_NULL; } #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 60 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 61 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" # 63 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #if 0 /* expanded by -frewrite-includes */ #include /* For SYS_xxx definitions */ #endif /* expanded by -frewrite-includes */ # 63 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" typedef uint32_t dispatch_tid; typedef uint32_t dispatch_lock; #define DLOCK_OWNER_MASK ((dispatch_lock)FUTEX_TID_MASK) #define DLOCK_WAITERS_BIT ((dispatch_lock)FUTEX_WAITERS) #define DLOCK_FAILED_TRYLOCK_BIT ((dispatch_lock)FUTEX_OWNER_DIED) #define DLOCK_OWNER_NULL ((dispatch_tid)0) #define _dispatch_tid_self() ((dispatch_tid)(_dispatch_get_tsd_base()->tid)) DISPATCH_ALWAYS_INLINE static inline dispatch_tid _dispatch_lock_owner(dispatch_lock lock_value) { return lock_value & DLOCK_OWNER_MASK; } #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 83 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 84 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" # 85 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" typedef DWORD dispatch_tid; typedef uint32_t dispatch_lock; #define DLOCK_OWNER_NULL ((dispatch_tid)0) #define DLOCK_OWNER_MASK ((dispatch_lock)0xfffffffc) #define DLOCK_WAITERS_BIT ((dispatch_lock)0x00000001) #define DLOCK_FAILED_TRYLOCK_BIT ((dispatch_lock)0x00000002) #define _dispatch_tid_self() ((dispatch_tid)(_dispatch_get_tsd_base()->tid << 2)) DISPATCH_ALWAYS_INLINE static inline dispatch_tid _dispatch_lock_owner(dispatch_lock lock_value) { return lock_value & DLOCK_OWNER_MASK; } #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__FreeBSD__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 104 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" typedef uint32_t dispatch_tid; typedef uint32_t dispatch_lock; #define DLOCK_OWNER_NULL ((dispatch_tid)0) #define DLOCK_OWNER_MASK ((dispatch_lock)0xfffffffc) #define DLOCK_WAITERS_BIT ((dispatch_lock)0x00000001) #define DLOCK_FAILED_TRYLOCK_BIT ((dispatch_lock)0x00000002) #define _dispatch_tid_self() ((dispatch_tid)(_dispatch_get_tsd_base()->tid)) DISPATCH_ALWAYS_INLINE static inline dispatch_tid _dispatch_lock_owner(dispatch_lock lock_value) { return lock_value & DLOCK_OWNER_MASK; } #else # 123 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" # error define _dispatch_lock encoding scheme for your platform here #endif # 125 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" DISPATCH_ALWAYS_INLINE static inline dispatch_lock _dispatch_lock_value_from_tid(dispatch_tid tid) { return tid & DLOCK_OWNER_MASK; } DISPATCH_ALWAYS_INLINE static inline dispatch_lock _dispatch_lock_value_for_self(void) { return _dispatch_lock_value_from_tid(_dispatch_tid_self()); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_lock_is_locked(dispatch_lock lock_value) { // equivalent to _dispatch_lock_owner(lock_value) == 0 return (lock_value & DLOCK_OWNER_MASK) != 0; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_lock_is_locked_by(dispatch_lock lock_value, dispatch_tid tid) { // equivalent to _dispatch_lock_owner(lock_value) == tid return ((lock_value ^ tid) & DLOCK_OWNER_MASK) == 0; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_lock_is_locked_by_self(dispatch_lock lock_value) { // equivalent to _dispatch_lock_owner(lock_value) == tid return ((lock_value ^ _dispatch_tid_self()) & DLOCK_OWNER_MASK) == 0; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_lock_has_waiters(dispatch_lock lock_value) { return (lock_value & DLOCK_WAITERS_BIT); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_lock_has_failed_trylock(dispatch_lock lock_value) { return (lock_value & DLOCK_FAILED_TRYLOCK_BIT); } #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 179 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 179 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" # 180 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #ifdef UL_COMPARE_AND_WAIT #define HAVE_UL_COMPARE_AND_WAIT 1 #endif # 183 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #ifdef UL_UNFAIR_LOCK #define HAVE_UL_UNFAIR_LOCK 1 #endif # 186 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #endif # 187 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #ifndef HAVE_FUTEX #if 0 /* disabled by -frewrite-includes */ #if defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 190 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #define HAVE_FUTEX 1 #define HAVE_FUTEX_PI 1 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__FreeBSD__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 193 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #define HAVE_FUTEX 0 #define HAVE_FUTEX_PI 0 #else # 196 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #define HAVE_FUTEX 0 #define HAVE_FUTEX_PI 0 #endif # 199 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #endif // HAVE_FUTEX # 200 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #if 0 /* disabled by -frewrite-includes */ #if defined(__x86_64__) || defined(__i386__) || defined(__s390x__) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 202 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #define DISPATCH_ONCE_USE_QUIESCENT_COUNTER 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __APPLE__ #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 204 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #define DISPATCH_ONCE_USE_QUIESCENT_COUNTER 1 #else # 206 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #define DISPATCH_ONCE_USE_QUIESCENT_COUNTER 0 #endif # 208 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #pragma mark - semaphores #if 0 /* disabled by -frewrite-includes */ #if USE_MACH_SEM #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 212 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" typedef semaphore_t _dispatch_sema4_t; #define _DSEMA4_POLICY_FIFO SYNC_POLICY_FIFO #define _DSEMA4_POLICY_LIFO SYNC_POLICY_LIFO #define _DSEMA4_TIMEOUT() KERN_OPERATION_TIMED_OUT #define _dispatch_sema4_init(sema, policy) (void)(*(sema) = MACH_PORT_NULL) #define _dispatch_sema4_is_created(sema) (*(sema) != MACH_PORT_NULL) void _dispatch_sema4_create_slow(_dispatch_sema4_t *sema, int policy); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif USE_POSIX_SEM #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 223 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" typedef sem_t _dispatch_sema4_t; #define _DSEMA4_POLICY_FIFO 0 #define _DSEMA4_POLICY_LIFO 0 #define _DSEMA4_TIMEOUT() ((errno) = ETIMEDOUT, -1) void _dispatch_sema4_init(_dispatch_sema4_t *sema, int policy); #define _dispatch_sema4_is_created(sema) ((void)sema, 1) #define _dispatch_sema4_create_slow(sema, policy) ((void)sema, (void)policy) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif USE_WIN32_SEM #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 234 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" typedef HANDLE _dispatch_sema4_t; #define _DSEMA4_POLICY_FIFO 0 #define _DSEMA4_POLICY_LIFO 0 #define _DSEMA4_TIMEOUT() ((errno) = ETIMEDOUT, -1) void _dispatch_sema4_init(_dispatch_sema4_t *sema, int policy); #define _dispatch_sema4_is_created(sema) ((void)sema, 1) #define _dispatch_sema4_create_slow(sema, policy) ((void)sema, (void)policy) #else # 245 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #error "port has to implement _dispatch_sema4_t" #endif # 247 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" void _dispatch_sema4_dispose_slow(_dispatch_sema4_t *sema, int policy); void _dispatch_sema4_signal(_dispatch_sema4_t *sema, long count); void _dispatch_sema4_wait(_dispatch_sema4_t *sema); bool _dispatch_sema4_timedwait(_dispatch_sema4_t *sema, dispatch_time_t timeout); DISPATCH_ALWAYS_INLINE static inline void _dispatch_sema4_create(_dispatch_sema4_t *sema, int policy) { if (!_dispatch_sema4_is_created(sema)) { _dispatch_sema4_create_slow(sema, policy); } } DISPATCH_ALWAYS_INLINE static inline void _dispatch_sema4_dispose(_dispatch_sema4_t *sema, int policy) { if (_dispatch_sema4_is_created(sema)) { _dispatch_sema4_dispose_slow(sema, policy); } } #pragma mark - compare and wait DISPATCH_NOT_TAIL_CALLED int _dispatch_wait_on_address(uint32_t volatile *address, uint32_t value, dispatch_time_t timeout, dispatch_lock_options_t flags); void _dispatch_wake_by_address(uint32_t volatile *address); #pragma mark - thread event /** * @typedef dispatch_thread_event_t * * @abstract * Dispatch Thread Events are used for one-time synchronization between threads. * * @discussion * Dispatch Thread Events are cheap synchronization points used when a thread * needs to block until a certain event has happened. Dispatch Thread Event * must be initialized and destroyed with _dispatch_thread_event_init() and * _dispatch_thread_event_destroy(). * * A Dispatch Thread Event must be waited on and signaled exactly once between * initialization and destruction. These objects are simpler than semaphores * and do not support being signaled and waited on an arbitrary number of times. * * This locking primitive has no notion of ownership */ typedef struct dispatch_thread_event_s { #if 0 /* disabled by -frewrite-includes */ #if HAVE_UL_COMPARE_AND_WAIT || HAVE_FUTEX #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 299 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" // 1 means signalled but not waited on yet // UINT32_MAX means waited on, but not signalled yet // 0 is the initial and final state uint32_t dte_value; #else # 304 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" _dispatch_sema4_t dte_sema; #endif # 306 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" } dispatch_thread_event_s, *dispatch_thread_event_t; DISPATCH_NOT_TAIL_CALLED void _dispatch_thread_event_wait_slow(dispatch_thread_event_t); void _dispatch_thread_event_signal_slow(dispatch_thread_event_t); DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_event_init(dispatch_thread_event_t dte) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_UL_COMPARE_AND_WAIT || HAVE_FUTEX #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 317 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" dte->dte_value = 0; #else # 319 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" _dispatch_sema4_init(&dte->dte_sema, _DSEMA4_POLICY_FIFO); #endif # 321 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_event_signal(dispatch_thread_event_t dte) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_UL_COMPARE_AND_WAIT || HAVE_FUTEX #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 328 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" if (os_atomic_inc_orig(&dte->dte_value, release) == 0) { // 0 -> 1 transition doesn't need a signal // force a wake even when the value is corrupt, // waiters do the validation return; } #else # 335 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" // fallthrough #endif # 337 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" _dispatch_thread_event_signal_slow(dte); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_event_wait(dispatch_thread_event_t dte) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_UL_COMPARE_AND_WAIT || HAVE_FUTEX #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 346 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" if (os_atomic_dec(&dte->dte_value, acquire) == 0) { // 1 -> 0 is always a valid transition, so we can return // for any other value, take the slow path which checks it's not corrupt return; } #else # 352 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" // fallthrough #endif # 354 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" _dispatch_thread_event_wait_slow(dte); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_event_destroy(dispatch_thread_event_t dte) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_UL_COMPARE_AND_WAIT || HAVE_FUTEX #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 362 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" // nothing to do dispatch_assert(dte->dte_value == 0); #else # 365 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" _dispatch_sema4_dispose(&dte->dte_sema, _DSEMA4_POLICY_FIFO); #endif # 367 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" } #pragma mark - unfair lock typedef struct dispatch_unfair_lock_s { dispatch_lock dul_lock; } dispatch_unfair_lock_s, *dispatch_unfair_lock_t; DISPATCH_NOT_TAIL_CALLED void _dispatch_unfair_lock_lock_slow(dispatch_unfair_lock_t l, dispatch_lock_options_t options); void _dispatch_unfair_lock_unlock_slow(dispatch_unfair_lock_t l, dispatch_lock tid_cur); DISPATCH_ALWAYS_INLINE static inline void _dispatch_unfair_lock_lock(dispatch_unfair_lock_t l) { dispatch_lock value_self = _dispatch_lock_value_for_self(); if (likely(os_atomic_cmpxchg(&l->dul_lock, DLOCK_OWNER_NULL, value_self, acquire))) { return; } return _dispatch_unfair_lock_lock_slow(l, DLOCK_LOCK_DATA_CONTENTION); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_unfair_lock_trylock(dispatch_unfair_lock_t l, dispatch_tid *owner) { dispatch_lock value_self = _dispatch_lock_value_for_self(); dispatch_lock old_value, new_value; os_atomic_rmw_loop(&l->dul_lock, old_value, new_value, acquire, { if (likely(!_dispatch_lock_is_locked(old_value))) { new_value = value_self; } else { new_value = old_value | DLOCK_FAILED_TRYLOCK_BIT; } }); if (owner) *owner = _dispatch_lock_owner(new_value); return !_dispatch_lock_is_locked(old_value); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_unfair_lock_tryunlock(dispatch_unfair_lock_t l) { dispatch_lock old_value, new_value; os_atomic_rmw_loop(&l->dul_lock, old_value, new_value, release, { if (unlikely(old_value & DLOCK_FAILED_TRYLOCK_BIT)) { new_value = old_value ^ DLOCK_FAILED_TRYLOCK_BIT; } else { new_value = DLOCK_OWNER_NULL; } }); if (unlikely(new_value)) { // unlock failed, renew the lock, which needs an acquire barrier os_atomic_thread_fence(acquire); return false; } if (unlikely(_dispatch_lock_has_waiters(old_value))) { _dispatch_unfair_lock_unlock_slow(l, old_value); } return true; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_unfair_lock_unlock_had_failed_trylock(dispatch_unfair_lock_t l) { dispatch_lock cur, value_self = _dispatch_lock_value_for_self(); #if 0 /* disabled by -frewrite-includes */ #if HAVE_FUTEX #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 441 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" if (likely(os_atomic_cmpxchgv(&l->dul_lock, value_self, DLOCK_OWNER_NULL, &cur, release))) { return false; } #else # 446 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" cur = os_atomic_xchg(&l->dul_lock, DLOCK_OWNER_NULL, release); if (likely(cur == value_self)) return false; #endif # 449 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" _dispatch_unfair_lock_unlock_slow(l, cur); return _dispatch_lock_has_failed_trylock(cur); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_unfair_lock_unlock(dispatch_unfair_lock_t l) { (void)_dispatch_unfair_lock_unlock_had_failed_trylock(l); } #pragma mark - gate lock #define DLOCK_GATE_UNLOCKED ((dispatch_lock)0) #define DLOCK_ONCE_UNLOCKED ((uintptr_t)0) #define DLOCK_ONCE_DONE (~(uintptr_t)0) typedef struct dispatch_gate_s { dispatch_lock dgl_lock; } dispatch_gate_s, *dispatch_gate_t; typedef struct dispatch_once_gate_s { union { dispatch_gate_s dgo_gate; uintptr_t dgo_once; }; } dispatch_once_gate_s, *dispatch_once_gate_t; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_ONCE_USE_QUIESCENT_COUNTER #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 479 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #define DISPATCH_ONCE_MAKE_GEN(gen) (((gen) << 2) + DLOCK_FAILED_TRYLOCK_BIT) #define DISPATCH_ONCE_IS_GEN(gen) (((gen) & 3) == DLOCK_FAILED_TRYLOCK_BIT) /* * the _COMM_PAGE_CPU_QUIESCENT_COUNTER value is incremented every time * all CPUs have performed a context switch. * * A counter update algorithm is: * * // atomic_or acq_rel is marked as ======== below * if (atomic_or(&mask, acq_rel) == full_mask) { * * tmp = atomic_load(&generation, relaxed); * atomic_store(&generation, gen + 1, relaxed); * * // atomic_store release is marked as -------- below * atomic_store(&mask, 0, release); * } * * This enforces boxes delimited by the acq_rel/release barriers to only be able * to observe two possible values for the counter which have been marked below. * * Lemma 1 * ~~~~~~~ * * Between two acq_rel barriers, a thread can only observe two possible values * of the generation counter G maintained by the kernel. * * The Figure below, adds the happens-before-relationships and assertions: * * | Thread A | Thread B | Thread C | * | | | | * |==================| | | * | G = N | | | * |------------------|--------. | | * | | | | | * | | v | | * | |==================| | * | | assert(G >= N) | | * | | | | * | | | | * | | | | * | | assert(G < N+2) | | * | |==================|--------. | * | | | | | * | | | v | * | | |==================| * | | | G = N + 2 | * | | |------------------| * | | | | * * * This allows us to name the area delimited by two consecutive acq_rel * barriers { N, N+1 } after the two possible values of G they can observe, * which we'll use from now on. * * * Lemma 2 * ~~~~~~~ * * Any operation that a thread does while observing G in { N-2, N-1 } will be * visible to a thread that can observe G in { N, N + 1 }. * * Any operation that a thread does while observing G in { N, N + 1 } cannot * possibly be visible to a thread observing G in { N-2, N-1 } * * This is a corollary of Lemma 1: the only possibility is for the update * of G to N to have happened between two acq_rel barriers of the considered * threads. * * Below is a figure of why instantiated with N = 2 * * | Thread A | Thread B | Thread C | * | | | | * | G ∈ { 0, 1 } | | | * | | | | * | | | | * | store(X, 1) | | | * | assert(!Z) | | | * | | | | * |==================|--------. | | * | G ∈ { 1, 2 } | | | | * | | v | | * | |==================|--------. | * | | G = 2 | | | * | |------------------| | | * | | | | | * | | | v | * | | |==================| * | | | G ∈ { 2, 3 } | * | | | | * | | | | * | | | store(Z, 1) | * | | | assert(X) | * | | | | * | | | | * * * Theorem * ~~~~~~~ * * The optimal number of increments to observe for the dispatch once algorithm * to be safe is 4. * * Proof (correctness): * * Consider a dispatch once initializer thread in its { N, N+1 } "zone". * * Per Lemma 2, any observer thread in its { N+2, N+3 } zone will see the * effect of the dispatch once initialization. * * Per Lemma 2, when the DONE transition happens in a thread zone { N+3, N+4 }, * then threads can observe this transition in their { N+2, N+3 } zone at the * earliest. * * Hence for an initializer bracket of { N, N+1 }, the first safe bracket for * the DONE transition is { N+3, N+4 }. * * * Proof (optimal): * * The following ordering is possible if waiting only for three periods: * * | Thread A | Thread B | Thread C | * | | | | * | | | | * | | |==================| * | | | G ∈ { 1, 2 } | * | | | | * | | | | * | | | R(once == -1) <-+--. * | | | | | * | -------+------------------+---------. | | * | | | | | | * | W(global, 42) | | | | | * | WRel(once, G:0) | | | | | * | | | | | | * | | | v | | * | | | R(global == 0) | | * | | | | | * | | | | | * |==================| | | | * | G ∈ { 1, 2 } | | | | * | |==================| | | * | | G = 2 | | | * | |------------------| | | * | | | | | * |==================| | | | * | G ∈ { 2, 3 } | | | | * | | | | | * | | | | | * | W(once, -1) ---+------------------+------------------+--' * | | | | * | | |==================| * | | | G ∈ { 2, 3 } | * | | | | * */ #define DISPATCH_ONCE_GEN_SAFE_DELTA (4 << 2) DISPATCH_ALWAYS_INLINE static inline uintptr_t _dispatch_once_generation(void) { uintptr_t value; value = *(volatile uintptr_t *)_COMM_PAGE_CPU_QUIESCENT_COUNTER; return (uintptr_t)DISPATCH_ONCE_MAKE_GEN(value); } DISPATCH_ALWAYS_INLINE static inline uintptr_t _dispatch_once_mark_quiescing(dispatch_once_gate_t dgo) { return os_atomic_xchg(&dgo->dgo_once, _dispatch_once_generation(), release); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_once_mark_done_if_quiesced(dispatch_once_gate_t dgo, uintptr_t gen) { if (_dispatch_once_generation() - gen >= DISPATCH_ONCE_GEN_SAFE_DELTA) { /* * See explanation above, when the quiescing counter approach is taken * then this store needs only to be relaxed as it is used as a witness * that the required barriers have happened. */ os_atomic_store(&dgo->dgo_once, DLOCK_ONCE_DONE, relaxed); } } #else # 669 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" DISPATCH_ALWAYS_INLINE static inline uintptr_t _dispatch_once_mark_done(dispatch_once_gate_t dgo) { return os_atomic_xchg(&dgo->dgo_once, DLOCK_ONCE_DONE, release); } #endif // DISPATCH_ONCE_USE_QUIESCENT_COUNTER # 676 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" void _dispatch_once_wait(dispatch_once_gate_t l); void _dispatch_gate_broadcast_slow(dispatch_gate_t l, dispatch_lock tid_cur); DISPATCH_ALWAYS_INLINE static inline bool _dispatch_gate_tryenter(dispatch_gate_t l) { return os_atomic_cmpxchg(&l->dgl_lock, DLOCK_GATE_UNLOCKED, _dispatch_lock_value_for_self(), acquire); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_gate_broadcast(dispatch_gate_t l) { dispatch_lock cur, value_self = _dispatch_lock_value_for_self(); cur = os_atomic_xchg(&l->dgl_lock, DLOCK_GATE_UNLOCKED, release); if (likely(cur == value_self)) return; _dispatch_gate_broadcast_slow(l, cur); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_once_gate_tryenter(dispatch_once_gate_t l) { return os_atomic_cmpxchg(&l->dgo_once, DLOCK_ONCE_UNLOCKED, (uintptr_t)_dispatch_lock_value_for_self(), relaxed); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_once_gate_broadcast(dispatch_once_gate_t l) { dispatch_lock value_self = _dispatch_lock_value_for_self(); uintptr_t v; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_ONCE_USE_QUIESCENT_COUNTER #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 713 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" v = _dispatch_once_mark_quiescing(l); #else # 715 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" v = _dispatch_once_mark_done(l); #endif # 717 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" if (likely((dispatch_lock)v == value_self)) return; _dispatch_gate_broadcast_slow(&l->dgo_gate, (dispatch_lock)v); } #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 722 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" DISPATCH_NOT_TAIL_CALLED void _dispatch_firehose_gate_wait(dispatch_gate_t l, uint32_t owner, uint32_t flags); #endif // TARGET_OS_MAC # 728 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" #endif // __DISPATCH_SHIMS_LOCK__ # 730 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/lock.h" # 228 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "shims/perfmon.h" #endif /* expanded by -frewrite-includes */ # 229 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/perfmon.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_PERFMON__ #define __DISPATCH_SHIMS_PERFMON__ #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PERF_MON #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/perfmon.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/perfmon.h" #error invalid configuration #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/perfmon.h" typedef enum { perfmon_thread_no_trace = 0, perfmon_thread_event_no_steal, // 1) Event threads that couldn't steal perfmon_thread_event_steal, // 2) Event threads failing to steal very late perfmon_thread_worker_non_oc, // 3) Non overcommit threads finding // nothing on the root queues perfmon_thread_worker_oc, // 4) Overcommit thread finding nothing to do perfmon_thread_manager, } perfmon_thread_type; DISPATCH_ALWAYS_INLINE static inline void _dispatch_perfmon_workitem_inc(void) { unsigned long cnt; cnt = (unsigned long)_dispatch_thread_getspecific(dispatch_bcounter_key); _dispatch_thread_setspecific(dispatch_bcounter_key, (void *)++cnt); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_perfmon_workitem_dec(void) { unsigned long cnt; cnt = (unsigned long)_dispatch_thread_getspecific(dispatch_bcounter_key); _dispatch_thread_setspecific(dispatch_bcounter_key, (void *)--cnt); } #define DISPATCH_PERF_MON_ARGS_PROTO , uint64_t perfmon_start #define DISPATCH_PERF_MON_ARGS , perfmon_start #define DISPATCH_PERF_MON_VAR uint64_t perfmon_start; #define DISPATCH_PERF_MON_VAR_INIT uint64_t perfmon_start = 0; #define _dispatch_perfmon_start_impl(trace) ({ \ if (trace) _dispatch_ktrace0(DISPATCH_PERF_MON_worker_thread_start); \ perfmon_start = _dispatch_uptime(); \ }) #define _dispatch_perfmon_start() \ DISPATCH_PERF_MON_VAR _dispatch_perfmon_start_impl(true) #define _dispatch_perfmon_start_notrace() \ DISPATCH_PERF_MON_VAR _dispatch_perfmon_start_impl(false) #define _dispatch_perfmon_end(thread_type) \ _dispatch_queue_merge_stats(perfmon_start, true, thread_type) #define _dispatch_perfmon_end_notrace() \ _dispatch_queue_merge_stats(perfmon_start, false, perfmon_thread_no_trace) void _dispatch_queue_merge_stats(uint64_t start, bool trace, perfmon_thread_type type); #else # 84 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/perfmon.h" #define DISPATCH_PERF_MON_ARGS_PROTO #define DISPATCH_PERF_MON_ARGS #define DISPATCH_PERF_MON_VAR #define DISPATCH_PERF_MON_VAR_INIT #define _dispatch_perfmon_workitem_inc() #define _dispatch_perfmon_workitem_dec() #define _dispatch_perfmon_start_impl(trace) #define _dispatch_perfmon_start() #define _dispatch_perfmon_end(thread_type) #define _dispatch_perfmon_start_notrace() #define _dispatch_perfmon_end_notrace() #endif // DISPATCH_PERF_MON # 98 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/perfmon.h" #endif # 100 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/perfmon.h" # 230 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "shims/getprogname.h" #endif /* expanded by -frewrite-includes */ # 231 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" 1 /* * Copyright (c) 2009-2010 Mark Heily * All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 22 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" # 23 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" #ifndef __DISPATCH_SHIMS_GETPROGNAME__ #define __DISPATCH_SHIMS_GETPROGNAME__ #if 0 /* disabled by -frewrite-includes */ #if !HAVE_GETPROGNAME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 28 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" #ifdef __ANDROID__ extern const char *__progname; #endif /* __ANDROID */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" const char *getprogname(void); #else # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" static inline char * getprogname(void) { #if 0 /* disabled by -frewrite-includes */ # if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" return program_invocation_short_name; #if 0 /* disabled by -frewrite-includes */ #if 0 # elif defined(__ANDROID__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" return __progname; # else # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" # error getprogname(3) is not available on this platform # endif # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" } #endif /* _WIN32 */ # 49 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" #endif /* HAVE_GETPROGNAME */ # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" #endif /* __DISPATCH_SHIMS_GETPROGNAME__ */ # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/getprogname.h" # 232 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "shims/time.h" #endif /* expanded by -frewrite-includes */ # 232 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SHIMS_TIME__ #define __DISPATCH_SHIMS_TIME__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #endif # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" static inline unsigned int sleep(unsigned int seconds) { Sleep(seconds * 1000); // milliseconds return 0; } #endif # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" typedef enum { DISPATCH_CLOCK_UPTIME, DISPATCH_CLOCK_MONOTONIC, DISPATCH_CLOCK_WALL, #define DISPATCH_CLOCK_COUNT (DISPATCH_CLOCK_WALL + 1) } dispatch_clock_t; void _dispatch_time_init(void); #if 0 /* disabled by -frewrite-includes */ #if defined(__i386__) || defined(__x86_64__) || !HAVE_MACH_ABSOLUTE_TIME #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 53 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" #define DISPATCH_TIME_UNIT_USES_NANOSECONDS 1 #else # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" #define DISPATCH_TIME_UNIT_USES_NANOSECONDS 0 #endif # 57 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_TIME_UNIT_USES_NANOSECONDS #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 59 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" // x86 currently implements mach time in nanoseconds // this is NOT likely to change DISPATCH_ALWAYS_INLINE static inline uint64_t _dispatch_time_mach2nano(uint64_t machtime) { return machtime; } DISPATCH_ALWAYS_INLINE static inline uint64_t _dispatch_time_nano2mach(uint64_t nsec) { return nsec; } #else # 75 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" #define DISPATCH_USE_HOST_TIME 1 extern uint64_t (*_dispatch_host_time_mach2nano)(uint64_t machtime); extern uint64_t (*_dispatch_host_time_nano2mach)(uint64_t nsec); static inline uint64_t _dispatch_time_mach2nano(uint64_t machtime) { return _dispatch_host_time_mach2nano(machtime); } static inline uint64_t _dispatch_time_nano2mach(uint64_t nsec) { return _dispatch_host_time_nano2mach(nsec); } #endif // DISPATCH_USE_HOST_TIME # 90 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" /* XXXRW: Some kind of overflow detection needed? */ #define _dispatch_timespec_to_nano(ts) \ ((uint64_t)(ts).tv_sec * NSEC_PER_SEC + (uint64_t)(ts).tv_nsec) #define _dispatch_timeval_to_nano(tv) \ ((uint64_t)(tv).tv_sec * NSEC_PER_SEC + \ (uint64_t)(tv).tv_usec * NSEC_PER_USEC) static inline uint64_t _dispatch_get_nanoseconds(void) { dispatch_static_assert(sizeof(NSEC_PER_SEC) == 8); dispatch_static_assert(sizeof(USEC_PER_SEC) == 8); #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 105 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" return clock_gettime_nsec_np(CLOCK_REALTIME); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif HAVE_DECL_CLOCK_REALTIME #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 107 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timespec ts; dispatch_assume_zero(clock_gettime(CLOCK_REALTIME, &ts)); return _dispatch_timespec_to_nano(ts); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 111 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" static const uint64_t kNTToUNIXBiasAdjustment = 11644473600 * NSEC_PER_SEC; // FILETIME is 100-nanosecond intervals since January 1, 1601 (UTC). FILETIME ft; ULARGE_INTEGER li; GetSystemTimePreciseAsFileTime(&ft); li.LowPart = ft.dwLowDateTime; li.HighPart = ft.dwHighDateTime; return li.QuadPart * 100ull - kNTToUNIXBiasAdjustment; #else # 120 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timeval tv; dispatch_assert_zero(gettimeofday(&tv, NULL)); return _dispatch_timeval_to_nano(tv); #endif # 124 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" } /* On the use of clock sources in the CLOCK_MONOTONIC family * * The code below requires monotonic clock sources that only tick * while the machine is running. * * Per POSIX, the CLOCK_MONOTONIC family is supposed to tick during * machine sleep; this is not the case on Linux, and that behavior * became part of the Linux ABI. * * Using the CLOCK_MONOTONIC family on POSIX-compliant platforms * will lead to bugs, hence its use is restricted to Linux. */ static inline uint64_t _dispatch_uptime(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH_ABSOLUTE_TIME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 143 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" return mach_absolute_time(); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif HAVE_DECL_CLOCK_MONOTONIC && defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 145 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timespec ts; dispatch_assume_zero(clock_gettime(CLOCK_MONOTONIC, &ts)); return _dispatch_timespec_to_nano(ts); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif HAVE_DECL_CLOCK_UPTIME && !defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 149 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timespec ts; dispatch_assume_zero(clock_gettime(CLOCK_UPTIME, &ts)); return _dispatch_timespec_to_nano(ts); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 153 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" ULONGLONG ullUnbiasedTime; _dispatch_QueryUnbiasedInterruptTimePrecise(&ullUnbiasedTime); return ullUnbiasedTime * 100; #else # 157 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" #error platform needs to implement _dispatch_uptime() #endif # 159 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" } static inline uint64_t _dispatch_monotonic_time(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH_ABSOLUTE_TIME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 165 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" return mach_continuous_time(); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 167 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timespec ts; dispatch_assume_zero(clock_gettime(CLOCK_BOOTTIME, &ts)); return _dispatch_timespec_to_nano(ts); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif HAVE_DECL_CLOCK_MONOTONIC #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 171 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timespec ts; dispatch_assume_zero(clock_gettime(CLOCK_MONOTONIC, &ts)); return _dispatch_timespec_to_nano(ts); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 175 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" ULONGLONG ullTime; _dispatch_QueryInterruptTimePrecise(&ullTime); return ullTime * 100ull; #else # 179 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" #error platform needs to implement _dispatch_monotonic_time() #endif # 181 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" } DISPATCH_ALWAYS_INLINE static inline uint64_t _dispatch_approximate_time(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH_APPROXIMATE_TIME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 188 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" return mach_approximate_time(); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif HAVE_DECL_CLOCK_MONOTONIC_COARSE && defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 190 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timespec ts; dispatch_assume_zero(clock_gettime(CLOCK_MONOTONIC_COARSE, &ts)); return _dispatch_timespec_to_nano(ts); #if 0 /* disabled by -frewrite-includes */ #if 0 #elif HAVE_DECL_CLOCK_UPTIME_FAST && !defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 194 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timespec ts; dispatch_assume_zero(clock_gettime(CLOCK_UPTIME_FAST, &ts)); return _dispatch_timespec_to_nano(ts); #else # 198 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" return _dispatch_uptime(); #endif # 200 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" } DISPATCH_ALWAYS_INLINE static inline uint64_t _dispatch_time_now(dispatch_clock_t clock) { switch (clock) { case DISPATCH_CLOCK_UPTIME: return _dispatch_uptime(); case DISPATCH_CLOCK_MONOTONIC: return _dispatch_monotonic_time(); case DISPATCH_CLOCK_WALL: return _dispatch_get_nanoseconds(); } __builtin_unreachable(); } typedef struct { uint64_t nows[DISPATCH_CLOCK_COUNT]; } dispatch_clock_now_cache_s, *dispatch_clock_now_cache_t; DISPATCH_ALWAYS_INLINE static inline uint64_t _dispatch_time_now_cached(dispatch_clock_t clock, dispatch_clock_now_cache_t cache) { if (likely(cache->nows[clock])) { return cache->nows[clock]; } #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 230 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" struct timespec ts; mach_get_times(&cache->nows[DISPATCH_CLOCK_UPTIME], &cache->nows[DISPATCH_CLOCK_MONOTONIC], &ts); cache->nows[DISPATCH_CLOCK_WALL] = _dispatch_timespec_to_nano(ts); #else # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" cache->nows[clock] = _dispatch_time_now(clock); #endif # 237 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" return cache->nows[clock]; } // Encoding of dispatch_time_t: // 1. Wall time has the top two bits set; negate to get the actual value. // 2. Absolute time has the top two bits clear and is the actual value. // 3. Continuous time has bit 63 set and bit 62 clear. Clear bit 63 to get the // actual value. // 4. "Forever" and "now" are encoded as ~0ULL and 0ULL respectively. // // The consequence of all this is that we can't have an actual time value that // is >= 0x4000000000000000. Larger values always get silently converted to // DISPATCH_TIME_FOREVER because the APIs that return time values have no way to // indicate a range error. #define DISPATCH_UP_OR_MONOTONIC_TIME_MASK (1ULL << 63) #define DISPATCH_WALLTIME_MASK (1ULL << 62) #define DISPATCH_TIME_MAX_VALUE (DISPATCH_WALLTIME_MASK - 1) DISPATCH_ALWAYS_INLINE static inline void _dispatch_time_to_clock_and_value(dispatch_time_t time, dispatch_clock_t *clock, uint64_t *value) { uint64_t actual_value; if ((int64_t)time < 0) { // Wall time or mach continuous time if (time & DISPATCH_WALLTIME_MASK) { // Wall time (value 11 in bits 63, 62) *clock = DISPATCH_CLOCK_WALL; actual_value = time == DISPATCH_WALLTIME_NOW ? _dispatch_get_nanoseconds() : (uint64_t)-time; } else { // Continuous time (value 10 in bits 63, 62). *clock = DISPATCH_CLOCK_MONOTONIC; actual_value = time & ~DISPATCH_UP_OR_MONOTONIC_TIME_MASK; } } else { *clock = DISPATCH_CLOCK_UPTIME; actual_value = time; } // Range-check the value before returning. *value = actual_value > DISPATCH_TIME_MAX_VALUE ? DISPATCH_TIME_FOREVER : actual_value; } DISPATCH_ALWAYS_INLINE static inline dispatch_time_t _dispatch_clock_and_value_to_time(dispatch_clock_t clock, uint64_t value) { if (value >= DISPATCH_TIME_MAX_VALUE) { return DISPATCH_TIME_FOREVER; } switch (clock) { case DISPATCH_CLOCK_WALL: return -value; case DISPATCH_CLOCK_UPTIME: return value; case DISPATCH_CLOCK_MONOTONIC: return value | DISPATCH_UP_OR_MONOTONIC_TIME_MASK; } __builtin_unreachable(); } #endif // __DISPATCH_SHIMS_TIME__ # 301 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims/time.h" # 233 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" 2 #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 236 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __has_builtin(__builtin_add_overflow) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 237 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define os_add_overflow(a, b, c) __builtin_add_overflow(a, b, c) #define os_sub_overflow(a, b, c) __builtin_sub_overflow(a, b, c) #define os_mul_overflow(a, b, c) __builtin_mul_overflow(a, b, c) #else # 241 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #error unsupported compiler #endif # 243 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #ifndef os_mul_and_add_overflow #define os_mul_and_add_overflow(a, x, b, res) __extension__({ \ __typeof(*(res)) _tmp; \ bool _s, _t; \ _s = os_mul_overflow((a), (x), &_tmp); \ _t = os_add_overflow((b), _tmp, (res)); \ _s | _t; \ }) #endif # 253 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #if 0 /* disabled by -frewrite-includes */ #if __has_feature(c_static_assert) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 256 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define __dispatch_is_array(x) \ _Static_assert(!__builtin_types_compatible_p(__typeof__((x)[0]) *, __typeof__(x)), \ #x " isn't an array") #define countof(x) \ ({ __dispatch_is_array(x); sizeof(x) / sizeof((x)[0]); }) #else # 262 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define countof(x) (sizeof(x) / sizeof(x[0])) #endif # 264 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" DISPATCH_ALWAYS_INLINE static inline void * _dispatch_mempcpy(void *ptr, const void *data, size_t len) { memcpy(ptr, data, len); return (char *)ptr + len; } #define _dispatch_memappend(ptr, e) \ _dispatch_mempcpy(ptr, e, sizeof(*(e))) #ifdef __APPLE__ // Clear the stack before calling long-running thread-handler functions that // never return (and don't take arguments), to facilitate leak detection and // provide cleaner backtraces. #define _dispatch_clear_stack(s) do { \ void *a[(s)/sizeof(void*) ? (s)/sizeof(void*) : 1]; \ a[0] = pthread_get_stackaddr_np(pthread_self()); \ void* volatile const p = (void*)&a[1]; /* */ \ bzero((void*)p, (size_t)(a[0] - (void*)&a[1])); \ } while (0) #else # 286 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #define _dispatch_clear_stack(s) #endif # 288 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" #endif # 290 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/shims.h" # 665 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "event/event_internal.h" #endif /* expanded by -frewrite-includes */ # 665 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" 1 /* * Copyright (c) 2008-2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_EVENT_EVENT_INTERNAL__ #define __DISPATCH_EVENT_EVENT_INTERNAL__ #if 0 /* expanded by -frewrite-includes */ #include "event_config.h" #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" 1 /* * Copyright (c) 2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __DISPATCH_EVENT_EVENT_CONFIG__ #define __DISPATCH_EVENT_EVENT_CONFIG__ #if 0 /* disabled by -frewrite-includes */ #if defined(__linux__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # 26 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_EVENT_BACKEND_EPOLL 1 # define DISPATCH_EVENT_BACKEND_KEVENT 0 # define DISPATCH_EVENT_BACKEND_WINDOWS 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif __has_include() #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # 1 "/usr/include/sys/event.h" 1 3 4 /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1999,2000,2001 Jonathan Lemon * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_EVENT_H_ #define _SYS_EVENT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/include/sys/event.h" 3 4 # 35 "/usr/include/sys/event.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/sys/event.h" 3 4 # 36 "/usr/include/sys/event.h" 3 4 #define EVFILT_READ (-1) #define EVFILT_WRITE (-2) #define EVFILT_AIO (-3) /* attached to aio requests */ #define EVFILT_VNODE (-4) /* attached to vnodes */ #define EVFILT_PROC (-5) /* attached to struct proc */ #define EVFILT_SIGNAL (-6) /* attached to struct proc */ #define EVFILT_TIMER (-7) /* timers */ #define EVFILT_PROCDESC (-8) /* attached to process descriptors */ #define EVFILT_FS (-9) /* filesystem events */ #define EVFILT_LIO (-10) /* attached to lio requests */ #define EVFILT_USER (-11) /* User events */ #define EVFILT_SENDFILE (-12) /* attached to sendfile requests */ #define EVFILT_EMPTY (-13) /* empty send socket buf */ #define EVFILT_SYSCOUNT 13 #if 0 /* disabled by -frewrite-includes */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 53 "/usr/include/sys/event.h" 3 4 #define EV_SET(kevp_, a, b, c, d, e, f) do { \ *(kevp_) = (struct kevent){ \ .ident = (a), \ .filter = (b), \ .flags = (c), \ .fflags = (d), \ .data = (e), \ .udata = (f), \ .ext = {0}, \ }; \ } while (0) #else /* Pre-C99 or not STDC (e.g., C++) */ # 65 "/usr/include/sys/event.h" 3 4 /* * The definition of the local variable kevp could possibly conflict * with a user-defined value passed in parameters a-f. */ #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ (kevp)->ext[0] = 0; \ (kevp)->ext[1] = 0; \ (kevp)->ext[2] = 0; \ (kevp)->ext[3] = 0; \ } while (0) #endif # 83 "/usr/include/sys/event.h" 3 4 struct kevent { __uintptr_t ident; /* identifier for this event */ short filter; /* filter for event */ unsigned short flags; /* action flags for kqueue */ unsigned int fflags; /* filter flag value */ __int64_t data; /* filter data value */ void *udata; /* opaque user data identifier */ __uint64_t ext[4]; /* extensions */ }; #if 0 /* disabled by -frewrite-includes */ #if defined(_WANT_FREEBSD11_KEVENT) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 95 "/usr/include/sys/event.h" 3 4 /* Older structure used in FreeBSD 11.x and older. */ struct freebsd11_kevent { __uintptr_t ident; /* identifier for this event */ short filter; /* filter for event */ unsigned short flags; unsigned int fflags; __intptr_t data; void *udata; /* opaque user data identifier */ }; #endif # 105 "/usr/include/sys/event.h" 3 4 #if 0 /* disabled by -frewrite-includes */ #if defined(_WANT_KEVENT32) || (defined(_KERNEL) && defined(__LP64__)) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 107 "/usr/include/sys/event.h" 3 4 struct kevent32 { __uint32_t ident; /* identifier for this event */ short filter; /* filter for event */ unsigned short flags; unsigned int fflags; #ifndef __amd64__ __uint32_t pad0; #endif # 115 "/usr/include/sys/event.h" 3 4 __uint32_t data1, data2; __uint32_t udata; /* opaque user data identifier */ #ifndef __amd64__ __uint32_t pad1; #endif # 120 "/usr/include/sys/event.h" 3 4 __uint32_t ext64[8]; }; #ifdef _WANT_FREEBSD11_KEVENT struct freebsd11_kevent32 { __uint32_t ident; /* identifier for this event */ short filter; /* filter for event */ unsigned short flags; unsigned int fflags; __int32_t data; __uint32_t udata; /* opaque user data identifier */ }; #endif # 133 "/usr/include/sys/event.h" 3 4 #endif # 134 "/usr/include/sys/event.h" 3 4 /* actions */ #define EV_ADD 0x0001 /* add event to kq (implies enable) */ #define EV_DELETE 0x0002 /* delete event from kq */ #define EV_ENABLE 0x0004 /* enable event */ #define EV_DISABLE 0x0008 /* disable event (not reported) */ #define EV_FORCEONESHOT 0x0100 /* enable _ONESHOT and force trigger */ #define EV_KEEPUDATA 0x0200 /* do not update the udata field */ /* flags */ #define EV_ONESHOT 0x0010 /* only report one occurrence */ #define EV_CLEAR 0x0020 /* clear event state after reporting */ #define EV_RECEIPT 0x0040 /* force EV_ERROR on success, data=0 */ #define EV_DISPATCH 0x0080 /* disable event after reporting */ #define EV_SYSFLAGS 0xF000 /* reserved by system */ #define EV_DROP 0x1000 /* note should be dropped */ #define EV_FLAG1 0x2000 /* filter-specific flag */ #define EV_FLAG2 0x4000 /* filter-specific flag */ /* returned values */ #define EV_EOF 0x8000 /* EOF detected */ #define EV_ERROR 0x4000 /* error, data contains errno */ /* * data/hint flags/masks for EVFILT_USER, shared with userspace * * On input, the top two bits of fflags specifies how the lower twenty four * bits should be applied to the stored value of fflags. * * On output, the top two bits will always be set to NOTE_FFNOP and the * remaining twenty four bits will contain the stored fflags value. */ #define NOTE_FFNOP 0x00000000 /* ignore input fflags */ #define NOTE_FFAND 0x40000000 /* AND fflags */ #define NOTE_FFOR 0x80000000 /* OR fflags */ #define NOTE_FFCOPY 0xc0000000 /* copy fflags */ #define NOTE_FFCTRLMASK 0xc0000000 /* masks for operations */ #define NOTE_FFLAGSMASK 0x00ffffff #define NOTE_TRIGGER 0x01000000 /* Cause the event to be triggered for output. */ /* * data/hint flags for EVFILT_{READ|WRITE}, shared with userspace */ #define NOTE_LOWAT 0x0001 /* low water mark */ #define NOTE_FILE_POLL 0x0002 /* behave like poll() */ /* * data/hint flags for EVFILT_VNODE, shared with userspace */ #define NOTE_DELETE 0x0001 /* vnode was removed */ #define NOTE_WRITE 0x0002 /* data contents changed */ #define NOTE_EXTEND 0x0004 /* size increased */ #define NOTE_ATTRIB 0x0008 /* attributes changed */ #define NOTE_LINK 0x0010 /* link count changed */ #define NOTE_RENAME 0x0020 /* vnode was renamed */ #define NOTE_REVOKE 0x0040 /* vnode access was revoked */ #define NOTE_OPEN 0x0080 /* vnode was opened */ #define NOTE_CLOSE 0x0100 /* file closed, fd did not allowed write */ #define NOTE_CLOSE_WRITE 0x0200 /* file closed, fd did allowed write */ #define NOTE_READ 0x0400 /* file was read */ /* * data/hint flags for EVFILT_PROC and EVFILT_PROCDESC, shared with userspace */ #define NOTE_EXIT 0x80000000 /* process exited */ #define NOTE_FORK 0x40000000 /* process forked */ #define NOTE_EXEC 0x20000000 /* process exec'd */ #define NOTE_PCTRLMASK 0xf0000000 /* mask for hint bits */ #define NOTE_PDATAMASK 0x000fffff /* mask for pid */ /* additional flags for EVFILT_PROC */ #define NOTE_TRACK 0x00000001 /* follow across forks */ #define NOTE_TRACKERR 0x00000002 /* could not track child */ #define NOTE_CHILD 0x00000004 /* am a child process */ /* additional flags for EVFILT_TIMER */ #define NOTE_SECONDS 0x00000001 /* data is seconds */ #define NOTE_MSECONDS 0x00000002 /* data is milliseconds */ #define NOTE_USECONDS 0x00000004 /* data is microseconds */ #define NOTE_NSECONDS 0x00000008 /* data is nanoseconds */ #define NOTE_ABSTIME 0x00000010 /* timeout is absolute */ struct knote; SLIST_HEAD(klist, knote); struct kqueue; TAILQ_HEAD(kqlist, kqueue); struct knlist { struct klist kl_list; void (*kl_lock)(void *); /* lock function */ void (*kl_unlock)(void *); void (*kl_assert_lock)(void *, int); void *kl_lockarg; /* argument passed to lock functions */ int kl_autodestroy; }; #ifdef _KERNEL /* * Flags for knote call */ #define KNF_LISTLOCKED 0x0001 /* knlist is locked */ #define KNF_NOKQLOCK 0x0002 /* do not keep KQ_LOCK */ #define KNOTE(list, hint, flags) knote(list, hint, flags) #define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED) #define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0) #define KNLIST_EMPTY(list) SLIST_EMPTY(&(list)->kl_list) /* * Flag indicating hint is a signal. Used by EVFILT_SIGNAL, and also * shared by EVFILT_PROC (all knotes attached to p->p_klist) */ #define NOTE_SIGNAL 0x08000000 /* * Hint values for the optional f_touch event filter. If f_touch is not set * to NULL and f_isfd is zero the f_touch filter will be called with the type * argument set to EVENT_REGISTER during a kevent() system call. It is also * called under the same conditions with the type argument set to EVENT_PROCESS * when the event has been triggered. */ #define EVENT_REGISTER 1 #define EVENT_PROCESS 2 struct filterops { int f_isfd; /* true if ident == filedescriptor */ int (*f_attach)(struct knote *kn); void (*f_detach)(struct knote *kn); int (*f_event)(struct knote *kn, long hint); void (*f_touch)(struct knote *kn, struct kevent *kev, u_long type); }; /* * An in-flux knote cannot be dropped from its kq while the kq is * unlocked. If the KN_SCAN flag is not set, a thread can only set * kn_influx when it is exclusive owner of the knote state, and can * modify kn_status as if it had the KQ lock. KN_SCAN must not be set * on a knote which is already in flux. * * kn_sfflags, kn_sdata, and kn_kevent are protected by the knlist lock. */ struct knote { SLIST_ENTRY(knote) kn_link; /* for kq */ SLIST_ENTRY(knote) kn_selnext; /* for struct selinfo */ struct knlist *kn_knlist; /* f_attach populated */ TAILQ_ENTRY(knote) kn_tqe; struct kqueue *kn_kq; /* which queue we are on */ struct kevent kn_kevent; void *kn_hook; int kn_hookid; int kn_status; /* protected by kq lock */ #define KN_ACTIVE 0x01 /* event has been triggered */ #define KN_QUEUED 0x02 /* event is on queue */ #define KN_DISABLED 0x04 /* event is disabled */ #define KN_DETACHED 0x08 /* knote is detached */ #define KN_MARKER 0x20 /* ignore this knote */ #define KN_KQUEUE 0x40 /* this knote belongs to a kq */ #define KN_SCAN 0x100 /* flux set in kqueue_scan() */ int kn_influx; int kn_sfflags; /* saved filter flags */ int64_t kn_sdata; /* saved data field */ union { struct file *p_fp; /* file data pointer */ struct proc *p_proc; /* proc pointer */ struct kaiocb *p_aio; /* AIO job pointer */ struct aioliojob *p_lio; /* LIO job pointer */ void *p_v; /* generic other pointer */ } kn_ptr; struct filterops *kn_fop; #define kn_id kn_kevent.ident #define kn_filter kn_kevent.filter #define kn_flags kn_kevent.flags #define kn_fflags kn_kevent.fflags #define kn_data kn_kevent.data #define kn_fp kn_ptr.p_fp }; struct kevent_copyops { void *arg; int (*k_copyout)(void *arg, struct kevent *kevp, int count); int (*k_copyin)(void *arg, struct kevent *kevp, int count); size_t kevent_size; }; struct thread; struct proc; struct knlist; struct mtx; struct rwlock; void knote(struct knlist *list, long hint, int lockflags); void knote_fork(struct knlist *list, int pid); struct knlist *knlist_alloc(struct mtx *lock); void knlist_detach(struct knlist *knl); void knlist_add(struct knlist *knl, struct knote *kn, int islocked); void knlist_remove(struct knlist *knl, struct knote *kn, int islocked); int knlist_empty(struct knlist *knl); void knlist_init(struct knlist *knl, void *lock, void (*kl_lock)(void *), void (*kl_unlock)(void *), void (*kl_assert_lock)(void *, int)); void knlist_init_mtx(struct knlist *knl, struct mtx *lock); void knlist_destroy(struct knlist *knl); void knlist_cleardel(struct knlist *knl, struct thread *td, int islocked, int killkn); #define knlist_clear(knl, islocked) \ knlist_cleardel((knl), NULL, (islocked), 0) #define knlist_delete(knl, td, islocked) \ knlist_cleardel((knl), (td), (islocked), 1) void knote_fdclose(struct thread *p, int fd); int kqfd_register(int fd, struct kevent *kev, struct thread *p, int mflag); int kqueue_add_filteropts(int filt, struct filterops *filtops); int kqueue_del_filteropts(int filt); void kqueue_drain_schedtask(void); #else /* !_KERNEL */ # 355 "/usr/include/sys/event.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 356 "/usr/include/sys/event.h" 3 4 # 357 "/usr/include/sys/event.h" 3 4 struct timespec; __BEGIN_DECLS int kqueue(void); int kevent(int kq, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); __END_DECLS #endif /* !_KERNEL */ # 367 "/usr/include/sys/event.h" 3 4 #endif /* !_SYS_EVENT_H_ */ # 369 "/usr/include/sys/event.h" 3 4 # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" 2 # define DISPATCH_EVENT_BACKEND_EPOLL 0 # define DISPATCH_EVENT_BACKEND_KEVENT 1 # define DISPATCH_EVENT_BACKEND_WINDOWS 0 #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_EVENT_BACKEND_EPOLL 0 # define DISPATCH_EVENT_BACKEND_KEVENT 0 # define DISPATCH_EVENT_BACKEND_WINDOWS 1 #else # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # error unsupported event loop #endif # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #define DISPATCH_MGR_QUEUE_DEBUG 1 #define DISPATCH_WLH_DEBUG 1 #endif # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #ifndef DISPATCH_MGR_QUEUE_DEBUG #define DISPATCH_MGR_QUEUE_DEBUG 0 #endif # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #ifndef DISPATCH_WLH_DEBUG #define DISPATCH_WLH_DEBUG 0 #endif # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #ifndef DISPATCH_MACHPORT_DEBUG #define DISPATCH_MACHPORT_DEBUG 0 #endif # 58 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #ifndef DISPATCH_TIMER_ASSERTIONS #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 61 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #define DISPATCH_TIMER_ASSERTIONS 1 #else # 63 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #define DISPATCH_TIMER_ASSERTIONS 0 #endif # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #endif # 66 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_TIMER_ASSERTIONS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #define DISPATCH_TIMER_ASSERT(a, op, b, text) ({ \ __typeof__(a) _a = (a); \ if (unlikely(!(_a op (b)))) { \ DISPATCH_CLIENT_CRASH(_a, "Timer: " text); \ } \ }) #else # 75 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #define DISPATCH_TIMER_ASSERT(a, op, b, text) ((void)0) #endif # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #ifndef EV_VANISHED #define EV_VANISHED 0x0200 #endif # 81 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_EVENT_BACKEND_KEVENT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 83 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ # if defined(EV_UDATA_SPECIFIC) && EV_UDATA_SPECIFIC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 84 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_HAVE_DIRECT_KNOTES 1 # else # 86 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_HAVE_DIRECT_KNOTES 0 # endif # 88 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ # if defined(EV_SET_QOS) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 90 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_USE_KEVENT_QOS 1 # else # 92 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_USE_KEVENT_QOS 0 # endif # 94 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef KEVENT_FLAG_ERROR_EVENTS # define KEVENT_FLAG_ERROR_EVENTS 0x002 # endif # 98 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifdef NOTE_LEEWAY # define DISPATCH_HAVE_TIMER_COALESCING 1 # else # 102 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define NOTE_LEEWAY 0 # define DISPATCH_HAVE_TIMER_COALESCING 0 # endif // !NOTE_LEEWAY # 105 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ # if defined(NOTE_CRITICAL) && defined(NOTE_BACKGROUND) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 106 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_HAVE_TIMER_QOS 1 # else # 108 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # undef NOTE_CRITICAL # define NOTE_CRITICAL 0 # undef NOTE_BACKGROUND # define NOTE_BACKGROUND 0 # define DISPATCH_HAVE_TIMER_QOS 0 # endif // !defined(NOTE_CRITICAL) || !defined(NOTE_BACKGROUND) # 114 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef NOTE_FUNLOCK # define NOTE_FUNLOCK 0x00000100 # endif # 118 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" // FreeBSD's kevent does not support those # ifndef NOTE_ABSOLUTE # define NOTE_ABSOLUTE 0 # endif # 123 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef NOTE_EXITSTATUS # define NOTE_EXITSTATUS 0 # endif # 126 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ # if HAVE_DECL_NOTE_REAP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 128 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ # if defined(NOTE_REAP) && defined(__APPLE__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 129 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # undef NOTE_REAP # define NOTE_REAP 0x10000000 // # endif # 132 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # endif // HAVE_DECL_NOTE_REAP # 133 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef VQ_QUOTA # undef HAVE_DECL_VQ_QUOTA // rdar://problem/24160982 # endif // VQ_QUOTA # 137 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef VQ_NEARLOWDISK # undef HAVE_DECL_VQ_NEARLOWDISK # endif // VQ_NEARLOWDISK # 141 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef VQ_DESIRED_DISK # undef HAVE_DECL_VQ_DESIRED_DISK # endif // VQ_DESIRED_DISK # 145 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef VQ_FREE_SPACE_CHANGE # undef HAVE_DECL_VQ_FREE_SPACE_CHANGE # endif // VQ_FREE_SPACE_CHANGE # 149 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ # if !defined(EVFILT_NW_CHANNEL) && defined(__APPLE__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 151 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define EVFILT_NW_CHANNEL (-16) # define NOTE_FLOW_ADV_UPDATE 0x1 # endif # 154 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #else // DISPATCH_EVENT_BACKEND_KEVENT # 155 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define EV_ADD 0x0001 # define EV_DELETE 0x0002 # define EV_ENABLE 0x0004 # define EV_ONESHOT 0x0010 # define EV_CLEAR 0x0020 # define EV_DISPATCH 0x0080 # define EVFILT_READ (-1) # define EVFILT_WRITE (-2) # define EVFILT_SIGNAL (-3) # define EVFILT_TIMER (-4) # define EVFILT_SYSCOUNT 4 # define DISPATCH_HAVE_TIMER_QOS 0 # define DISPATCH_HAVE_TIMER_COALESCING 0 # define DISPATCH_HAVE_DIRECT_KNOTES 0 #endif // !DISPATCH_EVENT_BACKEND_KEVENT # 173 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" // These flags are used by dispatch generic code and // translated back by the various backends to similar semantics // hence must be defined even on non Darwin platforms #ifndef KEVENT_FLAG_IMMEDIATE # define KEVENT_FLAG_IMMEDIATE 0x001 #endif # 180 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #ifdef EV_UDATA_SPECIFIC # define DISPATCH_EV_DIRECT (EV_UDATA_SPECIFIC|EV_DISPATCH) #else # 184 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_EV_DIRECT 0x0000 # define EV_UDATA_SPECIFIC 0x0000 # undef EV_VANISHED # define EV_VANISHED 0x0000 #endif # 189 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #define DISPATCH_EV_MSG_NEEDS_FREE 0x10000 // mach message needs to be freed() #define DISPATCH_EVFILT_TIMER (-EVFILT_SYSCOUNT - 1) #define DISPATCH_EVFILT_TIMER_WITH_CLOCK (-EVFILT_SYSCOUNT - 2) #define DISPATCH_EVFILT_CUSTOM_ADD (-EVFILT_SYSCOUNT - 3) #define DISPATCH_EVFILT_CUSTOM_OR (-EVFILT_SYSCOUNT - 4) #define DISPATCH_EVFILT_CUSTOM_REPLACE (-EVFILT_SYSCOUNT - 5) #define DISPATCH_EVFILT_MACH_NOTIFICATION (-EVFILT_SYSCOUNT - 6) #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 200 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #if 0 /* disabled by -frewrite-includes */ # if !EV_UDATA_SPECIFIC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 201 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # error mach support requires EV_UDATA_SPECIFIC # endif # 203 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef MACH_RCV_VOUCHER # define MACH_RCV_VOUCHER 0x00000800 # endif # 207 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef MACH_NOTIFY_SEND_POSSIBLE # undef MACH_NOTIFY_SEND_POSSIBLE # define MACH_NOTIFY_SEND_POSSIBLE MACH_NOTIFY_DEAD_NAME # endif # 212 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef NOTE_MACH_CONTINUOUS_TIME # define NOTE_MACH_CONTINUOUS_TIME 0 # endif // NOTE_MACH_CONTINUOUS_TIME # 216 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef HOST_NOTIFY_CALENDAR_SET # define HOST_NOTIFY_CALENDAR_SET HOST_NOTIFY_CALENDAR_CHANGE # endif // HOST_NOTIFY_CALENDAR_SET # 220 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef HOST_CALENDAR_SET_REPLYID # define HOST_CALENDAR_SET_REPLYID 951 # endif // HOST_CALENDAR_SET_REPLYID # 224 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef MACH_SEND_OVERRIDE # define MACH_SEND_OVERRIDE 0x00000020 typedef unsigned int mach_msg_priority_t; # define MACH_MSG_PRIORITY_UNSPECIFIED ((mach_msg_priority_t)0) # endif // MACH_SEND_OVERRIDE # 230 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef MACH_SEND_SYNC_OVERRIDE # define MACH_SEND_SYNC_OVERRIDE 0x00100000 # endif // MACH_SEND_SYNC_OVERRIDE # 234 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # ifndef MACH_RCV_SYNC_WAIT # define MACH_RCV_SYNC_WAIT 0x00004000 # endif // MACH_RCV_SYNC_WAIT # 238 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # define DISPATCH_MACH_TRAILER_SIZE sizeof(dispatch_mach_trailer_t) # define DISPATCH_MACH_RCV_TRAILER MACH_RCV_TRAILER_CTX # define DISPATCH_MACH_RCV_OPTIONS ( \ MACH_RCV_MSG | MACH_RCV_LARGE | MACH_RCV_LARGE_IDENTITY | \ MACH_RCV_TRAILER_ELEMENTS(DISPATCH_MACH_RCV_TRAILER) | \ MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0) | \ MACH_RCV_VOUCHER) #endif // HAVE_MACH # 247 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" #endif // __DISPATCH_EVENT_EVENT_CONFIG__ # 249 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_config.h" # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" 2 /* * The unote state has 3 pieces of information and reflects the state * of the unote registration and mirrors the state of the knote if any. * * This state is peculiar in the sense that it can be read concurrently, but * is never written to concurrently. This is achieved by serializing through * kevent calls from appropriate synchronization context (referred as `dkq` * for dispatch kevent queue in the dispatch source code). * * DU_STATE_ARMED * * This bit represents the fact that the registration is active and may * receive events at any given time. This bit can only be set if the WLH bits * are set and the DU_STATE_NEEDS_DELETE bit is not. * * DU_STATE_NEEDS_DELETE * * The kernel has indicated that it wants the next event for this unote to be * an unregistration. This bit can only be set if the DU_STATE_ARMED bit is * not set. * * DU_STATE_NEEDS_DELETE may be the only bit set in the unote state * * DU_STATE_WLH_MASK * * The most significant bits of du_state represent which event loop this unote * is registered with, and has a storage reference on it taken with * _dispatch_wlh_retain(). * * Registration * * Unote registration attempt is made with _dispatch_unote_register(). * On succes, it will set the WLH bits and the DU_STATE_ARMED bit, on failure * the state is 0. * * _dispatch_unote_register() must be called from the appropriate * synchronization context depending on the unote type. * * Event delivery * * When an event is delivered for a unote type that requires explicit * re-arming (EV_DISPATCH or EV_ONESHOT), the DU_STATE_ARMED bit is cleared. * If the event is marked as EV_ONESHOT, then the DU_STATE_NEEDS_DELETE bit * is also set, initiating the "deferred delete" state machine. * * For other unote types, the state isn't touched, unless the event is * EV_ONESHOT, in which case it causes an automatic unregistration. * * Unregistration * * The unote owner can attempt unregistering the unote with * _dispatch_unote_unregister() from the proper synchronization context * at any given time. When successful, the state will be set to 0 and the * unote is no longer active. Unregistration is always successful for events * that don't require explcit re-arming. * * When this unregistration fails, then the unote owner must wait for the * next event delivery for this unote. */ typedef uintptr_t dispatch_unote_state_t; #define DU_STATE_ARMED ((dispatch_unote_state_t)0x1ul) #define DU_STATE_NEEDS_DELETE ((dispatch_unote_state_t)0x2ul) #define DU_STATE_WLH_MASK ((dispatch_unote_state_t)~0x3ul) #define DU_STATE_UNREGISTERED ((dispatch_unote_state_t)0) struct dispatch_sync_context_s; typedef struct dispatch_wlh_s *dispatch_wlh_t; // opaque handle #define DISPATCH_WLH_ANON ((dispatch_wlh_t)(void*)(~0x3ul)) #define DISPATCH_WLH_MANAGER ((dispatch_wlh_t)(void*)(~0x7ul)) DISPATCH_ENUM(dispatch_unote_timer_flags, uint8_t, /* DISPATCH_TIMER_STRICT 0x1 */ /* DISPATCH_TIMER_BACKGROUND = 0x2, */ DISPATCH_TIMER_CLOCK_UPTIME = DISPATCH_CLOCK_UPTIME << 2, DISPATCH_TIMER_CLOCK_MONOTONIC = DISPATCH_CLOCK_MONOTONIC << 2, DISPATCH_TIMER_CLOCK_WALL = DISPATCH_CLOCK_WALL << 2, #define _DISPATCH_TIMER_CLOCK_MASK (0x3 << 2) DISPATCH_TIMER_INTERVAL = 0x10, /* DISPATCH_INTERVAL_UI_ANIMATION = 0x20 */ // See source_private.h DISPATCH_TIMER_AFTER = 0x40, ); static inline dispatch_clock_t _dispatch_timer_flags_to_clock(dispatch_unote_timer_flags_t flags) { return (dispatch_clock_t)((flags & _DISPATCH_TIMER_CLOCK_MASK) >> 2); } static inline dispatch_unote_timer_flags_t _dispatch_timer_flags_from_clock(dispatch_clock_t clock) { return (dispatch_unote_timer_flags_t)(clock << 2); } #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 127 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" typedef uintptr_t dispatch_unote_ident_t; #if 0 /* disabled by -frewrite-includes */ #if 0 #elif defined(__FreeBSD__) #endif #endif /* disabled by -frewrite-includes */ #elif 1 /* evaluated by -frewrite-includes */ # 129 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" typedef uintptr_t dispatch_unote_ident_t; #else # 131 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" typedef uint32_t dispatch_unote_ident_t; #endif # 133 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DISPATCH_UNOTE_CLASS_HEADER() \ dispatch_source_type_t du_type; \ uintptr_t du_owner_wref; /* "weak" back reference to the owner object */ \ os_atomic(dispatch_unote_state_t) du_state; \ dispatch_unote_ident_t du_ident; \ int8_t du_filter; \ uint8_t du_is_direct : 1; \ uint8_t du_is_timer : 1; \ uint8_t du_has_extended_status : 1; \ uint8_t du_memorypressure_override : 1; \ uint8_t du_vmpressure_override : 1; \ uint8_t du_can_be_wlh : 1; \ uint8_t dmrr_handler_is_block : 1; \ uint8_t du_unused_flag : 1; \ union { \ uint8_t du_timer_flags; \ os_atomic(bool) dmsr_notification_armed; \ bool dmr_reply_port_owned; \ }; \ uint8_t du_unused; \ uint32_t du_fflags; \ dispatch_priority_t du_priority #define _dispatch_ptr2wref(ptr) (~(uintptr_t)(ptr)) #define _dispatch_wref2ptr(ref) ((void*)~(ref)) #define _dispatch_source_from_refs(dr) \ ((dispatch_source_t)_dispatch_wref2ptr((dr)->du_owner_wref)) typedef struct dispatch_unote_class_s { DISPATCH_UNOTE_CLASS_HEADER(); } *dispatch_unote_class_t; enum { DS_EVENT_HANDLER = 0, DS_CANCEL_HANDLER, DS_REGISTN_HANDLER, }; #define DISPATCH_SOURCE_REFS_HEADER() \ DISPATCH_UNOTE_CLASS_HEADER(); \ struct dispatch_continuation_s *volatile ds_handler[3]; \ uint64_t ds_data DISPATCH_ATOMIC64_ALIGN; \ uint64_t ds_pending_data DISPATCH_ATOMIC64_ALIGN // Extracts source data from the ds_data field #define DISPATCH_SOURCE_GET_DATA(d) ((d) & 0xFFFFFFFF) // Extracts status from the ds_data field #define DISPATCH_SOURCE_GET_STATUS(d) ((d) >> 32) // Combine data and status for the ds_data field #define DISPATCH_SOURCE_COMBINE_DATA_AND_STATUS(data, status) \ ((((uint64_t)(status)) << 32) | (data)) #define DISPATCH_TIMER_DISARMED_MARKER 1ul // Source state which may contain references to the source object // Separately allocated so that 'leaks' can see sources typedef struct dispatch_source_refs_s { DISPATCH_SOURCE_REFS_HEADER(); } *dispatch_source_refs_t; typedef struct dispatch_timer_delay_s { uint64_t delay, leeway; } dispatch_timer_delay_s; #define DTH_INVALID_ID (~0u) #define DTH_TARGET_ID 0u #define DTH_DEADLINE_ID 1u #define DTH_ID_COUNT 2u typedef struct dispatch_timer_source_s { union { struct { uint64_t target; uint64_t deadline; }; uint64_t heap_key[DTH_ID_COUNT]; }; uint64_t interval; } *dispatch_timer_source_t; typedef struct dispatch_timer_config_s { struct dispatch_timer_source_s dtc_timer; dispatch_clock_t dtc_clock; } *dispatch_timer_config_t; typedef struct dispatch_timer_source_refs_s { DISPATCH_SOURCE_REFS_HEADER(); struct dispatch_timer_source_s dt_timer; struct dispatch_timer_config_s *dt_pending_config; uint32_t dt_heap_entry[DTH_ID_COUNT]; } *dispatch_timer_source_refs_t; typedef struct dispatch_timer_heap_s { uint32_t dth_count; uint8_t dth_segments; uint8_t dth_max_qos; #define DTH_DIRTY_GLOBAL 0x80 #define DTH_DIRTY_QOS_MASK ((1u << DISPATCH_TIMER_QOS_COUNT) - 1) uint8_t dth_dirty_bits; // Only used in the first heap uint8_t dth_armed : 1; uint8_t dth_needs_program : 1; dispatch_timer_source_refs_t dth_min[DTH_ID_COUNT]; void **dth_heap; } *dispatch_timer_heap_t; #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 244 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_MACHPORT_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 245 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void dispatch_debug_machport(mach_port_t name, const char *str); #define _dispatch_debug_machport(name) \ dispatch_debug_machport((name), __func__) #else # 249 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define _dispatch_debug_machport(name) ((void)(name)) #endif // DISPATCH_MACHPORT_DEBUG # 251 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" // Mach channel state which may contain references to the channel object // layout must match dispatch_source_refs_s struct dispatch_mach_recv_refs_s { DISPATCH_UNOTE_CLASS_HEADER(); dispatch_mach_handler_function_t dmrr_handler_func; void *dmrr_handler_ctxt; }; typedef struct dispatch_mach_recv_refs_s *dispatch_mach_recv_refs_t; struct dispatch_mach_reply_refs_s { DISPATCH_UNOTE_CLASS_HEADER(); pthread_priority_t dmr_priority : 32; void *dmr_ctxt; voucher_t dmr_voucher; LIST_ENTRY(dispatch_mach_reply_refs_s) dmr_list; }; typedef struct dispatch_mach_reply_refs_s *dispatch_mach_reply_refs_t; struct dispatch_mach_reply_wait_refs_s { struct dispatch_mach_reply_refs_s dwr_refs; mach_port_t dwr_waiter_tid; }; typedef struct dispatch_mach_reply_wait_refs_s *dispatch_mach_reply_wait_refs_t; #define _DISPATCH_MACH_STATE_UNUSED_MASK 0xffffff8000000000ull #define DISPATCH_MACH_STATE_ENQUEUED 0x0000008000000000ull #define DISPATCH_MACH_STATE_DIRTY 0x0000002000000000ull #define DISPATCH_MACH_STATE_PENDING_BARRIER 0x0000001000000000ull #define DISPATCH_MACH_STATE_RECEIVED_OVERRIDE 0x0000000800000000ull #define DISPATCH_MACH_STATE_MAX_QOS_MASK 0x0000000700000000ull #define DISPATCH_MACH_STATE_MAX_QOS_SHIFT 32 #define DISPATCH_MACH_STATE_UNLOCK_MASK 0x00000000ffffffffull struct dispatch_mach_send_refs_s { DISPATCH_UNOTE_CLASS_HEADER(); dispatch_unfair_lock_s dmsr_replies_lock; dispatch_mach_msg_t dmsr_checkin; LIST_HEAD(, dispatch_mach_reply_refs_s) dmsr_replies; #define DISPATCH_MACH_NEVER_CONNECTED 0x80000000 DISPATCH_UNION_LE(uint64_t volatile dmsr_state, dispatch_unfair_lock_s dmsr_state_lock, uint32_t dmsr_state_bits ) DISPATCH_ATOMIC64_ALIGN; struct dispatch_object_s *volatile dmsr_tail; struct dispatch_object_s *volatile dmsr_head; uint32_t volatile dmsr_disconnect_cnt; mach_port_t dmsr_send, dmsr_checkin_port; }; typedef struct dispatch_mach_send_refs_s *dispatch_mach_send_refs_t; bool _dispatch_mach_notification_armed(dispatch_mach_send_refs_t dmsr); void _dispatch_mach_notification_set_armed(dispatch_mach_send_refs_t dmsr); struct dispatch_xpc_term_refs_s { DISPATCH_UNOTE_CLASS_HEADER(); }; typedef struct dispatch_xpc_term_refs_s *dispatch_xpc_term_refs_t; void _dispatch_sync_ipc_handoff_begin(dispatch_wlh_t wlh, mach_port_t port, uint64_t _Atomic *addr); void _dispatch_sync_ipc_handoff_end(dispatch_wlh_t wlh, mach_port_t port); #endif // HAVE_MACH # 313 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" typedef union dispatch_unote_u { dispatch_unote_class_t _du; dispatch_source_refs_t _dr; dispatch_timer_source_refs_t _dt; #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 319 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" dispatch_mach_recv_refs_t _dmrr; dispatch_mach_send_refs_t _dmsr; dispatch_mach_reply_refs_t _dmr; dispatch_xpc_term_refs_t _dxtr; #endif # 324 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" } dispatch_unote_t DISPATCH_TRANSPARENT_UNION; #define DISPATCH_UNOTE_NULL ((dispatch_unote_t){ ._du = NULL }) #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_IPHONE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 329 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DSL_HASH_SIZE 64u // must be a power of two #else # 331 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DSL_HASH_SIZE 256u // must be a power of two #endif # 333 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DSL_HASH(x) ((x) & (DSL_HASH_SIZE - 1)) typedef struct dispatch_unote_linkage_s { LIST_ENTRY(dispatch_unote_linkage_s) du_link; struct dispatch_muxnote_s *du_muxnote; } DISPATCH_ATOMIC64_ALIGN *dispatch_unote_linkage_t; DISPATCH_ENUM(dispatch_unote_action, uint8_t, DISPATCH_UNOTE_ACTION_PASS_DATA, // pass ke->data DISPATCH_UNOTE_ACTION_PASS_FFLAGS, // pass ke->fflags DISPATCH_UNOTE_ACTION_SOURCE_OR_FFLAGS, // ds_pending_data |= ke->fflags DISPATCH_UNOTE_ACTION_SOURCE_SET_DATA, // ds_pending_data = ~ke->data DISPATCH_UNOTE_ACTION_SOURCE_ADD_DATA, // ds_pending_data += ke->data DISPATCH_UNOTE_ACTION_SOURCE_TIMER, // timer ); typedef struct dispatch_source_type_s { const char *dst_kind; int8_t dst_filter; dispatch_unote_action_t dst_action; uint8_t dst_per_trigger_qos : 1; uint8_t dst_strict : 1; uint8_t dst_timer_flags; uint16_t dst_flags; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_EVENT_BACKEND_KEVENT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 358 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" uint16_t dst_data; #endif # 360 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" uint32_t dst_fflags; uint32_t dst_mask; uint32_t dst_size; dispatch_unote_t (*dst_create)(dispatch_source_type_t dst, uintptr_t handle, uintptr_t mask); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_EVENT_BACKEND_KEVENT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 367 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" bool (*dst_update_mux)(struct dispatch_muxnote_s *dmn); #endif # 369 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void (*dst_merge_evt)(dispatch_unote_t du, uint32_t flags, uintptr_t data, pthread_priority_t pp); #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 372 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void (*dst_merge_msg)(dispatch_unote_t du, uint32_t flags, mach_msg_header_t *msg, mach_msg_size_t sz, pthread_priority_t msg_pp, pthread_priority_t override_pp); #endif # 376 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" } dispatch_source_type_s; #define dux_create(dst, handle, mask) (dst)->dst_create(dst, handle, mask) #define dux_type(du) (du)->du_type #define dux_needs_rearm(du) (dux_type(du)->dst_flags & (EV_ONESHOT | EV_DISPATCH)) #define dux_merge_evt(du, ...) dux_type(du)->dst_merge_evt(du, __VA_ARGS__) #define dux_merge_msg(du, ...) dux_type(du)->dst_merge_msg(du, __VA_ARGS__) extern const dispatch_source_type_s _dispatch_source_type_after; #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 387 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" extern const dispatch_source_type_s _dispatch_mach_type_notification; extern const dispatch_source_type_s _dispatch_mach_type_send; extern const dispatch_source_type_s _dispatch_mach_type_recv; extern const dispatch_source_type_s _dispatch_mach_type_reply; extern const dispatch_source_type_s _dispatch_xpc_type_sigterm; #define DISPATCH_MACH_TYPE_WAITER ((const dispatch_source_type_s *)-2) #endif # 394 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" extern const dispatch_source_type_s _dispatch_source_type_timer_with_clock; #pragma mark - #pragma mark deferred items #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_EVENT_BACKEND_KEVENT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 400 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_KEVENT_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 401 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" typedef struct kevent_qos_s dispatch_kevent_s; #else # 403 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" typedef struct kevent dispatch_kevent_s; #endif # 405 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" typedef dispatch_kevent_s *dispatch_kevent_t; #endif // DISPATCH_EVENT_BACKEND_KEVENT # 407 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DISPATCH_DEFERRED_ITEMS_EVENT_COUNT 16 typedef struct dispatch_deferred_items_s { dispatch_queue_global_t ddi_stashed_rq; dispatch_object_t ddi_stashed_dou; dispatch_qos_t ddi_stashed_qos; dispatch_wlh_t ddi_wlh; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_EVENT_BACKEND_KEVENT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 416 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" dispatch_kevent_t ddi_eventlist; uint16_t ddi_nevents; uint16_t ddi_maxevents; bool ddi_can_stash; uint16_t ddi_wlh_needs_delete : 1; uint16_t ddi_wlh_needs_update : 1; uint16_t ddi_wlh_servicing : 1; #endif # 424 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" } dispatch_deferred_items_s, *dispatch_deferred_items_t; #pragma mark - #pragma mark inlines #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 430 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" DISPATCH_ALWAYS_INLINE static inline void _dispatch_deferred_items_set(dispatch_deferred_items_t ddi) { _dispatch_thread_setspecific(dispatch_deferred_items_key, (void *)ddi); } DISPATCH_ALWAYS_INLINE static inline dispatch_deferred_items_t _dispatch_deferred_items_get(void) { return (dispatch_deferred_items_t) _dispatch_thread_getspecific(dispatch_deferred_items_key); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_needs_to_return_to_kernel(void) { return (uintptr_t)_dispatch_thread_getspecific(dispatch_r2k_key) != 0; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_set_return_to_kernel(void) { _dispatch_thread_setspecific(dispatch_r2k_key, (void *)1); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_clear_return_to_kernel(void) { _dispatch_thread_setspecific(dispatch_r2k_key, (void *)0); } DISPATCH_ALWAYS_INLINE static inline dispatch_wlh_t _du_state_wlh(dispatch_unote_state_t du_state) { return (dispatch_wlh_t)(du_state & DU_STATE_WLH_MASK); } DISPATCH_ALWAYS_INLINE static inline bool _du_state_registered(dispatch_unote_state_t du_state) { return du_state != DU_STATE_UNREGISTERED; } DISPATCH_ALWAYS_INLINE static inline bool _du_state_armed(dispatch_unote_state_t du_state) { return du_state & DU_STATE_ARMED; } DISPATCH_ALWAYS_INLINE static inline bool _du_state_needs_delete(dispatch_unote_state_t du_state) { return du_state & DU_STATE_NEEDS_DELETE; } DISPATCH_ALWAYS_INLINE static inline bool _du_state_needs_rearm(dispatch_unote_state_t du_state) { return _du_state_registered(du_state) && !_du_state_armed(du_state) && !_du_state_needs_delete(du_state); } DISPATCH_ALWAYS_INLINE static inline dispatch_unote_state_t _dispatch_unote_state(dispatch_unote_t du) { return os_atomic_load(&du._du->du_state, relaxed); } #define _dispatch_unote_wlh(du) \ _du_state_wlh(_dispatch_unote_state(du)) #define _dispatch_unote_registered(du) \ _du_state_registered(_dispatch_unote_state(du)) #define _dispatch_unote_armed(du) \ _du_state_armed(_dispatch_unote_state(du)) #define _dispatch_unote_needs_delete(du) \ _du_state_needs_delete(_dispatch_unote_state(du)) #define _dispatch_unote_needs_rearm(du) \ _du_state_needs_rearm(_dispatch_unote_state(du)) DISPATCH_ALWAYS_INLINE DISPATCH_OVERLOADABLE static inline void _dispatch_unote_state_set(dispatch_unote_t du, dispatch_unote_state_t value) { os_atomic_store(&du._du->du_state, value, relaxed); } DISPATCH_ALWAYS_INLINE DISPATCH_OVERLOADABLE static inline void _dispatch_unote_state_set(dispatch_unote_t du, dispatch_wlh_t wlh, dispatch_unote_state_t bits) { _dispatch_unote_state_set(du, (dispatch_unote_state_t)wlh | bits); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_unote_state_set_bit(dispatch_unote_t du, dispatch_unote_state_t bit) { _dispatch_unote_state_set(du, _dispatch_unote_state(du) | bit); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_unote_state_clear_bit(dispatch_unote_t du, dispatch_unote_state_t bit) { _dispatch_unote_state_set(du, _dispatch_unote_state(du) & ~bit); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_unote_wlh_changed(dispatch_unote_t du, dispatch_wlh_t expected_wlh) { dispatch_wlh_t wlh = _dispatch_unote_wlh(du); return wlh && wlh != DISPATCH_WLH_ANON && wlh != expected_wlh; } DISPATCH_ALWAYS_INLINE static inline dispatch_unote_linkage_t _dispatch_unote_get_linkage(dispatch_unote_t du) { dispatch_assert(!du._du->du_is_direct); return (dispatch_unote_linkage_t)((char *)du._du - sizeof(struct dispatch_unote_linkage_s)); } DISPATCH_ALWAYS_INLINE static inline dispatch_unote_t _dispatch_unote_linkage_get_unote(dispatch_unote_linkage_t dul) { return (dispatch_unote_t){ ._du = (dispatch_unote_class_t)(dul + 1) }; } #endif // DISPATCH_PURE_C # 574 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" DISPATCH_ALWAYS_INLINE static inline unsigned long _dispatch_timer_unote_compute_missed(dispatch_timer_source_refs_t dt, uint64_t now, unsigned long prev) { uint64_t missed = (now - dt->dt_timer.target) / dt->dt_timer.interval; if (++missed + prev > LONG_MAX) { missed = LONG_MAX - prev; } if (dt->dt_timer.interval < INT64_MAX) { uint64_t push_by = missed * dt->dt_timer.interval; dt->dt_timer.target += push_by; dt->dt_timer.deadline += push_by; } else { dt->dt_timer.target = UINT64_MAX; dt->dt_timer.deadline = UINT64_MAX; } prev += missed; return prev; } #pragma mark - #pragma mark prototypes #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_HAVE_TIMER_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 600 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DISPATCH_TIMER_QOS_NORMAL 0u #define DISPATCH_TIMER_QOS_CRITICAL 1u #define DISPATCH_TIMER_QOS_BACKGROUND 2u #define DISPATCH_TIMER_QOS_COUNT 3u #else # 605 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DISPATCH_TIMER_QOS_NORMAL 0u #define DISPATCH_TIMER_QOS_COUNT 1u #endif # 608 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DISPATCH_TIMER_QOS(tidx) ((uint32_t)(tidx) % DISPATCH_TIMER_QOS_COUNT) #define DISPATCH_TIMER_CLOCK(tidx) (dispatch_clock_t)((tidx) / DISPATCH_TIMER_QOS_COUNT) #define DISPATCH_TIMER_INDEX(clock, qos) (((clock) * DISPATCH_TIMER_QOS_COUNT) + (qos)) #define DISPATCH_TIMER_COUNT \ DISPATCH_TIMER_INDEX(DISPATCH_CLOCK_COUNT, 0) // Workloops do not support optimizing WALL timers #define DISPATCH_TIMER_WLH_COUNT \ DISPATCH_TIMER_INDEX(DISPATCH_CLOCK_WALL, 0) #define DISPATCH_TIMER_IDENT_CANCELED (~0u) extern struct dispatch_timer_heap_s _dispatch_timers_heap[DISPATCH_TIMER_COUNT]; dispatch_unote_t _dispatch_unote_create_with_handle(dispatch_source_type_t dst, uintptr_t handle, uintptr_t mask); dispatch_unote_t _dispatch_unote_create_with_fd(dispatch_source_type_t dst, uintptr_t handle, uintptr_t mask); dispatch_unote_t _dispatch_unote_create_without_handle( dispatch_source_type_t dst, uintptr_t handle, uintptr_t mask); void _dispatch_unote_dispose(dispatch_unote_t du); /* * @const DUU_DELETE_ACK * Unregistration can acknowledge the "needs-delete" state of a unote. * There must be some sort of synchronization between callers passing this flag * for a given unote. * * @const DUU_PROBE * This flag is passed for the first unregistration attempt of a unote. * When passed, it allows the unregistration to speculatively try to do the * unregistration syscalls and maybe get lucky. If the flag isn't passed, * unregistration will preflight the attempt, and will not perform any syscall * if it cannot guarantee their success. * * @const DUU_MUST_SUCCEED * The caller expects the unregistration to always succeeed. * _dispatch_unote_unregister will either crash or return true. */ #define DUU_DELETE_ACK 0x1 #define DUU_PROBE 0x2 #define DUU_MUST_SUCCEED 0x4 bool _dispatch_unote_unregister(dispatch_unote_t du, uint32_t flags); bool _dispatch_unote_register(dispatch_unote_t du, dispatch_wlh_t wlh, dispatch_priority_t pri); void _dispatch_unote_resume(dispatch_unote_t du); bool _dispatch_unote_unregister_muxed(dispatch_unote_t du); bool _dispatch_unote_register_muxed(dispatch_unote_t du); void _dispatch_unote_resume_muxed(dispatch_unote_t du); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_HAVE_DIRECT_KNOTES #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 661 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" bool _dispatch_unote_unregister_direct(dispatch_unote_t du, uint32_t flags); bool _dispatch_unote_register_direct(dispatch_unote_t du, dispatch_wlh_t wlh); void _dispatch_unote_resume_direct(dispatch_unote_t du); #endif # 665 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void _dispatch_timer_unote_configure(dispatch_timer_source_refs_t dt); #if 0 /* disabled by -frewrite-includes */ #if !DISPATCH_EVENT_BACKEND_WINDOWS #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 669 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void _dispatch_event_loop_atfork_child(void); #endif # 671 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #define DISPATCH_EVENT_LOOP_CONSUME_2 DISPATCH_WAKEUP_CONSUME_2 #define DISPATCH_EVENT_LOOP_OVERRIDE 0x80000000 void _dispatch_event_loop_poke(dispatch_wlh_t wlh, uint64_t dq_state, uint32_t flags); void _dispatch_event_loop_cancel_waiter(struct dispatch_sync_context_s *dsc); void _dispatch_event_loop_wake_owner(struct dispatch_sync_context_s *dsc, dispatch_wlh_t wlh, uint64_t old_state, uint64_t new_state); void _dispatch_event_loop_wait_for_ownership( struct dispatch_sync_context_s *dsc); void _dispatch_event_loop_end_ownership(dispatch_wlh_t wlh, uint64_t old_state, uint64_t new_state, uint32_t flags); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_WLH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 683 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void _dispatch_event_loop_assert_not_owned(dispatch_wlh_t wlh); #else # 685 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" #undef _dispatch_event_loop_assert_not_owned #define _dispatch_event_loop_assert_not_owned(wlh) ((void)wlh) #endif # 688 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void _dispatch_event_loop_leave_immediate(uint64_t dq_state); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_EVENT_BACKEND_KEVENT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 690 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void _dispatch_event_loop_leave_deferred(dispatch_deferred_items_t ddi, uint64_t dq_state); void _dispatch_event_loop_merge(dispatch_kevent_t events, int nevents); #endif # 694 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" void _dispatch_event_loop_drain(uint32_t flags); void _dispatch_event_loop_timer_arm(dispatch_timer_heap_t dth, uint32_t tidx, dispatch_timer_delay_s range, dispatch_clock_now_cache_t nows); void _dispatch_event_loop_timer_delete(dispatch_timer_heap_t dth, uint32_t tidx); void _dispatch_event_loop_drain_timers(dispatch_timer_heap_t dth, uint32_t count); DISPATCH_ALWAYS_INLINE static inline void _dispatch_timers_heap_dirty(dispatch_timer_heap_t dth, uint32_t tidx) { // Note: the dirty bits are only maintained in the first heap for any tidx dth[0].dth_dirty_bits |= (1 << DISPATCH_TIMER_QOS(tidx)) | DTH_DIRTY_GLOBAL; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_event_loop_drain_anon_timers(void) { if (_dispatch_timers_heap[0].dth_dirty_bits) { _dispatch_event_loop_drain_timers(_dispatch_timers_heap, DISPATCH_TIMER_COUNT); } } #endif /* __DISPATCH_EVENT_EVENT_INTERNAL__ */ # 721 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/event/event_internal.h" # 666 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 // Older Mac OS X and iOS Simulator fallbacks #ifndef HAVE_PTHREAD_WORKQUEUE_QOS #if 0 /* disabled by -frewrite-includes */ #if !DISPATCH_USE_INTERNAL_WORKQUEUE && HAVE__PTHREAD_WORKQUEUE_INIT && \ PTHREAD_WORKQUEUE_SPI_VERSION >= 20140213 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 672 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_PTHREAD_WORKQUEUE_QOS 1 #else # 674 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_PTHREAD_WORKQUEUE_QOS 0 #endif # 676 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(HAVE_PTHREAD_WORKQUEUE_QOS) # 677 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef HAVE_PTHREAD_WORKQUEUE_KEVENT #if 0 /* disabled by -frewrite-includes */ #if !DISPATCH_USE_INTERNAL_WORKQUEUE && HAVE__PTHREAD_WORKQUEUE_INIT && \ defined(KEVENT_FLAG_WORKQ) && PTHREAD_WORKQUEUE_SPI_VERSION >= 20150304 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 681 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_PTHREAD_WORKQUEUE_KEVENT 1 #else # 683 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_PTHREAD_WORKQUEUE_KEVENT 0 #endif # 685 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(HAVE_PTHREAD_WORKQUEUE_KEVENT) # 686 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef HAVE_PTHREAD_WORKQUEUE_WORKLOOP #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_KEVENT && defined(WORKQ_FEATURE_WORKLOOP) && \ defined(KEVENT_FLAG_WORKLOOP) && \ DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(101300) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 691 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_PTHREAD_WORKQUEUE_WORKLOOP 1 #else # 693 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define HAVE_PTHREAD_WORKQUEUE_WORKLOOP 0 #endif # 695 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(HAVE_PTHREAD_WORKQUEUE_WORKLOOP) # 696 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_USE_WORKQUEUE_NARROWING #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUES && DISPATCH_MIN_REQUIRED_OSX_AT_LEAST(101300) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 699 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_WORKQUEUE_NARROWING 1 #else # 701 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_WORKQUEUE_NARROWING 0 #endif # 703 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(DISPATCH_USE_WORKQUEUE_NARROWING) # 704 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_USE_PTHREAD_ROOT_QUEUES #if 0 /* disabled by -frewrite-includes */ #if defined(__BLOCKS__) && defined(__APPLE__) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 707 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_PTHREAD_ROOT_QUEUES 1 // #else # 709 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_PTHREAD_ROOT_QUEUES 0 #endif # 711 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(DISPATCH_USE_PTHREAD_ROOT_QUEUES) # 712 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_USE_PTHREAD_POOL #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_PTHREAD_ROOT_QUEUES || DISPATCH_USE_INTERNAL_WORKQUEUE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 715 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_PTHREAD_POOL 1 #else # 717 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_PTHREAD_POOL 0 #endif # 719 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(DISPATCH_USE_PTHREAD_POOL) # 720 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_USE_KEVENT_WORKQUEUE #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_KEVENT #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 723 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_KEVENT_WORKQUEUE 1 #else # 725 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_KEVENT_WORKQUEUE 0 #endif # 727 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(DISPATCH_USE_KEVENT_WORKQUEUE) # 728 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_KEVENT_WORKQUEUE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 730 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !HAVE_PTHREAD_WORKQUEUE_QOS || !EV_UDATA_SPECIFIC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 731 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #error Invalid build configuration #endif # 733 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // DISPATCH_USE_KEVENT_WORKQUEUE # 734 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_USE_MGR_THREAD #if 0 /* disabled by -frewrite-includes */ #if !DISPATCH_USE_KEVENT_WORKQUEUE || DISPATCH_DEBUG || DISPATCH_PROFILE #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 737 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_MGR_THREAD 1 #else # 739 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_MGR_THREAD 0 #endif # 741 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(DISPATCH_USE_MGR_THREAD) # 742 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_USE_KEVENT_WORKLOOP #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_WORKLOOP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 745 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_KEVENT_WORKLOOP 1 #else # 747 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_KEVENT_WORKLOOP 0 #endif # 749 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // !defined(DISPATCH_USE_KEVENT_WORKLOOP) # 750 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifdef EVFILT_MEMORYSTATUS #ifndef DISPATCH_USE_MEMORYSTATUS #define DISPATCH_USE_MEMORYSTATUS 1 #endif # 755 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // EVFILT_MEMORYSTATUS # 756 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_SIMULATOR #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 758 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #undef DISPATCH_USE_MEMORYPRESSURE_SOURCE #define DISPATCH_USE_MEMORYPRESSURE_SOURCE 0 #endif // TARGET_OS_SIMULATOR # 761 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(DISPATCH_USE_MEMORYPRESSURE_SOURCE) && DISPATCH_USE_MEMORYSTATUS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 762 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_MEMORYPRESSURE_SOURCE 1 #endif # 764 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 766 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 766 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 767 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #else // __has_include( #endif /* expanded by -frewrite-includes */ # 798 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 799 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 799 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 800 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_USE_IMPORTANCE_ASSERTION #define DISPATCH_USE_IMPORTANCE_ASSERTION 1 #endif # 803 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // HAVE_LIBPROC_INTERNAL_H # 804 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_SYS_GUARDED_H #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 806 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 806 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 807 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DISPATCH_USE_GUARDED_FD #define DISPATCH_USE_GUARDED_FD 1 #endif # 810 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // HAVE_SYS_GUARDED_H # 811 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DTRACE || DISPATCH_USE_DTRACE_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 814 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" typedef struct dispatch_trace_timer_params_s { int64_t deadline, interval, leeway; } *dispatch_trace_timer_params_t; #ifdef __cplusplus extern "C++" { #endif # 821 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include "provider.h" #endif /* expanded by -frewrite-includes */ # 821 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 822 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifdef __cplusplus } #endif # 825 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // DISPATCH_USE_DTRACE || DISPATCH_USE_DTRACE_INTROSPECTION # 826 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 828 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 828 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 829 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef DBG_DISPATCH #define DBG_DISPATCH 46 #endif # 832 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef KDBG_CODE #define KDBG_CODE(...) 0 #define DBG_FUNC_START 0 #define DBG_FUNC_END 0 #endif # 837 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_CODE(subclass, code) \ KDBG_CODE(DBG_DISPATCH, DISPATCH_TRACE_SUBCLASS_##subclass, code) #define DISPATCH_CODE_START(subclass, code) \ (DISPATCH_CODE(subclass, code) | DBG_FUNC_START) #define DISPATCH_CODE_END(subclass, code) \ (DISPATCH_CODE(subclass, code) | DBG_FUNC_END) #ifdef ARIADNEDBG_CODE #define ARIADNE_ENTER_DISPATCH_MAIN_CODE ARIADNEDBG_CODE(220, 2) #else # 846 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define ARIADNE_ENTER_DISPATCH_MAIN_CODE 0 #endif # 848 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !defined(DISPATCH_USE_VOUCHER_KDEBUG_TRACE) && \ (DISPATCH_INTROSPECTION || DISPATCH_PROFILE || DISPATCH_DEBUG) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 850 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_USE_VOUCHER_KDEBUG_TRACE 1 #endif # 852 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_TRACE_SUBCLASS_DEFAULT 0 #define DISPATCH_TRACE_SUBCLASS_VOUCHER 1 #define DISPATCH_TRACE_SUBCLASS_PERF 2 #define DISPATCH_TRACE_SUBCLASS_MACH_MSG 3 #define DISPATCH_TRACE_SUBCLASS_PERF_MON 4 #define DISPATCH_TRACE_SUBCLASS_QOS_TRACE 5 #define DISPATCH_TRACE_SUBCLASS_FIREHOSE_TRACE 6 #define DISPATCH_PERF_non_leaf_retarget DISPATCH_CODE(PERF, 1) #define DISPATCH_PERF_post_activate_retarget DISPATCH_CODE(PERF, 2) #define DISPATCH_PERF_post_activate_mutation DISPATCH_CODE(PERF, 3) #define DISPATCH_PERF_delayed_registration DISPATCH_CODE(PERF, 4) #define DISPATCH_PERF_mutable_target DISPATCH_CODE(PERF, 5) #define DISPATCH_PERF_strict_bg_timer DISPATCH_CODE(PERF, 6) #define DISPATCH_PERF_suspended_timer_fire DISPATCH_CODE(PERF, 7) #define DISPATCH_PERF_handlerless_source_fire DISPATCH_CODE(PERF, 8) #define DISPATCH_PERF_source_registration_without_qos DISPATCH_CODE(PERF, 9) #define DISPATCH_MACH_MSG_hdr_move DISPATCH_CODE(MACH_MSG, 1) #define DISPATCH_PERF_MON_worker_thread_start DISPATCH_CODE_START(PERF_MON, 1) #define DISPATCH_PERF_MON_worker_thread_end DISPATCH_CODE_END(PERF_MON, 1) #define DISPATCH_PERF_MON_worker_useless DISPATCH_CODE(PERF_MON, 2) #define DISPATCH_QOS_TRACE_queue_creation_start DISPATCH_CODE_START(QOS_TRACE, 1) #define DISPATCH_QOS_TRACE_queue_creation_end DISPATCH_CODE_END(QOS_TRACE, 1) #define DISPATCH_QOS_TRACE_queue_dispose DISPATCH_CODE(QOS_TRACE, 2) #define DISPATCH_QOS_TRACE_private_block_creation DISPATCH_CODE(QOS_TRACE, 3) #define DISPATCH_QOS_TRACE_private_block_dispose DISPATCH_CODE(QOS_TRACE, 4) #define DISPATCH_QOS_TRACE_continuation_push_eb DISPATCH_CODE(QOS_TRACE, 5) #define DISPATCH_QOS_TRACE_continuation_push_ab DISPATCH_CODE(QOS_TRACE, 6) #define DISPATCH_QOS_TRACE_continuation_push_f DISPATCH_CODE(QOS_TRACE, 7) #define DISPATCH_QOS_TRACE_source_push DISPATCH_CODE(QOS_TRACE, 8) #define DISPATCH_QOS_TRACE_continuation_pop DISPATCH_CODE(QOS_TRACE, 9) #define DISPATCH_QOS_TRACE_source_pop DISPATCH_CODE(QOS_TRACE, 10) #define DISPATCH_QOS_TRACE_queue_item_complete DISPATCH_CODE(QOS_TRACE, 11) #define DISPATCH_QOS_TRACE_src_callout DISPATCH_CODE(QOS_TRACE, 12) #define DISPATCH_QOS_TRACE_src_dispose DISPATCH_CODE(QOS_TRACE, 13) #define DISPATCH_FIREHOSE_TRACE_reserver_gave_up DISPATCH_CODE(FIREHOSE_TRACE, 1) #define DISPATCH_FIREHOSE_TRACE_reserver_wait DISPATCH_CODE(FIREHOSE_TRACE, 2) #define DISPATCH_FIREHOSE_TRACE_allocator DISPATCH_CODE(FIREHOSE_TRACE, 3) #define DISPATCH_FIREHOSE_TRACE_wait_for_logd DISPATCH_CODE(FIREHOSE_TRACE, 4) #define DISPATCH_FIREHOSE_TRACE_chunk_install DISPATCH_CODE(FIREHOSE_TRACE, 5) DISPATCH_ALWAYS_INLINE static inline void _dispatch_ktrace_impl(uint32_t code, uint64_t a, uint64_t b, uint64_t c, uint64_t d) { if (!code) return; #ifdef _COMM_PAGE_KDEBUG_ENABLE if (likely(*(volatile uint32_t *)_COMM_PAGE_KDEBUG_ENABLE == 0)) return; #endif # 912 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" kdebug_trace(code, a, b, c, d); } #define _dispatch_cast_to_uint64(e) \ __builtin_choose_expr(sizeof(e) > 4, \ ((uint64_t)(e)), ((uint64_t)(uintptr_t)(e))) #define _dispatch_ktrace(code, a, b, c, d) _dispatch_ktrace_impl(code, \ _dispatch_cast_to_uint64(a), _dispatch_cast_to_uint64(b), \ _dispatch_cast_to_uint64(c), _dispatch_cast_to_uint64(d)) #else // __has_include() # 922 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_CODE(subclass, code) 0 #define ARIADNE_ENTER_DISPATCH_MAIN_CODE 0 #define DISPATCH_USE_VOUCHER_KDEBUG_TRACE 0 #define _dispatch_ktrace(code, a, b, c, d) #endif // !__has_include() # 927 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_ktrace4(code, a, b, c, d) _dispatch_ktrace(code, a, b, c, d) #define _dispatch_ktrace3(code, a, b, c) _dispatch_ktrace(code, a, b, c, 0) #define _dispatch_ktrace2(code, a, b) _dispatch_ktrace(code, a, b, 0, 0) #define _dispatch_ktrace1(code, a) _dispatch_ktrace(code, a, 0, 0, 0) #define _dispatch_ktrace0(code) _dispatch_ktrace(code, 0, 0, 0, 0) #define BITPACK_UINT32_PAIR(a, b) (((uint64_t) (a) << 32) | (uint64_t) (b)) #ifndef MACH_MSGH_BITS_VOUCHER_MASK #define MACH_MSGH_BITS_VOUCHER_MASK 0x001f0000 #define MACH_MSGH_BITS_SET_PORTS(remote, local, voucher) \ (((remote) & MACH_MSGH_BITS_REMOTE_MASK) | \ (((local) << 8) & MACH_MSGH_BITS_LOCAL_MASK) | \ (((voucher) << 16) & MACH_MSGH_BITS_VOUCHER_MASK)) #define MACH_MSGH_BITS_VOUCHER(bits) \ (((bits) & MACH_MSGH_BITS_VOUCHER_MASK) >> 16) #define MACH_MSGH_BITS_HAS_VOUCHER(bits) \ (MACH_MSGH_BITS_VOUCHER(bits) != MACH_MSGH_BITS_ZERO) #define msgh_voucher_port msgh_reserved #define mach_voucher_t mach_port_t #define MACH_VOUCHER_NULL MACH_PORT_NULL #define MACH_SEND_INVALID_VOUCHER 0x10000005 #endif # 950 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef VOUCHER_USE_MACH_VOUCHER #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 953 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define VOUCHER_USE_MACH_VOUCHER 1 #endif # 955 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // VOUCHER_USE_MACH_VOUCHER # 956 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef VOUCHER_USE_EMPTY_MACH_BASE_VOUCHER #if 0 /* disabled by -frewrite-includes */ #if RDAR_24272659 // FIXME: #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 959 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define VOUCHER_USE_EMPTY_MACH_BASE_VOUCHER 1 #else // RDAR_24272659 # 961 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define VOUCHER_USE_EMPTY_MACH_BASE_VOUCHER 0 #endif // RDAR_24272659 # 963 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 964 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #ifndef VOUCHER_USE_PERSONA #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_USE_MACH_VOUCHER && defined(BANK_PERSONA_TOKEN) && \ !TARGET_OS_SIMULATOR #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 968 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define VOUCHER_USE_PERSONA 1 #else # 970 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define VOUCHER_USE_PERSONA 0 #endif # 972 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // VOUCHER_USE_PERSONA # 973 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_USE_MACH_VOUCHER #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 975 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #undef DISPATCH_USE_IMPORTANCE_ASSERTION #define DISPATCH_USE_IMPORTANCE_ASSERTION 0 #else # 978 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #undef MACH_RCV_VOUCHER #define MACH_RCV_VOUCHER 0 #define VOUCHER_USE_PERSONA 0 #endif // VOUCHER_USE_MACH_VOUCHER # 982 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_hardware_crash() \ __asm__(""); __builtin_trap() // #ifdef _WIN32 #define _dispatch_set_crash_log_cause_and_message(ac, msg) do { \ (void)(ac); \ _dispatch_set_crash_log_message_dynamic((msg)); \ } while (0) #define _dispatch_set_crash_log_message(msg) \ _dispatch_set_crash_log_message_dynamic((msg)) #define _dispatch_set_crash_log_message_dynamic(msg) _RPTF0(_CRT_ASSERT, (msg)) #else // _WIN32 # 995 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_set_crash_log_cause_and_message(ac, msg) ((void)(ac)) #define _dispatch_set_crash_log_message(msg) #define _dispatch_set_crash_log_message_dynamic(msg) #endif // _WIN32 # 999 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1001 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" // MIG_REPLY_MISMATCH means either: // 1) A signal handler is NOT using async-safe API. See the sigaction(2) man // page for more info. // 2) A hand crafted call to mach_msg*() screwed up. Use MIG. #define DISPATCH_VERIFY_MIG(x) do { \ if ((x) == MIG_REPLY_MISMATCH) { \ _dispatch_set_crash_log_cause_and_message((x), \ "MIG_REPLY_MISMATCH"); \ _dispatch_hardware_crash(); \ } \ } while (0) #endif # 1013 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_INTERNAL_CRASH(c, x) do { \ _dispatch_set_crash_log_cause_and_message((c), \ "BUG IN LIBDISPATCH: " x); \ _dispatch_hardware_crash(); \ } while (0) #define DISPATCH_CLIENT_CRASH(c, x) do { \ _dispatch_set_crash_log_cause_and_message((c), \ "BUG IN CLIENT OF LIBDISPATCH: " x); \ _dispatch_hardware_crash(); \ } while (0) #define _OS_OBJECT_CLIENT_CRASH(x) do { \ _dispatch_set_crash_log_message("API MISUSE: " x); \ _dispatch_hardware_crash(); \ } while (0) #define DISPATCH_ASSERTION_FAILED_MESSAGE \ "BUG IN CLIENT OF LIBDISPATCH: Assertion failed: " #define _dispatch_assert_crash(msg) do { \ const char *__msg = (msg); \ _dispatch_log("%s", __msg); \ _dispatch_set_crash_log_message_dynamic(__msg); \ _dispatch_hardware_crash(); \ } while (0) #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1042 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_client_assert_fail(fmt, ...) do { \ char *_msg = NULL; \ int _length = _scprintf("%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, ##__VA_ARGS__); \ dispatch_assert(_length != -1); \ _msg = (char *)malloc((unsigned)_length + 1); \ dispatch_assert(_msg); \ (void)snprintf(_msg, (unsigned)_length + 1, "%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, ##__VA_ARGS__); \ _dispatch_assert_crash(_msg); \ free(_msg); \ } while (0) #else # 1053 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_client_assert_fail(fmt, ...) do { \ char *_msg = NULL; \ (void)asprintf(&_msg, "%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, \ ##__VA_ARGS__); \ _dispatch_assert_crash(_msg); \ free(_msg); \ } while (0) #endif # 1061 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define DISPATCH_NO_VOUCHER ((voucher_t)(void*)~0ul) #define DISPATCH_NO_PRIORITY ((pthread_priority_t)~0ul) DISPATCH_ENUM(dispatch_thread_set_self, unsigned long, DISPATCH_PRIORITY_ENFORCE = 0x1, DISPATCH_VOUCHER_REPLACE = 0x2, DISPATCH_VOUCHER_CONSUME = 0x4, DISPATCH_THREAD_PARK = 0x8, ); DISPATCH_WARN_RESULT static inline voucher_t _dispatch_adopt_priority_and_set_voucher( pthread_priority_t priority, voucher_t voucher, dispatch_thread_set_self_t flags); #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1075 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" mach_port_t _dispatch_get_mach_host_port(void); #endif # 1077 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1079 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1080 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" extern bool _dispatch_set_qos_class_enabled; #else # 1082 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_set_qos_class_enabled (1) #endif # 1084 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif // HAVE_PTHREAD_WORKQUEUE_QOS # 1085 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_KEVENT_WORKQUEUE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1086 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_MGR_THREAD #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1087 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" extern bool _dispatch_kevent_workqueue_enabled; #else # 1089 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_kevent_workqueue_enabled (1) #endif # 1091 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #else # 1092 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #define _dispatch_kevent_workqueue_enabled (0) #endif // DISPATCH_USE_KEVENT_WORKQUEUE # 1094 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_KEVENT_WORKLOOP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1096 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #if 0 /* disabled by -frewrite-includes */ #if !DISPATCH_USE_KEVENT_WORKQUEUE || !DISPATCH_USE_KEVENT_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1097 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #error Invalid build configuration #endif # 1099 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" #endif # 1100 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" /* #includes dependent on internal.h */ #if 0 /* expanded by -frewrite-includes */ #include "object_internal.h" #endif /* expanded by -frewrite-includes */ # 1102 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_OBJECT_INTERNAL__ #define __DISPATCH_OBJECT_INTERNAL__ #if 0 /* disabled by -frewrite-includes */ #if !OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_DECL(name) DISPATCH_DECL(name) #define OS_OBJECT_DECL_SUBCLASS(name, super) DISPATCH_DECL(name) #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #if 0 /* disabled by -frewrite-includes */ #if USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_EXTRA_VTABLE_SYMBOL(name) _OS_##name##_vtable #define DISPATCH_CLASS_SYMBOL(name) OS_dispatch_##name##_class #define DISPATCH_CLASS_RAW_SYMBOL_NAME(name) \ OS_OBJC_CLASS_RAW_SYMBOL_NAME(DISPATCH_CLASS(name)) #else # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_CLASS_SYMBOL(name) _##name##_vtable #define OS_OBJC_CLASS_RAW_SYMBOL_NAME(name) \ "__" OS_STRINGIFY(name) "_vtable" #define DISPATCH_CLASS_SYMBOL(name) _dispatch_##name##_vtable #define DISPATCH_CLASS_RAW_SYMBOL_NAME(name) \ "__dispatch_" OS_STRINGIFY(name) "_vtable" #endif # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_CLASS(name) OS_dispatch_##name #if 0 /* disabled by -frewrite-includes */ #if USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 51 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_OBJC_CLASS_DECL(name) \ extern void *DISPATCH_CLASS_SYMBOL(name) \ __asm__(DISPATCH_CLASS_RAW_SYMBOL_NAME(name)) #endif # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" // define a new proper class #define OS_OBJECT_CLASS_DECL(name, ...) \ struct name##_s; \ struct name##_extra_vtable_s { \ __VA_ARGS__; \ }; \ struct name##_vtable_s { \ _OS_OBJECT_CLASS_HEADER(); \ struct name##_extra_vtable_s _os_obj_vtable; \ }; \ OS_OBJECT_EXTRA_VTABLE_DECL(name, name) \ extern const struct name##_vtable_s OS_OBJECT_CLASS_SYMBOL(name) \ __asm__(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name))) #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_SWIFT3 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 71 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_INTERNAL_CLASS_DECL(name, super, ...) \ OS_OBJECT_OBJC_RUNTIME_VISIBLE \ OS_OBJECT_DECL_IMPL_CLASS(name, OS_OBJECT_CLASS(super)); \ OS_OBJECT_CLASS_DECL(name, ## __VA_ARGS__) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif OS_OBJECT_USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 76 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_INTERNAL_CLASS_DECL(name, super, ...) \ OS_OBJECT_DECL(name); \ OS_OBJECT_CLASS_DECL(name, ## __VA_ARGS__) #else # 80 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_INTERNAL_CLASS_DECL(name, super, ...) \ typedef struct name##_s *name##_t; \ OS_OBJECT_CLASS_DECL(name, ## __VA_ARGS__) #endif # 84 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_CLASS_DECL_BARE(name, cluster) \ OS_OBJECT_CLASS_DECL(dispatch_##name, \ DISPATCH_##cluster##_VTABLE_HEADER(dispatch_##name)) #define DISPATCH_CLASS_DECL(name, cluster) \ _OS_OBJECT_DECL_PROTOCOL(dispatch_##name, dispatch_object) \ _OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(dispatch_##name, dispatch_##name) \ DISPATCH_CLASS_DECL_BARE(name, cluster) #define DISPATCH_SUBCLASS_DECL(name, super, ctype) \ _OS_OBJECT_DECL_PROTOCOL(dispatch_##name, dispatch_##super); \ _OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(dispatch_##name, dispatch_##name) \ OS_OBJECT_SUBCLASS_DECL(dispatch_##name, dispatch_##ctype) #define DISPATCH_INTERNAL_CLASS_DECL(name, cluster) \ DISPATCH_DECL(dispatch_##name); \ DISPATCH_CLASS_DECL(name, cluster) // define a new subclass used in a cluster #define OS_OBJECT_SUBCLASS_DECL(name, ctype) \ struct name##_s; \ OS_OBJECT_EXTRA_VTABLE_DECL(name, ctype) \ extern const struct ctype##_vtable_s OS_OBJECT_CLASS_SYMBOL(name) \ __asm__(OS_OBJC_CLASS_RAW_SYMBOL_NAME(OS_OBJECT_CLASS(name))) #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_SWIFT3 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 111 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" // define a new internal subclass used in a class cluster #define OS_OBJECT_INTERNAL_SUBCLASS_DECL(name, super, ctype) \ _OS_OBJECT_DECL_PROTOCOL(name, super); \ _OS_OBJECT_DECL_SUBCLASS_INTERFACE(name, super) \ OS_OBJECT_SUBCLASS_DECL(name, ctype) #else # 117 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" // define a new internal subclass used in a class cluster #define OS_OBJECT_INTERNAL_SUBCLASS_DECL(name, super, ctype) \ OS_OBJECT_DECL_SUBCLASS(name, ctype); \ _OS_OBJECT_DECL_SUBCLASS_INTERFACE(name, super) \ OS_OBJECT_SUBCLASS_DECL(name, ctype) #endif # 123 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_INTERNAL_SUBCLASS_DECL(name, super, ctype) \ OS_OBJECT_INTERNAL_SUBCLASS_DECL(dispatch_##name, dispatch_##super, \ dispatch_##ctype) // vtable symbols #define OS_OBJECT_VTABLE(name) (&OS_OBJECT_CLASS_SYMBOL(name)) #define DISPATCH_OBJC_CLASS(name) (&DISPATCH_CLASS_SYMBOL(name)) // vtables for subclasses used in a class cluster #if 0 /* disabled by -frewrite-includes */ #if USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 134 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" // ObjC classes and dispatch vtables are co-located via linker order and alias // files rdar://10640168 #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC2 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 137 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_VTABLE_SUBCLASS_INSTANCE(name, ctype, xdispose, dispose, ...) \ __attribute__((section("__DATA,__objc_data"), used)) \ const struct ctype##_extra_vtable_s \ OS_OBJECT_EXTRA_VTABLE_SYMBOL(name) = { __VA_ARGS__ } #define OS_OBJECT_EXTRA_VTABLE_DECL(name, ctype) #define DISPATCH_VTABLE(name) DISPATCH_OBJC_CLASS(name) #else # 144 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_VTABLE_SUBCLASS_INSTANCE(name, ctype, xdispose, dispose, ...) \ const struct ctype##_vtable_s \ OS_OBJECT_EXTRA_VTABLE_SYMBOL(name) = { \ ._os_obj_objc_isa = &OS_OBJECT_CLASS_SYMBOL(name), \ ._os_obj_vtable = { __VA_ARGS__ }, \ } #define OS_OBJECT_EXTRA_VTABLE_DECL(name, ctype) \ extern const struct ctype##_vtable_s \ OS_OBJECT_EXTRA_VTABLE_SYMBOL(name); #define DISPATCH_VTABLE(name) &OS_OBJECT_EXTRA_VTABLE_SYMBOL(dispatch_##name) #endif // OS_OBJECT_HAVE_OBJC2 # 155 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #else # 156 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_VTABLE_SUBCLASS_INSTANCE(name, ctype, xdispose, dispose, ...) \ const struct ctype##_vtable_s OS_OBJECT_CLASS_SYMBOL(name) = { \ ._os_obj_xref_dispose = xdispose, \ ._os_obj_dispose = dispose, \ ._os_obj_vtable = { __VA_ARGS__ }, \ } #define OS_OBJECT_EXTRA_VTABLE_DECL(name, ctype) #define DISPATCH_VTABLE(name) DISPATCH_OBJC_CLASS(name) #endif // USE_OBJC # 165 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" // vtables for proper classes #define OS_OBJECT_VTABLE_INSTANCE(name, xdispose, dispose, ...) \ OS_OBJECT_VTABLE_SUBCLASS_INSTANCE(name, name, \ xdispose, dispose, __VA_ARGS__) #define DISPATCH_VTABLE_INSTANCE(name, ...) \ DISPATCH_VTABLE_SUBCLASS_INSTANCE(name, name, __VA_ARGS__) #if 0 /* disabled by -frewrite-includes */ #if USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 175 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_VTABLE_SUBCLASS_INSTANCE(name, ctype, ...) \ OS_OBJECT_VTABLE_SUBCLASS_INSTANCE(dispatch_##name, dispatch_##ctype, \ _dispatch_xref_dispose, _dispatch_dispose, __VA_ARGS__) #define DISPATCH_OBJECT_VTABLE_HEADER(x) \ unsigned long const do_type; \ void (*const do_dispose)(struct x##_s *, bool *allow_free); \ size_t (*const do_debug)(struct x##_s *, char *, size_t); \ void (*const do_invoke)(struct x##_s *, dispatch_invoke_context_t, \ dispatch_invoke_flags_t) #else # 186 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_VTABLE_SUBCLASS_INSTANCE(name, ctype, ...) \ OS_OBJECT_VTABLE_SUBCLASS_INSTANCE(dispatch_##name, dispatch_##ctype, \ _dispatch_xref_dispose, _dispatch_dispose, \ .do_kind = #name, __VA_ARGS__) #define DISPATCH_OBJECT_VTABLE_HEADER(x) \ unsigned long const do_type; \ const char *const do_kind; \ void (*const do_dispose)(struct x##_s *, bool *allow_free); \ size_t (*const do_debug)(struct x##_s *, char *, size_t); \ void (*const do_invoke)(struct x##_s *, dispatch_invoke_context_t, \ dispatch_invoke_flags_t) #endif # 199 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_QUEUE_VTABLE_HEADER(x); \ DISPATCH_OBJECT_VTABLE_HEADER(x); \ void (*const dq_activate)(dispatch_queue_class_t, bool *allow_resume); \ void (*const dq_wakeup)(dispatch_queue_class_t, dispatch_qos_t, \ dispatch_wakeup_flags_t); \ void (*const dq_push)(dispatch_queue_class_t, dispatch_object_t, \ dispatch_qos_t) #define dx_vtable(x) (&(x)->do_vtable->_os_obj_vtable) #define dx_type(x) dx_vtable(x)->do_type #define dx_metatype(x) (dx_vtable(x)->do_type & _DISPATCH_META_TYPE_MASK) #define dx_cluster(x) (dx_vtable(x)->do_type & _DISPATCH_TYPE_CLUSTER_MASK) #define dx_hastypeflag(x, f) (dx_vtable(x)->do_type & _DISPATCH_##f##_TYPEFLAG) #define dx_debug(x, y, z) dx_vtable(x)->do_debug((x), (y), (z)) #define dx_dispose(x, y) dx_vtable(x)->do_dispose(x, y) #define dx_invoke(x, y, z) dx_vtable(x)->do_invoke(x, y, z) #define dx_push(x, y, z) dx_vtable(x)->dq_push(x, y, z) #define dx_wakeup(x, y, z) dx_vtable(x)->dq_wakeup(x, y, z) #define DISPATCH_OBJECT_GLOBAL_REFCNT _OS_OBJECT_GLOBAL_REFCNT #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC1 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 222 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_GLOBAL_OBJECT_HEADER(name) \ .do_vtable = DISPATCH_VTABLE(name), \ ._objc_isa = DISPATCH_OBJC_CLASS(name), \ .do_ref_cnt = DISPATCH_OBJECT_GLOBAL_REFCNT, \ .do_xref_cnt = DISPATCH_OBJECT_GLOBAL_REFCNT #else # 228 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_GLOBAL_OBJECT_HEADER(name) \ .do_vtable = DISPATCH_VTABLE(name), \ .do_ref_cnt = DISPATCH_OBJECT_GLOBAL_REFCNT, \ .do_xref_cnt = DISPATCH_OBJECT_GLOBAL_REFCNT #endif # 233 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_SIZEOF_PTR == 8 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" // the bottom nibble must not be zero, the rest of the bits should be random // we sign extend the 64-bit version so that a better instruction encoding is // generated on Intel #define DISPATCH_OBJECT_LISTLESS ((void *)0xffffffff89abcdef) #else # 240 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_OBJECT_LISTLESS ((void *)0x89abcdef) #endif # 242 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" DISPATCH_ENUM(dispatch_wakeup_flags, uint32_t, // The caller of dx_wakeup owns two internal refcounts on the object being // woken up. Two are needed for WLH wakeups where two threads need // the object to remain valid in a non-coordinated way // - the thread doing the poke for the duration of the poke // - drainers for the duration of their drain DISPATCH_WAKEUP_CONSUME_2 = 0x00000001, // Some change to the object needs to be published to drainers. // If the drainer isn't the same thread, some scheme such as the dispatch // queue DIRTY bit must be used and a release barrier likely has to be // involved before dx_wakeup returns DISPATCH_WAKEUP_MAKE_DIRTY = 0x00000002, // This wakeup is made by a sync owner that still holds the drain lock DISPATCH_WAKEUP_BARRIER_COMPLETE = 0x00000004, // This wakeup is caused by a dispatch_block_wait() DISPATCH_WAKEUP_BLOCK_WAIT = 0x00000008, // This wakeup may cause the source to leave its DSF_NEEDS_EVENT state DISPATCH_WAKEUP_EVENT = 0x00000010, ); typedef struct dispatch_invoke_context_s { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_WORKQUEUE_NARROWING #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 269 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" uint64_t dic_next_narrow_check; #endif # 271 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" struct dispatch_object_s *dic_barrier_waiter; dispatch_qos_t dic_barrier_waiter_bucket; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_COCOA_COMPAT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 274 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" void *dic_autorelease_pool; #endif # 276 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" } dispatch_invoke_context_s, *dispatch_invoke_context_t; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_WORKQUEUE_NARROWING #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 279 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_THREAD_IS_NARROWING 1 #define dispatch_with_disabled_narrowing(dic, ...) ({ \ uint64_t suspend_narrow_check = dic->dic_next_narrow_check; \ dic->dic_next_narrow_check = 0; \ __VA_ARGS__; \ dic->dic_next_narrow_check = suspend_narrow_check; \ }) #else # 288 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define dispatch_with_disabled_narrowing(dic, ...) __VA_ARGS__ #endif # 290 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" DISPATCH_ENUM(dispatch_invoke_flags, uint32_t, DISPATCH_INVOKE_NONE = 0x00000000, // Invoke modes // // @const DISPATCH_INVOKE_STEALING // This invoke is a stealer, meaning that it doesn't own the // enqueue lock at drain lock time. // // @const DISPATCH_INVOKE_WLH // This invoke is for a bottom WLH // DISPATCH_INVOKE_STEALING = 0x00000001, DISPATCH_INVOKE_WLH = 0x00000002, // Misc flags // // @const DISPATCH_INVOKE_ASYNC_REPLY // An asynchronous reply to a message is being handled. // // @const DISPATCH_INVOKE_DISALLOW_SYNC_WAITERS // The next serial drain should not allow sync waiters. // DISPATCH_INVOKE_ASYNC_REPLY = 0x00000004, DISPATCH_INVOKE_DISALLOW_SYNC_WAITERS = 0x00000008, // Below this point flags are propagated to recursive calls to drain(), // continuation pop() or dx_invoke(). #define _DISPATCH_INVOKE_PROPAGATE_MASK 0xffff0000u // Drain modes // // @const DISPATCH_INVOKE_WORKER_DRAIN // Invoke has been issued by a worker thread (work queue thread, or // pthread root queue) drain. This flag is NOT set when the main queue, // manager queue or runloop queues are drained // // @const DISPATCH_INVOKE_REDIRECTING_DRAIN // Has only been draining concurrent queues so far // Implies DISPATCH_INVOKE_WORKER_DRAIN // // @const DISPATCH_INVOKE_MANAGER_DRAIN // We're draining from a manager context // // @const DISPATCH_INVOKE_THREAD_BOUND // We're draining from the context of a thread-bound queue (main thread) // // @const DISPATCH_INVOKE_WORKER_DRAIN // The queue at the bottom of this drain is a workloop that supports // reordering. // DISPATCH_INVOKE_WORKER_DRAIN = 0x00010000, DISPATCH_INVOKE_REDIRECTING_DRAIN = 0x00020000, DISPATCH_INVOKE_MANAGER_DRAIN = 0x00040000, DISPATCH_INVOKE_THREAD_BOUND = 0x00080000, DISPATCH_INVOKE_WORKLOOP_DRAIN = 0x00100000, #define _DISPATCH_INVOKE_DRAIN_MODE_MASK 0x00ff0000u // Autoreleasing modes // // @const DISPATCH_INVOKE_AUTORELEASE_ALWAYS // Always use autoreleasepools around callouts // // @const DISPATCH_INVOKE_AUTORELEASE_NEVER // Never use autoreleasepools around callouts // DISPATCH_INVOKE_AUTORELEASE_ALWAYS = 0x01000000, DISPATCH_INVOKE_AUTORELEASE_NEVER = 0x02000000, #define _DISPATCH_INVOKE_AUTORELEASE_MASK 0x03000000u ); DISPATCH_ENUM(dispatch_object_flags, unsigned long, _DISPATCH_META_TYPE_MASK = 0x000000ff, // mask for object meta-types _DISPATCH_TYPE_CLUSTER_MASK = 0x000000f0, // mask for the cluster type _DISPATCH_SUB_TYPE_MASK = 0x0000ff00, // mask for object sub-types _DISPATCH_TYPEFLAGS_MASK = 0x00ff0000, // mask for object typeflags _DISPATCH_OBJECT_CLUSTER = 0x00000000, // dispatch object cluster _DISPATCH_CONTINUATION_TYPE = 0x00000000, // meta-type for continuations _DISPATCH_SEMAPHORE_TYPE = 0x00000001, // meta-type for semaphores _DISPATCH_NODE_TYPE = 0x00000002, // meta-type for data node _DISPATCH_IO_TYPE = 0x00000003, // meta-type for io channels _DISPATCH_OPERATION_TYPE = 0x00000004, // meta-type for io operations _DISPATCH_DISK_TYPE = 0x00000005, // meta-type for io disks _DISPATCH_QUEUE_CLUSTER = 0x00000010, // dispatch queue cluster _DISPATCH_LANE_TYPE = 0x00000011, // meta-type for lanes _DISPATCH_WORKLOOP_TYPE = 0x00000012, // meta-type for workloops _DISPATCH_SOURCE_TYPE = 0x00000013, // meta-type for sources // QUEUE_ROOT is set on root queues (queues with a NULL do_targetq) // QUEUE_BASE is set on hierarchy bases, these always target a root queue // NO_CONTEXT is set on types not supporting dispatch_{get,set}_context _DISPATCH_QUEUE_ROOT_TYPEFLAG = 0x00010000, _DISPATCH_QUEUE_BASE_TYPEFLAG = 0x00020000, _DISPATCH_NO_CONTEXT_TYPEFLAG = 0x00040000, #define DISPATCH_OBJECT_SUBTYPE(ty, base) (_DISPATCH_##base##_TYPE | (ty) << 8) #define DISPATCH_CONTINUATION_TYPE(name) \ DISPATCH_OBJECT_SUBTYPE(DC_##name##_TYPE, CONTINUATION) DISPATCH_SEMAPHORE_TYPE = DISPATCH_OBJECT_SUBTYPE(1, SEMAPHORE), DISPATCH_GROUP_TYPE = DISPATCH_OBJECT_SUBTYPE(2, SEMAPHORE), DISPATCH_DATA_TYPE = DISPATCH_OBJECT_SUBTYPE(1, NODE), DISPATCH_MACH_MSG_TYPE = DISPATCH_OBJECT_SUBTYPE(2, NODE), DISPATCH_QUEUE_ATTR_TYPE = DISPATCH_OBJECT_SUBTYPE(3, NODE), DISPATCH_IO_TYPE = DISPATCH_OBJECT_SUBTYPE(0, IO), DISPATCH_OPERATION_TYPE = DISPATCH_OBJECT_SUBTYPE(0, OPERATION), DISPATCH_DISK_TYPE = DISPATCH_OBJECT_SUBTYPE(0, DISK), DISPATCH_QUEUE_SERIAL_TYPE = DISPATCH_OBJECT_SUBTYPE(1, LANE), DISPATCH_QUEUE_CONCURRENT_TYPE = DISPATCH_OBJECT_SUBTYPE(2, LANE), DISPATCH_QUEUE_GLOBAL_ROOT_TYPE = DISPATCH_OBJECT_SUBTYPE(3, LANE) | _DISPATCH_QUEUE_ROOT_TYPEFLAG | _DISPATCH_NO_CONTEXT_TYPEFLAG, DISPATCH_QUEUE_PTHREAD_ROOT_TYPE = DISPATCH_OBJECT_SUBTYPE(4, LANE) | _DISPATCH_QUEUE_ROOT_TYPEFLAG | _DISPATCH_NO_CONTEXT_TYPEFLAG, DISPATCH_QUEUE_MGR_TYPE = DISPATCH_OBJECT_SUBTYPE(5, LANE) | _DISPATCH_QUEUE_BASE_TYPEFLAG | _DISPATCH_NO_CONTEXT_TYPEFLAG, DISPATCH_QUEUE_MAIN_TYPE = DISPATCH_OBJECT_SUBTYPE(6, LANE) | _DISPATCH_QUEUE_BASE_TYPEFLAG | _DISPATCH_NO_CONTEXT_TYPEFLAG, DISPATCH_QUEUE_RUNLOOP_TYPE = DISPATCH_OBJECT_SUBTYPE(7, LANE) | _DISPATCH_QUEUE_BASE_TYPEFLAG | _DISPATCH_NO_CONTEXT_TYPEFLAG, DISPATCH_QUEUE_NETWORK_EVENT_TYPE = DISPATCH_OBJECT_SUBTYPE(8, LANE) | _DISPATCH_QUEUE_BASE_TYPEFLAG, DISPATCH_WORKLOOP_TYPE = DISPATCH_OBJECT_SUBTYPE(0, WORKLOOP) | _DISPATCH_QUEUE_BASE_TYPEFLAG, DISPATCH_SOURCE_KEVENT_TYPE = DISPATCH_OBJECT_SUBTYPE(1, SOURCE), DISPATCH_MACH_CHANNEL_TYPE = DISPATCH_OBJECT_SUBTYPE(2, SOURCE), ); typedef struct _os_object_vtable_s { _OS_OBJECT_CLASS_HEADER(); } _os_object_vtable_s; typedef struct _os_object_s { _OS_OBJECT_HEADER( const _os_object_vtable_s *os_obj_isa, os_obj_ref_cnt, os_obj_xref_cnt); } _os_object_s; #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC1 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 437 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_STRUCT_HEADER(x) \ _OS_OBJECT_HEADER(\ const void *_objc_isa, \ do_ref_cnt, \ do_xref_cnt); \ const struct x##_vtable_s *do_vtable #else # 444 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define OS_OBJECT_STRUCT_HEADER(x) \ _OS_OBJECT_HEADER(\ const struct x##_vtable_s *do_vtable, \ do_ref_cnt, \ do_xref_cnt) #endif # 450 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define _DISPATCH_OBJECT_HEADER(x) \ struct _os_object_s _as_os_obj[0]; \ OS_OBJECT_STRUCT_HEADER(dispatch_##x); \ struct dispatch_##x##_s *volatile do_next; \ struct dispatch_queue_s *do_targetq; \ void *do_ctxt; \ void *do_finalizer #define DISPATCH_OBJECT_HEADER(x) \ struct dispatch_object_s _as_do[0]; \ _DISPATCH_OBJECT_HEADER(x) // Swift-unavailable -init requires method in each class. #define DISPATCH_UNAVAILABLE_INIT() \ - (instancetype)init { \ DISPATCH_CLIENT_CRASH(0, "-init called directly"); \ return [super init]; \ } _OS_OBJECT_DECL_PROTOCOL(dispatch_object, object); DISPATCH_CLASS_DECL_BARE(object, OBJECT); struct dispatch_object_s { _DISPATCH_OBJECT_HEADER(object); }; DISPATCH_COLD size_t _dispatch_object_debug_attr(dispatch_object_t dou, char* buf, size_t bufsiz); void *_dispatch_object_alloc(const void *vtable, size_t size); void _dispatch_object_finalize(dispatch_object_t dou); void _dispatch_object_dealloc(dispatch_object_t dou); #if 0 /* disabled by -frewrite-includes */ #if !USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 484 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" void _dispatch_xref_dispose(dispatch_object_t dou); #endif # 486 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" void _dispatch_dispose(dispatch_object_t dou); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_COCOA_COMPAT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 488 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #if 0 /* disabled by -frewrite-includes */ #if USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 489 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 489 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" # 490 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #if 0 /* disabled by -frewrite-includes */ #if __has_include() #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 491 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 491 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" # 492 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #else # 493 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" extern void *objc_autoreleasePoolPush(void); extern void objc_autoreleasePoolPop(void *context); #endif // __has_include() # 496 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define _dispatch_autorelease_pool_push() \ objc_autoreleasePoolPush() #define _dispatch_autorelease_pool_pop(context) \ objc_autoreleasePoolPop(context) #else # 501 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" void *_dispatch_autorelease_pool_push(void); void _dispatch_autorelease_pool_pop(void *context); #endif # 504 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" void _dispatch_last_resort_autorelease_pool_push(dispatch_invoke_context_t dic); void _dispatch_last_resort_autorelease_pool_pop(dispatch_invoke_context_t dic); #define dispatch_invoke_with_autoreleasepool(flags, ...) ({ \ void *pool = NULL; \ if ((flags) & DISPATCH_INVOKE_AUTORELEASE_ALWAYS) { \ pool = _dispatch_autorelease_pool_push(); \ DISPATCH_COMPILER_CAN_ASSUME(pool); \ }; \ __VA_ARGS__; \ if (pool) _dispatch_autorelease_pool_pop(pool); \ }) #else # 517 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define dispatch_invoke_with_autoreleasepool(flags, ...) \ do { (void)flags; __VA_ARGS__; } while (0) #endif # 520 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #if 0 /* disabled by -frewrite-includes */ #if USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 522 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" OS_OBJECT_OBJC_CLASS_DECL(object); #endif # 524 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC2 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 526 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" // ObjC toll-free bridging, keep in sync with libdispatch.order file // // This is required by the dispatch_data_t/NSData bridging, which is not // supported on the old runtime. #define DISPATCH_OBJECT_TFB(f, o, ...) \ if (unlikely(((uintptr_t)((o)._os_obj->os_obj_isa) & 1) || \ (Class)((o)._os_obj->os_obj_isa) < \ (Class)OS_OBJECT_VTABLE(dispatch_object) || \ (Class)((o)._os_obj->os_obj_isa) >= \ (Class)OS_OBJECT_VTABLE(object))) { \ return f((o), ##__VA_ARGS__); \ } id _dispatch_objc_alloc(Class cls, size_t size); void _dispatch_objc_retain(dispatch_object_t dou); void _dispatch_objc_release(dispatch_object_t dou); void _dispatch_objc_set_context(dispatch_object_t dou, void *context); void *_dispatch_objc_get_context(dispatch_object_t dou); void _dispatch_objc_set_finalizer_f(dispatch_object_t dou, dispatch_function_t finalizer); void _dispatch_objc_set_target_queue(dispatch_object_t dou, dispatch_queue_t queue); void _dispatch_objc_suspend(dispatch_object_t dou); void _dispatch_objc_resume(dispatch_object_t dou); void _dispatch_objc_activate(dispatch_object_t dou); DISPATCH_COLD size_t _dispatch_objc_debug(dispatch_object_t dou, char* buf, size_t bufsiz); #if 0 /* disabled by -frewrite-includes */ #if __OBJC2__ #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 555 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" @interface NSObject (DISPATCH_CONCAT(_,DISPATCH_CLASS(object))) - (void)_setContext:(void*)context; - (void*)_getContext; - (void)_setFinalizer:(dispatch_function_t)finalizer; - (void)_setTargetQueue:(dispatch_queue_t)queue; - (void)_suspend; - (void)_resume; - (void)_activate; @end #endif // __OBJC2__ # 565 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #else # 566 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #define DISPATCH_OBJECT_TFB(f, o, ...) #endif // OS_OBJECT_HAVE_OBJC2 # 568 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" #pragma mark - #pragma mark _os_object_s /* * Low level _os_atomic_refcnt_* actions * * _os_atomic_refcnt_inc2o(o, f): * performs a refcount increment and returns the new refcount value * * _os_atomic_refcnt_dec2o(o, f): * performs a refcount decrement and returns the new refcount value * * _os_atomic_refcnt_dispose_barrier2o(o, f): * a barrier to perform prior to tearing down an object when the refcount * reached -1. */ #define _os_atomic_refcnt_perform2o(o, f, op, n, m) ({ \ __typeof__(o) _o = (o); \ int _ref_cnt = _o->f; \ if (likely(_ref_cnt != _OS_OBJECT_GLOBAL_REFCNT)) { \ _ref_cnt = os_atomic_##op##2o(_o, f, n, m); \ } \ _ref_cnt; \ }) #define _os_atomic_refcnt_add_orig2o(o, m, n) \ _os_atomic_refcnt_perform2o(o, m, add_orig, n, relaxed) #define _os_atomic_refcnt_sub2o(o, m, n) \ _os_atomic_refcnt_perform2o(o, m, sub, n, release) #define _os_atomic_refcnt_dispose_barrier2o(o, m) \ (void)os_atomic_load2o(o, m, acquire) /* * Higher level _os_object_{x,}refcnt_* actions * * _os_atomic_{x,}refcnt_inc_orig(o): * increment the external (resp. internal) refcount and * returns the old refcount value * * _os_atomic_{x,}refcnt_dec(o): * decrement the external (resp. internal) refcount and * returns the new refcount value * * _os_atomic_{x,}refcnt_dispose_barrier(o): * performs the pre-teardown barrier for the external * (resp. internal) refcount * */ #define _os_object_xrefcnt_inc_orig(o) \ _os_atomic_refcnt_add_orig2o(o, os_obj_xref_cnt, 1) #define _os_object_xrefcnt_dec(o) \ _os_atomic_refcnt_sub2o(o, os_obj_xref_cnt, 1) #define _os_object_xrefcnt_dispose_barrier(o) \ _os_atomic_refcnt_dispose_barrier2o(o, os_obj_xref_cnt) #define _os_object_refcnt_add_orig(o, n) \ _os_atomic_refcnt_add_orig2o(o, os_obj_ref_cnt, n) #define _os_object_refcnt_sub(o, n) \ _os_atomic_refcnt_sub2o(o, os_obj_ref_cnt, n) #define _os_object_refcnt_dispose_barrier(o) \ _os_atomic_refcnt_dispose_barrier2o(o, os_obj_ref_cnt) void _os_object_atfork_child(void); void _os_object_atfork_parent(void); void _os_object_atfork_prepare(void); void _os_object_init(void); unsigned long _os_object_retain_count(_os_object_t obj); bool _os_object_retain_weak(_os_object_t obj); bool _os_object_allows_weak_reference(_os_object_t obj); void _os_object_dispose(_os_object_t obj); void _os_object_xref_dispose(_os_object_t obj); #endif // __DISPATCH_OBJECT_INTERNAL__ # 649 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/object_internal.h" # 1103 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "semaphore_internal.h" #endif /* expanded by -frewrite-includes */ # 1103 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/semaphore_internal.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SEMAPHORE_INTERNAL__ #define __DISPATCH_SEMAPHORE_INTERNAL__ struct dispatch_queue_s; DISPATCH_CLASS_DECL(semaphore, OBJECT); struct dispatch_semaphore_s { DISPATCH_OBJECT_HEADER(semaphore); intptr_t volatile dsema_value; intptr_t dsema_orig; _dispatch_sema4_t dsema_sema; }; /* * Dispatch Group State: * * Generation (32 - 63): * 32 bit counter that is incremented each time the group value reaaches * 0 after a dispatch_group_leave. This 32bit word is used to block waiters * (threads in dispatch_group_wait) in _dispatch_wait_on_address() until the * generation changes. * * Value (2 - 31): * 30 bit value counter of the number of times the group was entered. * dispatch_group_enter counts downward on 32bits, and dispatch_group_leave * upward on 64bits, which causes the generation to bump each time the value * reaches 0 again due to carry propagation. * * Has Notifs (1): * This bit is set when the list of notifications on the group becomes non * empty. It is also used as a lock as the thread that successfuly clears this * bit is the thread responsible for firing the notifications. * * Has Waiters (0): * This bit is set when there are waiters (threads in dispatch_group_wait) * that need to be woken up the next time the value reaches 0. Waiters take * a snapshot of the generation before waiting and will wait for the * generation to change before they return. */ #define DISPATCH_GROUP_GEN_MASK 0xffffffff00000000ULL #define DISPATCH_GROUP_VALUE_MASK 0x00000000fffffffcULL #define DISPATCH_GROUP_VALUE_INTERVAL 0x0000000000000004ULL #define DISPATCH_GROUP_VALUE_1 DISPATCH_GROUP_VALUE_MASK #define DISPATCH_GROUP_VALUE_MAX DISPATCH_GROUP_VALUE_INTERVAL #define DISPATCH_GROUP_HAS_NOTIFS 0x0000000000000002ULL #define DISPATCH_GROUP_HAS_WAITERS 0x0000000000000001ULL DISPATCH_CLASS_DECL(group, OBJECT); struct dispatch_group_s { DISPATCH_OBJECT_HEADER(group); DISPATCH_UNION_LE(uint64_t volatile dg_state, uint32_t dg_bits, uint32_t dg_gen ) DISPATCH_ATOMIC64_ALIGN; struct dispatch_continuation_s *volatile dg_notify_head; struct dispatch_continuation_s *volatile dg_notify_tail; }; DISPATCH_ALWAYS_INLINE static inline uint32_t _dg_state_value(uint64_t dg_state) { return (uint32_t)(-((uint32_t)dg_state & DISPATCH_GROUP_VALUE_MASK)) >> 2; } DISPATCH_ALWAYS_INLINE static inline uint32_t _dg_state_gen(uint64_t dg_state) { return (uint32_t)(dg_state >> 32); } dispatch_group_t _dispatch_group_create_and_enter(void); void _dispatch_group_dispose(dispatch_object_t dou, bool *allow_free); DISPATCH_COLD size_t _dispatch_group_debug(dispatch_object_t dou, char *buf, size_t bufsiz); void _dispatch_semaphore_dispose(dispatch_object_t dou, bool *allow_free); DISPATCH_COLD size_t _dispatch_semaphore_debug(dispatch_object_t dou, char *buf, size_t bufsiz); #endif # 110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/semaphore_internal.h" # 1104 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "introspection_internal.h" #endif /* expanded by -frewrite-includes */ # 1104 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" 1 /* * Copyright (c) 2010-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_INTROSPECTION_INTERNAL__ #define __DISPATCH_INTROSPECTION_INTERNAL__ /* keep in sync with introspection_private.h */ enum dispatch_introspection_runtime_event { dispatch_introspection_runtime_event_worker_event_delivery = 1, dispatch_introspection_runtime_event_worker_unpark = 2, dispatch_introspection_runtime_event_worker_request = 3, dispatch_introspection_runtime_event_worker_park = 4, dispatch_introspection_runtime_event_sync_wait = 10, dispatch_introspection_runtime_event_async_sync_handoff = 11, dispatch_introspection_runtime_event_sync_sync_handoff = 12, dispatch_introspection_runtime_event_sync_async_handoff = 13, }; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" #define DC_BARRIER 0x1 #define DC_SYNC 0x2 #define DC_APPLY 0x4 typedef struct dispatch_queue_introspection_context_s { dispatch_queue_class_t dqic_queue; dispatch_function_t dqic_finalizer; LIST_ENTRY(dispatch_queue_introspection_context_s) dqic_list; char __dqic_no_queue_inversion[0]; // used for queue inversion debugging only dispatch_unfair_lock_s dqic_order_top_head_lock; dispatch_unfair_lock_s dqic_order_bottom_head_lock; LIST_HEAD(, dispatch_queue_order_entry_s) dqic_order_top_head; LIST_HEAD(, dispatch_queue_order_entry_s) dqic_order_bottom_head; } *dispatch_queue_introspection_context_t; struct dispatch_introspection_state_s { LIST_HEAD(, dispatch_introspection_thread_s) threads; LIST_HEAD(, dispatch_queue_introspection_context_s) queues; dispatch_unfair_lock_s threads_lock; dispatch_unfair_lock_s queues_lock; ptrdiff_t thread_queue_offset; // dispatch introspection features bool debug_queue_inversions; // DISPATCH_DEBUG_QUEUE_INVERSIONS }; extern struct dispatch_introspection_state_s _dispatch_introspection; void _dispatch_introspection_init(void); void _dispatch_introspection_thread_add(void); dispatch_function_t _dispatch_object_finalizer(dispatch_object_t dou); void _dispatch_object_set_finalizer(dispatch_object_t dou, dispatch_function_t finalizer); dispatch_queue_class_t _dispatch_introspection_queue_create( dispatch_queue_class_t dqu); void _dispatch_introspection_queue_dispose(dispatch_queue_class_t dqu); void _dispatch_introspection_queue_item_enqueue(dispatch_queue_class_t dqu, dispatch_object_t dou); void _dispatch_introspection_queue_item_dequeue(dispatch_queue_class_t dqu, dispatch_object_t dou); void _dispatch_introspection_queue_item_complete(dispatch_object_t dou); void _dispatch_introspection_callout_entry(void *ctxt, dispatch_function_t f); void _dispatch_introspection_callout_return(void *ctxt, dispatch_function_t f); struct dispatch_object_s *_dispatch_introspection_queue_fake_sync_push_pop( dispatch_queue_t dq, void *ctxt, dispatch_function_t func, uintptr_t dc_flags); void _dispatch_introspection_runtime_event( enum dispatch_introspection_runtime_event event, void *ptr, uint64_t value); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 100 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_queue_push_list(dispatch_queue_class_t dqu, dispatch_object_t head, dispatch_object_t tail) { struct dispatch_object_s *dou = head._do; do { _dispatch_introspection_queue_item_enqueue(dqu, dou); } while (dou != tail._do && (dou = dou->do_next)); }; DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_queue_push(dispatch_queue_class_t dqu, dispatch_object_t dou) { _dispatch_introspection_queue_item_enqueue(dqu, dou); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_queue_pop(dispatch_queue_class_t dqu, dispatch_object_t dou) { _dispatch_introspection_queue_item_dequeue(dqu, dou); } void _dispatch_introspection_order_record(dispatch_queue_t top_q); void _dispatch_introspection_target_queue_changed(dispatch_queue_t dq); DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_sync_begin(dispatch_queue_class_t dq) { if (!_dispatch_introspection.debug_queue_inversions) return; _dispatch_introspection_order_record(dq._dq); } #endif // DISPATCH_PURE_C # 142 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" #else // DISPATCH_INTROSPECTION # 144 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" #define _dispatch_introspection_init() #define _dispatch_introspection_thread_add() DISPATCH_ALWAYS_INLINE static inline dispatch_queue_class_t _dispatch_introspection_queue_create(dispatch_queue_class_t dqu) { return dqu; } #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 156 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" DISPATCH_ALWAYS_INLINE static inline dispatch_function_t _dispatch_object_finalizer(dispatch_object_t dou) { return dou._do->do_finalizer; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_object_set_finalizer(dispatch_object_t dou, dispatch_function_t finalizer) { dou._do->do_finalizer = finalizer; } #endif // DISPATCH_PURE_C # 173 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_queue_dispose( dispatch_queue_class_t dqu DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_queue_push_list( dispatch_queue_class_t dqu DISPATCH_UNUSED, dispatch_object_t head DISPATCH_UNUSED, dispatch_object_t tail DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_queue_push(dispatch_queue_class_t dqu DISPATCH_UNUSED, dispatch_object_t dou DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_queue_pop(dispatch_queue_class_t dqu DISPATCH_UNUSED, dispatch_object_t dou DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_queue_item_complete( dispatch_object_t dou DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_callout_entry(void *ctxt DISPATCH_UNUSED, dispatch_function_t f DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_callout_return(void *ctxt DISPATCH_UNUSED, dispatch_function_t f DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_target_queue_changed( dispatch_queue_t dq DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_sync_begin( dispatch_queue_class_t dq DISPATCH_UNUSED) {} DISPATCH_ALWAYS_INLINE static inline struct dispatch_object_s * _dispatch_introspection_queue_fake_sync_push_pop( dispatch_queue_t dq DISPATCH_UNUSED, void *ctxt DISPATCH_UNUSED, dispatch_function_t func DISPATCH_UNUSED, uintptr_t dc_flags DISPATCH_UNUSED) { return NULL; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_introspection_runtime_event( enum dispatch_introspection_runtime_event event DISPATCH_UNUSED, void *ptr DISPATCH_UNUSED, uint64_t value DISPATCH_UNUSED) {} #endif // DISPATCH_INTROSPECTION # 235 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" #endif // __DISPATCH_INTROSPECTION_INTERNAL__ # 237 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/introspection_internal.h" # 1105 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "queue_internal.h" #endif /* expanded by -frewrite-includes */ # 1105 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_QUEUE_INTERNAL__ #define __DISPATCH_QUEUE_INTERNAL__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #pragma mark - #pragma mark dispatch_queue_flags, dq_state DISPATCH_ENUM(dispatch_queue_flags, uint32_t, DQF_NONE = 0x00000000, DQF_AUTORELEASE_ALWAYS = 0x00010000, DQF_AUTORELEASE_NEVER = 0x00020000, #define _DQF_AUTORELEASE_MASK 0x00030000 DQF_THREAD_BOUND = 0x00040000, // queue is bound to a thread DQF_BARRIER_BIT = 0x00080000, // queue is a barrier on its target DQF_TARGETED = 0x00100000, // queue is targeted by another object DQF_LABEL_NEEDS_FREE = 0x00200000, // queue label was strdup()ed DQF_MUTABLE = 0x00400000, DQF_RELEASED = 0x00800000, // xref_cnt == -1 // // Only applies to sources // // @const DSF_STRICT // Semantics of the source are strict (implies DQF_MUTABLE being unset): // - handlers can't be changed past activation // - EV_VANISHED causes a hard failure // - source can't change WLH // // @const DSF_WLH_CHANGED // The wlh for the source changed (due to retarget past activation). // Only used for debugging and diagnostics purposes. // // @const DSF_CANCELED // Explicit cancelation has been requested. // // @const DSF_CANCEL_WAITER // At least one caller of dispatch_source_cancel_and_wait() is waiting on // the cancelation to finish. DSF_CANCELED must be set if this bit is set. // // @const DSF_NEEDS_EVENT // The source has started to delete its unotes due to cancelation, but // couldn't finish its unregistration and is waiting for some asynchronous // events to fire to be able to. // // This flag prevents spurious wakeups when the source state machine // requires specific events to make progress. Events that are likely // to unblock a source state machine pass DISPATCH_WAKEUP_EVENT // which neuters the effect of DSF_NEEDS_EVENT. // // @const DSF_DELETED // The source can now only be used as a queue and is not allowed to register // any new unote anymore. All the previously registered unotes are inactive // and their knote is gone. However, these previously registered unotes may // still be in the process of delivering their last event. // // Sources have an internal refcount taken always while they use eventing // subsystems which is consumed when this bit is set. // DSF_STRICT = 0x04000000, DSF_WLH_CHANGED = 0x08000000, DSF_CANCELED = 0x10000000, DSF_CANCEL_WAITER = 0x20000000, DSF_NEEDS_EVENT = 0x40000000, DSF_DELETED = 0x80000000, #define DQF_FLAGS_MASK ((dispatch_queue_flags_t)0xffff0000) #define DQF_WIDTH_MASK ((dispatch_queue_flags_t)0x0000ffff) #define DQF_WIDTH(n) ((dispatch_queue_flags_t)(uint16_t)(n)) ); /* * dispatch queues `dq_state` demystified * ******************************************************************************* * * Most Significant 32 bit Word * ---------------------------- * * sc: suspend count (bits 63 - 58) * The suspend count unsurprisingly holds the suspend count of the queue * Only 7 bits are stored inline. Extra counts are transfered in a side * suspend count and when that has happened, the ssc: bit is set. */ #define DISPATCH_QUEUE_SUSPEND_INTERVAL 0x0400000000000000ull #define DISPATCH_QUEUE_SUSPEND_HALF 0x20u /* * ssc: side suspend count (bit 57) * This bit means that the total suspend count didn't fit in the inline * suspend count, and that there are additional suspend counts stored in the * `dq_side_suspend_cnt` field. */ #define DISPATCH_QUEUE_HAS_SIDE_SUSPEND_CNT 0x0200000000000000ull /* * i: inactive bit (bit 56) * This bit means that the object is inactive (see dispatch_activate) */ #define DISPATCH_QUEUE_INACTIVE 0x0100000000000000ull /* * na: needs activation (bit 55) * This bit is set if the object is created inactive. It tells * dispatch_queue_wakeup to perform various tasks at first wakeup. * * This bit is cleared as part of the first wakeup. Having that bit prevents * the object from being woken up (because _dq_state_should_wakeup will say * no), except in the dispatch_activate/dispatch_resume codepath. */ #define DISPATCH_QUEUE_NEEDS_ACTIVATION 0x0080000000000000ull /* * This mask covers the suspend count (sc), side suspend count bit (ssc), * inactive (i) and needs activation (na) bits */ #define DISPATCH_QUEUE_SUSPEND_BITS_MASK 0xff80000000000000ull /* * ib: in barrier (bit 54) * This bit is set when the queue is currently executing a barrier */ #define DISPATCH_QUEUE_IN_BARRIER 0x0040000000000000ull /* * qf: queue full (bit 53) * This bit is a subtle hack that allows to check for any queue width whether * the full width of the queue is used or reserved (depending on the context) * In other words that the queue has reached or overflown its capacity. */ #define DISPATCH_QUEUE_WIDTH_FULL_BIT 0x0020000000000000ull #define DISPATCH_QUEUE_WIDTH_FULL 0x1000ull #define DISPATCH_QUEUE_WIDTH_POOL (DISPATCH_QUEUE_WIDTH_FULL - 1) #define DISPATCH_QUEUE_WIDTH_MAX (DISPATCH_QUEUE_WIDTH_FULL - 2) #define DISPATCH_QUEUE_USES_REDIRECTION(width) \ ({ uint16_t _width = (width); \ _width > 1 && _width < DISPATCH_QUEUE_WIDTH_POOL; }) /* * w: width (bits 52 - 41) * This encodes how many work items are in flight. Barriers hold `dq_width` * of them while they run. This is encoded as a signed offset with respect, * to full use, where the negative values represent how many available slots * are left, and the positive values how many work items are exceeding our * capacity. * * When this value is positive, then `wo` is always set to 1. */ #define DISPATCH_QUEUE_WIDTH_INTERVAL 0x0000020000000000ull #define DISPATCH_QUEUE_WIDTH_MASK 0x003ffe0000000000ull #define DISPATCH_QUEUE_WIDTH_SHIFT 41 /* * pb: pending barrier (bit 40) * Drainers set this bit when they couldn't run the next work item and it is * a barrier. When this bit is set, `dq_width - 1` work item slots are * reserved so that no wakeup happens until the last work item in flight * completes. */ #define DISPATCH_QUEUE_PENDING_BARRIER 0x0000010000000000ull /* * d: dirty bit (bit 39) * This bit is set when a queue transitions from empty to not empty. * This bit is set before dq_items_head is set, with appropriate barriers. * Any thread looking at a queue head is responsible for unblocking any * dispatch_*_sync that could be enqueued at the beginning. * * Drainer perspective * =================== * * When done, any "Drainer", in particular for dispatch_*_sync() handoff * paths, exits in 3 steps, and the point of the DIRTY bit is to make * the Drainers take the slow path at step 2 to take into account enqueuers * that could have made the queue non idle concurrently. * * * // drainer-exit step 1 * if (unlikely(dq->dq_items_tail)) { // speculative test * return handle_non_empty_queue_or_wakeup(dq); * } * // drainer-exit step 2 * if (!_dispatch_queue_drain_try_unlock(dq, ${owned}, ...)) { * return handle_non_empty_queue_or_wakeup(dq); * } * // drainer-exit step 3 * // no need to wake up the queue, it's really empty for sure * return; * * * The crux is _dispatch_queue_drain_try_unlock(), it is a function whose * contract is to release everything the current thread owns from the queue * state, so that when it's successful, any other thread can acquire * width from that queue. * * But, that function must fail if it sees the DIRTY bit set, leaving * the state untouched. Leaving the state untouched is vital as it ensures * that no other Slayer^WDrainer can rise at the same time, because the * resource stays locked. * * * Note that releasing the DRAIN_LOCK or ENQUEUE_LOCK (see below) currently * doesn't use that pattern, and always tries to requeue. It isn't a problem * because while holding either of these locks prevents *some* sync (the * barrier one) codepaths to acquire the resource, the retry they perform * at their step D (see just below) isn't affected by the state of these bits * at all. * * * Sync items perspective * ====================== * * On the dispatch_*_sync() acquire side, the code must look like this: * * * // step A * if (try_acquire_sync(dq)) { * return sync_operation_fastpath(dq, item); * } * * // step B * if (queue_push_and_inline(dq, item)) { * atomic_store(dq->dq_items_head, item, relaxed); * // step C * atomic_or(dq->dq_state, DIRTY, release); * * // step D * if (try_acquire_sync(dq)) { * try_lock_transfer_or_wakeup(dq); * } * } * * // step E * wait_for_lock_transfer(dq); * * * A. If this code can acquire the resource it needs at step A, we're good. * * B. If the item isn't the first at enqueue time, then there is no issue * At least another thread went through C, this thread isn't interesting * for the possible races, responsibility to make progress is transfered * to the thread which went through C-D. * * C. The DIRTY bit is set with a release barrier, after the head/tail * has been set, so that seeing the DIRTY bit means that head/tail * will be visible to any drainer that has the matching acquire barrier. * * Drainers may see the head/tail and fail to see DIRTY, in which * case, their _dispatch_queue_drain_try_unlock() will clear the DIRTY * bit, and fail, causing the caller to retry exactly once. * * D. At this stage, there's two possible outcomes: * * - either the acquire works this time, in which case this thread * successfuly becomes a drainer. That's obviously the happy path. * It means all drainers are after Step 2 (or there is no Drainer) * * - or the acquire fails, which means that another drainer is before * its Step 2. Since we set the DIRTY bit on the dq_state by now, * and that drainers manipulate the state atomically, at least one * drainer that is still before its step 2 will fail its step 2, and * be responsible for making progress. * * * Async items perspective * ====================== * * On the async codepath, when the queue becomes non empty, the queue * is always woken up. There is no point in trying to avoid that wake up * for the async case, because it's required for the async()ed item to make * progress: a drain of the queue must happen. * * So on the async "acquire" side, there is no subtlety at all. */ #define DISPATCH_QUEUE_DIRTY 0x0000008000000000ull /* * md: enqueued/draining on manager (bit 38) * Set when enqueued and draining on the manager hierarchy. * * Unlike the ENQUEUED bit, it is kept until the queue is unlocked from its * invoke call on the manager. This is used to prevent stealing, and * overrides to be applied down the target queue chain. */ #define DISPATCH_QUEUE_ENQUEUED_ON_MGR 0x0000004000000000ull /* * r: queue graph role (bits 37 - 36) * Queue role in the target queue graph * * 11: unused * 10: WLH base * 01: non wlh base * 00: inner queue */ #define DISPATCH_QUEUE_ROLE_MASK 0x0000003000000000ull #define DISPATCH_QUEUE_ROLE_BASE_WLH 0x0000002000000000ull #define DISPATCH_QUEUE_ROLE_BASE_ANON 0x0000001000000000ull #define DISPATCH_QUEUE_ROLE_INNER 0x0000000000000000ull /* * o: has override (bit 35, if role is DISPATCH_QUEUE_ROLE_BASE_ANON) * Set when a queue has received a QOS override and needs to reset it. * This bit is only cleared when the final drain_try_unlock() succeeds. * * sw: has received sync wait (bit 35, if role DISPATCH_QUEUE_ROLE_BASE_WLH) * Set when a queue owner has been exposed to the kernel because of * dispatch_sync() contention. */ #define DISPATCH_QUEUE_RECEIVED_OVERRIDE 0x0000000800000000ull #define DISPATCH_QUEUE_RECEIVED_SYNC_WAIT 0x0000000800000000ull /* * max_qos: max qos (bits 34 - 32) * This is the maximum qos that has been enqueued on the queue */ #define DISPATCH_QUEUE_MAX_QOS_MASK 0x0000000700000000ull #define DISPATCH_QUEUE_MAX_QOS_SHIFT 32 /* * dl: drain lock (bits 31-0) * This is used by the normal drain to drain exlusively relative to other * drain stealers (like the QoS Override codepath). It holds the identity * (thread port) of the current drainer. * * st: sync transfer (bit 1 or 30) * Set when a dispatch_sync() is transferred to * * e: enqueued bit (bit 0 or 31) * Set when a queue is enqueued on its target queue */ #define DISPATCH_QUEUE_DRAIN_OWNER_MASK ((uint64_t)DLOCK_OWNER_MASK) #define DISPATCH_QUEUE_SYNC_TRANSFER ((uint64_t)DLOCK_FAILED_TRYLOCK_BIT) #define DISPATCH_QUEUE_ENQUEUED ((uint64_t)DLOCK_WAITERS_BIT) #define DISPATCH_QUEUE_DRAIN_PRESERVED_BITS_MASK \ (DISPATCH_QUEUE_ENQUEUED_ON_MGR | DISPATCH_QUEUE_ENQUEUED | \ DISPATCH_QUEUE_ROLE_MASK | DISPATCH_QUEUE_MAX_QOS_MASK) #define DISPATCH_QUEUE_DRAIN_UNLOCK_MASK \ (DISPATCH_QUEUE_DRAIN_OWNER_MASK | DISPATCH_QUEUE_RECEIVED_OVERRIDE | \ DISPATCH_QUEUE_RECEIVED_SYNC_WAIT | DISPATCH_QUEUE_SYNC_TRANSFER) /* ******************************************************************************* * * `Drainers` * * Drainers are parts of the code that hold the drain lock by setting its value * to their thread port. There are two kinds: * 1. async drainers, * 2. lock transfer handlers. * * Drainers from the first category are _dispatch_queue_class_invoke and its * stealers. Those drainers always try to reserve width at the same time they * acquire the drain lock, to make sure they can make progress, and else exit * quickly. * * Drainers from the second category are `slow` work items. Those run on the * calling thread, and when done, try to transfer the width they own to the * possible next `slow` work item, and if there is no such item, they reliquish * that right. To do so, prior to taking any decision, they also try to own * the full "barrier" width on the given queue. * ******************************************************************************* * * Enqueuing and wakeup rules * * Nobody should enqueue any dispatch object if it has no chance to make any * progress. That means that queues that: * - are suspended * - have reached or overflown their capacity * - are currently draining * - are already enqueued * * should not try to be enqueued. * ******************************************************************************* * * Lock transfer * * The point of the lock transfer code is to allow pure dispatch_*_sync() * callers to make progress without requiring the bring up of a drainer. * There are two reason for that: * * - performance, as draining has to give up for dispatch_*_sync() work items, * so waking up a queue for this is wasteful. * * - liveness, as with dispatch_*_sync() you burn threads waiting, you're more * likely to hit various thread limits and may not have any drain being * brought up if the process hits a limit. * * * Lock transfer happens at the end on the dispatch_*_sync() codepaths: * * - obviously once a dispatch_*_sync() work item finishes, it owns queue * width and it should try to transfer that ownership to the possible next * queued item if it is a dispatch_*_sync() item * * - just before such a work item blocks to make sure that that work item * itself isn't its own last chance to be woken up. That can happen when * a Drainer pops up everything from the queue, and that a dispatch_*_sync() * work item has taken the slow path then was preempted for a long time. * * That's why such work items, if first in the queue, must try a lock * transfer procedure. * * * For transfers where a partial width is owned, we give back that width. * If the queue state is "idle" again, we attempt to acquire the full width. * If that succeeds, this falls back to the full barrier lock * transfer, else it wakes up the queue according to its state. * * For full barrier transfers, if items eligible for lock transfer are found, * then they are woken up and the lock transfer is successful. * * If none are found, the full barrier width is released. If by doing so the * DIRTY bit is found, releasing the full barrier width fails and transferring * the lock is retried from scratch. */ #define DISPATCH_QUEUE_STATE_INIT_VALUE(width) \ ((DISPATCH_QUEUE_WIDTH_FULL - (width)) << DISPATCH_QUEUE_WIDTH_SHIFT) /* Magic dq_state values for global queues: they have QUEUE_FULL and IN_BARRIER * set to force the slow path in dispatch_barrier_sync() and dispatch_sync() */ #define DISPATCH_ROOT_QUEUE_STATE_INIT_VALUE \ (DISPATCH_QUEUE_WIDTH_FULL_BIT | DISPATCH_QUEUE_IN_BARRIER) #define DISPATCH_QUEUE_SERIAL_DRAIN_OWNED \ (DISPATCH_QUEUE_IN_BARRIER | DISPATCH_QUEUE_WIDTH_INTERVAL) #pragma mark - #pragma mark dispatch_queue_t typedef struct dispatch_queue_specific_s { const void *dqs_key; void *dqs_ctxt; dispatch_function_t dqs_destructor; TAILQ_ENTRY(dispatch_queue_specific_s) dqs_entry; } *dispatch_queue_specific_t; typedef struct dispatch_queue_specific_head_s { dispatch_unfair_lock_s dqsh_lock; TAILQ_HEAD(, dispatch_queue_specific_s) dqsh_entries; } *dispatch_queue_specific_head_t; #define DISPATCH_WORKLOOP_ATTR_HAS_SCHED 0x1u #define DISPATCH_WORKLOOP_ATTR_HAS_POLICY 0x2u #define DISPATCH_WORKLOOP_ATTR_HAS_CPUPERCENT 0x4u #define DISPATCH_WORKLOOP_ATTR_HAS_QOS_CLASS 0x8u #define DISPATCH_WORKLOOP_ATTR_NEEDS_DESTROY 0x10u typedef struct dispatch_workloop_attr_s *dispatch_workloop_attr_t; typedef struct dispatch_workloop_attr_s { uint32_t dwla_flags; dispatch_priority_t dwla_pri; #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_MAC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 474 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" struct sched_param dwla_sched; #endif // TARGET_OS_MAC # 476 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" int dwla_policy; struct { uint8_t percent; uint32_t refillms; } dwla_cpupercent; } dispatch_workloop_attr_s; /* * Dispatch Queue cluster related types * * The dispatch queue cluster uses aliasing structs, and loosely follows the * external types exposed in * * The API types pretend to have this hierarchy: * * dispatch_queue_t * +--> dispatch_workloop_t * +--> dispatch_queue_serial_t --> dispatch_queue_main_t * +--> dispatch_queue_concurrent_t * '--> dispatch_queue_global_t * * * However, in the library itself, there are more types and a finer grained * hierarchy when it comes to the struct members. * * dispatch_queue_class_t / struct dispatch_queue_s * +--> struct dispatch_workloop_s * '--> dispatch_lane_class_t * +--> struct dispatch_lane_s * | +--> struct dispatch_source_s * | '--> struct dispatch_mach_s * +--> struct dispatch_queue_static_s * '--> struct dispatch_queue_global_s * +--> struct dispatch_queue_pthread_root_s * * * dispatch_queue_class_t && struct dispatch_queue_s * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * The queue class type is a transparent union of all queue types, which allows * cutting down the explicit downcasts to `dispatch_queue_t` when calling * a function working on any dispatch_queue_t type. * * The concrete struct layout is struct dispatch_queue_s * it provides: * - dispatch object fields * - dq_state * - dq_serialnum * - dq_label * - dq_atomic_flags * - dq_sref_cnt * - an auxiliary pointer used by sub-classes (dq_specific_head, ds_refs, ...) * - dq_priority (XXX: we should push it down to lanes) * * It also provides storage for one opaque pointer sized field. * * dispatch_lane_class_t * ~~~~~~~~~~~~~~~~~~~~~ * * The lane class type is a transparent union of all "lane" types, which have * a single head/tail pair. * * There's no proper concrete struct layout associated, `struct dispatch_lane_s` * is used most of the time instead. The lane class adds: * - dq_items_head * - dq_items_tail (allocated in the hole the queue class carves out) * * * struct dispatch_lane_s and variants * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * This is the concrete type used for: * - API serial/concurrent/runloop queues * - sources and mach channels * - the main and manager queues, as struct dispatch_queue_static_s which is * a cacheline aligned variant of struct dispatch_lane_s. * * It also provides: * - dq_sidelock, used for suspension & target queue handling, * - dq_side_suspend_cnt. * * Sources (struct dispatch_source_s) and mach channels (struct dispatch_mach_s) * use the last 32bit word for flags private to their use. * * struct dispatch_queue_global_s is used for all dispatch root queues: * - global concurent queues * - pthread root queues * - the network event thread * * These pretend to derive from dispatch_lane_s but use the dq_sidelock, * dq_side_suspend_cnt differently, which is possible because root queues cannot * be targetted or suspended and hence have no use for these. */ #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC1 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 571 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define _DISPATCH_QUEUE_CLASS_HEADER(x, __pointer_sized_field__) \ DISPATCH_OBJECT_HEADER(x); \ DISPATCH_UNION_LE(uint64_t volatile dq_state, \ dispatch_lock dq_state_lock, \ uint32_t dq_state_bits \ ); \ __pointer_sized_field__ #else # 579 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define _DISPATCH_QUEUE_CLASS_HEADER(x, __pointer_sized_field__) \ DISPATCH_OBJECT_HEADER(x); \ __pointer_sized_field__; \ DISPATCH_UNION_LE(uint64_t volatile dq_state, \ dispatch_lock dq_state_lock, \ uint32_t dq_state_bits \ ) #endif # 587 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_QUEUE_CLASS_HEADER(x, __pointer_sized_field__) \ _DISPATCH_QUEUE_CLASS_HEADER(x, __pointer_sized_field__); \ /* LP64 global queue cacheline boundary */ \ unsigned long dq_serialnum; \ const char *dq_label; \ DISPATCH_UNION_LE(uint32_t volatile dq_atomic_flags, \ const uint16_t dq_width, \ const uint16_t __dq_opaque2 \ ); \ dispatch_priority_t dq_priority; \ union { \ struct dispatch_queue_specific_head_s *dq_specific_head; \ struct dispatch_source_refs_s *ds_refs; \ struct dispatch_timer_source_refs_s *ds_timer_refs; \ struct dispatch_mach_recv_refs_s *dm_recv_refs; \ }; \ int volatile dq_sref_cnt struct dispatch_queue_s { DISPATCH_QUEUE_CLASS_HEADER(queue, void *__dq_opaque1); /* 32bit hole on LP64 */ } DISPATCH_ATOMIC64_ALIGN; struct dispatch_workloop_s { struct dispatch_queue_s _as_dq[0]; DISPATCH_QUEUE_CLASS_HEADER(workloop, dispatch_timer_heap_t dwl_timer_heap); uint8_t dwl_drained_qos; /* 24 bits hole */ struct dispatch_object_s *dwl_heads[DISPATCH_QOS_NBUCKETS]; struct dispatch_object_s *dwl_tails[DISPATCH_QOS_NBUCKETS]; dispatch_workloop_attr_t dwl_attr; } DISPATCH_ATOMIC64_ALIGN; #define DISPATCH_LANE_CLASS_HEADER(x) \ struct dispatch_queue_s _as_dq[0]; \ DISPATCH_QUEUE_CLASS_HEADER(x, \ struct dispatch_object_s *volatile dq_items_tail); \ dispatch_unfair_lock_s dq_sidelock; \ struct dispatch_object_s *volatile dq_items_head; \ uint32_t dq_side_suspend_cnt typedef struct dispatch_lane_s { DISPATCH_LANE_CLASS_HEADER(lane); /* 32bit hole on LP64 */ } DISPATCH_ATOMIC64_ALIGN *dispatch_lane_t; // Cache aligned type for static queues (main queue, manager) struct dispatch_queue_static_s { struct dispatch_lane_s _as_dl[0]; \ DISPATCH_LANE_CLASS_HEADER(lane); } DISPATCH_CACHELINE_ALIGN; #define DISPATCH_QUEUE_ROOT_CLASS_HEADER(x) \ struct dispatch_queue_s _as_dq[0]; \ DISPATCH_QUEUE_CLASS_HEADER(x, \ struct dispatch_object_s *volatile dq_items_tail); \ int volatile dgq_thread_pool_size; \ struct dispatch_object_s *volatile dq_items_head; \ int volatile dgq_pending struct dispatch_queue_global_s { DISPATCH_QUEUE_ROOT_CLASS_HEADER(lane); } DISPATCH_CACHELINE_ALIGN; typedef struct dispatch_pthread_root_queue_observer_hooks_s { void (*queue_will_execute)(dispatch_queue_t queue); void (*queue_did_execute)(dispatch_queue_t queue); } dispatch_pthread_root_queue_observer_hooks_s; typedef dispatch_pthread_root_queue_observer_hooks_s *dispatch_pthread_root_queue_observer_hooks_t; #ifdef __APPLE__ #define DISPATCH_IOHID_SPI 1 DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW DISPATCH_NONNULL4 dispatch_queue_global_t _dispatch_pthread_root_queue_create_with_observer_hooks_4IOHID( const char *label, unsigned long flags, const pthread_attr_t *attr, dispatch_pthread_root_queue_observer_hooks_t observer_hooks, dispatch_block_t configure); DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW bool _dispatch_queue_is_exclusively_owned_by_current_thread_4IOHID( dispatch_queue_t queue); #endif // __APPLE__ # 677 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_PTHREAD_POOL #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 679 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" typedef struct dispatch_pthread_root_queue_context_s { #if 0 /* disabled by -frewrite-includes */ #if !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 681 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" pthread_attr_t dpq_thread_attr; #endif # 683 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" dispatch_block_t dpq_thread_configure; struct dispatch_semaphore_s dpq_thread_mediator; dispatch_pthread_root_queue_observer_hooks_s dpq_observer_hooks; } *dispatch_pthread_root_queue_context_t; #endif // DISPATCH_USE_PTHREAD_POOL # 688 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_PTHREAD_ROOT_QUEUES #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 690 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" typedef struct dispatch_queue_pthread_root_s { struct dispatch_queue_global_s _as_dgq[0]; DISPATCH_QUEUE_ROOT_CLASS_HEADER(lane); struct dispatch_pthread_root_queue_context_s dpq_ctxt; } *dispatch_queue_pthread_root_t; #endif // DISPATCH_USE_PTHREAD_ROOT_QUEUES # 696 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" dispatch_static_assert(sizeof(struct dispatch_queue_s) <= 128); dispatch_static_assert(sizeof(struct dispatch_lane_s) <= 128); dispatch_static_assert(sizeof(struct dispatch_queue_global_s) <= 128); dispatch_static_assert(offsetof(struct dispatch_queue_s, dq_state) % sizeof(uint64_t) == 0, "dq_state must be 8-byte aligned"); #define dispatch_assert_valid_queue_type(type) \ dispatch_static_assert(sizeof(struct dispatch_queue_s) <= \ sizeof(struct type), #type " smaller than dispatch_queue_s"); \ dispatch_static_assert(_Alignof(struct type) >= sizeof(uint64_t), \ #type " is not 8-byte aligned"); \ dispatch_assert_aliases(dispatch_queue_s, type, dq_state); \ dispatch_assert_aliases(dispatch_queue_s, type, dq_serialnum); \ dispatch_assert_aliases(dispatch_queue_s, type, dq_label); \ dispatch_assert_aliases(dispatch_queue_s, type, dq_atomic_flags); \ dispatch_assert_aliases(dispatch_queue_s, type, dq_sref_cnt); \ dispatch_assert_aliases(dispatch_queue_s, type, dq_specific_head); \ dispatch_assert_aliases(dispatch_queue_s, type, dq_priority) #define dispatch_assert_valid_lane_type(type) \ dispatch_assert_valid_queue_type(type); \ dispatch_assert_aliases(dispatch_lane_s, type, dq_items_head); \ dispatch_assert_aliases(dispatch_lane_s, type, dq_items_tail) dispatch_assert_valid_queue_type(dispatch_lane_s); dispatch_assert_valid_lane_type(dispatch_queue_static_s); dispatch_assert_valid_lane_type(dispatch_queue_global_s); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_PTHREAD_ROOT_QUEUES #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 725 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" dispatch_assert_valid_lane_type(dispatch_queue_pthread_root_s); #endif # 727 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" DISPATCH_CLASS_DECL(queue, QUEUE); DISPATCH_CLASS_DECL_BARE(lane, QUEUE); DISPATCH_CLASS_DECL(workloop, QUEUE); DISPATCH_SUBCLASS_DECL(queue_serial, queue, lane); DISPATCH_SUBCLASS_DECL(queue_main, queue_serial, lane); DISPATCH_SUBCLASS_DECL(queue_concurrent, queue, lane); DISPATCH_SUBCLASS_DECL(queue_global, queue, lane); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_PTHREAD_ROOT_QUEUES #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 736 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" DISPATCH_INTERNAL_SUBCLASS_DECL(queue_pthread_root, queue, lane); #endif # 738 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" DISPATCH_INTERNAL_SUBCLASS_DECL(queue_runloop, queue_serial, lane); DISPATCH_INTERNAL_SUBCLASS_DECL(queue_mgr, queue_serial, lane); struct firehose_client_s; typedef struct dispatch_thread_context_s *dispatch_thread_context_t; typedef struct dispatch_thread_context_s { dispatch_thread_context_t dtc_prev; const void *dtc_key; union { size_t dtc_apply_nesting; dispatch_io_t dtc_io_in_barrier; union firehose_buffer_u *dtc_fb; void *dtc_mig_demux_ctx; dispatch_mach_msg_t dtc_dmsg; struct dispatch_ipc_handoff_s *dtc_dih; }; } dispatch_thread_context_s; typedef union dispatch_thread_frame_s *dispatch_thread_frame_t; typedef union dispatch_thread_frame_s { struct { // must be in the same order as our TSD keys! dispatch_queue_t dtf_queue; dispatch_thread_frame_t dtf_prev; }; void *dtf_pair[2]; } dispatch_thread_frame_s; typedef dispatch_queue_t dispatch_queue_wakeup_target_t; #define DISPATCH_QUEUE_WAKEUP_NONE ((dispatch_queue_wakeup_target_t)0) #define DISPATCH_QUEUE_WAKEUP_TARGET ((dispatch_queue_wakeup_target_t)1) #define DISPATCH_QUEUE_WAKEUP_MGR (_dispatch_mgr_q._as_dq) #define DISPATCH_QUEUE_WAKEUP_WAIT_FOR_EVENT ((dispatch_queue_wakeup_target_t)-1) void _dispatch_queue_xref_dispose(dispatch_queue_class_t dq); void _dispatch_queue_wakeup(dispatch_queue_class_t dqu, dispatch_qos_t qos, dispatch_wakeup_flags_t flags, dispatch_queue_wakeup_target_t target); void _dispatch_queue_invoke_finish(dispatch_queue_t dq, dispatch_invoke_context_t dic, dispatch_queue_t tq, uint64_t owned); dispatch_priority_t _dispatch_queue_compute_priority_and_wlh( dispatch_queue_class_t dq, dispatch_wlh_t *wlh_out); void _dispatch_lane_set_target_queue(dispatch_lane_t dq, dispatch_queue_t tq); void _dispatch_lane_class_dispose(dispatch_queue_class_t dq, bool *allow_free); void _dispatch_lane_dispose(dispatch_lane_class_t dq, bool *allow_free); void _dispatch_lane_suspend(dispatch_lane_class_t dq); void _dispatch_lane_resume(dispatch_lane_class_t dq, bool activate); void _dispatch_lane_activate(dispatch_lane_class_t dq, bool *allow_resume); void _dispatch_lane_invoke(dispatch_lane_class_t dq, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); void _dispatch_lane_push(dispatch_lane_class_t dq, dispatch_object_t dou, dispatch_qos_t qos); void _dispatch_lane_concurrent_push(dispatch_lane_class_t dq, dispatch_object_t dou, dispatch_qos_t qos); void _dispatch_lane_wakeup(dispatch_lane_class_t dq, dispatch_qos_t qos, dispatch_wakeup_flags_t flags); dispatch_queue_wakeup_target_t _dispatch_lane_serial_drain( dispatch_lane_class_t dq, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags, uint64_t *owned); void _dispatch_workloop_dispose(dispatch_workloop_t dwl, bool *allow_free); void _dispatch_workloop_activate(dispatch_workloop_t dwl); void _dispatch_workloop_invoke(dispatch_workloop_t dwl, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); void _dispatch_workloop_push(dispatch_workloop_t dwl, dispatch_object_t dou, dispatch_qos_t qos); void _dispatch_workloop_wakeup(dispatch_workloop_t dwl, dispatch_qos_t qos, dispatch_wakeup_flags_t flags); void _dispatch_root_queue_poke(dispatch_queue_global_t dq, int n, int floor); void _dispatch_root_queue_wakeup(dispatch_queue_global_t dq, dispatch_qos_t qos, dispatch_wakeup_flags_t flags); void _dispatch_root_queue_push(dispatch_queue_global_t dq, dispatch_object_t dou, dispatch_qos_t qos); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_KEVENT_WORKQUEUE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 815 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" void _dispatch_kevent_workqueue_init(void); #endif # 817 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_PTHREAD_ROOT_QUEUES #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 818 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" void _dispatch_pthread_root_queue_dispose(dispatch_lane_class_t dq, bool *allow_free); #endif // DISPATCH_USE_PTHREAD_ROOT_QUEUES # 821 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" void _dispatch_main_queue_push(dispatch_queue_main_t dq, dispatch_object_t dou, dispatch_qos_t qos); void _dispatch_main_queue_wakeup(dispatch_queue_main_t dq, dispatch_qos_t qos, dispatch_wakeup_flags_t flags); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_COCOA_COMPAT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 826 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" void _dispatch_runloop_queue_wakeup(dispatch_lane_t dq, dispatch_qos_t qos, dispatch_wakeup_flags_t flags); void _dispatch_runloop_queue_xref_dispose(dispatch_lane_t dq); void _dispatch_runloop_queue_dispose(dispatch_lane_t dq, bool *allow_free); #endif // DISPATCH_COCOA_COMPAT # 831 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" void _dispatch_mgr_queue_push(dispatch_lane_t dq, dispatch_object_t dou, dispatch_qos_t qos); void _dispatch_mgr_queue_wakeup(dispatch_lane_t dq, dispatch_qos_t qos, dispatch_wakeup_flags_t flags); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_MGR_THREAD #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 836 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" void _dispatch_mgr_thread(dispatch_lane_t dq, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); #endif # 839 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" void _dispatch_apply_invoke(void *ctxt); void _dispatch_apply_redirect_invoke(void *ctxt); void _dispatch_barrier_async_detached_f(dispatch_queue_class_t dq, void *ctxt, dispatch_function_t func); #define DISPATCH_BARRIER_TRYSYNC_SUSPEND 0x1 void _dispatch_barrier_trysync_or_async_f(dispatch_lane_class_t dq, void *ctxt, dispatch_function_t func, uint32_t flags); void _dispatch_queue_atfork_child(void); DISPATCH_COLD size_t _dispatch_queue_debug(dispatch_queue_class_t dq, char *buf, size_t bufsiz); DISPATCH_COLD size_t _dispatch_queue_debug_attr(dispatch_queue_t dq, char *buf, size_t bufsiz); #define DISPATCH_ROOT_QUEUE_COUNT (DISPATCH_QOS_NBUCKETS * 2) // must be in lowest to highest qos order (as encoded in dispatch_qos_t) // overcommit qos index values need bit 1 set enum { DISPATCH_ROOT_QUEUE_IDX_MAINTENANCE_QOS = 0, DISPATCH_ROOT_QUEUE_IDX_MAINTENANCE_QOS_OVERCOMMIT, DISPATCH_ROOT_QUEUE_IDX_BACKGROUND_QOS, DISPATCH_ROOT_QUEUE_IDX_BACKGROUND_QOS_OVERCOMMIT, DISPATCH_ROOT_QUEUE_IDX_UTILITY_QOS, DISPATCH_ROOT_QUEUE_IDX_UTILITY_QOS_OVERCOMMIT, DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS, DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS_OVERCOMMIT, DISPATCH_ROOT_QUEUE_IDX_USER_INITIATED_QOS, DISPATCH_ROOT_QUEUE_IDX_USER_INITIATED_QOS_OVERCOMMIT, DISPATCH_ROOT_QUEUE_IDX_USER_INTERACTIVE_QOS, DISPATCH_ROOT_QUEUE_IDX_USER_INTERACTIVE_QOS_OVERCOMMIT, _DISPATCH_ROOT_QUEUE_IDX_COUNT, }; // skip zero // 1 - main_q // 2 - mgr_q // 3 - mgr_root_q // 4,5,6,7,8,9,10,11,12,13,14,15 - global queues // 17 - workloop_fallback_q // we use 'xadd' on Intel, so the initial value == next assigned #define DISPATCH_QUEUE_SERIAL_NUMBER_INIT 17 extern unsigned long volatile _dispatch_queue_serial_numbers; // mark the workloop fallback queue to avoid finalizing objects on the base // queue of custom outside-of-qos workloops #define DISPATCH_QUEUE_SERIAL_NUMBER_WLF 16 extern struct dispatch_queue_static_s _dispatch_mgr_q; // serial 2 #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_MGR_THREAD && DISPATCH_USE_PTHREAD_ROOT_QUEUES #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 892 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" extern struct dispatch_queue_global_s _dispatch_mgr_root_queue; // serial 3 #endif # 894 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" extern struct dispatch_queue_global_s _dispatch_root_queues[]; // serials 4 - 15 #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 897 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_ASSERT_ON_MANAGER_QUEUE() \ dispatch_assert_queue(_dispatch_mgr_q._as_dq) #else # 900 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_ASSERT_ON_MANAGER_QUEUE() #endif # 902 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #pragma mark - #pragma mark dispatch_queue_attr_t DISPATCH_CLASS_DECL(queue_attr, OBJECT); struct dispatch_queue_attr_s { OS_OBJECT_STRUCT_HEADER(dispatch_queue_attr); }; typedef struct dispatch_queue_attr_info_s { dispatch_qos_t dqai_qos : 8; int dqai_relpri : 8; uint16_t dqai_overcommit:2; uint16_t dqai_autorelease_frequency:2; uint16_t dqai_concurrent:1; uint16_t dqai_inactive:1; } dispatch_queue_attr_info_t; typedef enum { _dispatch_queue_attr_overcommit_unspecified = 0, _dispatch_queue_attr_overcommit_enabled, _dispatch_queue_attr_overcommit_disabled, } _dispatch_queue_attr_overcommit_t; #define DISPATCH_QUEUE_ATTR_OVERCOMMIT_COUNT 3 #define DISPATCH_QUEUE_ATTR_AUTORELEASE_FREQUENCY_COUNT 3 #define DISPATCH_QUEUE_ATTR_QOS_COUNT (DISPATCH_QOS_MAX + 1) #define DISPATCH_QUEUE_ATTR_PRIO_COUNT (1 - QOS_MIN_RELATIVE_PRIORITY) #define DISPATCH_QUEUE_ATTR_CONCURRENCY_COUNT 2 #define DISPATCH_QUEUE_ATTR_INACTIVE_COUNT 2 #define DISPATCH_QUEUE_ATTR_COUNT ( \ DISPATCH_QUEUE_ATTR_OVERCOMMIT_COUNT * \ DISPATCH_QUEUE_ATTR_AUTORELEASE_FREQUENCY_COUNT * \ DISPATCH_QUEUE_ATTR_QOS_COUNT * \ DISPATCH_QUEUE_ATTR_PRIO_COUNT * \ DISPATCH_QUEUE_ATTR_CONCURRENCY_COUNT * \ DISPATCH_QUEUE_ATTR_INACTIVE_COUNT ) extern const struct dispatch_queue_attr_s _dispatch_queue_attrs[DISPATCH_QUEUE_ATTR_COUNT]; dispatch_queue_attr_info_t _dispatch_queue_attr_to_info(dispatch_queue_attr_t); #pragma mark - #pragma mark dispatch_continuation_t // If dc_flags is less than 0x1000, then the object is a continuation. // Otherwise, the object has a private layout and memory management rules. The // layout until after 'do_next' must align with normal objects. #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_SIZEOF_PTR == 8 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 958 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_CONTINUATION_HEADER(x) \ union { \ const void *do_vtable; \ uintptr_t dc_flags; \ }; \ union { \ pthread_priority_t dc_priority; \ int dc_cache_cnt; \ uintptr_t dc_pad; \ }; \ struct dispatch_##x##_s *volatile do_next; \ struct voucher_s *dc_voucher; \ dispatch_function_t dc_func; \ void *dc_ctxt; \ void *dc_data; \ void *dc_other #if 0 /* disabled by -frewrite-includes */ #if 0 #elif OS_OBJECT_HAVE_OBJC1 #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 975 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_CONTINUATION_HEADER(x) \ dispatch_function_t dc_func; \ union { \ pthread_priority_t dc_priority; \ int dc_cache_cnt; \ uintptr_t dc_pad; \ }; \ struct voucher_s *dc_voucher; \ union { \ const void *do_vtable; \ uintptr_t dc_flags; \ }; \ struct dispatch_##x##_s *volatile do_next; \ void *dc_ctxt; \ void *dc_data; \ void *dc_other #else # 992 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_CONTINUATION_HEADER(x) \ union { \ const void *do_vtable; \ uintptr_t dc_flags; \ }; \ union { \ pthread_priority_t dc_priority; \ int dc_cache_cnt; \ uintptr_t dc_pad; \ }; \ struct voucher_s *dc_voucher; \ struct dispatch_##x##_s *volatile do_next; \ dispatch_function_t dc_func; \ void *dc_ctxt; \ void *dc_data; \ void *dc_other #endif # 1009 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define _DISPATCH_CONTINUATION_PTRS 8 #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_HW_CONFIG_UP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1011 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" // UP devices don't contend on continuations so we don't need to force them to // occupy a whole cacheline (which is intended to avoid contention) #define DISPATCH_CONTINUATION_SIZE \ (_DISPATCH_CONTINUATION_PTRS * DISPATCH_SIZEOF_PTR) #else # 1016 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_CONTINUATION_SIZE ROUND_UP_TO_CACHELINE_SIZE( \ (_DISPATCH_CONTINUATION_PTRS * DISPATCH_SIZEOF_PTR)) #endif # 1019 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define ROUND_UP_TO_CONTINUATION_SIZE(x) \ (((x) + (DISPATCH_CONTINUATION_SIZE - 1u)) & \ ~(DISPATCH_CONTINUATION_SIZE - 1u)) // continuation is a dispatch_sync or dispatch_barrier_sync #define DC_FLAG_SYNC_WAITER 0x001ul // continuation acts as a barrier #define DC_FLAG_BARRIER 0x002ul // continuation resources are freed on run // this is set on async or for non event_handler source handlers #define DC_FLAG_CONSUME 0x004ul // continuation has a group in dc_data #define DC_FLAG_GROUP_ASYNC 0x008ul // continuation function is a block (copied in dc_ctxt) #define DC_FLAG_BLOCK 0x010ul // continuation function is a block with private data, implies BLOCK_BIT #define DC_FLAG_BLOCK_WITH_PRIVATE_DATA 0x020ul // source handler requires fetching context from source #define DC_FLAG_FETCH_CONTEXT 0x040ul // continuation is a dispatch_async_and_wait #define DC_FLAG_ASYNC_AND_WAIT 0x080ul // bit used to make sure dc_flags is never 0 for allocated continuations #define DC_FLAG_ALLOCATED 0x100ul // continuation is an internal implementation detail that should not be // introspected #define DC_FLAG_NO_INTROSPECTION 0x200ul typedef struct dispatch_continuation_s { DISPATCH_CONTINUATION_HEADER(continuation); } *dispatch_continuation_t; dispatch_assert_aliases(dispatch_continuation_s, dispatch_object_s, do_next); dispatch_assert_aliases(dispatch_continuation_s, dispatch_object_s, do_vtable); typedef struct dispatch_sync_context_s { struct dispatch_continuation_s _as_dc[0]; DISPATCH_CONTINUATION_HEADER(continuation); dispatch_function_t dsc_func; void *dsc_ctxt; dispatch_thread_frame_s dsc_dtf; dispatch_thread_event_s dsc_event; dispatch_tid dsc_waiter; uint8_t dsc_override_qos_floor; uint8_t dsc_override_qos; uint16_t dsc_autorelease : 2; uint16_t dsc_wlh_was_first : 1; uint16_t dsc_wlh_is_workloop : 1; uint16_t dsc_waiter_needs_cancel : 1; uint16_t dsc_release_storage : 1; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1069 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" uint16_t dsc_from_async : 1; #endif # 1071 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" } *dispatch_sync_context_t; typedef struct dispatch_continuation_vtable_s { _OS_OBJECT_CLASS_HEADER(); DISPATCH_OBJECT_VTABLE_HEADER(dispatch_continuation); } const *dispatch_continuation_vtable_t; #ifndef DISPATCH_CONTINUATION_CACHE_LIMIT #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1080 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_CONTINUATION_CACHE_LIMIT 112 // one 256k heap for 64 threads #define DISPATCH_CONTINUATION_CACHE_LIMIT_MEMORYPRESSURE_PRESSURE_WARN 16 #else # 1083 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define DISPATCH_CONTINUATION_CACHE_LIMIT 1024 #define DISPATCH_CONTINUATION_CACHE_LIMIT_MEMORYPRESSURE_PRESSURE_WARN 128 #endif # 1086 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #endif # 1087 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" dispatch_continuation_t _dispatch_continuation_alloc_from_heap(void); void _dispatch_continuation_free_to_heap(dispatch_continuation_t c); void _dispatch_continuation_pop(dispatch_object_t dou, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags, dispatch_queue_class_t dqu); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_MEMORYPRESSURE_SOURCE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1095 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" extern int _dispatch_continuation_cache_limit; void _dispatch_continuation_free_to_cache_limit(dispatch_continuation_t c); #else # 1098 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #define _dispatch_continuation_cache_limit DISPATCH_CONTINUATION_CACHE_LIMIT #define _dispatch_continuation_free_to_cache_limit(c) \ _dispatch_continuation_free_to_heap(c) #endif # 1102 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #pragma mark - #pragma mark dispatch_continuation vtables enum { _DC_USER_TYPE = 0, DC_ASYNC_REDIRECT_TYPE, DC_MACH_SEND_BARRRIER_DRAIN_TYPE, DC_MACH_SEND_BARRIER_TYPE, DC_MACH_RECV_BARRIER_TYPE, DC_MACH_ASYNC_REPLY_TYPE, #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1114 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" DC_WORKLOOP_STEALING_TYPE, DC_OVERRIDE_STEALING_TYPE, DC_OVERRIDE_OWNING_TYPE, #endif # 1118 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1119 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" DC_MACH_IPC_HANDOFF_TYPE, #endif # 1121 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" _DC_MAX_TYPE, }; DISPATCH_ALWAYS_INLINE static inline unsigned long dc_type(dispatch_continuation_t dc) { return dx_type((struct dispatch_object_s *)dc); } extern const struct dispatch_continuation_vtable_s _dispatch_continuation_vtables[_DC_MAX_TYPE]; #define DC_VTABLE(name) (&_dispatch_continuation_vtables[DC_##name##_TYPE]) #define DC_VTABLE_ENTRY(name, ...) \ [DC_##name##_TYPE] = { \ .do_type = DISPATCH_CONTINUATION_TYPE(name), \ __VA_ARGS__ \ } #pragma mark - #pragma mark _dispatch_set_priority_and_voucher #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1145 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" void _dispatch_set_priority_and_mach_voucher_slow(pthread_priority_t pri, mach_voucher_t kv); voucher_t _dispatch_set_priority_and_voucher_slow(pthread_priority_t pri, voucher_t voucher, dispatch_thread_set_self_t flags); #else # 1151 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" static inline void _dispatch_set_priority_and_mach_voucher_slow(pthread_priority_t pri, mach_voucher_t kv) { (void)pri; (void)kv; } #endif # 1158 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #pragma mark - #pragma mark dispatch_apply_t struct dispatch_apply_s { #if 0 /* disabled by -frewrite-includes */ #if !OS_OBJECT_HAVE_OBJC1 #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 1163 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" dispatch_continuation_t da_dc; #endif # 1165 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" size_t volatile da_index, da_todo; size_t da_iterations; #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC1 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1168 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" dispatch_continuation_t da_dc; #endif # 1170 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" size_t da_nested; dispatch_thread_event_s da_event; dispatch_invoke_flags_t da_flags; int32_t da_thr_cnt; }; dispatch_static_assert(offsetof(struct dispatch_continuation_s, dc_flags) == offsetof(struct dispatch_apply_s, da_dc), "These fields must alias so that leaks instruments work"); typedef struct dispatch_apply_s *dispatch_apply_t; #pragma mark - #pragma mark dispatch_block_t #ifdef __BLOCKS__ #define DISPATCH_BLOCK_API_MASK (0x100u - 1) #define DISPATCH_BLOCK_HAS_VOUCHER (1u << 31) #define DISPATCH_BLOCK_HAS_PRIORITY (1u << 30) #define DISPATCH_BLOCK_PRIVATE_DATA_HEADER() \ unsigned long dbpd_magic; \ dispatch_block_flags_t dbpd_flags; \ unsigned int volatile dbpd_atomic_flags; \ int volatile dbpd_performed; \ pthread_priority_t dbpd_priority; \ voucher_t dbpd_voucher; \ dispatch_block_t dbpd_block; \ dispatch_group_t dbpd_group; \ dispatch_queue_t dbpd_queue; \ mach_port_t dbpd_thread; #if 0 /* disabled by -frewrite-includes */ #if !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 1202 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" struct dispatch_block_private_data_s { DISPATCH_BLOCK_PRIVATE_DATA_HEADER(); }; #endif # 1206 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" typedef struct dispatch_block_private_data_s *dispatch_block_private_data_t; // dbpd_atomic_flags bits #define DBF_CANCELED 1u // block has been cancelled #define DBF_WAITING 2u // dispatch_block_wait has begun #define DBF_WAITED 4u // dispatch_block_wait has finished without timeout #define DBF_PERFORM 8u // dispatch_block_perform: don't group_leave #define DISPATCH_BLOCK_PRIVATE_DATA_MAGIC 0xD159B10C // 0xDISPatch_BLOCk // struct for synchronous perform: no group_leave at end of invoke #define DISPATCH_BLOCK_PRIVATE_DATA_PERFORM_INITIALIZER(flags, block, voucher) \ { \ .dbpd_magic = DISPATCH_BLOCK_PRIVATE_DATA_MAGIC, \ .dbpd_flags = (flags), \ .dbpd_atomic_flags = DBF_PERFORM, \ .dbpd_block = (block), \ .dbpd_voucher = (voucher), \ } extern void (*const _dispatch_block_special_invoke)(void*); dispatch_block_t _dispatch_block_create(dispatch_block_flags_t flags, voucher_t voucher, pthread_priority_t priority, dispatch_block_t block); void _dispatch_block_invoke_direct(const struct dispatch_block_private_data_s *dbcpd); void _dispatch_block_sync_invoke(void *block); void *_dispatch_continuation_get_function_symbol(dispatch_continuation_t dc); dispatch_qos_t _dispatch_continuation_init_slow(dispatch_continuation_t dc, dispatch_queue_class_t dqu, dispatch_block_flags_t flags); #endif /* __BLOCKS__ */ # 1238 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" #endif # 1240 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/queue_internal.h" # 1106 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "source_internal.h" #endif /* expanded by -frewrite-includes */ # 1106 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/source_internal.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_SOURCE_INTERNAL__ #define __DISPATCH_SOURCE_INTERNAL__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/source_internal.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/source_internal.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/source_internal.h" _OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(dispatch_source, dispatch_object) DISPATCH_CLASS_DECL_BARE(source, QUEUE); #define DISPATCH_SOURCE_CLASS_HEADER(x) \ DISPATCH_LANE_CLASS_HEADER(x); \ uint16_t \ /* set under the drain lock */ \ ds_is_installed:1, \ dm_connect_handler_called:1, \ dm_cancel_handler_called:1, \ dm_is_xpc:1, \ __ds_flags_pad : 12; \ uint16_t __dq_flags_separation[0]; \ uint16_t \ /* set under the send queue lock */ \ dm_needs_mgr:1, \ dm_disconnected:1, \ __dm_flags_pad : 14 struct dispatch_source_s { DISPATCH_SOURCE_CLASS_HEADER(source); } DISPATCH_ATOMIC64_ALIGN; dispatch_assert_valid_lane_type(dispatch_source_s); dispatch_static_assert(sizeof(struct dispatch_source_s) <= 128); void _dispatch_source_xref_dispose(dispatch_source_t ds); void _dispatch_source_dispose(dispatch_source_t ds, bool *allow_free); void _dispatch_source_activate(dispatch_source_t ds, bool *allow_resume); void _dispatch_source_invoke(dispatch_source_t ds, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); void _dispatch_source_wakeup(dispatch_source_t ds, dispatch_qos_t qos, dispatch_wakeup_flags_t flags); void _dispatch_source_merge_evt(dispatch_unote_t du, uint32_t flags, uintptr_t data, pthread_priority_t pp); DISPATCH_COLD size_t _dispatch_source_debug(dispatch_source_t ds, char* buf, size_t bufsiz); #endif /* __DISPATCH_SOURCE_INTERNAL__ */ # 73 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/source_internal.h" # 1107 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "mach_internal.h" #endif /* expanded by -frewrite-includes */ # 1107 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/mach_internal.h" 1 /* * Copyright (c) 2008-2016 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_MACH_INTERNAL__ #define __DISPATCH_MACH_INTERNAL__ #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 30 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/mach_internal.h" #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/mach_internal.h" # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/mach_internal.h" #endif # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/mach_internal.h" // NOTE: dispatch_source_mach_send_flags_t and dispatch_source_mach_recv_flags_t // bit values must not overlap as they share the same kevent fflags ! /*! * @enum dispatch_source_mach_send_flags_t * * @constant DISPATCH_MACH_SEND_DELETED * Port-deleted notification. Disabled for source registration. */ enum { DISPATCH_MACH_SEND_DELETED = 0x4, }; /*! * @enum dispatch_source_mach_recv_flags_t * * @constant DISPATCH_MACH_RECV_MESSAGE * Receive right has pending messages */ enum { DISPATCH_MACH_RECV_MESSAGE = 0x2, }; DISPATCH_CLASS_DECL(mach, QUEUE); DISPATCH_CLASS_DECL(mach_msg, OBJECT); struct dispatch_mach_s { DISPATCH_SOURCE_CLASS_HEADER(mach); dispatch_mach_send_refs_t dm_send_refs; dispatch_xpc_term_refs_t dm_xpc_term_refs; } DISPATCH_ATOMIC64_ALIGN; dispatch_assert_valid_lane_type(dispatch_mach_s); struct dispatch_mach_msg_s { DISPATCH_OBJECT_HEADER(mach_msg); union { mach_msg_option_t dmsg_options; mach_error_t dmsg_error; }; mach_port_t dmsg_reply; pthread_priority_t dmsg_priority; voucher_t dmsg_voucher; dispatch_mach_msg_destructor_t dmsg_destructor; size_t dmsg_size; union { mach_msg_header_t *dmsg_msg; char dmsg_buf[0]; }; }; DISPATCH_ALWAYS_INLINE static inline void _dispatch_mach_xref_dispose(struct dispatch_mach_s *dm) { if (dm->dm_is_xpc) { dm->dm_recv_refs->dmrr_handler_ctxt = (void *)0xbadfeed; } } extern dispatch_mach_xpc_hooks_t _dispatch_mach_xpc_hooks; extern const struct dispatch_mach_xpc_hooks_s _dispatch_mach_xpc_hooks_default; void _dispatch_mach_ipc_handoff_invoke(dispatch_continuation_t dc, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); void _dispatch_mach_msg_async_reply_invoke(dispatch_continuation_t dc, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); void _dispatch_mach_dispose(dispatch_mach_t dm, bool *allow_free); void _dispatch_mach_activate(dispatch_mach_t dm, bool *allow_resume); void _dispatch_mach_invoke(dispatch_mach_t dm, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); void _dispatch_mach_wakeup(dispatch_mach_t dm, dispatch_qos_t qos, dispatch_wakeup_flags_t flags); DISPATCH_COLD size_t _dispatch_mach_debug(dispatch_mach_t dm, char* buf, size_t bufsiz); void _dispatch_mach_notification_merge_evt(dispatch_unote_t du, uint32_t flags, uintptr_t data, pthread_priority_t pp); void _dispatch_mach_merge_msg(dispatch_unote_t du, uint32_t flags, mach_msg_header_t *msg, mach_msg_size_t msgsz, pthread_priority_t msg_pp, pthread_priority_t ovr_pp); void _dispatch_mach_reply_merge_msg(dispatch_unote_t du, uint32_t flags, mach_msg_header_t *msg, mach_msg_size_t msgsz, pthread_priority_t msg_pp, pthread_priority_t ovr_pp); void _dispatch_xpc_sigterm_merge_evt(dispatch_unote_t du, uint32_t flags, uintptr_t data, pthread_priority_t pp); void _dispatch_mach_msg_dispose(dispatch_mach_msg_t dmsg, bool *allow_free); void _dispatch_mach_msg_invoke(dispatch_mach_msg_t dmsg, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); DISPATCH_COLD size_t _dispatch_mach_msg_debug(dispatch_mach_msg_t dmsg, char* buf, size_t bufsiz); void _dispatch_mach_send_barrier_drain_invoke(dispatch_continuation_t dc, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); void _dispatch_mach_barrier_invoke(dispatch_continuation_t dc, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags); #endif // HAVE_MACH # 133 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/mach_internal.h" #endif /* __DISPATCH_MACH_INTERNAL__ */ # 134 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/mach_internal.h" # 1108 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "voucher_internal.h" #endif /* expanded by -frewrite-includes */ # 1108 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" 1 /* * Copyright (c) 2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_VOUCHER_INTERNAL__ #define __DISPATCH_VOUCHER_INTERNAL__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #pragma mark - #pragma mark voucher_recipe_t (disabled) #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_ENABLE_RECIPE_OBJECTS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" /*! * @group Voucher Creation SPI * SPI intended for clients that need to create vouchers. */ OS_OBJECT_DECL_CLASS(voucher_recipe); /*! * @function voucher_create * * @abstract * Creates a new voucher object from a recipe. * * @discussion * Error handling TBD * * @result * The newly created voucher object. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_EXPORT OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT OS_NOTHROW voucher_t voucher_create(voucher_recipe_t recipe); #endif // VOUCHER_ENABLE_RECIPE_OBJECTS # 62 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_ENABLE_GET_MACH_VOUCHER #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 64 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" /*! * @function voucher_get_mach_voucher * * @abstract * Returns the mach voucher port underlying the specified voucher object. * * @discussion * The caller must either maintain a reference on the voucher object while the * returned mach voucher port is in use to ensure it stays valid for the * duration, or it must retain the mach voucher port with mach_port_mod_refs(). * * @param voucher * The voucher object to query. * * @result * A mach voucher port. */ API_AVAILABLE(macos(10.10), ios(8.0)) OS_VOUCHER_EXPORT OS_WARN_RESULT OS_NOTHROW mach_voucher_t voucher_get_mach_voucher(voucher_t voucher); #endif // VOUCHER_ENABLE_GET_MACH_VOUCHER # 86 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #pragma mark - #pragma mark voucher_t void _voucher_init(void); void _voucher_atfork_child(void); void _voucher_activity_debug_channel_init(void); #if 0 /* disabled by -frewrite-includes */ #if OS_VOUCHER_ACTIVITY_SPI && OS_VOUCHER_ACTIVITY_GENERATE_SWAPS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 94 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" void _voucher_activity_swap(firehose_activity_id_t old_id, firehose_activity_id_t new_id); #endif # 97 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" void _voucher_xref_dispose(voucher_t voucher); void _voucher_dispose(voucher_t voucher); size_t _voucher_debug(voucher_t v, char* buf, size_t bufsiz); void DISPATCH_TSD_DTOR_CC _voucher_thread_cleanup(void *voucher); mach_voucher_t _voucher_get_mach_voucher(voucher_t voucher); voucher_t _voucher_create_without_importance(voucher_t voucher); voucher_t _voucher_create_accounting_voucher(voucher_t voucher); mach_voucher_t _voucher_create_mach_voucher_with_priority(voucher_t voucher, pthread_priority_t priority); voucher_t _voucher_create_with_priority_and_mach_voucher(voucher_t voucher, pthread_priority_t priority, mach_voucher_t kv); void _voucher_dealloc_mach_voucher(mach_voucher_t kv); #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_ENABLE_RECIPE_OBJECTS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 111 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" _OS_OBJECT_DECL_SUBCLASS_INTERFACE(voucher_recipe, object) #endif # 113 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" voucher_t voucher_retain(voucher_t voucher); void voucher_release(voucher_t voucher); #define VOUCHER_NO_MACH_VOUCHER MACH_PORT_DEAD #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_USE_MACH_VOUCHER #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 120 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 122 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define DISPATCH_VOUCHER_DEBUG 1 #define DISPATCH_VOUCHER_ACTIVITY_DEBUG 1 #endif # 125 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 126 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" # 127 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" typedef uint32_t _voucher_magic_t; typedef uint32_t _voucher_priority_t; #define VOUCHER_MAGIC_V3 ((_voucher_magic_t)0x0390cefa) // FACE9003 typedef struct _voucher_mach_udata_s { _voucher_magic_t vmu_magic; _voucher_priority_t vmu_priority; uint8_t _vmu_after_priority[0]; firehose_activity_id_t vmu_activity; uint64_t vmu_activity_pid; firehose_activity_id_t vmu_parent_activity; uint8_t _vmu_after_activity[0]; } _voucher_mach_udata_s; OS_ENUM(voucher_fields, uint16_t, VOUCHER_FIELD_NONE = 0, VOUCHER_FIELD_KVOUCHER = 1u << 0, VOUCHER_FIELD_PRIORITY = 1u << 1, VOUCHER_FIELD_ACTIVITY = 1u << 2, #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_ENABLE_RECIPE_OBJECTS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 150 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" VOUCHER_FIELD_EXTRA = 1u << 15, #else # 152 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" VOUCHER_FIELD_EXTRA = 0, #endif # 154 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" ); typedef struct voucher_s { _OS_OBJECT_HEADER( struct voucher_vtable_s *os_obj_isa, os_obj_ref_cnt, os_obj_xref_cnt); struct voucher_hash_entry_s { uintptr_t vhe_next; uintptr_t vhe_prev_ptr; } v_list; mach_voucher_t v_kvoucher, v_ipc_kvoucher; // if equal, only one reference voucher_t v_kvbase; // if non-NULL, v_kvoucher is a borrowed reference firehose_activity_id_t v_activity; uint64_t v_activity_creator; firehose_activity_id_t v_parent_activity; _voucher_priority_t v_priority; unsigned int v_kv_has_importance:1; #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_ENABLE_RECIPE_OBJECTS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 173 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" size_t v_recipe_extra_offset; mach_voucher_attr_recipe_size_t v_recipe_extra_size; #endif # 176 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" } voucher_s; typedef struct voucher_hash_head_s { uintptr_t vhh_first; } voucher_hash_head_s; DISPATCH_ALWAYS_INLINE static inline bool _voucher_hash_is_enqueued(const struct voucher_s *v) { return v->v_list.vhe_prev_ptr != 0; } DISPATCH_ALWAYS_INLINE static inline void _voucher_hash_mark_not_enqueued(struct voucher_s *v) { v->v_list.vhe_prev_ptr = 0; v->v_list.vhe_next = (uintptr_t)DISPATCH_OBJECT_LISTLESS; } DISPATCH_ALWAYS_INLINE static inline void _voucher_hash_set_next(uintptr_t *next, struct voucher_s *v) { *next = ~(uintptr_t)v; } DISPATCH_ALWAYS_INLINE static inline voucher_t _voucher_hash_get_next(uintptr_t next) { return (voucher_t)~next; } DISPATCH_ALWAYS_INLINE static inline void _voucher_hash_set_prev_ptr(uintptr_t *prev_ptr, uintptr_t *addr) { *prev_ptr = ~(uintptr_t)addr; } DISPATCH_ALWAYS_INLINE static inline void _voucher_hash_store_to_prev_ptr(uintptr_t prev_ptr, struct voucher_s *v) { *(uintptr_t *)~prev_ptr = ~(uintptr_t)v; } #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_ENABLE_RECIPE_OBJECTS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 226 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define _voucher_extra_size(v) ((v)->v_recipe_extra_size) #define _voucher_extra_recipes(v) ((char*)(v) + (v)->v_recipe_extra_offset) #else # 229 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define _voucher_extra_size(v) 0 #define _voucher_extra_recipes(v) NULL #endif # 232 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_ENABLE_RECIPE_OBJECTS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 234 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" typedef struct voucher_recipe_s { _OS_OBJECT_HEADER( const _os_object_vtable_s *os_obj_isa, os_obj_ref_cnt, os_obj_xref_cnt); size_t vr_allocation_size; mach_voucher_attr_recipe_size_t volatile vr_size; mach_voucher_attr_recipe_t vr_data; } voucher_recipe_s; #endif # 244 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 246 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define VL_HASH_SIZE 64u // must be a power of two #else # 248 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define VL_HASH_SIZE 256u // must be a power of two #endif # 250 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define VL_HASH(kv) (MACH_PORT_INDEX(kv) & (VL_HASH_SIZE - 1)) #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG && DISPATCH_VOUCHER_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 253 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define _dispatch_voucher_debug(msg, v, ...) \ _dispatch_debug("voucher[%p]: " msg, v, ##__VA_ARGS__) #define _dispatch_kvoucher_debug(msg, kv, ...) \ _dispatch_debug("kvoucher[0x%08x]: " msg, kv, ##__VA_ARGS__) #define _dispatch_voucher_debug_machport(name) _dispatch_debug_machport(name) #else # 259 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define _dispatch_voucher_debug(msg, v, ...) #define _dispatch_kvoucher_debug(msg, kv, ...) #define _dispatch_voucher_debug_machport(name) ((void)(name)) #endif # 263 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DTRACE_INTROSPECTION && defined(__APPLE__) // rdar://33642820 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 265 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define _voucher_trace(how, ...) ({ \ if (unlikely(VOUCHER_##how##_ENABLED())) { \ VOUCHER_##how(__VA_ARGS__); \ } \ }) #else # 271 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define _voucher_trace(how, ...) ((void)0) #endif # 273 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #ifndef DISPATCH_VOUCHER_OBJC_DEBUG #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION || DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 276 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define DISPATCH_VOUCHER_OBJC_DEBUG 1 #else # 278 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define DISPATCH_VOUCHER_OBJC_DEBUG 0 #endif # 280 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #endif // DISPATCH_VOUCHER_OBJC_DEBUG # 281 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" DISPATCH_ALWAYS_INLINE static inline struct voucher_s * _voucher_retain_inline(struct voucher_s *voucher) { // not using _os_object_refcnt* because we don't need barriers: // vouchers are immutable and are in a hash table with a lock int xref_cnt = os_atomic_inc2o(voucher, os_obj_xref_cnt, relaxed); _voucher_trace(RETAIN, (voucher_t)voucher, xref_cnt + 1); _dispatch_voucher_debug("retain -> %d", voucher, xref_cnt + 1); if (unlikely(xref_cnt <= 0)) { _OS_OBJECT_CLIENT_CRASH("Voucher resurrection"); } return voucher; } DISPATCH_ALWAYS_INLINE static inline void _voucher_release_inline(struct voucher_s *voucher) { // not using _os_object_refcnt* because we don't need barriers: // vouchers are immutable and are in a hash table with a lock int xref_cnt = os_atomic_dec2o(voucher, os_obj_xref_cnt, relaxed); _voucher_trace(RELEASE, (voucher_t)voucher, xref_cnt + 1); _dispatch_voucher_debug("release -> %d", voucher, xref_cnt + 1); if (likely(xref_cnt >= 0)) { return; } if (unlikely(xref_cnt < -1)) { _OS_OBJECT_CLIENT_CRASH("Voucher over-release"); } return _os_object_xref_dispose((_os_object_t)voucher); } #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 316 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" DISPATCH_ALWAYS_INLINE static inline voucher_t _voucher_retain(voucher_t voucher) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_VOUCHER_OBJC_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 322 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" os_retain(voucher); #else # 324 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" _voucher_retain_inline(voucher); #endif // DISPATCH_VOUCHER_OBJC_DEBUG # 326 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" return voucher; } DISPATCH_ALWAYS_INLINE static inline void _voucher_release(voucher_t voucher) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_VOUCHER_OBJC_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 334 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" os_release(voucher); #else # 336 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" _voucher_release_inline(voucher); #endif // DISPATCH_VOUCHER_OBJC_DEBUG # 338 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _voucher_release_no_dispose(voucher_t voucher) { #if 0 /* disabled by -frewrite-includes */ #if !DISPATCH_VOUCHER_OBJC_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 345 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" // not using _os_object_refcnt* because we don't need barriers: // vouchers are immutable and are in a hash table with a lock int xref_cnt = os_atomic_dec2o(voucher, os_obj_xref_cnt, relaxed); _voucher_trace(RELEASE, voucher, xref_cnt + 1); _dispatch_voucher_debug("release -> %d", voucher, xref_cnt + 1); if (likely(xref_cnt >= 0)) { return; } _OS_OBJECT_CLIENT_CRASH("Voucher over-release"); #else # 355 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" return os_release(voucher); #endif // DISPATCH_DEBUG # 357 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" } DISPATCH_ALWAYS_INLINE static inline voucher_t _voucher_get(void) { return _dispatch_thread_getspecific(dispatch_voucher_key); } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline voucher_t _voucher_copy(void) { voucher_t voucher = _voucher_get(); if (voucher) _voucher_retain(voucher); return voucher; } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline voucher_t _voucher_copy_without_importance(void) { voucher_t voucher = _voucher_get(); if (voucher) voucher = _voucher_create_without_importance(voucher); return voucher; } DISPATCH_ALWAYS_INLINE static inline void _voucher_mach_voucher_set(mach_voucher_t kv) { if (kv == VOUCHER_NO_MACH_VOUCHER) return; _dispatch_set_priority_and_mach_voucher_slow(0, kv); } DISPATCH_ALWAYS_INLINE static inline mach_voucher_t _voucher_swap_and_get_mach_voucher(voucher_t ov, voucher_t voucher) { if (ov == voucher) return VOUCHER_NO_MACH_VOUCHER; if (ov) _voucher_trace(ORPHAN, ov); _dispatch_thread_setspecific(dispatch_voucher_key, voucher); if (voucher) _voucher_trace(ADOPT, voucher); _dispatch_voucher_debug("swap from voucher[%p]", voucher, ov); mach_voucher_t kv = voucher ? voucher->v_kvoucher : MACH_VOUCHER_NULL; mach_voucher_t okv = ov ? ov->v_kvoucher : MACH_VOUCHER_NULL; #if 0 /* disabled by -frewrite-includes */ #if OS_VOUCHER_ACTIVITY_GENERATE_SWAPS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 404 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" firehose_activity_id_t aid = voucher ? voucher->v_activity : 0; firehose_activity_id_t oaid = ov ? ov->v_activity : 0; if (aid != oaid) _voucher_activity_swap(aid, oaid); #endif # 408 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" return (kv != okv) ? kv : VOUCHER_NO_MACH_VOUCHER; } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline voucher_t _voucher_adopt(voucher_t voucher) { voucher_t ov = _voucher_get(); _voucher_mach_voucher_set(_voucher_swap_and_get_mach_voucher(ov, voucher)); return ov; } DISPATCH_ALWAYS_INLINE static inline void _voucher_replace(voucher_t voucher) { voucher_t ov = _voucher_adopt(voucher); if (ov) _voucher_release(ov); } DISPATCH_ALWAYS_INLINE static inline void _voucher_clear(void) { _voucher_replace(NULL); } DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _voucher_get_priority(voucher_t v) { return v ? (pthread_priority_t)v->v_priority : 0; } DISPATCH_ALWAYS_INLINE static inline firehose_activity_id_t _voucher_get_activity_id(voucher_t v, uint64_t *creator_pid) { if (creator_pid) *creator_pid = v ? v->v_activity_creator : 0; return v ? v->v_activity : 0; } void _voucher_task_mach_voucher_init(void* ctxt); extern dispatch_once_t _voucher_task_mach_voucher_pred; extern mach_voucher_t _voucher_task_mach_voucher; #if 0 /* disabled by -frewrite-includes */ #if VOUCHER_USE_EMPTY_MACH_BASE_VOUCHER #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 454 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define _voucher_default_task_mach_voucher MACH_VOUCHER_NULL #else # 456 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" extern mach_voucher_t _voucher_default_task_mach_voucher; #endif # 458 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" DISPATCH_ALWAYS_INLINE static inline mach_voucher_t _voucher_get_task_mach_voucher(void) { dispatch_once_f(&_voucher_task_mach_voucher_pred, NULL, _voucher_task_mach_voucher_init); return _voucher_task_mach_voucher; } DISPATCH_ALWAYS_INLINE static inline bool _voucher_mach_msg_set_mach_voucher(mach_msg_header_t *msg, mach_voucher_t kv, bool move_send) { if (MACH_MSGH_BITS_HAS_VOUCHER(msg->msgh_bits)) return false; if (!kv) return false; msg->msgh_voucher_port = kv; msg->msgh_bits |= MACH_MSGH_BITS_SET_PORTS(0, 0, move_send ? MACH_MSG_TYPE_MOVE_SEND : MACH_MSG_TYPE_COPY_SEND); _dispatch_kvoucher_debug("msg[%p] set %s", kv, msg, move_send ? "move-send" : "copy-send"); _dispatch_voucher_debug_machport(kv); return true; } DISPATCH_ALWAYS_INLINE static inline bool _voucher_mach_msg_set(mach_msg_header_t *msg, voucher_t voucher) { if (MACH_MSGH_BITS_HAS_VOUCHER(msg->msgh_bits)) return false; mach_voucher_t kv; if (voucher) { kv = _voucher_get_mach_voucher(voucher); } else { kv = _voucher_get_task_mach_voucher(); } return _voucher_mach_msg_set_mach_voucher(msg, kv, false); } DISPATCH_ALWAYS_INLINE static inline mach_voucher_t _voucher_mach_msg_get(mach_msg_header_t *msg, mach_msg_bits_t *msgh_bits) { if (!MACH_MSGH_BITS_HAS_VOUCHER(msg->msgh_bits)) { *msgh_bits = 0; return MACH_VOUCHER_NULL; } mach_voucher_t kv = msg->msgh_voucher_port; msg->msgh_voucher_port = MACH_VOUCHER_NULL; mach_msg_bits_t mask = MACH_MSGH_BITS_VOUCHER_MASK|MACH_MSGH_BITS_RAISEIMP; *msgh_bits = msg->msgh_bits & mask; msg->msgh_bits &= ~mask; return kv; } DISPATCH_ALWAYS_INLINE static inline mach_voucher_t _voucher_mach_msg_clear(mach_msg_header_t *msg, bool move_send) { mach_msg_bits_t kvbits = MACH_MSGH_BITS_VOUCHER(msg->msgh_bits); mach_voucher_t kv = msg->msgh_voucher_port, kvm = MACH_VOUCHER_NULL; if ((kvbits == MACH_MSG_TYPE_COPY_SEND || kvbits == MACH_MSG_TYPE_MOVE_SEND) && kv) { _dispatch_kvoucher_debug("msg[%p] clear %s", kv, msg, move_send ? "move-send" : "copy-send"); _dispatch_voucher_debug_machport(kv); if (kvbits == MACH_MSG_TYPE_MOVE_SEND) { // return/drop received or pseudo-received // voucher reference (e.g. due to send failure). if (move_send) { kvm = kv; } else { _voucher_dealloc_mach_voucher(kv); } } msg->msgh_voucher_port = MACH_VOUCHER_NULL; msg->msgh_bits &= (mach_msg_bits_t)~MACH_MSGH_BITS_VOUCHER_MASK; } return kvm; } #pragma mark - #pragma mark dispatch_continuation_t + voucher_t #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_VOUCHER_KDEBUG_TRACE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 543 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define DISPATCH_VOUCHER_CODE(code) DISPATCH_CODE(VOUCHER, code) #else # 545 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define DISPATCH_VOUCHER_CODE(code) 0 #endif // DISPATCH_USE_VOUCHER_KDEBUG_TRACE # 547 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #define DISPATCH_TRACE_VOUCHER_DC_PUSH DISPATCH_VOUCHER_CODE(0x1) #define DISPATCH_TRACE_VOUCHER_DC_POP DISPATCH_VOUCHER_CODE(0x2) #define DISPATCH_TRACE_VOUCHER_DMSG_PUSH DISPATCH_VOUCHER_CODE(0x3) #define DISPATCH_TRACE_VOUCHER_DMSG_POP DISPATCH_VOUCHER_CODE(0x4) #define DISPATCH_TRACE_VOUCHER_ACTIVITY_ADOPT DISPATCH_VOUCHER_CODE(0x5) DISPATCH_ALWAYS_INLINE static inline void _dispatch_voucher_ktrace(uint32_t code, voucher_t v, const void *container) { if (v == DISPATCH_NO_VOUCHER) return; natural_t voucher = v ? v->v_kvoucher : MACH_VOUCHER_NULL; _dispatch_ktrace2(code, voucher, (uintptr_t)container); } #define _dispatch_voucher_ktrace(code, v, container) \ _dispatch_voucher_ktrace(DISPATCH_TRACE_VOUCHER_##code, v, container) #define _dispatch_voucher_ktrace_dc_push(dc) \ _dispatch_voucher_ktrace(DC_PUSH, (dc)->dc_voucher, (dc)) #define _dispatch_voucher_ktrace_dc_pop(dc, v) \ _dispatch_voucher_ktrace(DC_POP, v, (dc)) #define _dispatch_voucher_ktrace_dmsg_push(dmsg) \ _dispatch_voucher_ktrace(DMSG_PUSH, (dmsg)->dmsg_voucher, (dmsg)) #define _dispatch_voucher_ktrace_dmsg_pop(dmsg) \ _dispatch_voucher_ktrace(DMSG_POP, (dmsg)->dmsg_voucher, (dmsg)) #define _dispatch_voucher_ktrace_activity_adopt(aid) \ _dispatch_ktrace1(DISPATCH_TRACE_VOUCHER_ACTIVITY_ADOPT, aid); DISPATCH_ALWAYS_INLINE static inline void _dispatch_continuation_voucher_set(dispatch_continuation_t dc, dispatch_block_flags_t flags) { voucher_t v = NULL; // _dispatch_continuation_voucher_set is never called for blocks with // private data or with the DISPATCH_BLOCK_HAS_VOUCHER flag set. // only _dispatch_continuation_init_slow handles this bit. dispatch_assert(!(flags & DISPATCH_BLOCK_HAS_VOUCHER)); if (!(flags & DISPATCH_BLOCK_NO_VOUCHER)) { v = _voucher_copy(); } dc->dc_voucher = v; _dispatch_voucher_debug("continuation[%p] set", dc->dc_voucher, dc); _dispatch_voucher_ktrace_dc_push(dc); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_continuation_voucher_adopt(dispatch_continuation_t dc, uintptr_t dc_flags) { voucher_t v = dc->dc_voucher; dispatch_thread_set_self_t consume = (dc_flags & DC_FLAG_CONSUME); dispatch_assert(DC_FLAG_CONSUME == DISPATCH_VOUCHER_CONSUME); if (consume) { dc->dc_voucher = VOUCHER_INVALID; } if (likely(v != DISPATCH_NO_VOUCHER)) { _dispatch_voucher_ktrace_dc_pop(dc, v); _dispatch_voucher_debug("continuation[%p] adopt", v, dc); } (void)_dispatch_adopt_priority_and_set_voucher(dc->dc_priority, v, consume | DISPATCH_VOUCHER_REPLACE); } #pragma mark - #pragma mark _voucher activity subsystem extern dispatch_once_t _firehose_task_buffer_pred; extern union firehose_buffer_u *_firehose_task_buffer; extern uint64_t _voucher_unique_pid; extern dispatch_mach_t _voucher_activity_debug_channel; extern voucher_activity_hooks_t _voucher_libtrace_hooks; #endif // DISPATCH_PURE_C # 625 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #else // VOUCHER_USE_MACH_VOUCHER # 627 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #pragma mark - #pragma mark Simulator / vouchers disabled #define _dispatch_voucher_debug(msg, v, ...) #define _dispatch_kvoucher_debug(msg, kv, ...) DISPATCH_ALWAYS_INLINE static inline voucher_t _voucher_retain(voucher_t voucher) { return voucher; } DISPATCH_ALWAYS_INLINE static inline void _voucher_release(voucher_t voucher) { (void)voucher; } DISPATCH_ALWAYS_INLINE static inline voucher_t _voucher_get(void) { return NULL; } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline voucher_t _voucher_copy(void) { return NULL; } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline voucher_t _voucher_copy_without_importance(void) { return NULL; } DISPATCH_ALWAYS_INLINE static inline mach_voucher_t _voucher_swap_and_get_mach_voucher(voucher_t ov, voucher_t voucher) { (void)ov; (void)voucher; return MACH_VOUCHER_NULL; } DISPATCH_ALWAYS_INLINE static inline voucher_t _voucher_adopt(voucher_t voucher) { return voucher; } DISPATCH_ALWAYS_INLINE static inline void _voucher_replace(voucher_t voucher) { (void)voucher; } DISPATCH_ALWAYS_INLINE static inline void _voucher_clear(void) { } DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _voucher_get_priority(voucher_t voucher) { (void)voucher; return 0; } DISPATCH_ALWAYS_INLINE static inline bool _voucher_mach_msg_set_mach_voucher(mach_msg_header_t *msg, mach_voucher_t kv, bool move_send) { (void)msg; (void)kv; (void)move_send; return false; } DISPATCH_ALWAYS_INLINE static inline bool _voucher_mach_msg_set(mach_msg_header_t *msg, voucher_t voucher) { (void)msg; (void)voucher; return false; } DISPATCH_ALWAYS_INLINE static inline mach_voucher_t _voucher_mach_msg_get(mach_msg_header_t *msg, mach_msg_bits_t *msgh_bits) { (void)msg;(void)msgh_bits; return 0; } DISPATCH_ALWAYS_INLINE static inline mach_voucher_t _voucher_mach_msg_clear(mach_msg_header_t *msg, bool move_send) { (void)msg; (void)move_send; return MACH_VOUCHER_NULL; } #define _dispatch_voucher_ktrace_dc_push(dc) #define _dispatch_voucher_ktrace_dc_pop(dc, v) #define _dispatch_voucher_ktrace_dmsg_push(dmsg) #define _dispatch_voucher_ktrace_dmsg_pop(dmsg) DISPATCH_ALWAYS_INLINE static inline void _dispatch_continuation_voucher_set(dispatch_continuation_t dc, dispatch_block_flags_t flags) { (void)dc; (void)flags; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_continuation_voucher_adopt(dispatch_continuation_t dc, uintptr_t dc_flags) { (void)dc; (void)dc_flags; } #endif // VOUCHER_USE_MACH_VOUCHER # 761 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" #endif /* __DISPATCH_VOUCHER_INTERNAL__ */ # 763 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/voucher_internal.h" # 1109 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "data_internal.h" #endif /* expanded by -frewrite-includes */ # 1109 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" 1 /* * Copyright (c) 2009-2012 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_DATA_INTERNAL__ #define __DISPATCH_DATA_INTERNAL__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" typedef struct range_record_s { dispatch_data_t data_object; size_t from; size_t length; } range_record; #if 0 /* disabled by -frewrite-includes */ #if OS_OBJECT_HAVE_OBJC2 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" #define DISPATCH_DATA_IS_BRIDGED_TO_NSDATA 1 #else # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" #define DISPATCH_DATA_IS_BRIDGED_TO_NSDATA 0 #endif # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DATA_IS_BRIDGED_TO_NSDATA #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" DISPATCH_OBJC_CLASS_DECL(data); DISPATCH_OBJC_CLASS_DECL(data_empty); _OS_OBJECT_DECL_PROTOCOL(dispatch_data, dispatch_object); #define DISPATCH_DATA_CLASS DISPATCH_VTABLE(data) #define DISPATCH_DATA_EMPTY_CLASS DISPATCH_VTABLE(data_empty) #else # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" DISPATCH_CLASS_DECL(data, OBJECT); #define DISPATCH_DATA_CLASS DISPATCH_VTABLE(data) #endif // DISPATCH_DATA_IS_BRIDGED_TO_NSDATA # 57 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" struct dispatch_data_s { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DATA_IS_BRIDGED_TO_NSDATA #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 60 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" const void *do_vtable; dispatch_queue_t do_targetq; void *ctxt; void *finalizer; #else # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" DISPATCH_OBJECT_HEADER(data); #endif // DISPATCH_DATA_IS_BRIDGED_TO_NSDATA # 67 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" const void *buf; dispatch_block_t destructor; size_t size, num_records; range_record records[0]; }; DISPATCH_ALWAYS_INLINE static inline bool _dispatch_data_leaf(struct dispatch_data_s *dd) { return dd->num_records == 0; } /* * This is about the number of records required to hold that dispatch data * if it's not a leaf. Callers either want that value, or have to special * case the case when the dispatch data *is* a leaf before (and that the actual * embedded record count of that dispatch data is 0) */ DISPATCH_ALWAYS_INLINE static inline size_t _dispatch_data_num_records(struct dispatch_data_s *dd) { return dd->num_records ?: 1; } typedef dispatch_data_t (*dispatch_transform_t)(dispatch_data_t data); struct dispatch_data_format_type_s { uint64_t type; uint64_t input_mask; uint64_t output_mask; dispatch_transform_t decode; dispatch_transform_t encode; }; void _dispatch_data_init_with_bytes(dispatch_data_t data, const void *buffer, size_t size, dispatch_block_t destructor); void _dispatch_data_dispose(dispatch_data_t data, bool *allow_free); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DATA_IS_BRIDGED_TO_NSDATA #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 107 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" void _dispatch_data_set_target_queue(struct dispatch_data_s *dd, dispatch_queue_t tq); #endif # 110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" DISPATCH_COLD size_t _dispatch_data_debug(dispatch_data_t data, char* buf, size_t bufsiz); #if 0 /* disabled by -frewrite-includes */ #if !defined(__cplusplus) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 114 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" extern const dispatch_block_t _dispatch_data_destructor_inline; #define DISPATCH_DATA_DESTRUCTOR_INLINE (_dispatch_data_destructor_inline) /* * the out parameters are about seeing "through" trivial subranges * so for something like this: dd = { subrange [ dd1, offset1 ] }, * this will return { dd1, offset + offset1 } * * If the dispatch object isn't a trivial subrange, it returns { dd, offset } */ DISPATCH_ALWAYS_INLINE static inline const void* _dispatch_data_map_direct(struct dispatch_data_s *dd, size_t offset, struct dispatch_data_s **dd_out, size_t *from_out) { const void *buffer = NULL; dispatch_assert(dd->size); if (unlikely(!_dispatch_data_leaf(dd)) && _dispatch_data_num_records(dd) == 1) { offset += dd->records[0].from; dd = (struct dispatch_data_s *)dd->records[0].data_object; } if (likely(_dispatch_data_leaf(dd))) { buffer = dd->buf + offset; } else { buffer = os_atomic_load((void **)&dd->buf, relaxed); if (buffer) { buffer += offset; } } if (dd_out) *dd_out = dd; if (from_out) *from_out = offset; return buffer; } #endif // !defined(__cplusplus) # 152 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" #endif // __DISPATCH_DATA_INTERNAL__ # 154 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/data_internal.h" # 1110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "io_internal.h" #endif /* expanded by -frewrite-includes */ # 1110 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" 1 /* * Copyright (c) 2009-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_IO_INTERNAL__ #define __DISPATCH_IO_INTERNAL__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" #define _DISPATCH_IO_LABEL_SIZE 16 #if 0 /* disabled by -frewrite-includes */ #if TARGET_OS_IPHONE // rdar://problem/9032036 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" #define DIO_MAX_CHUNK_SIZE (512u * 1024) #define DIO_HASH_SIZE 64u // must be a power of two #else # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" #define DIO_MAX_CHUNK_SIZE (1024u * 1024) #define DIO_HASH_SIZE 256u // must be a power of two #endif # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" #define DIO_HASH(x) ((uintptr_t)(x) & (DIO_HASH_SIZE - 1)) #define DIO_DEFAULT_LOW_WATER_CHUNKS 1u // default low-water mark #define DIO_MAX_PENDING_IO_REQS 6u // Pending I/O read advises typedef unsigned int dispatch_op_direction_t; enum { DOP_DIR_READ = 0, DOP_DIR_WRITE, DOP_DIR_MAX, DOP_DIR_IGNORE = UINT_MAX, }; typedef unsigned int dispatch_op_flags_t; #define DOP_DEFAULT 0u // check conditions to determine delivery #define DOP_DELIVER 1u // always deliver operation #define DOP_DONE 2u // operation is done (implies deliver) #define DOP_STOP 4u // operation interrupted by chan stop (implies done) #define DOP_NO_EMPTY 8u // don't deliver empty data // dispatch_io_t atomic_flags #define DIO_CLOSED 1u // channel has been closed #define DIO_STOPPED 2u // channel has been stopped (implies closed) DISPATCH_INTERNAL_CLASS_DECL(operation, OBJECT); DISPATCH_INTERNAL_CLASS_DECL(disk, OBJECT); struct dispatch_stream_s { dispatch_queue_t dq; dispatch_source_t source; dispatch_operation_t op; bool source_running; TAILQ_HEAD(, dispatch_operation_s) operations[2]; }; typedef struct dispatch_stream_s *dispatch_stream_t; struct dispatch_io_path_data_s { dispatch_io_t channel; int oflag; mode_t mode; size_t pathlen; char path[]; }; typedef struct dispatch_io_path_data_s *dispatch_io_path_data_t; struct dispatch_stat_s { dev_t dev; mode_t mode; }; struct dispatch_disk_s { DISPATCH_OBJECT_HEADER(disk); TAILQ_HEAD(dispatch_disk_operations_s, dispatch_operation_s) operations; dispatch_operation_t cur_rq; dispatch_queue_t pick_queue; size_t free_idx; size_t req_idx; size_t advise_idx; dev_t dev; bool io_active; LIST_ENTRY(dispatch_disk_s) disk_list; size_t advise_list_depth; dispatch_operation_t advise_list[]; }; struct dispatch_fd_entry_s { dispatch_fd_t fd; dispatch_io_path_data_t path_data; int orig_flags, orig_nosigpipe, err; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_GUARDED_FD_CHANGE_FDGUARD #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 118 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" int orig_fd_flags; #endif # 120 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_GUARDED_FD #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 121 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" unsigned int guard_flags; #endif # 123 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" struct dispatch_stat_s stat; dispatch_stream_t streams[2]; dispatch_disk_t disk; dispatch_queue_t close_queue, barrier_queue; dispatch_group_t barrier_group; dispatch_io_t convenience_channel; TAILQ_HEAD(, dispatch_operation_s) stream_ops; LIST_ENTRY(dispatch_fd_entry_s) fd_list; }; typedef struct dispatch_fd_entry_s *dispatch_fd_entry_t; typedef struct dispatch_io_param_s { dispatch_io_type_t type; // STREAM OR RANDOM size_t low; size_t high; uint64_t interval; unsigned long interval_flags; } dispatch_io_param_s; struct dispatch_operation_s { DISPATCH_OBJECT_HEADER(operation); dispatch_queue_t op_q; dispatch_op_direction_t direction; // READ OR WRITE dispatch_io_param_s params; #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 149 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" LONGLONG offset; #else # 151 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" off_t offset; #endif # 153 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" size_t length; int err; dispatch_io_handler_t handler; dispatch_io_t channel; dispatch_fd_entry_t fd_entry; dispatch_source_t timer; bool active; off_t advise_offset; void* buf; dispatch_op_flags_t flags; size_t buf_siz, buf_len, undelivered, total; dispatch_data_t buf_data, data; TAILQ_ENTRY(dispatch_operation_s) operation_list; // the request list in the fd_entry stream_ops TAILQ_ENTRY(dispatch_operation_s) stream_list; }; DISPATCH_CLASS_DECL(io, OBJECT); struct dispatch_io_s { DISPATCH_OBJECT_HEADER(io); dispatch_queue_t queue, barrier_queue; dispatch_group_t barrier_group; dispatch_io_param_s params; dispatch_fd_entry_t fd_entry; unsigned int atomic_flags; dispatch_fd_t fd, fd_actual; #if 0 /* disabled by -frewrite-includes */ #if defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 180 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" LONGLONG f_ptr; #else # 182 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" off_t f_ptr; #endif # 184 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" int err; // contains creation errors only }; void _dispatch_io_set_target_queue(dispatch_io_t channel, dispatch_queue_t dq); DISPATCH_COLD size_t _dispatch_io_debug(dispatch_io_t channel, char* buf, size_t bufsiz); void _dispatch_io_dispose(dispatch_io_t channel, bool *allow_free); DISPATCH_COLD size_t _dispatch_operation_debug(dispatch_operation_t op, char* buf, size_t bufsiz); void _dispatch_operation_dispose(dispatch_operation_t operation, bool *allow_free); void _dispatch_disk_dispose(dispatch_disk_t disk, bool *allow_free); #endif // __DISPATCH_IO_INTERNAL__ # 199 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/io_internal.h" # 1111 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "inline_internal.h" #endif /* expanded by -frewrite-includes */ # 1111 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" 1 /* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_INLINE_INTERNAL__ #define __DISPATCH_INLINE_INTERNAL__ #ifndef __DISPATCH_INDIRECT__ #error "Please #include instead of this file directly." #if 0 /* expanded by -frewrite-includes */ #include // for HeaderDoc #endif /* expanded by -frewrite-includes */ # 32 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #endif # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_CLIENT_CALLOUT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_NOTHROW void _dispatch_client_callout(void *ctxt, dispatch_function_t f); DISPATCH_NOTHROW void _dispatch_client_callout2(void *ctxt, size_t i, void (*f)(void *, size_t)); #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_NOTHROW void _dispatch_client_callout3(void *ctxt, dispatch_mach_reason_t reason, dispatch_mach_msg_t dmsg, dispatch_mach_async_reply_callback_t f); DISPATCH_NOTHROW void _dispatch_client_callout4(void *ctxt, dispatch_mach_reason_t reason, dispatch_mach_msg_t dmsg, mach_error_t error, dispatch_mach_handler_function_t f); #endif // HAVE_MACH # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #else // !DISPATCH_USE_CLIENT_CALLOUT # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_ALWAYS_INLINE static inline void _dispatch_client_callout(void *ctxt, dispatch_function_t f) { return f(ctxt); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_client_callout2(void *ctxt, size_t i, void (*f)(void *, size_t)) { return f(ctxt, i); } #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_ALWAYS_INLINE static inline void _dispatch_client_callout3(void *ctxt, dispatch_mach_reason_t reason, dispatch_mach_msg_t dmsg, dispatch_mach_async_reply_callback_t f) { return f(ctxt, reason, dmsg); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_client_callout4(void *ctxt, dispatch_mach_reason_t reason, dispatch_mach_msg_t dmsg, mach_error_t error, dispatch_mach_handler_function_t f) { return f(ctxt, reason, dmsg, error); } #endif // HAVE_MACH # 85 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #endif // !DISPATCH_USE_CLIENT_CALLOUT # 87 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #pragma mark - #pragma mark _os_object_t & dispatch_object_t #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 91 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_ALWAYS_INLINE static inline const char * _dispatch_object_class_name(dispatch_object_t dou) { #if 0 /* disabled by -frewrite-includes */ #if USE_OBJC #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 97 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return object_getClassName((id)dou._do) + strlen("OS_dispatch_"); #else # 99 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return dx_vtable(dou._do)->do_kind; #endif # 101 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_global(dispatch_object_t dou) { return dou._do->do_ref_cnt == DISPATCH_OBJECT_GLOBAL_REFCNT; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_root_or_base_queue(dispatch_object_t dou) { return dx_hastypeflag(dou._do, QUEUE_ROOT) || dx_hastypeflag(dou._do, QUEUE_BASE); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_has_vtable(dispatch_object_t dou) { // vtables are pointers far away from the low page in memory return dou._dc->dc_flags > 0xffful; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_queue(dispatch_object_t dou) { return _dispatch_object_has_vtable(dou) && dx_vtable(dou._dq)->dq_push; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_continuation(dispatch_object_t dou) { if (_dispatch_object_has_vtable(dou)) { return dx_metatype(dou._do) == _DISPATCH_CONTINUATION_TYPE; } return true; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_has_type(dispatch_object_t dou, unsigned long type) { return _dispatch_object_has_vtable(dou) && dx_type(dou._do) == type; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_redirection(dispatch_object_t dou) { return _dispatch_object_has_type(dou, DISPATCH_CONTINUATION_TYPE(ASYNC_REDIRECT)); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_barrier(dispatch_object_t dou) { dispatch_queue_flags_t dq_flags; if (!_dispatch_object_has_vtable(dou)) { return (dou._dc->dc_flags & DC_FLAG_BARRIER); } if (dx_cluster(dou._do) != _DISPATCH_QUEUE_CLUSTER) { return false; } dq_flags = os_atomic_load2o(dou._dq, dq_atomic_flags, relaxed); return dq_flags & DQF_BARRIER_BIT; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_waiter(dispatch_object_t dou) { if (_dispatch_object_has_vtable(dou)) { return false; } return (dou._dc->dc_flags & (DC_FLAG_SYNC_WAITER | DC_FLAG_ASYNC_AND_WAIT)); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_sync_waiter(dispatch_object_t dou) { if (_dispatch_object_has_vtable(dou)) { return false; } return (dou._dc->dc_flags & DC_FLAG_SYNC_WAITER); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_object_is_sync_waiter_non_barrier(dispatch_object_t dou) { if (_dispatch_object_has_vtable(dou)) { return false; } return ((dou._dc->dc_flags & (DC_FLAG_BARRIER | DC_FLAG_SYNC_WAITER)) == (DC_FLAG_SYNC_WAITER)); } DISPATCH_ALWAYS_INLINE static inline _os_object_t _os_object_retain_internal_n_inline(_os_object_t obj, int n) { int ref_cnt = _os_object_refcnt_add_orig(obj, n); if (unlikely(ref_cnt < 0)) { _OS_OBJECT_CLIENT_CRASH("Resurrection of an object"); } return obj; } DISPATCH_ALWAYS_INLINE static inline void _os_object_release_internal_n_no_dispose_inline(_os_object_t obj, int n) { int ref_cnt = _os_object_refcnt_sub(obj, n); if (likely(ref_cnt >= 0)) { return; } _OS_OBJECT_CLIENT_CRASH("Over-release of an object"); } DISPATCH_ALWAYS_INLINE static inline void _os_object_release_internal_n_inline(_os_object_t obj, int n) { int ref_cnt = _os_object_refcnt_sub(obj, n); if (likely(ref_cnt >= 0)) { return; } if (unlikely(ref_cnt < -1)) { _OS_OBJECT_CLIENT_CRASH("Over-release of an object"); } #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_DEBUG #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 239 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" int xref_cnt = obj->os_obj_xref_cnt; if (unlikely(xref_cnt >= 0)) { DISPATCH_INTERNAL_CRASH(xref_cnt, "Release while external references exist"); } #endif # 245 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" // _os_object_refcnt_dispose_barrier() is in _os_object_dispose() return _os_object_dispose(obj); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_retain(dispatch_object_t dou) { (void)_os_object_retain_internal_n_inline(dou._os_obj, 1); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_retain_2(dispatch_object_t dou) { (void)_os_object_retain_internal_n_inline(dou._os_obj, 2); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_retain_n(dispatch_object_t dou, int n) { (void)_os_object_retain_internal_n_inline(dou._os_obj, n); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_retain_n_unsafe(dispatch_object_t dou, int n) { // _dispatch_retain_*_unsafe assumes: // - the object is not global // - there's no refcount management bug // // This is meant to be used only when called between the update_tail and // update_prev os_mpsc methods, so that the assembly of that critical window // is as terse as possible (this window is a possible dequeuer starvation). // // Other code should use the safe variants at all times. os_atomic_add2o(dou._os_obj, os_obj_ref_cnt, n, relaxed); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_retain_2_unsafe(dispatch_object_t dou) { _dispatch_retain_n_unsafe(dou, 2); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_release(dispatch_object_t dou) { _os_object_release_internal_n_inline(dou._os_obj, 1); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_release_2(dispatch_object_t dou) { _os_object_release_internal_n_inline(dou._os_obj, 2); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_release_n(dispatch_object_t dou, int n) { _os_object_release_internal_n_inline(dou._os_obj, n); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_release_no_dispose(dispatch_object_t dou) { _os_object_release_internal_n_no_dispose_inline(dou._os_obj, 1); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_release_2_no_dispose(dispatch_object_t dou) { _os_object_release_internal_n_no_dispose_inline(dou._os_obj, 2); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_release_tailcall(dispatch_object_t dou) { _os_object_release_internal(dou._os_obj); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_release_2_tailcall(dispatch_object_t dou) { _os_object_release_internal_n(dou._os_obj, 2); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_retain_unote_owner(dispatch_unote_t du) { _dispatch_retain_2(_dispatch_wref2ptr(du._du->du_owner_wref)); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_release_unote_owner_tailcall(dispatch_unote_t du) { _dispatch_release_2_tailcall(_dispatch_wref2ptr(du._du->du_owner_wref)); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_retain_storage(dispatch_queue_class_t dqu) { int ref_cnt = os_atomic_inc2o(dqu._dq, dq_sref_cnt, relaxed); if (unlikely(ref_cnt <= 0)) { _OS_OBJECT_CLIENT_CRASH("Resurrection of an object"); } } DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_release_storage(dispatch_queue_class_t dqu) { // this refcount only delays the _dispatch_object_dealloc() and there's no // need for visibility wrt to the allocation, the internal refcount already // gives us that, and the object becomes immutable after the last internal // refcount release. int ref_cnt = os_atomic_dec2o(dqu._dq, dq_sref_cnt, relaxed); if (unlikely(ref_cnt >= 0)) { return; } if (unlikely(ref_cnt < -1)) { _OS_OBJECT_CLIENT_CRASH("Over-release of an object"); } dqu._dq->dq_state = 0xdead000000000000; _dispatch_object_dealloc(dqu._dq); } DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL static inline void _dispatch_object_set_target_queue_inline(dispatch_object_t dou, dispatch_queue_t tq) { _dispatch_retain(tq); tq = os_atomic_xchg2o(dou._do, do_targetq, tq, release); if (tq) _dispatch_release(tq); } #endif // DISPATCH_PURE_C # 396 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #pragma mark - #pragma mark dispatch_thread #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 399 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_ALWAYS_INLINE static inline dispatch_thread_context_t _dispatch_thread_context_find(const void *key) { dispatch_thread_context_t dtc = _dispatch_thread_getspecific(dispatch_context_key); while (dtc) { if (dtc->dtc_key == key) { return dtc; } dtc = dtc->dtc_prev; } return NULL; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_context_push(dispatch_thread_context_t ctxt) { ctxt->dtc_prev = _dispatch_thread_getspecific(dispatch_context_key); _dispatch_thread_setspecific(dispatch_context_key, ctxt); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_context_pop(dispatch_thread_context_t ctxt) { dispatch_assert(_dispatch_thread_getspecific(dispatch_context_key) == ctxt); _dispatch_thread_setspecific(dispatch_context_key, ctxt->dtc_prev); } typedef struct dispatch_thread_frame_iterator_s { dispatch_queue_t dtfi_queue; dispatch_thread_frame_t dtfi_frame; } *dispatch_thread_frame_iterator_t; DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_frame_iterate_start(dispatch_thread_frame_iterator_t it) { _dispatch_thread_getspecific_pair( dispatch_queue_key, (void **)&it->dtfi_queue, dispatch_frame_key, (void **)&it->dtfi_frame); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_frame_iterate_next(dispatch_thread_frame_iterator_t it) { dispatch_thread_frame_t dtf = it->dtfi_frame; dispatch_queue_t dq = it->dtfi_queue; if (dtf) { dispatch_queue_t tq = dq->do_targetq; if (tq) { // redirections or dispatch_sync may skip frames, // so we need to simulate seeing the missing links it->dtfi_queue = tq; if (dq == dtf->dtf_queue) { it->dtfi_frame = dtf->dtf_prev; } } else { it->dtfi_queue = dtf->dtf_queue; it->dtfi_frame = dtf->dtf_prev; } } else if (dq) { it->dtfi_queue = dq->do_targetq; } } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_thread_frame_find_queue(dispatch_queue_t dq) { struct dispatch_thread_frame_iterator_s it; _dispatch_thread_frame_iterate_start(&it); while (it.dtfi_queue) { if (it.dtfi_queue == dq) { return true; } _dispatch_thread_frame_iterate_next(&it); } return false; } DISPATCH_ALWAYS_INLINE static inline dispatch_thread_frame_t _dispatch_thread_frame_get_current(void) { return _dispatch_thread_getspecific(dispatch_frame_key); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_frame_save_state(dispatch_thread_frame_t dtf) { _dispatch_thread_getspecific_packed_pair( dispatch_queue_key, dispatch_frame_key, dtf->dtf_pair); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_frame_push(dispatch_thread_frame_t dtf, dispatch_queue_class_t dqu) { _dispatch_thread_frame_save_state(dtf); _dispatch_thread_setspecific_pair(dispatch_queue_key, dqu._dq, dispatch_frame_key, dtf); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_frame_push_and_rebase(dispatch_thread_frame_t dtf, dispatch_queue_class_t dqu, dispatch_thread_frame_t new_base) { _dispatch_thread_frame_save_state(dtf); _dispatch_thread_setspecific_pair(dispatch_queue_key, dqu._dq, dispatch_frame_key, new_base); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_frame_pop(dispatch_thread_frame_t dtf) { _dispatch_thread_setspecific_packed_pair( dispatch_queue_key, dispatch_frame_key, dtf->dtf_pair); } DISPATCH_ALWAYS_INLINE static inline dispatch_queue_t _dispatch_thread_frame_stash(dispatch_thread_frame_t dtf) { _dispatch_thread_getspecific_pair( dispatch_queue_key, &dtf->dtf_pair[0], dispatch_frame_key, &dtf->dtf_pair[1]); _dispatch_thread_frame_pop(dtf->dtf_prev); return dtf->dtf_queue; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_frame_unstash(dispatch_thread_frame_t dtf) { _dispatch_thread_frame_pop(dtf); } DISPATCH_ALWAYS_INLINE static inline int _dispatch_wqthread_override_start_check_owner(mach_port_t thread, dispatch_qos_t qos, mach_port_t *ulock_addr) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 553 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if (!_dispatch_set_qos_class_enabled) return 0; return _pthread_workqueue_override_start_direct_check_owner(thread, _dispatch_qos_to_pp(qos), ulock_addr); #else # 557 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)thread; (void)qos; (void)ulock_addr; return 0; #endif # 560 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_wqthread_override_start(mach_port_t thread, dispatch_qos_t qos) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 567 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if (!_dispatch_set_qos_class_enabled) return; (void)_pthread_workqueue_override_start_direct(thread, _dispatch_qos_to_pp(qos)); #else # 571 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)thread; (void)qos; #endif # 573 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_wqthread_override_reset(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 580 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if (!_dispatch_set_qos_class_enabled) return; (void)_pthread_workqueue_override_reset(); #endif # 583 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_override_start(mach_port_t thread, pthread_priority_t pp, void *resource) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 591 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if (!_dispatch_set_qos_class_enabled) return; (void)_pthread_qos_override_start_direct(thread, pp, resource); #else # 594 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)thread; (void)pp; (void)resource; #endif # 596 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_thread_override_end(mach_port_t thread, void *resource) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 603 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if (!_dispatch_set_qos_class_enabled) return; (void)_pthread_qos_override_end_direct(thread, resource); #else # 606 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)thread; (void)resource; #endif # 608 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } #endif // DISPATCH_PURE_C # 611 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #pragma mark - #pragma mark dispatch_queue_t state accessors #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 614 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_ALWAYS_INLINE static inline dispatch_queue_flags_t _dispatch_queue_atomic_flags(dispatch_queue_class_t dqu) { return os_atomic_load2o(dqu._dq, dq_atomic_flags, relaxed); } DISPATCH_ALWAYS_INLINE static inline dispatch_queue_flags_t _dispatch_queue_atomic_flags_set(dispatch_queue_class_t dqu, dispatch_queue_flags_t bits) { return os_atomic_or2o(dqu._dq, dq_atomic_flags, bits, relaxed); } DISPATCH_ALWAYS_INLINE static inline dispatch_queue_flags_t _dispatch_queue_atomic_flags_set_and_clear_orig(dispatch_queue_class_t dqu, dispatch_queue_flags_t add_bits, dispatch_queue_flags_t clr_bits) { dispatch_queue_flags_t oflags, nflags; os_atomic_rmw_loop2o(dqu._dq, dq_atomic_flags, oflags, nflags, relaxed, { nflags = (oflags | add_bits) & ~clr_bits; if (nflags == oflags) os_atomic_rmw_loop_give_up(return oflags); }); return oflags; } DISPATCH_ALWAYS_INLINE static inline dispatch_queue_flags_t _dispatch_queue_atomic_flags_set_and_clear(dispatch_queue_class_t dqu, dispatch_queue_flags_t add_bits, dispatch_queue_flags_t clr_bits) { dispatch_queue_flags_t oflags, nflags; os_atomic_rmw_loop2o(dqu._dq, dq_atomic_flags, oflags, nflags, relaxed, { nflags = (oflags | add_bits) & ~clr_bits; if (nflags == oflags) os_atomic_rmw_loop_give_up(return oflags); }); return nflags; } DISPATCH_ALWAYS_INLINE static inline dispatch_queue_flags_t _dispatch_queue_atomic_flags_set_orig(dispatch_queue_class_t dqu, dispatch_queue_flags_t bits) { return os_atomic_or_orig2o(dqu._dq, dq_atomic_flags, bits, relaxed); } DISPATCH_ALWAYS_INLINE static inline dispatch_queue_flags_t _dispatch_queue_atomic_flags_clear(dispatch_queue_class_t dqu, dispatch_queue_flags_t bits) { return os_atomic_and2o(dqu._dq, dq_atomic_flags, ~bits, relaxed); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_is_thread_bound(dispatch_queue_class_t dqu) { return _dispatch_queue_atomic_flags(dqu) & DQF_THREAD_BOUND; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_label_needs_free(dispatch_queue_class_t dqu) { return _dispatch_queue_atomic_flags(dqu) & DQF_LABEL_NEEDS_FREE; } DISPATCH_ALWAYS_INLINE static inline dispatch_invoke_flags_t _dispatch_queue_autorelease_frequency(dispatch_queue_class_t dqu) { const unsigned long factor = DISPATCH_INVOKE_AUTORELEASE_ALWAYS / DQF_AUTORELEASE_ALWAYS; dispatch_assert(factor > 0); dispatch_queue_flags_t qaf = _dispatch_queue_atomic_flags(dqu); qaf &= (dispatch_queue_flags_t)_DQF_AUTORELEASE_MASK; return (dispatch_invoke_flags_t)qaf * factor; } DISPATCH_ALWAYS_INLINE static inline dispatch_invoke_flags_t _dispatch_queue_merge_autorelease_frequency(dispatch_queue_class_t dqu, dispatch_invoke_flags_t flags) { dispatch_invoke_flags_t qaf = _dispatch_queue_autorelease_frequency(dqu); if (qaf) { flags &= ~_DISPATCH_INVOKE_AUTORELEASE_MASK; flags |= qaf; } return flags; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_is_mutable(dispatch_queue_class_t dqu) { return _dispatch_queue_atomic_flags(dqu) & DQF_MUTABLE; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_wlh_retain(dispatch_wlh_t wlh) { if (wlh && wlh != DISPATCH_WLH_ANON) { _dispatch_queue_retain_storage((dispatch_queue_t)wlh); } } DISPATCH_ALWAYS_INLINE static inline void _dispatch_wlh_release(dispatch_wlh_t wlh) { if (wlh && wlh != DISPATCH_WLH_ANON) { _dispatch_queue_release_storage((dispatch_queue_t)wlh); } } #define DISPATCH_WLH_STORAGE_REF 1ul DISPATCH_ALWAYS_INLINE DISPATCH_PURE static inline dispatch_wlh_t _dispatch_get_wlh(void) { return _dispatch_thread_getspecific(dispatch_wlh_key); } DISPATCH_ALWAYS_INLINE static inline dispatch_workloop_t _dispatch_wlh_to_workloop(dispatch_wlh_t wlh) { if (wlh == DISPATCH_WLH_ANON) { return NULL; } if (dx_metatype((dispatch_workloop_t)wlh) == _DISPATCH_WORKLOOP_TYPE) { return (dispatch_workloop_t)wlh; } return NULL; } DISPATCH_ALWAYS_INLINE DISPATCH_PURE static inline dispatch_wlh_t _dispatch_get_event_wlh(void) { dispatch_deferred_items_t ddi = _dispatch_deferred_items_get(); if (ddi) { DISPATCH_COMPILER_CAN_ASSUME(ddi->ddi_wlh != DISPATCH_WLH_ANON); return ddi->ddi_wlh; } return DISPATCH_WLH_ANON; } DISPATCH_ALWAYS_INLINE DISPATCH_PURE static inline dispatch_wlh_t _dispatch_get_wlh_reference(void) { dispatch_wlh_t wlh = _dispatch_get_wlh(); return (dispatch_wlh_t)((uintptr_t)wlh & ~DISPATCH_WLH_STORAGE_REF); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_adopt_wlh_anon_recurse(void) { dispatch_wlh_t cur_wlh = _dispatch_get_wlh_reference(); if (cur_wlh == DISPATCH_WLH_ANON) return false; _dispatch_debug("wlh[anon]: set current (releasing %p)", cur_wlh); _dispatch_wlh_release(cur_wlh); _dispatch_thread_setspecific(dispatch_wlh_key, (void *)DISPATCH_WLH_ANON); return true; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_adopt_wlh_anon(void) { if (unlikely(!_dispatch_adopt_wlh_anon_recurse())) { DISPATCH_INTERNAL_CRASH(0, "Lingering DISPATCH_WLH_ANON"); } } DISPATCH_ALWAYS_INLINE static inline void _dispatch_adopt_wlh(dispatch_wlh_t wlh) { dispatch_wlh_t cur_wlh = _dispatch_get_wlh_reference(); _dispatch_debug("wlh[%p]: adopt current (releasing %p)", wlh, cur_wlh); if (cur_wlh == DISPATCH_WLH_ANON) { DISPATCH_INTERNAL_CRASH(0, "Lingering DISPATCH_WLH_ANON"); } if (cur_wlh != wlh) { dispatch_assert(wlh); _dispatch_wlh_release(cur_wlh); _dispatch_wlh_retain(wlh); } _dispatch_thread_setspecific(dispatch_wlh_key, (void *)wlh); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_preserve_wlh_storage_reference(dispatch_wlh_t wlh) { dispatch_assert(wlh != DISPATCH_WLH_ANON); dispatch_assert(wlh == _dispatch_get_wlh()); _dispatch_thread_setspecific(dispatch_wlh_key, (void *)((uintptr_t)wlh | DISPATCH_WLH_STORAGE_REF)); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_reset_wlh(void) { dispatch_assert(_dispatch_get_wlh() == DISPATCH_WLH_ANON); _dispatch_debug("wlh[anon]: clear current"); _dispatch_thread_setspecific(dispatch_wlh_key, NULL); _dispatch_clear_return_to_kernel(); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_wlh_should_poll_unote(dispatch_unote_t du) { dispatch_deferred_items_t ddi = _dispatch_deferred_items_get(); return _dispatch_needs_to_return_to_kernel() && ddi && ddi->ddi_wlh != DISPATCH_WLH_ANON && _dispatch_unote_wlh(du) == ddi->ddi_wlh; } #endif // DISPATCH_PURE_C # 850 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #ifndef __cplusplus DISPATCH_ALWAYS_INLINE static inline uint32_t _dq_state_suspend_cnt(uint64_t dq_state) { return (uint32_t)(dq_state / DISPATCH_QUEUE_SUSPEND_INTERVAL); } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_has_side_suspend_cnt(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_HAS_SIDE_SUSPEND_CNT; } DISPATCH_ALWAYS_INLINE static inline int32_t _dq_state_extract_width_bits(uint64_t dq_state) { dq_state &= DISPATCH_QUEUE_WIDTH_MASK; return (int32_t)(dq_state >> DISPATCH_QUEUE_WIDTH_SHIFT); } DISPATCH_ALWAYS_INLINE static inline int32_t _dq_state_available_width(uint64_t dq_state) { int32_t full = DISPATCH_QUEUE_WIDTH_FULL; if (likely(!(dq_state & DISPATCH_QUEUE_WIDTH_FULL_BIT))) { return full - _dq_state_extract_width_bits(dq_state); } return 0; } DISPATCH_ALWAYS_INLINE static inline int32_t _dq_state_used_width(uint64_t dq_state, uint16_t dq_width) { int32_t full = DISPATCH_QUEUE_WIDTH_FULL; int32_t width = _dq_state_extract_width_bits(dq_state); if (dq_state & DISPATCH_QUEUE_PENDING_BARRIER) { // DISPATCH_QUEUE_PENDING_BARRIER means (dq_width - 1) of the used width // is pre-reservation that we want to ignore return width - (full - dq_width) - (dq_width - 1); } return width - (full - dq_width); } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_suspended(uint64_t dq_state) { return dq_state >= DISPATCH_QUEUE_NEEDS_ACTIVATION; } #define DISPATCH_QUEUE_IS_SUSPENDED(x) \ _dq_state_is_suspended(os_atomic_load2o(x, dq_state, relaxed)) DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_inactive(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_INACTIVE; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_needs_activation(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_NEEDS_ACTIVATION; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_in_barrier(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_IN_BARRIER; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_has_available_width(uint64_t dq_state) { return !(dq_state & DISPATCH_QUEUE_WIDTH_FULL_BIT); } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_has_pending_barrier(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_PENDING_BARRIER; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_dirty(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_DIRTY; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_base_wlh(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_ROLE_BASE_WLH; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_base_anon(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_ROLE_BASE_ANON; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_inner_queue(uint64_t dq_state) { return (dq_state & DISPATCH_QUEUE_ROLE_MASK) == DISPATCH_QUEUE_ROLE_INNER; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_enqueued(uint64_t dq_state) { return dq_state & (DISPATCH_QUEUE_ENQUEUED|DISPATCH_QUEUE_ENQUEUED_ON_MGR); } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_enqueued_on_target(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_ENQUEUED; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_enqueued_on_manager(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_ENQUEUED_ON_MGR; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_in_sync_transfer(uint64_t dq_state) { return dq_state & DISPATCH_QUEUE_SYNC_TRANSFER; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_received_override(uint64_t dq_state) { return _dq_state_is_base_anon(dq_state) && (dq_state & DISPATCH_QUEUE_RECEIVED_OVERRIDE); } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_received_sync_wait(uint64_t dq_state) { return _dq_state_is_base_wlh(dq_state) && (dq_state & DISPATCH_QUEUE_RECEIVED_SYNC_WAIT); } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dq_state_max_qos(uint64_t dq_state) { dq_state &= DISPATCH_QUEUE_MAX_QOS_MASK; return (dispatch_qos_t)(dq_state >> DISPATCH_QUEUE_MAX_QOS_SHIFT); } DISPATCH_ALWAYS_INLINE static inline uint64_t _dq_state_from_qos(dispatch_qos_t qos) { return (uint64_t)(qos) << DISPATCH_QUEUE_MAX_QOS_SHIFT; } DISPATCH_ALWAYS_INLINE static inline uint64_t _dq_state_merge_qos(uint64_t dq_state, dispatch_qos_t qos) { uint64_t qos_bits = _dq_state_from_qos(qos); if ((dq_state & DISPATCH_QUEUE_MAX_QOS_MASK) < qos_bits) { dq_state &= ~DISPATCH_QUEUE_MAX_QOS_MASK; dq_state |= qos_bits; if (unlikely(_dq_state_is_base_anon(dq_state))) { dq_state |= DISPATCH_QUEUE_RECEIVED_OVERRIDE; } } return dq_state; } DISPATCH_ALWAYS_INLINE static inline dispatch_tid _dq_state_drain_owner(uint64_t dq_state) { return _dispatch_lock_owner((dispatch_lock)dq_state); } #define DISPATCH_QUEUE_DRAIN_OWNER(dq) \ _dq_state_drain_owner(os_atomic_load2o(dq, dq_state, relaxed)) DISPATCH_ALWAYS_INLINE static inline bool _dq_state_drain_locked_by(uint64_t dq_state, dispatch_tid tid) { return _dispatch_lock_is_locked_by((dispatch_lock)dq_state, tid); } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_drain_locked_by_self(uint64_t dq_state) { return _dispatch_lock_is_locked_by_self((dispatch_lock)dq_state); } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_drain_locked(uint64_t dq_state) { return _dispatch_lock_is_locked((dispatch_lock)dq_state); } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_sync_runnable(uint64_t dq_state) { return dq_state < DISPATCH_QUEUE_IN_BARRIER; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_is_runnable(uint64_t dq_state) { return dq_state < DISPATCH_QUEUE_WIDTH_FULL_BIT; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_should_override(uint64_t dq_state) { if (_dq_state_is_suspended(dq_state) || _dq_state_is_enqueued_on_manager(dq_state)) { return false; } if (_dq_state_is_enqueued_on_target(dq_state)) { return true; } if (_dq_state_is_base_wlh(dq_state)) { return false; } return _dq_state_drain_locked(dq_state); } #endif // __cplusplus # 1109 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #pragma mark - #pragma mark dispatch_queue_t state machine static inline pthread_priority_t _dispatch_get_priority(void); static inline dispatch_priority_t _dispatch_get_basepri(void); static inline dispatch_qos_t _dispatch_get_basepri_override_qos_floor(void); static inline void _dispatch_set_basepri_override_qos(dispatch_qos_t qos); static inline void _dispatch_reset_basepri(dispatch_priority_t dbp); static inline dispatch_priority_t _dispatch_set_basepri(dispatch_priority_t dbp); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 1120 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" // Note to later developers: ensure that any initialization changes are // made for statically allocated queues (i.e. _dispatch_main_q). static inline dispatch_queue_class_t _dispatch_queue_init(dispatch_queue_class_t dqu, dispatch_queue_flags_t dqf, uint16_t width, uint64_t initial_state_bits) { uint64_t dq_state = DISPATCH_QUEUE_STATE_INIT_VALUE(width); dispatch_queue_t dq = dqu._dq; dispatch_assert((initial_state_bits & ~(DISPATCH_QUEUE_ROLE_MASK | DISPATCH_QUEUE_INACTIVE)) == 0); if (initial_state_bits & DISPATCH_QUEUE_INACTIVE) { dq_state |= DISPATCH_QUEUE_INACTIVE + DISPATCH_QUEUE_NEEDS_ACTIVATION; dq->do_ref_cnt += 2; // rdar://8181908 see _dispatch_lane_resume if (dx_metatype(dq) == _DISPATCH_SOURCE_TYPE) { dq->do_ref_cnt++; // released when DSF_DELETED is set } } dq_state |= (initial_state_bits & DISPATCH_QUEUE_ROLE_MASK); dq->do_next = DISPATCH_OBJECT_LISTLESS; dqf |= DQF_WIDTH(width); os_atomic_store2o(dq, dq_atomic_flags, dqf, relaxed); dq->dq_state = dq_state; dq->dq_serialnum = os_atomic_inc_orig(&_dispatch_queue_serial_numbers, relaxed); return dqu; } #define _dispatch_queue_alloc(name, dqf, w, initial_state_bits) \ _dispatch_queue_init(_dispatch_object_alloc(DISPATCH_VTABLE(name),\ sizeof(struct dispatch_##name##_s)), dqf, w, initial_state_bits) /* Used by: * - _dispatch_lane_set_target_queue * - changing dispatch source handlers * * Tries to prevent concurrent wakeup of an inactive queue by suspending it. */ DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline bool _dispatch_lane_try_inactive_suspend(dispatch_lane_class_t dqu) { uint64_t old_state, new_state; (void)os_atomic_rmw_loop2o(dqu._dl, dq_state, old_state, new_state, relaxed, { if (unlikely(!_dq_state_is_inactive(old_state))) { os_atomic_rmw_loop_give_up(return false); } new_state = old_state + DISPATCH_QUEUE_SUSPEND_INTERVAL; }); if (unlikely(!_dq_state_is_suspended(old_state) || _dq_state_has_side_suspend_cnt(old_state))) { // Crashing here means that 128+ dispatch_suspend() calls have been // made on an inactive object and then dispatch_set_target_queue() or // dispatch_set_*_handler() has been called. // // We don't want to handle the side suspend count in a codepath that // needs to be fast. DISPATCH_CLIENT_CRASH(0, "Too many calls to dispatch_suspend() " "prior to calling dispatch_set_target_queue() " "or dispatch_set_*_handler()"); } return true; } DISPATCH_ALWAYS_INLINE static inline bool _dq_state_needs_lock_override(uint64_t dq_state, dispatch_qos_t qos) { return _dq_state_is_base_anon(dq_state) && qos < _dq_state_max_qos(dq_state); } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_queue_override_self(uint64_t dq_state) { dispatch_qos_t qos = _dq_state_max_qos(dq_state); _dispatch_wqthread_override_start(_dispatch_tid_self(), qos); // ensure that the root queue sees // that this thread was overridden. _dispatch_set_basepri_override_qos(qos); return qos; } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline uint64_t _dispatch_queue_drain_try_lock(dispatch_queue_t dq, dispatch_invoke_flags_t flags) { uint64_t pending_barrier_width = (dq->dq_width - 1) * DISPATCH_QUEUE_WIDTH_INTERVAL; uint64_t set_owner_and_set_full_width = _dispatch_lock_value_for_self() | DISPATCH_QUEUE_WIDTH_FULL_BIT; uint64_t lock_fail_mask, old_state, new_state, dequeue_mask; // same as !_dq_state_is_runnable() lock_fail_mask = ~(DISPATCH_QUEUE_WIDTH_FULL_BIT - 1); // same as _dq_state_drain_locked() lock_fail_mask |= DISPATCH_QUEUE_DRAIN_OWNER_MASK; if (flags & DISPATCH_INVOKE_STEALING) { lock_fail_mask |= DISPATCH_QUEUE_ENQUEUED_ON_MGR; dequeue_mask = 0; } else if (flags & DISPATCH_INVOKE_MANAGER_DRAIN) { dequeue_mask = DISPATCH_QUEUE_ENQUEUED_ON_MGR; } else { lock_fail_mask |= DISPATCH_QUEUE_ENQUEUED_ON_MGR; dequeue_mask = DISPATCH_QUEUE_ENQUEUED; } dispatch_assert(!(flags & DISPATCH_INVOKE_WLH)); dispatch_qos_t oq_floor = _dispatch_get_basepri_override_qos_floor(); retry: os_atomic_rmw_loop2o(dq, dq_state, old_state, new_state, acquire, { new_state = old_state; if (likely(!(old_state & lock_fail_mask))) { if (unlikely(_dq_state_needs_lock_override(old_state, oq_floor))) { os_atomic_rmw_loop_give_up({ oq_floor = _dispatch_queue_override_self(old_state); goto retry; }); } // // Only keep the HAS_WAITER, MAX_QOS and ENQUEUED bits // In particular acquiring the drain lock clears the DIRTY and // RECEIVED_OVERRIDE bits. // new_state &= DISPATCH_QUEUE_DRAIN_PRESERVED_BITS_MASK; new_state |= set_owner_and_set_full_width; if (_dq_state_has_pending_barrier(old_state) || old_state + pending_barrier_width < DISPATCH_QUEUE_WIDTH_FULL_BIT) { new_state |= DISPATCH_QUEUE_IN_BARRIER; } } else if (dequeue_mask) { // dequeue_mask is in a register, xor yields better assembly new_state ^= dequeue_mask; } else { os_atomic_rmw_loop_give_up(break); } }); dispatch_assert((old_state & dequeue_mask) == dequeue_mask); if (likely(!(old_state & lock_fail_mask))) { new_state &= DISPATCH_QUEUE_IN_BARRIER | DISPATCH_QUEUE_WIDTH_FULL_BIT | dequeue_mask; old_state &= DISPATCH_QUEUE_WIDTH_MASK; return new_state - old_state; } return 0; } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline bool _dispatch_queue_drain_try_lock_wlh(dispatch_queue_t dq, uint64_t *dq_state) { uint64_t old_state, new_state; uint64_t lock_bits = _dispatch_lock_value_for_self() | DISPATCH_QUEUE_WIDTH_FULL_BIT | DISPATCH_QUEUE_IN_BARRIER; os_atomic_rmw_loop2o(dq, dq_state, old_state, new_state, acquire, { new_state = old_state; if (unlikely(_dq_state_is_suspended(old_state))) { new_state &= ~DISPATCH_QUEUE_ENQUEUED; } else if (unlikely(_dq_state_drain_locked(old_state))) { os_atomic_rmw_loop_give_up(break); } else { new_state &= DISPATCH_QUEUE_DRAIN_PRESERVED_BITS_MASK; new_state |= lock_bits; } }); if (unlikely(!_dq_state_is_base_wlh(old_state) || !_dq_state_is_enqueued_on_target(old_state) || _dq_state_is_enqueued_on_manager(old_state))) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_SIZEOF_PTR == 4 #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1298 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" old_state >>= 32; #endif # 1300 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_INTERNAL_CRASH(old_state, "Invalid wlh state"); } if (dq_state) *dq_state = new_state; return !_dq_state_is_suspended(old_state) && !_dq_state_drain_locked(old_state); } /* Used by _dispatch_barrier_{try,}sync * * Note, this fails if any of e:1 or dl!=0, but that allows this code to be a * simple cmpxchg which is significantly faster on Intel, and makes a * significant difference on the uncontended codepath. * * See discussion for DISPATCH_QUEUE_DIRTY in queue_internal.h * * Initial state must be `completely idle` * Final state forces { ib:1, qf:1, w:0 } */ DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline bool _dispatch_queue_try_acquire_barrier_sync_and_suspend(dispatch_lane_t dq, uint32_t tid, uint64_t suspend_count) { uint64_t init = DISPATCH_QUEUE_STATE_INIT_VALUE(dq->dq_width); uint64_t value = DISPATCH_QUEUE_WIDTH_FULL_BIT | DISPATCH_QUEUE_IN_BARRIER | _dispatch_lock_value_from_tid(tid) | (suspend_count * DISPATCH_QUEUE_SUSPEND_INTERVAL); uint64_t old_state, new_state; return os_atomic_rmw_loop2o(dq, dq_state, old_state, new_state, acquire, { uint64_t role = old_state & DISPATCH_QUEUE_ROLE_MASK; if (old_state != (init | role)) { os_atomic_rmw_loop_give_up(break); } new_state = value | role; }); } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline bool _dispatch_queue_try_acquire_barrier_sync(dispatch_queue_class_t dq, uint32_t tid) { return _dispatch_queue_try_acquire_barrier_sync_and_suspend(dq._dl, tid, 0); } /* Used by _dispatch_sync for root queues and some drain codepaths * * Root queues have no strict orderning and dispatch_sync() always goes through. * Drain is the sole setter of `dl` hence can use this non failing version of * _dispatch_queue_try_acquire_sync(). * * Final state: { w += 1 } */ DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_reserve_sync_width(dispatch_lane_t dq) { os_atomic_add2o(dq, dq_state, DISPATCH_QUEUE_WIDTH_INTERVAL, relaxed); } /* Used by _dispatch_sync on non-serial queues * * Initial state must be { sc:0, ib:0, pb:0, d:0 } * Final state: { w += 1 } */ DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline bool _dispatch_queue_try_reserve_sync_width(dispatch_lane_t dq) { uint64_t old_state, new_state; // reserving non barrier width // doesn't fail if only the ENQUEUED bit is set (unlike its barrier width // equivalent), so we have to check that this thread hasn't enqueued // anything ahead of this call or we can break ordering if (unlikely(dq->dq_items_tail)) { return false; } return os_atomic_rmw_loop2o(dq, dq_state, old_state, new_state, relaxed, { if (unlikely(!_dq_state_is_sync_runnable(old_state)) || _dq_state_is_dirty(old_state) || _dq_state_has_pending_barrier(old_state)) { os_atomic_rmw_loop_give_up(return false); } new_state = old_state + DISPATCH_QUEUE_WIDTH_INTERVAL; }); } /* Used by target-queue recursing code * * Initial state must be { sc:0, ib:0, qf:0, pb:0, d:0 } * Final state: { w += 1 } */ DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline bool _dispatch_queue_try_acquire_async(dispatch_lane_t dq) { uint64_t old_state, new_state; return os_atomic_rmw_loop2o(dq, dq_state, old_state, new_state, acquire, { if (unlikely(!_dq_state_is_runnable(old_state) || _dq_state_is_dirty(old_state) || _dq_state_has_pending_barrier(old_state))) { os_atomic_rmw_loop_give_up(return false); } new_state = old_state + DISPATCH_QUEUE_WIDTH_INTERVAL; }); } /* Used by concurrent drain * * Either acquires the full barrier width, in which case the Final state is: * { ib:1 qf:1 pb:0 d:0 } * Or if there isn't enough width prepare the queue with the PENDING_BARRIER bit * { ib:0 pb:1 d:0} * * This always clears the dirty bit as we know for sure we shouldn't reevaluate * the state machine here */ DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline bool _dispatch_queue_try_upgrade_full_width(dispatch_lane_t dq, uint64_t owned) { uint64_t old_state, new_state; uint64_t pending_barrier_width = DISPATCH_QUEUE_PENDING_BARRIER + (dq->dq_width - 1) * DISPATCH_QUEUE_WIDTH_INTERVAL; os_atomic_rmw_loop2o(dq, dq_state, old_state, new_state, acquire, { new_state = old_state - owned; if (likely(!_dq_state_has_pending_barrier(old_state))) { new_state += pending_barrier_width; } if (likely(_dq_state_is_runnable(new_state))) { new_state += DISPATCH_QUEUE_WIDTH_INTERVAL; new_state += DISPATCH_QUEUE_IN_BARRIER; new_state -= DISPATCH_QUEUE_PENDING_BARRIER; } new_state &= ~DISPATCH_QUEUE_DIRTY; }); return new_state & DISPATCH_QUEUE_IN_BARRIER; } /* Used at the end of Drainers * * This adjusts the `owned` width when the next continuation is already known * to account for its barrierness. */ DISPATCH_ALWAYS_INLINE static inline uint64_t _dispatch_queue_adjust_owned(dispatch_queue_class_t dq, uint64_t owned, struct dispatch_object_s *next_dc) { uint16_t dq_width = dq._dq->dq_width; uint64_t reservation; if (unlikely(dq_width > 1)) { if (next_dc && _dispatch_object_is_barrier(next_dc)) { reservation = DISPATCH_QUEUE_PENDING_BARRIER; reservation += (dq_width - 1) * DISPATCH_QUEUE_WIDTH_INTERVAL; owned -= reservation; } } return owned; } /* Used at the end of Drainers * * Unlocking fails if the DIRTY bit is seen (and the queue is not suspended). * In that case, only the DIRTY bit is cleared. The DIRTY bit is therefore used * as a signal to renew the drain lock instead of releasing it. * * Successful unlock forces { dl:0, d:!done, qo:0 } and gives back `owned` */ DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline bool _dispatch_queue_drain_try_unlock(dispatch_queue_t dq, uint64_t owned, bool done) { uint64_t old_state, new_state; os_atomic_rmw_loop2o(dq, dq_state, old_state, new_state, release, { new_state = old_state - owned; new_state &= ~DISPATCH_QUEUE_DRAIN_UNLOCK_MASK; if (unlikely(_dq_state_is_suspended(old_state))) { // nothing to do } else if (unlikely(_dq_state_is_dirty(old_state))) { os_atomic_rmw_loop_give_up({ // just renew the drain lock with an acquire barrier, to see // what the enqueuer that set DIRTY has done. // the xor generates better assembly as DISPATCH_QUEUE_DIRTY // is already in a register os_atomic_xor2o(dq, dq_state, DISPATCH_QUEUE_DIRTY, acquire); return false; }); } else if (likely(done)) { new_state &= ~DISPATCH_QUEUE_MAX_QOS_MASK; } else { new_state |= DISPATCH_QUEUE_DIRTY; } }); if (_dq_state_received_override(old_state)) { // Ensure that the root queue sees that this thread was overridden. _dispatch_set_basepri_override_qos(_dq_state_max_qos(old_state)); } return true; } #pragma mark - #pragma mark os_mpsc_queue #define _os_mpsc_head(q, _ns, ...) &(q)->_ns##_head ##__VA_ARGS__ #define _os_mpsc_tail(q, _ns, ...) &(q)->_ns##_tail ##__VA_ARGS__ #define os_mpsc(q, _ns, ...) (q, _ns, __VA_ARGS__) #define os_mpsc_node_type(Q) _os_atomic_basetypeof(_os_mpsc_head Q) // // Multi Producer calls, can be used safely concurrently // // Returns true when the queue was empty and the head must be set #define os_mpsc_push_update_tail(Q, tail, _o_next) ({ \ os_mpsc_node_type(Q) _tl = (tail); \ os_atomic_store2o(_tl, _o_next, NULL, relaxed); \ os_atomic_xchg(_os_mpsc_tail Q, _tl, release); \ }) #define os_mpsc_push_was_empty(prev) ((prev) == NULL) #define os_mpsc_push_update_prev(Q, prev, head, _o_next) ({ \ os_mpsc_node_type(Q) _prev = (prev); \ if (likely(_prev)) { \ (void)os_atomic_store2o(_prev, _o_next, (head), relaxed); \ } else { \ (void)os_atomic_store(_os_mpsc_head Q, (head), relaxed); \ } \ }) #define os_mpsc_push_list(Q, head, tail, _o_next) ({ \ os_mpsc_node_type(Q) _token; \ _token = os_mpsc_push_update_tail(Q, tail, _o_next); \ os_mpsc_push_update_prev(Q, _token, head, _o_next); \ os_mpsc_push_was_empty(_token); \ }) // Returns true when the queue was empty and the head must be set #define os_mpsc_push_item(Q, tail, _o_next) ({ \ os_mpsc_node_type(Q) _tail = (tail); \ os_mpsc_push_list(Q, _tail, _tail, _o_next); \ }) // // Single Consumer calls, can NOT be used safely concurrently // #define os_mpsc_looks_empty(Q) \ (os_atomic_load(_os_mpsc_tail Q, relaxed) == NULL) #define os_mpsc_get_head(Q) ({ \ __typeof__(_os_mpsc_head Q) __n = _os_mpsc_head Q; \ os_mpsc_node_type(Q) _node; \ _node = os_atomic_load(__n, dependency); \ if (unlikely(_node == NULL)) { \ _node = _dispatch_wait_for_enqueuer((void **)__n); \ } \ _node; \ }) #define os_mpsc_get_next(_n, _o_next) ({ \ __typeof__(_n) __n = (_n); \ _os_atomic_basetypeof(&__n->_o_next) _node; \ _node = os_atomic_load(&__n->_o_next, dependency); \ if (unlikely(_node == NULL)) { \ _node = _dispatch_wait_for_enqueuer((void **)&__n->_o_next); \ } \ _node; \ }) #define os_mpsc_pop_head(Q, head, _o_next) ({ \ os_mpsc_node_type(Q) _head = (head), _n; \ _n = os_atomic_load2o(_head, _o_next, dependency); \ os_atomic_store(_os_mpsc_head Q, _n, relaxed); \ /* 22708742: set tail to NULL with release, so that NULL write */ \ /* to head above doesn't clobber head from concurrent enqueuer */ \ if (unlikely(!_n && \ !os_atomic_cmpxchg(_os_mpsc_tail Q, _head, NULL, release))) { \ _n = os_mpsc_get_next(_head, _o_next); \ os_atomic_store(_os_mpsc_head Q, _n, relaxed); \ } \ _n; \ }) #define os_mpsc_undo_pop_list(Q, head, tail, next, _o_next) ({ \ os_mpsc_node_type(Q) _hd = (head), _tl = (tail), _n = (next); \ os_atomic_store2o(_tl, _o_next, _n, relaxed); \ if (unlikely(!_n && \ !os_atomic_cmpxchg(_os_mpsc_tail Q, NULL, _tl, release))) { \ _n = os_mpsc_get_head(Q); \ os_atomic_store2o(_tl, _o_next, _n, relaxed); \ } \ os_atomic_store(_os_mpsc_head Q, _hd, relaxed); \ }) #define os_mpsc_undo_pop_head(Q, head, next, _o_next) ({ \ os_mpsc_node_type(Q) _head = (head); \ os_mpsc_undo_pop_list(Q, _head, _head, next, _o_next); \ }) #define os_mpsc_capture_snapshot(Q, tail) ({ \ os_mpsc_node_type(Q) _head = os_mpsc_get_head(Q); \ os_atomic_store(_os_mpsc_head Q, NULL, relaxed); \ /* 22708742: set tail to NULL with release, so that NULL write */ \ /* to head above doesn't clobber head from concurrent enqueuer */ \ *(tail) = os_atomic_xchg(_os_mpsc_tail Q, NULL, release); \ _head; \ }) #define os_mpsc_pop_snapshot_head(head, tail, _o_next) ({ \ __typeof__(head) _head = (head), _tail = (tail), _n = NULL; \ if (_head != _tail) _n = os_mpsc_get_next(_head, _o_next); \ _n; \ }) #define os_mpsc_prepend(Q, head, tail, _o_next) ({ \ os_mpsc_node_type(Q) _n = os_atomic_load(_os_mpsc_head Q, relaxed); \ os_mpsc_undo_pop_list(Q, head, tail, _n, _o_next); \ }) #pragma mark - #pragma mark dispatch_queue_t tq lock DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_sidelock_trylock(dispatch_lane_t dq, dispatch_qos_t qos) { dispatch_tid owner; if (_dispatch_unfair_lock_trylock(&dq->dq_sidelock, &owner)) { return true; } _dispatch_wqthread_override_start_check_owner(owner, qos, &dq->dq_sidelock.dul_lock); return false; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_sidelock_lock(dispatch_lane_t dq) { return _dispatch_unfair_lock_lock(&dq->dq_sidelock); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_sidelock_tryunlock(dispatch_lane_t dq) { if (_dispatch_unfair_lock_tryunlock(&dq->dq_sidelock)) { return true; } // Ensure that the root queue sees that this thread was overridden. // Since we don't know which override QoS was used, use MAINTENANCE // as a marker for _dispatch_reset_basepri_override() _dispatch_set_basepri_override_qos(DISPATCH_QOS_MAINTENANCE); return false; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_sidelock_unlock(dispatch_lane_t dq) { if (_dispatch_unfair_lock_unlock_had_failed_trylock(&dq->dq_sidelock)) { // Ensure that the root queue sees that this thread was overridden. // Since we don't know which override QoS was used, use MAINTENANCE // as a marker for _dispatch_reset_basepri_override() _dispatch_set_basepri_override_qos(DISPATCH_QOS_MAINTENANCE); } } #pragma mark - #pragma mark dispatch_queue_t misc DISPATCH_ALWAYS_INLINE static inline dispatch_queue_t _dispatch_queue_get_current(void) { return (dispatch_queue_t)_dispatch_thread_getspecific(dispatch_queue_key); } DISPATCH_ALWAYS_INLINE static inline dispatch_queue_t _dispatch_queue_get_current_or_default(void) { int idx = DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS_OVERCOMMIT; return _dispatch_queue_get_current() ?: _dispatch_root_queues[idx]._as_dq; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_set_current(dispatch_queue_class_t dqu) { _dispatch_thread_setspecific(dispatch_queue_key, dqu._dq); } DISPATCH_ALWAYS_INLINE static inline struct dispatch_object_s* _dispatch_queue_get_head(dispatch_lane_class_t dq) { return os_mpsc_get_head(os_mpsc(dq._dl, dq_items)); } DISPATCH_ALWAYS_INLINE static inline struct dispatch_object_s* _dispatch_queue_pop_head(dispatch_lane_class_t dq, struct dispatch_object_s *dc) { return os_mpsc_pop_head(os_mpsc(dq._dl, dq_items), dc, do_next); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_push_item(dispatch_lane_class_t dqu, dispatch_object_t dou) { return os_mpsc_push_item(os_mpsc(dqu._dl, dq_items), dou._do, do_next); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_root_queue_push_inline(dispatch_queue_global_t dq, dispatch_object_t _head, dispatch_object_t _tail, int n) { struct dispatch_object_s *hd = _head._do, *tl = _tail._do; if (unlikely(os_mpsc_push_list(os_mpsc(dq, dq_items), hd, tl, do_next))) { return _dispatch_root_queue_poke(dq, n, 0); } } #if 0 /* expanded by -frewrite-includes */ #include "trace.h" #endif /* expanded by -frewrite-includes */ # 1737 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" 1 /* * Copyright (c) 2010-2013 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ /* * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch * which are subject to change in future releases of Mac OS X. Any applications * relying on these interfaces WILL break. */ #ifndef __DISPATCH_TRACE__ #define __DISPATCH_TRACE__ #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_PURE_C #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DTRACE_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 33 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define _dispatch_trace_callout(_c, _f, _dcc) do { \ if (unlikely(DISPATCH_CALLOUT_ENTRY_ENABLED() || \ DISPATCH_CALLOUT_RETURN_ENABLED())) { \ dispatch_queue_t _dq = _dispatch_queue_get_current(); \ const char *_label = _dq && _dq->dq_label ? _dq->dq_label : ""; \ dispatch_function_t _func = (dispatch_function_t)(_f); \ void *_ctxt = (_c); \ DISPATCH_CALLOUT_ENTRY(_dq, _label, _func, _ctxt); \ _dcc; \ DISPATCH_CALLOUT_RETURN(_dq, _label, _func, _ctxt); \ } else { \ _dcc; \ } \ } while (0) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define _dispatch_trace_callout(_c, _f, _dcc) \ do { (void)(_c); (void)(_f); _dcc; } while (0) #endif // DISPATCH_USE_DTRACE_INTROSPECTION || DISPATCH_INTROSPECTION # 51 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DTRACE_INTROSPECTION || DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 53 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_client_callout(void *ctxt, dispatch_function_t f) { dispatch_function_t func = (f == _dispatch_call_block_and_release && ctxt ? _dispatch_Block_invoke(ctxt) : f); _dispatch_introspection_callout_entry(ctxt, func); _dispatch_trace_callout(ctxt, func, _dispatch_client_callout(ctxt, f)); _dispatch_introspection_callout_return(ctxt, func); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_client_callout2(void *ctxt, size_t i, void (*f)(void *, size_t)) { dispatch_function_t func = (dispatch_function_t)f; _dispatch_introspection_callout_entry(ctxt, func); _dispatch_trace_callout(ctxt, func, _dispatch_client_callout2(ctxt, i, f)); _dispatch_introspection_callout_return(ctxt, func); } #define _dispatch_client_callout _dispatch_trace_client_callout #define _dispatch_client_callout2 _dispatch_trace_client_callout2 #endif // DISPATCH_USE_DTRACE_INTROSPECTION || DISPATCH_INTROSPECTION # 77 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #ifdef _COMM_PAGE_KDEBUG_ENABLE #define DISPATCH_KTRACE_ENABLED \ (*(volatile uint32_t *)_COMM_PAGE_KDEBUG_ENABLE != 0) #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 83 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define _dispatch_only_if_ktrace_enabled(...) \ if (unlikely(DISPATCH_KTRACE_ENABLED)) ({ __VA_ARGS__; }) #else # 86 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define _dispatch_only_if_ktrace_enabled(...) (void)0 #endif /* DISPATCH_INTROSPECTION */ # 88 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #else /* _COMM_PAGE_KDEBUG_ENABLE */ # 90 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define DISPATCH_KTRACE_ENABLED 0 #define _dispatch_only_if_ktrace_enabled(...) (void)0 #endif /* _COMM_PAGE_KDEBUG_ENABLE */ # 94 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DTRACE_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 97 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define _dispatch_trace_continuation(_q, _o, _t) do { \ dispatch_queue_t _dq = (_q); \ const char *_label = _dq && _dq->dq_label ? _dq->dq_label : ""; \ struct dispatch_object_s *_do = (_o); \ dispatch_continuation_t _dc; \ char *_kind; \ dispatch_function_t _func; \ void *_ctxt; \ if (_dispatch_object_has_vtable(_do)) { \ _kind = (char*)_dispatch_object_class_name(_do); \ if ((dx_metatype(_do) == _DISPATCH_SOURCE_TYPE) && \ _dq != _dispatch_mgr_q._as_dq) { \ dispatch_source_t _ds = (dispatch_source_t)_do; \ _dc = os_atomic_load(&_ds->ds_refs->ds_handler[ \ DS_EVENT_HANDLER], relaxed); \ _func = _dc ? _dc->dc_func : NULL; \ _ctxt = _dc ? _dc->dc_ctxt : NULL; \ } else { \ _func = (dispatch_function_t)_dispatch_lane_invoke; \ _ctxt = _do->do_ctxt; \ } \ } else { \ _dc = (void*)_do; \ _ctxt = _dc->dc_ctxt; \ if (_dc->dc_flags & DC_FLAG_SYNC_WAITER) { \ _kind = "semaphore"; \ _func = (dispatch_function_t)dispatch_semaphore_signal; \ } else if (_dc->dc_flags & DC_FLAG_BLOCK) { \ _kind = "block"; \ _func = _dispatch_Block_invoke(_dc->dc_ctxt); \ } else { \ _kind = "function"; \ _func = _dc->dc_func; \ } \ } \ _t(_dq, _label, _do, _kind, _func, _ctxt); \ } while (0) #if 0 /* disabled by -frewrite-includes */ #if 0 #elif DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #elif 0 /* evaluated by -frewrite-includes */ # 135 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define _dispatch_trace_continuation(_q, _o, _t) \ do { (void)(_q); (void)(_o); } while(0) #define DISPATCH_QUEUE_PUSH_ENABLED() 0 #define DISPATCH_QUEUE_POP_ENABLED() 0 #endif // DISPATCH_USE_DTRACE_INTROSPECTION || DISPATCH_INTROSPECTION # 140 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DTRACE_INTROSPECTION || DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 142 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" DISPATCH_ALWAYS_INLINE static inline dispatch_queue_class_t _dispatch_trace_queue_create(dispatch_queue_class_t dqu) { _dispatch_only_if_ktrace_enabled({ uint64_t dq_label[4] = {0}; // So that we get the right null termination dispatch_queue_t dq = dqu._dq; strncpy((char *)dq_label, (char *)dq->dq_label ?: "", sizeof(dq_label)); _dispatch_ktrace2(DISPATCH_QOS_TRACE_queue_creation_start, dq->dq_serialnum, _dispatch_priority_to_pp_prefer_fallback(dq->dq_priority)); _dispatch_ktrace4(DISPATCH_QOS_TRACE_queue_creation_end, dq_label[0], dq_label[1], dq_label[2], dq_label[3]); }); return _dispatch_introspection_queue_create(dqu); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_queue_dispose(dispatch_queue_class_t dqu) { _dispatch_ktrace1(DISPATCH_QOS_TRACE_queue_dispose, (dqu._dq)->dq_serialnum); _dispatch_introspection_queue_dispose(dqu); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_source_dispose(dispatch_source_t ds) { _dispatch_ktrace1(DISPATCH_QOS_TRACE_src_dispose, (uintptr_t)ds); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_block_create_with_voucher_and_priority(dispatch_block_t db, void *func, dispatch_block_flags_t original_flags, pthread_priority_t original_priority, pthread_priority_t thread_prio, pthread_priority_t final_block_prio) { _dispatch_ktrace4(DISPATCH_QOS_TRACE_private_block_creation, (uintptr_t)db, (uintptr_t)func, BITPACK_UINT32_PAIR(original_flags, original_priority), BITPACK_UINT32_PAIR(thread_prio, final_block_prio)); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_firehose_reserver_gave_up(uint8_t stream, uint8_t ref, bool waited, uint64_t old_state, uint64_t new_state) { uint64_t first = ((uint64_t)ref << 8) | (uint64_t)stream; uint64_t second = waited; _dispatch_ktrace4(DISPATCH_FIREHOSE_TRACE_reserver_gave_up, first, second, old_state, new_state); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_firehose_reserver_wait(uint8_t stream, uint8_t ref, bool waited, uint64_t old_state, uint64_t new_state, bool reliable) { uint64_t first = ((uint64_t)ref << 8) | (uint64_t)stream; uint64_t second = ((uint64_t)reliable << 1) | waited; _dispatch_ktrace4(DISPATCH_FIREHOSE_TRACE_reserver_wait, first, second, old_state, new_state); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_firehose_allocator(uint64_t ask0, uint64_t ask1, uint64_t old_state, uint64_t new_state) { _dispatch_ktrace4(DISPATCH_FIREHOSE_TRACE_allocator, ask0, ask1, old_state, new_state); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_firehose_wait_for_logd(uint8_t stream, uint64_t timestamp, uint64_t old_state, uint64_t new_state) { _dispatch_ktrace4(DISPATCH_FIREHOSE_TRACE_wait_for_logd, stream, timestamp, old_state, new_state); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_firehose_chunk_install(uint64_t ask0, uint64_t ask1, uint64_t old_state, uint64_t new_state) { _dispatch_ktrace4(DISPATCH_FIREHOSE_TRACE_chunk_install, ask0, ask1, old_state, new_state); } /* Implemented in introspection.c */ void _dispatch_trace_item_push_internal(dispatch_queue_t dq, dispatch_object_t dou); #define _dispatch_trace_item_push_inline(...) \ _dispatch_only_if_ktrace_enabled({ \ _dispatch_trace_item_push_internal(__VA_ARGS__); \ }) DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_item_push_list(dispatch_queue_global_t dq, dispatch_object_t _head, dispatch_object_t _tail) { if (unlikely(DISPATCH_QUEUE_PUSH_ENABLED() || DISPATCH_KTRACE_ENABLED)) { struct dispatch_object_s *dou = _head._do; do { if (unlikely(DISPATCH_QUEUE_PUSH_ENABLED())) { _dispatch_trace_continuation(dq->_as_dq, dou, DISPATCH_QUEUE_PUSH); } _dispatch_trace_item_push_inline(dq->_as_dq, dou); } while (dou != _tail._do && (dou = dou->do_next)); } _dispatch_introspection_queue_push_list(dq, _head, _tail); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_item_push(dispatch_queue_class_t dqu, dispatch_object_t _tail) { if (unlikely(DISPATCH_QUEUE_PUSH_ENABLED())) { _dispatch_trace_continuation(dqu._dq, _tail._do, DISPATCH_QUEUE_PUSH); } _dispatch_trace_item_push_inline(dqu._dq, _tail._do); _dispatch_introspection_queue_push(dqu, _tail); } /* Implemented in introspection.c */ void _dispatch_trace_item_pop_internal(dispatch_queue_t dq, dispatch_object_t dou); #define _dispatch_trace_item_pop_inline(...) \ _dispatch_only_if_ktrace_enabled({ \ _dispatch_trace_item_pop_internal(__VA_ARGS__); \ }) DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_item_pop(dispatch_queue_class_t dqu, dispatch_object_t dou) { if (unlikely(DISPATCH_QUEUE_POP_ENABLED())) { _dispatch_trace_continuation(dqu._dq, dou._do, DISPATCH_QUEUE_POP); } _dispatch_trace_item_pop_inline(dqu._dq, dou); _dispatch_introspection_queue_pop(dqu, dou); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_item_complete_inline(dispatch_object_t dou) { _dispatch_ktrace1(DISPATCH_QOS_TRACE_queue_item_complete, dou._do_value); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_item_complete(dispatch_object_t dou) { _dispatch_trace_item_complete_inline(dou); _dispatch_introspection_queue_item_complete(dou); } DISPATCH_ALWAYS_INLINE static inline struct dispatch_object_s * _dispatch_trace_item_sync_push_pop(dispatch_queue_class_t dqu, void *ctx, dispatch_function_t f, uintptr_t dc_flags) { // No need to add tracing here since the introspection calls out to // _trace_item_push and _trace_item_pop return _dispatch_introspection_queue_fake_sync_push_pop(dqu._dq, ctx, f, dc_flags); } /* Implemented in introspection.c */ void _dispatch_trace_source_callout_entry_internal(dispatch_source_t ds, long kind, dispatch_queue_t dq, dispatch_continuation_t dc); #define _dispatch_trace_source_callout_entry(...) \ _dispatch_only_if_ktrace_enabled({ \ _dispatch_trace_source_callout_entry_internal(__VA_ARGS__); \ }) #define _dispatch_trace_runtime_event(evt, ptr, value) \ _dispatch_introspection_runtime_event(\ dispatch_introspection_runtime_event_##evt, ptr, value) #define DISPATCH_TRACE_ARG(arg) , arg #else # 343 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define _dispatch_trace_queue_create _dispatch_introspection_queue_create #define _dispatch_trace_queue_dispose _dispatch_introspection_queue_dispose #define _dispatch_trace_source_dispose(ds) ((void)0) #define _dispatch_trace_block_create_with_voucher_and_priority(_db, _func, \ _flags, _pri, _tpri, _bpri) \ do { (void)_db; (void)_func; (void) _flags; (void) _pri; (void) _tpri; \ (void) _bpri; } while (0) #define _dispatch_trace_firehose_reserver_gave_up(stream, ref, waited, \ old_state, new_state) \ do { (void)(stream); (void)(ref); (void)(waited); (void)(old_state); \ (void)(new_state); } while (0) #define _dispatch_trace_firehose_reserver_wait(stream, ref, waited, \ old_state, new_state, reliable) \ do { (void)(stream); (void)(ref); (void)(waited); (void)(old_state); \ (void)(new_state); (void)(reliable); } while (0) #define _dispatch_trace_firehose_allocator(ask0, ask1, old_state, new_state) \ do { (void)(ask0); (void)(ask1); (void)(old_state); \ (void)(new_state); } while (0) #define _dispatch_trace_firehose_wait_for_logd(stream, timestamp, old_state, \ new_state) \ do { (void)(stream); (void)(timestamp); (void)(old_state); \ (void)(new_state); } while (0) #define _dispatch_trace_firehose_chunk_install(ask0, ask1, old_state, \ new_state) \ do { (void)(ask0); (void)(ask1); (void)(old_state); \ (void)(new_state); } while (0) #define _dispatch_trace_item_push(dq, dou) \ do { (void)(dq); (void)(dou); } while(0) #define _dispatch_trace_item_push_list(dq, head, tail) \ do { (void)(dq); (void)(head); (void)tail; } while(0) #define _dispatch_trace_item_pop(dq, dou) \ do { (void)(dq); (void)(dou); } while(0) #define _dispatch_trace_item_complete(dou) ((void)0) #define _dispatch_trace_item_sync_push_pop(dq, ctxt, func, flags) \ do { (void)(dq); (void)(ctxt); (void)(func); (void)(flags); } while(0) #define _dispatch_trace_source_callout_entry(ds, k, dq, dc) ((void)0) #define _dispatch_trace_runtime_event(evt, ptr, value) \ do { (void)(ptr); (void)(value); } while(0) #define DISPATCH_TRACE_ARG(arg) #endif // DISPATCH_USE_DTRACE_INTROSPECTION || DISPATCH_INTROSPECTION # 383 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_DTRACE #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 385 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" static inline dispatch_function_t _dispatch_trace_timer_function(dispatch_timer_source_refs_t dr) { dispatch_continuation_t dc; dc = os_atomic_load(&dr->ds_handler[DS_EVENT_HANDLER], relaxed); return dc ? dc->dc_func : NULL; } DISPATCH_ALWAYS_INLINE static inline uint64_t _dispatch_time_clock_to_nsecs(dispatch_clock_t clock, uint64_t t) { #if 0 /* disabled by -frewrite-includes */ #if !DISPATCH_TIME_UNIT_USES_NANOSECONDS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 398 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" switch (clock) { case DISPATCH_CLOCK_MONOTONIC: case DISPATCH_CLOCK_UPTIME: return _dispatch_time_mach2nano(t); case DISPATCH_CLOCK_WALL: return t; } #else # 406 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" (void)clock; return t; #endif # 409 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" } DISPATCH_ALWAYS_INLINE static inline dispatch_trace_timer_params_t _dispatch_trace_timer_params(dispatch_clock_t clock, struct dispatch_timer_source_s *values, uint64_t deadline, dispatch_trace_timer_params_t params) { #define _dispatch_trace_time2nano3(t) \ (_dispatch_time_clock_to_nsecs(clock, t)) #define _dispatch_trace_time2nano2(v, t) ({ uint64_t _t = (t); \ (v) >= INT64_MAX ? -1ll : (int64_t)_dispatch_trace_time2nano3(_t);}) #define _dispatch_trace_time2nano(v) ({ uint64_t _t; \ _t = _dispatch_trace_time2nano3(v); _t >= INT64_MAX ? -1ll : \ (int64_t)_t; }) if (deadline) { params->deadline = (int64_t)deadline; } else { uint64_t now = _dispatch_time_now(clock); params->deadline = _dispatch_trace_time2nano2(values->target, values->target < now ? 0 : values->target - now); } uint64_t leeway = values->deadline - values->target; params->interval = _dispatch_trace_time2nano(values->interval); params->leeway = _dispatch_trace_time2nano(leeway); return params; } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_trace_timer_configure_enabled(void) { return DISPATCH_TIMER_CONFIGURE_ENABLED(); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_timer_configure(dispatch_source_t ds, dispatch_clock_t clock, struct dispatch_timer_source_s *values) { dispatch_timer_source_refs_t dr = ds->ds_timer_refs; struct dispatch_trace_timer_params_s params; DISPATCH_TIMER_CONFIGURE(ds, _dispatch_trace_timer_function(dr), _dispatch_trace_timer_params(clock, values, 0, ¶ms)); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_timer_program(dispatch_timer_source_refs_t dr, uint64_t deadline) { if (unlikely(DISPATCH_TIMER_PROGRAM_ENABLED())) { if (deadline && dr) { dispatch_source_t ds = _dispatch_source_from_refs(dr); dispatch_clock_t clock = DISPATCH_TIMER_CLOCK(dr->du_ident); struct dispatch_trace_timer_params_s params; DISPATCH_TIMER_PROGRAM(ds, _dispatch_trace_timer_function(dr), _dispatch_trace_timer_params(clock, &dr->dt_timer, deadline, ¶ms)); } } } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_timer_wake(dispatch_timer_source_refs_t dr) { if (unlikely(DISPATCH_TIMER_WAKE_ENABLED())) { if (dr) { dispatch_source_t ds = _dispatch_source_from_refs(dr); DISPATCH_TIMER_WAKE(ds, _dispatch_trace_timer_function(dr)); } } } DISPATCH_ALWAYS_INLINE static inline void _dispatch_trace_timer_fire(dispatch_timer_source_refs_t dr, uint64_t data, uint64_t missed) { if (unlikely(DISPATCH_TIMER_FIRE_ENABLED())) { if (!(data - missed) && dr) { dispatch_source_t ds = _dispatch_source_from_refs(dr); DISPATCH_TIMER_FIRE(ds, _dispatch_trace_timer_function(dr)); } } } #else # 497 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #define _dispatch_trace_timer_configure_enabled() false #define _dispatch_trace_timer_configure(ds, clock, values) \ do { (void)(ds); (void)(clock); (void)(values); } while(0) #define _dispatch_trace_timer_program(dr, deadline) \ do { (void)(dr); (void)(deadline); } while(0) #define _dispatch_trace_timer_wake(dr) \ do { (void)(dr); } while(0) #define _dispatch_trace_timer_fire(dr, data, missed) \ do { (void)(dr); (void)(data); (void)(missed); } while(0) #endif // DISPATCH_USE_DTRACE # 509 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #endif // DISPATCH_PURE_C # 511 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" #endif // __DISPATCH_TRACE__ # 513 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/trace.h" # 1738 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" 2 DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_push_queue(dispatch_queue_t tq, dispatch_queue_class_t dq, uint64_t dq_state) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_USE_KEVENT_WORKLOOP #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1745 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if (likely(_dq_state_is_base_wlh(dq_state))) { _dispatch_trace_runtime_event(worker_request, dq._dq, 1); return _dispatch_event_loop_poke((dispatch_wlh_t)dq._dq, dq_state, DISPATCH_EVENT_LOOP_CONSUME_2); } #endif // DISPATCH_USE_KEVENT_WORKLOOP # 1751 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" _dispatch_trace_item_push(tq, dq); return dx_push(tq, dq, _dq_state_max_qos(dq_state)); } DISPATCH_ALWAYS_INLINE static inline dispatch_priority_t _dispatch_root_queue_identity_assume(dispatch_queue_global_t assumed_rq) { dispatch_priority_t old_dbp = _dispatch_get_basepri(); dispatch_assert(dx_hastypeflag(assumed_rq, QUEUE_ROOT)); _dispatch_reset_basepri(assumed_rq->dq_priority); _dispatch_queue_set_current(assumed_rq); return old_dbp; } typedef dispatch_queue_wakeup_target_t _dispatch_queue_class_invoke_handler_t(dispatch_queue_class_t, dispatch_invoke_context_t dic, dispatch_invoke_flags_t, uint64_t *owned); DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_class_invoke(dispatch_queue_class_t dqu, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags, dispatch_invoke_flags_t const_restrict_flags, _dispatch_queue_class_invoke_handler_t invoke) { dispatch_queue_t dq = dqu._dq; dispatch_queue_wakeup_target_t tq = DISPATCH_QUEUE_WAKEUP_NONE; bool owning = !(flags & DISPATCH_INVOKE_STEALING); uint64_t owned = 0; // When called from a plain _dispatch_queue_drain: // overriding = false // owning = true // // When called from an override continuation: // overriding = true // owning depends on whether the override embedded the queue or steals if (!(flags & (DISPATCH_INVOKE_STEALING | DISPATCH_INVOKE_WLH))) { dq->do_next = DISPATCH_OBJECT_LISTLESS; _dispatch_trace_item_pop(_dispatch_queue_get_current(), dq); } flags |= const_restrict_flags; if (likely(flags & DISPATCH_INVOKE_WLH)) { owned = DISPATCH_QUEUE_SERIAL_DRAIN_OWNED | DISPATCH_QUEUE_ENQUEUED; } else { owned = _dispatch_queue_drain_try_lock(dq, flags); } if (likely(owned)) { dispatch_priority_t old_dbp; if (!(flags & DISPATCH_INVOKE_MANAGER_DRAIN)) { old_dbp = _dispatch_set_basepri(dq->dq_priority); } else { old_dbp = 0; } if (flags & DISPATCH_INVOKE_WORKLOOP_DRAIN) { if (unlikely(_dispatch_queue_atomic_flags(dqu) & DQF_MUTABLE)) { _dispatch_queue_atomic_flags_clear(dqu, DQF_MUTABLE); } } flags = _dispatch_queue_merge_autorelease_frequency(dq, flags); attempt_running_slow_head: #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_COCOA_COMPAT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 1817 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if ((flags & DISPATCH_INVOKE_WLH) && !(flags & DISPATCH_INVOKE_AUTORELEASE_ALWAYS)) { _dispatch_last_resort_autorelease_pool_push(dic); } #endif // DISPATCH_COCOA_COMPAT # 1822 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" tq = invoke(dq, dic, flags, &owned); #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_COCOA_COMPAT #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 1824 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if ((flags & DISPATCH_INVOKE_WLH) && !(flags & DISPATCH_INVOKE_AUTORELEASE_ALWAYS)) { dispatch_thread_frame_s dtf; _dispatch_thread_frame_push(&dtf, dq); _dispatch_last_resort_autorelease_pool_pop(dic); _dispatch_thread_frame_pop(&dtf); } #endif // DISPATCH_COCOA_COMPAT # 1832 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_assert(tq != DISPATCH_QUEUE_WAKEUP_TARGET); if (unlikely(tq != DISPATCH_QUEUE_WAKEUP_NONE && tq != DISPATCH_QUEUE_WAKEUP_WAIT_FOR_EVENT)) { // Either dc is set, which is a deferred invoke case // // or only tq is and it means a reenqueue is required, because of: // a retarget, a suspension, or a width change. // // In both cases, we want to bypass the check for DIRTY. // That may cause us to leave DIRTY in place but all drain lock // acquirers clear it } else if (!_dispatch_queue_drain_try_unlock(dq, owned, tq == DISPATCH_QUEUE_WAKEUP_NONE)) { tq = _dispatch_queue_get_current(); if (dx_hastypeflag(tq, QUEUE_ROOT) || !owning) { goto attempt_running_slow_head; } DISPATCH_COMPILER_CAN_ASSUME(tq != DISPATCH_QUEUE_WAKEUP_NONE); } else { owned = 0; tq = NULL; } if (!(flags & DISPATCH_INVOKE_MANAGER_DRAIN)) { _dispatch_reset_basepri(old_dbp); } } if (likely(owning)) { _dispatch_trace_item_complete(dq); } if (tq) { return _dispatch_queue_invoke_finish(dq, dic, tq, owned); } return _dispatch_release_2_tailcall(dq); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_class_probe(dispatch_lane_class_t dqu) { struct dispatch_object_s *tail; // seq_cst wrt atomic store to dq_state // seq_cst wrt atomic store to dq_flags tail = os_atomic_load2o(dqu._dl, dq_items_tail, ordered); return unlikely(tail != NULL); } DISPATCH_ALWAYS_INLINE DISPATCH_CONST static inline bool _dispatch_is_in_root_queues_array(dispatch_queue_class_t dqu) { return (dqu._dgq >= _dispatch_root_queues) && (dqu._dgq < _dispatch_root_queues + _DISPATCH_ROOT_QUEUE_IDX_COUNT); } DISPATCH_ALWAYS_INLINE DISPATCH_CONST static inline dispatch_queue_global_t _dispatch_get_root_queue(dispatch_qos_t qos, bool overcommit) { if (unlikely(qos < DISPATCH_QOS_MIN || qos > DISPATCH_QOS_MAX)) { DISPATCH_CLIENT_CRASH(qos, "Corrupted priority"); } return &_dispatch_root_queues[2 * (qos - 1) + overcommit]; } #define _dispatch_get_default_queue(overcommit) \ _dispatch_root_queues[DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS + \ !!(overcommit)]._as_dq DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_set_bound_thread(dispatch_queue_class_t dqu) { // Tag thread-bound queues with the owning thread dispatch_assert(_dispatch_queue_is_thread_bound(dqu)); uint64_t old_state, new_state; os_atomic_rmw_loop2o(dqu._dq, dq_state, old_state, new_state, relaxed, { new_state = old_state; new_state &= ~DISPATCH_QUEUE_DRAIN_OWNER_MASK; new_state |= _dispatch_lock_value_for_self(); }); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_queue_clear_bound_thread(dispatch_queue_class_t dqu) { dispatch_assert(_dispatch_queue_is_thread_bound(dqu)); os_atomic_and2o(dqu._dq, dq_state, ~DISPATCH_QUEUE_DRAIN_OWNER_MASK, relaxed); } DISPATCH_ALWAYS_INLINE static inline dispatch_pthread_root_queue_observer_hooks_t _dispatch_get_pthread_root_queue_observer_hooks(void) { return _dispatch_thread_getspecific( dispatch_pthread_root_queue_observer_hooks_key); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_set_pthread_root_queue_observer_hooks( dispatch_pthread_root_queue_observer_hooks_t observer_hooks) { _dispatch_thread_setspecific(dispatch_pthread_root_queue_observer_hooks_key, observer_hooks); } #pragma mark - #pragma mark dispatch_priority DISPATCH_ALWAYS_INLINE static inline dispatch_priority_t _dispatch_get_basepri(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1950 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return (dispatch_priority_t)(uintptr_t)_dispatch_thread_getspecific( dispatch_basepri_key); #else # 1953 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return 0; #endif # 1955 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_reset_basepri(dispatch_priority_t dbp) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1962 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_priority_t old_dbp = _dispatch_get_basepri(); // If an inner-loop or'd in the override flag to the per-thread priority, // it needs to be propagated up the chain. dbp &= ~DISPATCH_PRIORITY_OVERRIDE_MASK; dbp |= (old_dbp & DISPATCH_PRIORITY_OVERRIDE_MASK); _dispatch_thread_setspecific(dispatch_basepri_key, (void*)(uintptr_t)dbp); #else # 1969 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)dbp; #endif # 1971 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_get_basepri_override_qos_floor(void) { dispatch_priority_t dbp = _dispatch_get_basepri(); dispatch_qos_t qos = _dispatch_priority_qos(dbp); dispatch_qos_t oqos = _dispatch_priority_override_qos(dbp); return MAX(qos, oqos); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_set_basepri_override_qos(dispatch_qos_t qos) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 1988 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_priority_t dbp = _dispatch_get_basepri(); if (_dispatch_priority_override_qos(dbp) >= qos) return; dbp &= ~DISPATCH_PRIORITY_OVERRIDE_MASK; dbp |= qos << DISPATCH_PRIORITY_OVERRIDE_SHIFT; _dispatch_thread_setspecific(dispatch_basepri_key, (void*)(uintptr_t)dbp); #else # 1994 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)qos; #endif # 1996 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_reset_basepri_override(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2003 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_priority_t dbp = _dispatch_get_basepri(); dispatch_qos_t oqos = _dispatch_priority_override_qos(dbp); if (oqos) { dbp &= ~DISPATCH_PRIORITY_OVERRIDE_MASK; _dispatch_thread_setspecific(dispatch_basepri_key, (void*)(uintptr_t)dbp); return oqos != DISPATCH_QOS_SATURATED; } #endif # 2011 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return false; } DISPATCH_ALWAYS_INLINE static inline dispatch_priority_t _dispatch_set_basepri(dispatch_priority_t dq_dbp) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2019 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_priority_t old_dbp = _dispatch_get_basepri(); dispatch_priority_t dbp = old_dbp; if (unlikely(!old_dbp)) { dbp = dq_dbp & ~DISPATCH_PRIORITY_OVERRIDE_MASK; } else if (dq_dbp & DISPATCH_PRIORITY_REQUESTED_MASK) { dbp &= (DISPATCH_PRIORITY_OVERRIDE_MASK | DISPATCH_PRIORITY_FLAG_OVERCOMMIT); dbp |= MAX(old_dbp & DISPATCH_PRIORITY_REQUESTED_MASK, dq_dbp & DISPATCH_PRIORITY_REQUESTED_MASK); if (_dispatch_priority_fallback_qos(dq_dbp) > _dispatch_priority_qos(dbp)) { dq_dbp &= (DISPATCH_PRIORITY_FALLBACK_QOS_MASK | DISPATCH_PRIORITY_FLAG_FALLBACK | DISPATCH_PRIORITY_FLAG_FLOOR); } else { dq_dbp &= DISPATCH_PRIORITY_FLAG_FLOOR; } dbp |= dq_dbp; } else { if (dbp & DISPATCH_PRIORITY_REQUESTED_MASK) { dbp |= DISPATCH_PRIORITY_FLAG_FLOOR; } if (_dispatch_priority_fallback_qos(dq_dbp) > _dispatch_priority_qos(dbp)) { dbp &= ~DISPATCH_PRIORITY_FALLBACK_QOS_MASK; dbp |= (dq_dbp & (DISPATCH_PRIORITY_FALLBACK_QOS_MASK | DISPATCH_PRIORITY_FLAG_FALLBACK)); } } _dispatch_thread_setspecific(dispatch_basepri_key, (void*)(uintptr_t)dbp); return old_dbp; #else # 2052 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)dq_dbp; return 0; #endif # 2055 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_init_basepri(dispatch_priority_t dbp) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2062 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_assert(!_dispatch_get_basepri()); _dispatch_thread_setspecific(dispatch_basepri_key, (void*)(uintptr_t)dbp); #else # 2065 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)dbp; #endif # 2067 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_init_basepri_wlh(dispatch_priority_t dbp) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2074 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_assert(!_dispatch_get_basepri()); dbp |= _dispatch_priority_make_override(DISPATCH_QOS_SATURATED); _dispatch_thread_setspecific(dispatch_basepri_key, (void*)(uintptr_t)dbp); #else # 2078 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)dbp; #endif # 2080 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline void _dispatch_clear_basepri(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2087 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" _dispatch_thread_setspecific(dispatch_basepri_key, (void*)(uintptr_t)0); #endif # 2089 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_priority_adopt(pthread_priority_t pp, unsigned long flags) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2096 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_priority_t dbp = _dispatch_get_basepri(); pthread_priority_t basepp = _dispatch_priority_to_pp_strip_flags(dbp); pthread_priority_t minbasepp = basepp & ~(pthread_priority_t)_PTHREAD_PRIORITY_PRIORITY_MASK; bool enforce = (flags & DISPATCH_PRIORITY_ENFORCE) || (pp & _PTHREAD_PRIORITY_ENFORCE_FLAG); pp &= ~_PTHREAD_PRIORITY_FLAGS_MASK; if (unlikely(!pp)) { dispatch_qos_t fallback = _dispatch_priority_fallback_qos(dbp); return fallback ? _dispatch_qos_to_pp(fallback) : basepp; } else if (pp < minbasepp) { return basepp; } else if (enforce || (dbp & (DISPATCH_PRIORITY_FLAG_FLOOR | DISPATCH_PRIORITY_FLAG_FALLBACK))) { return pp; } else { return basepp; } #else # 2116 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)pp; (void)flags; return 0; #endif # 2119 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_get_priority(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2126 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" pthread_priority_t pp = (uintptr_t) _dispatch_thread_getspecific(dispatch_priority_key); return pp; #else # 2130 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return 0; #endif # 2132 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2135 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_priority_compute_update(pthread_priority_t pp) { dispatch_assert(pp != DISPATCH_NO_PRIORITY); if (!_dispatch_set_qos_class_enabled) return 0; // the priority in _dispatch_get_priority() only tracks manager-ness // and overcommit, which is inherited from the current value for each update // however if the priority had the NEEDS_UNBIND flag set we need to clear it // the first chance we get // // the manager bit is invalid input, but we keep it to get meaningful // assertions in _dispatch_set_priority_and_voucher_slow() pp &= _PTHREAD_PRIORITY_EVENT_MANAGER_FLAG | ~_PTHREAD_PRIORITY_FLAGS_MASK; pthread_priority_t cur_priority = _dispatch_get_priority(); pthread_priority_t unbind = _PTHREAD_PRIORITY_NEEDS_UNBIND_FLAG; pthread_priority_t overcommit = _PTHREAD_PRIORITY_OVERCOMMIT_FLAG; if (unlikely(cur_priority & unbind)) { // else we always need an update if the NEEDS_UNBIND flag is set // the slow path in _dispatch_set_priority_and_voucher_slow() will // adjust the priority further with the proper overcommitness return pp ? pp : (cur_priority & ~unbind); } else { cur_priority &= ~overcommit; } if (unlikely(pp != cur_priority)) return pp; return 0; } #endif # 2164 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline voucher_t _dispatch_set_priority_and_voucher(pthread_priority_t pp, voucher_t v, dispatch_thread_set_self_t flags) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2171 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" pp = _dispatch_priority_compute_update(pp); if (likely(!pp)) { if (v == DISPATCH_NO_VOUCHER) { return DISPATCH_NO_VOUCHER; } if (likely(v == _voucher_get())) { bool retained = flags & DISPATCH_VOUCHER_CONSUME; if (flags & DISPATCH_VOUCHER_REPLACE) { if (retained && v) _voucher_release_no_dispose(v); v = DISPATCH_NO_VOUCHER; } else { if (!retained && v) _voucher_retain(v); } return v; } } return _dispatch_set_priority_and_voucher_slow(pp, v, flags); #else # 2189 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)pp; (void)v; (void)flags; return DISPATCH_NO_VOUCHER; #endif # 2192 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline voucher_t _dispatch_adopt_priority_and_set_voucher(pthread_priority_t pp, voucher_t v, dispatch_thread_set_self_t flags) { pthread_priority_t p = 0; if (pp != DISPATCH_NO_PRIORITY) { p = _dispatch_priority_adopt(pp, flags); } return _dispatch_set_priority_and_voucher(p, v, flags); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_reset_priority_and_voucher(pthread_priority_t pp, voucher_t v) { if (pp == DISPATCH_NO_PRIORITY) pp = 0; (void)_dispatch_set_priority_and_voucher(pp, v, DISPATCH_VOUCHER_CONSUME | DISPATCH_VOUCHER_REPLACE); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_reset_voucher(voucher_t v, dispatch_thread_set_self_t flags) { flags |= DISPATCH_VOUCHER_CONSUME | DISPATCH_VOUCHER_REPLACE; (void)_dispatch_set_priority_and_voucher(0, v, flags); } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_queue_push_qos(dispatch_queue_class_t dq, dispatch_qos_t qos) { if (qos > _dispatch_priority_qos(dq._dl->dq_priority)) { return qos; } return DISPATCH_QOS_UNSPECIFIED; } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_queue_wakeup_qos(dispatch_queue_class_t dq, dispatch_qos_t qos) { if (!qos) qos = _dispatch_priority_fallback_qos(dq._dl->dq_priority); // for asynchronous workitems, queue priority is the floor for overrides return MAX(qos, _dispatch_priority_qos(dq._dl->dq_priority)); } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_queue_max_qos(dispatch_queue_class_t dq) { // Note: the non atomic load allows to avoid CAS on 32bit architectures // which doesn't give us much as the bits we want are in a single byte // and can't quite be read non atomically. Given that this function is // called in various critical codepaths (such as _dispatch_lane_push() // between the tail exchange and updating the `prev` pointer), we care // deeply about avoiding this. return _dq_state_max_qos((uint64_t)dq._dl->dq_state_bits << 32); } DISPATCH_ALWAYS_INLINE static inline bool _dispatch_queue_need_override(dispatch_queue_class_t dq, dispatch_qos_t qos) { dispatch_qos_t max_qos = _dispatch_queue_max_qos(dq); return max_qos == DISPATCH_QOS_UNSPECIFIED || max_qos < qos; } #define DISPATCH_PRIORITY_PROPAGATE_CURRENT 0x1 #define DISPATCH_PRIORITY_PROPAGATE_FOR_SYNC_IPC 0x2 DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_priority_compute_propagated(pthread_priority_t pp, unsigned int flags) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2272 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if (flags & DISPATCH_PRIORITY_PROPAGATE_CURRENT) { pp = _dispatch_get_priority(); } pp &= ~_PTHREAD_PRIORITY_FLAGS_MASK; if (!(flags & DISPATCH_PRIORITY_PROPAGATE_FOR_SYNC_IPC) && pp > _dispatch_qos_to_pp(DISPATCH_QOS_USER_INITIATED)) { // Cap QOS for propagation at user-initiated return _dispatch_qos_to_pp(DISPATCH_QOS_USER_INITIATED); } return pp; #else # 2283 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)pp; (void)flags; return 0; #endif # 2286 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_priority_propagate(void) { return _dispatch_priority_compute_propagated(0, DISPATCH_PRIORITY_PROPAGATE_CURRENT); } // including maintenance DISPATCH_ALWAYS_INLINE static inline bool _dispatch_is_background_thread(void) { #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2302 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" pthread_priority_t pp = _dispatch_get_priority(); return _dispatch_qos_is_background(_dispatch_qos_from_pp(pp)); #else # 2305 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return false; #endif # 2307 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" } #pragma mark - #pragma mark dispatch_block_t #ifdef __BLOCKS__ DISPATCH_ALWAYS_INLINE static inline bool _dispatch_block_has_private_data(const dispatch_block_t block) { return (_dispatch_Block_invoke(block) == _dispatch_block_special_invoke); } DISPATCH_ALWAYS_INLINE DISPATCH_WARN_RESULT static inline pthread_priority_t _dispatch_block_invoke_should_set_priority(dispatch_block_flags_t flags, pthread_priority_t new_pri) { pthread_priority_t old_pri, p = 0; // 0 means do not change priority. if ((flags & DISPATCH_BLOCK_HAS_PRIORITY) && ((flags & DISPATCH_BLOCK_ENFORCE_QOS_CLASS) || !(flags & DISPATCH_BLOCK_INHERIT_QOS_CLASS))) { new_pri &= ~_PTHREAD_PRIORITY_FLAGS_MASK; old_pri = _dispatch_get_priority() & ~_PTHREAD_PRIORITY_FLAGS_MASK; if (old_pri && old_pri < new_pri) p = old_pri; } return p; } DISPATCH_ALWAYS_INLINE static inline dispatch_block_private_data_t _dispatch_block_get_data(const dispatch_block_t db) { if (!_dispatch_block_has_private_data(db)) { return NULL; } // Keep in sync with _dispatch_block_create implementation uint8_t *x = (uint8_t *)db; // x points to base of struct Block_layout x += sizeof(struct Block_layout); // x points to base of captured dispatch_block_private_data_s object dispatch_block_private_data_t dbpd = (dispatch_block_private_data_t)x; if (dbpd->dbpd_magic != DISPATCH_BLOCK_PRIVATE_DATA_MAGIC) { DISPATCH_CLIENT_CRASH(dbpd->dbpd_magic, "Corruption of dispatch block object"); } return dbpd; } DISPATCH_ALWAYS_INLINE static inline pthread_priority_t _dispatch_block_get_priority(const dispatch_block_t db) { dispatch_block_private_data_t dbpd = _dispatch_block_get_data(db); return dbpd ? dbpd->dbpd_priority : 0; } DISPATCH_ALWAYS_INLINE static inline dispatch_block_flags_t _dispatch_block_get_flags(const dispatch_block_t db) { dispatch_block_private_data_t dbpd = _dispatch_block_get_data(db); return dbpd ? dbpd->dbpd_flags : 0; } #endif # 2374 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #pragma mark - #pragma mark dispatch_continuation_t DISPATCH_ALWAYS_INLINE static inline dispatch_continuation_t _dispatch_continuation_alloc_cacheonly(void) { dispatch_continuation_t dc = (dispatch_continuation_t) _dispatch_thread_getspecific(dispatch_cache_key); if (likely(dc)) { _dispatch_thread_setspecific(dispatch_cache_key, dc->do_next); } return dc; } DISPATCH_ALWAYS_INLINE static inline dispatch_continuation_t _dispatch_continuation_alloc(void) { dispatch_continuation_t dc = _dispatch_continuation_alloc_cacheonly(); if (unlikely(!dc)) { return _dispatch_continuation_alloc_from_heap(); } return dc; } DISPATCH_ALWAYS_INLINE static inline dispatch_continuation_t _dispatch_continuation_free_cacheonly(dispatch_continuation_t dc) { dispatch_continuation_t prev_dc = (dispatch_continuation_t) _dispatch_thread_getspecific(dispatch_cache_key); int cnt = prev_dc ? prev_dc->dc_cache_cnt + 1 : 1; // Cap continuation cache if (unlikely(cnt > _dispatch_continuation_cache_limit)) { return dc; } dc->do_next = prev_dc; dc->dc_cache_cnt = cnt; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_ALLOCATOR #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2416 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" // This magical value helps memory tools to recognize continuations on // the various free lists that are really free. dc->dc_flags = (uintptr_t)(void *)&_dispatch_main_heap; #endif # 2420 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" _dispatch_thread_setspecific(dispatch_cache_key, dc); return NULL; } DISPATCH_ALWAYS_INLINE static inline void _dispatch_continuation_free(dispatch_continuation_t dc) { dc = _dispatch_continuation_free_cacheonly(dc); if (unlikely(dc)) { _dispatch_continuation_free_to_cache_limit(dc); } } DISPATCH_ALWAYS_INLINE static inline void _dispatch_continuation_with_group_invoke(dispatch_continuation_t dc) { struct dispatch_object_s *dou = dc->dc_data; unsigned long type = dx_type(dou); if (type == DISPATCH_GROUP_TYPE) { _dispatch_client_callout(dc->dc_ctxt, dc->dc_func); _dispatch_trace_item_complete(dc); dispatch_group_leave((dispatch_group_t)dou); } else { DISPATCH_INTERNAL_CRASH(dx_type(dou), "Unexpected object type"); } } DISPATCH_ALWAYS_INLINE static inline void _dispatch_continuation_invoke_inline(dispatch_object_t dou, dispatch_invoke_flags_t flags, dispatch_queue_class_t dqu) { dispatch_continuation_t dc = dou._dc, dc1; dispatch_invoke_with_autoreleasepool(flags, { uintptr_t dc_flags = dc->dc_flags; // Add the item back to the cache before calling the function. This // allows the 'hot' continuation to be used for a quick callback. // // The ccache version is per-thread. // Therefore, the object has not been reused yet. // This generates better assembly. _dispatch_continuation_voucher_adopt(dc, dc_flags); if (!(dc_flags & DC_FLAG_NO_INTROSPECTION)) { _dispatch_trace_item_pop(dqu, dou); } if (dc_flags & DC_FLAG_CONSUME) { dc1 = _dispatch_continuation_free_cacheonly(dc); } else { dc1 = NULL; } if (unlikely(dc_flags & DC_FLAG_GROUP_ASYNC)) { _dispatch_continuation_with_group_invoke(dc); } else { _dispatch_client_callout(dc->dc_ctxt, dc->dc_func); _dispatch_trace_item_complete(dc); } if (unlikely(dc1)) { _dispatch_continuation_free_to_cache_limit(dc1); } }); _dispatch_perfmon_workitem_inc(); } DISPATCH_ALWAYS_INLINE_NDEBUG static inline void _dispatch_continuation_pop_inline(dispatch_object_t dou, dispatch_invoke_context_t dic, dispatch_invoke_flags_t flags, dispatch_queue_class_t dqu) { dispatch_pthread_root_queue_observer_hooks_t observer_hooks = _dispatch_get_pthread_root_queue_observer_hooks(); if (observer_hooks) observer_hooks->queue_will_execute(dqu._dq); flags &= _DISPATCH_INVOKE_PROPAGATE_MASK; if (_dispatch_object_has_vtable(dou)) { dx_invoke(dou._dq, dic, flags); } else { _dispatch_continuation_invoke_inline(dou, flags, dqu); } if (observer_hooks) observer_hooks->queue_did_execute(dqu._dq); } // used to forward the do_invoke of a continuation with a vtable to its real // implementation. #define _dispatch_continuation_pop_forwarded(dc, dc_flags, dq, ...) \ ({ \ dispatch_continuation_t _dc = (dc), _dc1; \ uintptr_t _dc_flags = (dc_flags); \ _dispatch_continuation_voucher_adopt(_dc, _dc_flags); \ if (!(_dc_flags & DC_FLAG_NO_INTROSPECTION)) { \ _dispatch_trace_item_pop(dq, dc); \ } \ if (_dc_flags & DC_FLAG_CONSUME) { \ _dc1 = _dispatch_continuation_free_cacheonly(_dc); \ } else { \ _dc1 = NULL; \ } \ __VA_ARGS__; \ if (!(_dc_flags & DC_FLAG_NO_INTROSPECTION)) { \ _dispatch_trace_item_complete(_dc); \ } \ if (unlikely(_dc1)) { \ _dispatch_continuation_free_to_cache_limit(_dc1); \ } \ }) DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_continuation_priority_set(dispatch_continuation_t dc, dispatch_queue_class_t dqu, pthread_priority_t pp, dispatch_block_flags_t flags) { dispatch_qos_t qos = DISPATCH_QOS_UNSPECIFIED; #if 0 /* disabled by -frewrite-includes */ #if HAVE_PTHREAD_WORKQUEUE_QOS #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2535 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" dispatch_queue_t dq = dqu._dq; if (likely(pp)) { bool enforce = (flags & DISPATCH_BLOCK_ENFORCE_QOS_CLASS); bool is_floor = (dq->dq_priority & DISPATCH_PRIORITY_FLAG_FLOOR); bool dq_has_qos = (dq->dq_priority & DISPATCH_PRIORITY_REQUESTED_MASK); if (enforce) { pp |= _PTHREAD_PRIORITY_ENFORCE_FLAG; qos = _dispatch_qos_from_pp_unsafe(pp); } else if (!is_floor && dq_has_qos) { pp = 0; } else { qos = _dispatch_qos_from_pp_unsafe(pp); } } dc->dc_priority = pp; #else # 2552 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)dc; (void)dqu; (void)pp; (void)flags; #endif # 2554 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return qos; } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_continuation_init_f(dispatch_continuation_t dc, dispatch_queue_class_t dqu, void *ctxt, dispatch_function_t f, dispatch_block_flags_t flags, uintptr_t dc_flags) { pthread_priority_t pp = 0; dc->dc_flags = dc_flags | DC_FLAG_ALLOCATED; dc->dc_func = f; dc->dc_ctxt = ctxt; // in this context DISPATCH_BLOCK_HAS_PRIORITY means that the priority // should not be propagated, only taken from the handler if it has one if (!(flags & DISPATCH_BLOCK_HAS_PRIORITY)) { pp = _dispatch_priority_propagate(); } _dispatch_continuation_voucher_set(dc, flags); return _dispatch_continuation_priority_set(dc, dqu, pp, flags); } DISPATCH_ALWAYS_INLINE static inline dispatch_qos_t _dispatch_continuation_init(dispatch_continuation_t dc, dispatch_queue_class_t dqu, dispatch_block_t work, dispatch_block_flags_t flags, uintptr_t dc_flags) { void *ctxt = _dispatch_Block_copy(work); dc_flags |= DC_FLAG_BLOCK | DC_FLAG_ALLOCATED; if (unlikely(_dispatch_block_has_private_data(work))) { dc->dc_flags = dc_flags; dc->dc_ctxt = ctxt; // will initialize all fields but requires dc_flags & dc_ctxt to be set return _dispatch_continuation_init_slow(dc, dqu, flags); } dispatch_function_t func = _dispatch_Block_invoke(work); if (dc_flags & DC_FLAG_CONSUME) { func = _dispatch_call_block_and_release; } return _dispatch_continuation_init_f(dc, dqu, ctxt, func, flags, dc_flags); } DISPATCH_ALWAYS_INLINE static inline void _dispatch_continuation_async(dispatch_queue_class_t dqu, dispatch_continuation_t dc, dispatch_qos_t qos, uintptr_t dc_flags) { #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_INTROSPECTION #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 2605 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" if (!(dc_flags & DC_FLAG_NO_INTROSPECTION)) { _dispatch_trace_item_push(dqu, dc); } #else # 2609 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" (void)dc_flags; #endif # 2611 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" return dx_push(dqu._dq, dc, qos); } #endif // DISPATCH_PURE_C # 2615 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" #endif /* __DISPATCH_INLINE_INTERNAL__ */ # 2617 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/inline_internal.h" # 1112 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "firehose/firehose_internal.h" #endif /* expanded by -frewrite-includes */ # 1112 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 1 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" 1 /* * Copyright (c) 2015 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @APPLE_APACHE_LICENSE_HEADER_END@ */ #ifndef __FIREHOSE_INTERNAL__ #define __FIREHOSE_INTERNAL__ #if 0 /* disabled by -frewrite-includes */ #if OS_FIREHOSE_SPI #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" // make sure this is defined so that we get MIG_SERVER_DIED when a send once // notification is sent back because of a crashed server #ifndef __MigTypeCheck #define __MigTypeCheck 1 #endif # 31 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #define fcp_quarntined fcp_quarantined #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 43 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include "os/firehose_server_private.h" #endif /* expanded by -frewrite-includes */ # 44 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include "firehose_buffer_internal.h" #endif /* expanded by -frewrite-includes */ # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 46 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #ifdef FIREHOSE_SERVER #if 0 /* expanded by -frewrite-includes */ #include "firehose_server_internal.h" #endif /* expanded by -frewrite-includes */ # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 48 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #endif # 49 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #if 0 /* expanded by -frewrite-includes */ #include "firehose_inline_internal.h" #endif /* expanded by -frewrite-includes */ # 49 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #endif // OS_FIREHOSE_SPI # 52 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" #endif // __FIREHOSE_INTERNAL__ # 54 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/firehose/firehose_internal.h" # 1113 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" 2 __END_DECLS #endif /* __DISPATCH_INTERNAL__ */ # 1117 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/internal.h" # 22 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" 2 struct __dispatch_benchmark_data_s { #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH_ABSOLUTE_TIME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 25 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" mach_timebase_info_data_t tbi; #endif # 27 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" uint64_t loop_cost; void (*func)(void *); void *ctxt; size_t count; }; static void _dispatch_benchmark_init(void *context) { struct __dispatch_benchmark_data_s *bdata = context; // try and simulate performance of real benchmark as much as possible // keep 'f', 'c' and 'cnt' in registers register void (*f)(void *) = bdata->func; register void *c = bdata->ctxt; register size_t cnt = bdata->count; size_t i = 0; uint64_t start, delta; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_SIZEOF_PTR == 8 && !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 45 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" __uint128_t lcost; #else # 47 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" long double lcost; #endif # 49 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH_ABSOLUTE_TIME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 50 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" kern_return_t kr; kr = mach_timebase_info(&bdata->tbi); dispatch_assert_zero(kr); #endif # 55 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" start = _dispatch_uptime(); do { i++; f(c); } while (i < cnt); delta = _dispatch_uptime() - start; lcost = delta; #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH_ABSOLUTE_TIME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 65 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" lcost *= bdata->tbi.numer; lcost /= bdata->tbi.denom; #endif # 68 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" lcost /= cnt; bdata->loop_cost = lcost > UINT64_MAX ? UINT64_MAX : (uint64_t)lcost; } #ifdef __BLOCKS__ uint64_t dispatch_benchmark(size_t count, void (^block)(void)) { return dispatch_benchmark_f(count, block, _dispatch_Block_invoke(block)); } #endif # 80 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" static void _dispatch_benchmark_dummy_function(void *ctxt DISPATCH_UNUSED) { } uint64_t dispatch_benchmark_f(size_t count, register void *ctxt, register void (*func)(void *)) { static struct __dispatch_benchmark_data_s bdata = { .func = _dispatch_benchmark_dummy_function, .count = 10000000ul, // ten million }; static dispatch_once_t pred; uint64_t ns, start, delta; #if 0 /* disabled by -frewrite-includes */ #if DISPATCH_SIZEOF_PTR == 8 && !defined(_WIN32) #endif #endif /* disabled by -frewrite-includes */ #if 1 /* evaluated by -frewrite-includes */ # 97 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" __uint128_t conversion, big_denom; #else # 99 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" long double conversion, big_denom; #endif # 101 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" size_t i = 0; dispatch_once_f(&pred, &bdata, _dispatch_benchmark_init); if (unlikely(count == 0)) { return 0; } start = _dispatch_uptime(); do { i++; func(ctxt); } while (i < count); delta = _dispatch_uptime() - start; conversion = delta; #if 0 /* disabled by -frewrite-includes */ #if HAVE_MACH_ABSOLUTE_TIME #endif #endif /* disabled by -frewrite-includes */ #if 0 /* evaluated by -frewrite-includes */ # 118 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" conversion *= bdata.tbi.numer; big_denom = bdata.tbi.denom; #else # 121 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" big_denom = delta; #endif # 123 "/wrkdirs/usr/ports/devel/libdispatch/work/swift-corelibs-libdispatch-swift-5.5-RELEASE/src/benchmark.c" big_denom *= count; conversion /= big_denom; ns = conversion > UINT64_MAX ? UINT64_MAX : (uint64_t)conversion; return ns - bdata.loop_cost; }