Skip to content

[pull] swiftwasm from main #635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 109 commits into
base: swiftwasm
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
b05e8a0
Fix sorting keys tests
woxtu Jun 10, 2023
d62fc6d
Fix sorting keys
woxtu Jun 10, 2023
1c929e5
Fixes issue #4642: Encountering "Constant strings cannot be deallocat…
dhoepfl Nov 2, 2023
36a411b
Ensure URLSession and curl agree on the host (#4836)
jrflat Nov 16, 2023
9f011c6
Foundation: avoid temporary file leaks on Windows
compnerd Nov 22, 2023
1b514e4
Merge pull request #4757 from woxtu/sorted-keys
YOCKOW Dec 12, 2023
c38b49e
[runloop] Fix the failure memory order argument to atomic_compare_exc…
MaskRay Dec 19, 2023
c854cfc
Avoid unnecessarily allocating an array when initializing `String` fr…
fumoboy007 Jan 4, 2024
aed2252
Add `NSLock.withLock(_:)` method. (#4736)
fumoboy007 Jan 4, 2024
dbca8c7
Merge pull request #4855 from MaskRay/compare_exchange
Azoy Jan 5, 2024
988564c
[wasm][build] Guard libdispatch and Threads usage with HAS_LIBDISPATC…
kateinoigakukun Feb 4, 2024
18d6a75
[wasm] Port BlocksRuntime for no dlfcn.h platforms
kateinoigakukun Feb 7, 2024
98e2d98
Bump the macOS deployment target to 10.13 in the Xcode project.
kateinoigakukun Feb 14, 2024
e54dd44
Support Windows ARM64 builds.
hjyamauchi Feb 13, 2024
dc54902
Stop assuming `CFSTR` is a constant-time expression with Clang 15 (#4…
kateinoigakukun Feb 15, 2024
7f62c8c
Merge pull request #4873 from kateinoigakukun/yt/fix-xcode-15-min-macos
kateinoigakukun Feb 16, 2024
81e494c
NSNotification.Name is sendable
jumhyn-browser Feb 15, 2024
d5c78dc
CG types are sendable
jumhyn-browser Feb 15, 2024
eafffe1
Merge pull request #4874 from jumhyn-browser/cg-types-sendable
compnerd Feb 21, 2024
8df6fbf
Merge pull request #4875 from jumhyn-browser/nsnotification-name-send…
compnerd Feb 21, 2024
2b752a5
Merge pull request #4866 from kateinoigakukun/pr-7f195656e3309a1be99a…
kateinoigakukun Feb 22, 2024
004a9dd
[wasm][build] Exclude Tools from build when BUILD_TOOLS is OFF
kateinoigakukun Feb 7, 2024
3744d4d
[wasm] Port thread-related APIs for no thread platform
kateinoigakukun Oct 29, 2023
40496bb
Merge pull request #4869 from kateinoigakukun/pr-c22e31c72f24e4dfb622…
kateinoigakukun Feb 22, 2024
32e9e2d
[Build] Add `SWIFT_SYSTEM_NAME` setting.
al45tair Feb 22, 2024
b0b6977
[Build] Make CMake locate librt for us.
al45tair Feb 22, 2024
db0c7fc
[Build] When building against musl, add -lfts.
al45tair Feb 22, 2024
c890a55
Merge pull request #4868 from kateinoigakukun/pr-972effe45a04043fc1ab…
kateinoigakukun Feb 22, 2024
a63cfba
[wasm][build] Disable networking targets from CMake build
kateinoigakukun Feb 4, 2024
fa30868
[wasm] Fix signatures of `swift_retain`
kateinoigakukun Feb 4, 2024
cd522ff
[wasm] Port NSError.swift for WASI
kateinoigakukun Feb 8, 2024
05e5023
[wasm] Port `CoreFoundation/Base.subproj/CFFileUtilities.c`
kateinoigakukun Feb 4, 2024
f634213
[wasm] Unlock cwd-related APIs
kateinoigakukun Feb 4, 2024
68775d9
[wasm] Use `__wasilibc_get_environ` to get environ
kateinoigakukun Feb 4, 2024
836b940
[wasm] Port CoreFoundation/Base.subproj/CFRuntime.c
kateinoigakukun Feb 4, 2024
05de042
Merge pull request #4879 from kateinoigakukun/pr-c2f8576d97c0e1f37633…
kateinoigakukun Feb 24, 2024
ceedffe
Merge pull request #4867 from kateinoigakukun/pr-0f36722d80d2aa315829…
kateinoigakukun Feb 24, 2024
80e95bb
[Build] Add some libraries to the autolink list.
al45tair Feb 22, 2024
48076cb
[CoreFoundation][Build] Explicitly check for a few functions.
al45tair Feb 22, 2024
fbc7e2c
[CoreFoundation] Don't assume we can use __GLIBC_PREREQ on Linux.
al45tair Feb 22, 2024
321997f
[CoreFoundation] Musl doesn't have _D_EXACT_NAMLEN or d_namlen.
al45tair Feb 22, 2024
56c4738
[CoreFoundation][Foundation][Tools] Miscellanous musl support.
al45tair Feb 22, 2024
806ba24
Merge pull request #4870 from kateinoigakukun/pr-c5d9ac3f9d224d05c5fd…
kateinoigakukun Feb 26, 2024
a3c2228
[Build] Make sure we include CheckSymbolExists.
al45tair Feb 26, 2024
5a1db79
Merge pull request #4876 from al45tair/eng/PR-123381867
al45tair Feb 27, 2024
7fa782b
Repair the macOS build by adding missing `-D` in Xcode project
kateinoigakukun Feb 28, 2024
b5988f5
Merge pull request #4888 from kateinoigakukun/yt/repair-macos-build
compnerd Feb 29, 2024
6895a0b
Merge pull request #4880 from kateinoigakukun/pr-7d659760664db4e1cb06…
kateinoigakukun Feb 29, 2024
50cf198
Merge pull request #4881 from kateinoigakukun/pr-2c016a5c7b35e2c61489…
kateinoigakukun Feb 29, 2024
76b1357
Merge pull request #4883 from kateinoigakukun/pr-4283049ef87ac9644247…
kateinoigakukun Feb 29, 2024
85314f7
Merge pull request #4882 from kateinoigakukun/pr-c7ef47460e4315ebd73c…
kateinoigakukun Feb 29, 2024
7d40966
Merge pull request #4878 from kateinoigakukun/pr-9a7128f36562ce5da5c7…
kateinoigakukun Feb 29, 2024
7008825
Port `CoreFoundation/Base.subproj/CFFileUtilities.c`
kateinoigakukun Feb 4, 2024
095b12f
[wasm] Port ProcessInfo for WASI platform
kateinoigakukun Feb 14, 2024
3048047
[wasm] Port use of `dirent` for wasi-libc
kateinoigakukun Feb 14, 2024
a5d3c21
[wasm] Fix definition conflict of `errno`
kateinoigakukun Feb 23, 2024
106cf08
Merge pull request #4890 from kateinoigakukun/pr-e95a11fcc23a99344e92…
kateinoigakukun Mar 1, 2024
44ee4ed
Merge pull request #4891 from kateinoigakukun/pr-b292e9c5b58de43b6a3a…
kateinoigakukun Mar 1, 2024
64a89bf
Merge pull request #4894 from kateinoigakukun/pr-98833f56713b558c0c12…
kateinoigakukun Mar 2, 2024
ca40780
[wasm] Provide stub for `_NSCreateTemporaryFile` on WASI
kateinoigakukun Feb 14, 2024
48f2ad0
[wasm] Port `CoreFoundation/StringEncodings.subproj`
kateinoigakukun Mar 1, 2024
e80fcc5
[wasm] Port FileManager for WASI platform
kateinoigakukun Mar 1, 2024
06c2eec
Merge pull request #4897 from kateinoigakukun/pr-49cb54aab4ab471cfedd…
kateinoigakukun Mar 2, 2024
294988f
Merge pull request #4896 from kateinoigakukun/pr-d439004e8dc1ebc3653d…
kateinoigakukun Mar 2, 2024
fbae263
Merge pull request #4898 from kateinoigakukun/pr-232e89b439816fe1ab82…
kateinoigakukun Mar 2, 2024
5a60991
[wasm] Include syslog.h only if available
kateinoigakukun Mar 1, 2024
660ccc8
[wasm] Port CoreFoundation/PlugIn.subproj
kateinoigakukun Mar 1, 2024
5dc4849
[wasm] Port CoreFoundation/Preferences.subproj
kateinoigakukun Mar 1, 2024
7c7225a
Merge pull request #4899 from kateinoigakukun/pr-f57925e663dfa963eeb2…
kateinoigakukun Mar 3, 2024
131ec0d
Merge pull request #4901 from kateinoigakukun/pr-7c917980cf487714a509…
kateinoigakukun Mar 4, 2024
e0c821f
[wasm] Port CoreFoundation/String.subproj
kateinoigakukun Mar 1, 2024
087a706
Merge pull request #4900 from kateinoigakukun/pr-f0914c36fb2222012add…
kateinoigakukun Mar 4, 2024
778dde9
Merge pull request #4902 from kateinoigakukun/pr-46e15f9f0db9d9dafc39…
kateinoigakukun Mar 4, 2024
7a70a1b
[wasm] Remove too conservative guards around file operations
kateinoigakukun Mar 1, 2024
92f7dd1
Update Sources/Foundation/Data.swift
kateinoigakukun Mar 6, 2024
ea22e02
[wasm] Guard out the use of `libdispatch` types
kateinoigakukun Feb 4, 2024
3451ceb
Merge pull request #4893 from kateinoigakukun/pr-60e5fee97c1f1f8f2ded…
kateinoigakukun Mar 7, 2024
8a134e8
[wasm] Grab wasi-libc constants manually
kateinoigakukun Feb 14, 2024
7e66e34
[wasm] Port CoreFoundation/NumberDate.subproj
kateinoigakukun Mar 7, 2024
7891776
[wasm] Port CoreFoundation/Locale.subproj
kateinoigakukun Mar 7, 2024
efc0182
[wasm] Port CFStream for no-dispatch platforms
kateinoigakukun Mar 7, 2024
5d81a9e
[wasm] Port CoreFoundation/Parsing.subproj
kateinoigakukun Mar 7, 2024
e333136
Merge pull request #4906 from kateinoigakukun/pr-b27e5ce8e96f2e3c7c9d…
kateinoigakukun Mar 8, 2024
ac2b8ca
Merge pull request #4905 from kateinoigakukun/pr-a79046959cf116072901…
kateinoigakukun Mar 8, 2024
56b27ca
Merge pull request #4907 from kateinoigakukun/pr-5394e105706db6b3c22f…
kateinoigakukun Mar 8, 2024
355fbfa
Merge pull request #4908 from kateinoigakukun/pr-34e15bc0ecf1c67a4ca9…
kateinoigakukun Mar 8, 2024
ff07568
Merge pull request #4909 from kateinoigakukun/pr-9a5e81eb27c79df6e55a…
kateinoigakukun Mar 8, 2024
48c5fd4
[wasm] Guard RunLoop.subproj sources with `__HAS_DISPATCH__`
kateinoigakukun Mar 7, 2024
eded784
Merge pull request #4910 from kateinoigakukun/pr-03a3440ba15da48de18b…
kateinoigakukun Mar 8, 2024
dc551c7
[wasm] Port CoreFoundation/CMakeLists.txt
kateinoigakukun Mar 1, 2024
6869b4b
Merge pull request #4912 from kateinoigakukun/pr-f937fe8e72fee42afb2f…
kateinoigakukun Mar 8, 2024
514e2bd
Merge pull request #4911 from kateinoigakukun/pr-35d76bc0234067e20476…
kateinoigakukun Mar 8, 2024
ee05d2d
[wasm] Enable wasi-libc emulations for Foundation
kateinoigakukun Mar 8, 2024
ddb58bd
[wasm] Exclude some completely unavailable APIs from build
kateinoigakukun Mar 8, 2024
7e25bb8
[wasm] Port Sources/Foundation/FileHandle.swift
kateinoigakukun Mar 8, 2024
de93e26
[wasm] Miscellaneous Foundation fixes
kateinoigakukun Mar 8, 2024
7226a6e
[wasm] Port Sources/Foundation/NSObjCRuntime.swift
kateinoigakukun Mar 8, 2024
90c1832
[wasm] Import `sys/mman.h` through CoreFoundation
kateinoigakukun Mar 8, 2024
f7d3cde
Merge pull request #4914 from kateinoigakukun/pr-0e428ab1d3cbb96680c2…
kateinoigakukun Mar 8, 2024
f997707
Merge pull request #4913 from kateinoigakukun/pr-f6022e0721b057fdae9a…
kateinoigakukun Mar 9, 2024
092ec88
Merge pull request #4916 from kateinoigakukun/pr-275996903bbf87833bc2…
kateinoigakukun Mar 9, 2024
83634d0
Merge pull request #4917 from kateinoigakukun/pr-92d02acf81308c010f2f…
kateinoigakukun Mar 9, 2024
44031b5
[wasm] Miscellanous Base.subproj fixes
kateinoigakukun Mar 1, 2024
6a70d03
[wasm] Follow-up dispatch fix for CFStream.c
kateinoigakukun Mar 9, 2024
e7b4cbf
Merge pull request #4915 from kateinoigakukun/pr-aad5de6289e0575216a3…
kateinoigakukun Mar 9, 2024
b5fa198
Merge pull request #4918 from kateinoigakukun/pr-0df99f952c1c29bd10a4…
kateinoigakukun Mar 9, 2024
9e5b848
Merge pull request #4919 from kateinoigakukun/pr-fcdcbc1b3e7c1adfac08…
kateinoigakukun Mar 9, 2024
736ea3c
Merge pull request #4920 from kateinoigakukun/pr-3b8b9e773c1c1791d383…
kateinoigakukun Mar 9, 2024
1dac113
Merge pull request #4892 from kateinoigakukun/pr-6e9074ea384bd0846772…
kateinoigakukun Mar 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ project(Foundation
LANGUAGES C Swift)
enable_testing()

if(NOT SWIFT_SYSTEM_NAME)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(SWIFT_SYSTEM_NAME macosx)
else()
set(SWIFT_SYSTEM_NAME "$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
endif()
endif()

# NOTE(compnerd) default to /MD or /MDd by default based on the configuration.
# Cache the variable to allow the user to alter the configuration.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" CACHE
Expand All @@ -38,9 +46,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)

option(BUILD_SHARED_LIBS "build shared libraries" ON)
option(BUILD_FULLY_STATIC "build fully static" NO)
option(HAS_LIBDISPATCH_API "has libdispatch API" ON)
option(BUILD_NETWORKING "build FoundationNetworking module" ON)
option(BUILD_TOOLS "build tools" ON)
option(FOUNDATION_ENABLE_FOUNDATION_NETWORKING "build FoundationNetworking module" ON)
option(FOUNDATION_BUILD_TOOLS "build tools" ON)
option(NS_CURL_ASSUME_FEATURES_MISSING "Assume that optional libcurl features are missing rather than test the library's version, for build debugging" NO)

if(HAS_LIBDISPATCH_API)
Expand All @@ -49,6 +58,12 @@ endif()

find_package(ICU COMPONENTS uc i18n REQUIRED OPTIONAL_COMPONENTS data)

# This is needed if we're statically linking, otherwise we can't pull in Dispatch
# because we won't have RT::rt as a CMake target.
if(NOT CMAKE_SYSTEM_NAME STREQUAL Android)
find_package(LibRT)
endif()

include(SwiftSupport)
include(GNUInstallDirs)
include(XCTest)
Expand All @@ -57,7 +72,9 @@ set(CF_DEPLOYMENT_SWIFT YES CACHE BOOL "Build for Swift" FORCE)

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG OFF)
find_package(Threads REQUIRED)
if(HAS_LIBDISPATCH_API)
find_package(Threads REQUIRED)
endif()

set(SAVED_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS NO)
Expand Down Expand Up @@ -99,13 +116,13 @@ if(NOT BUILD_SHARED_LIBS)
endif()

install(TARGETS CoreFoundation CFXMLInterface
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
DESTINATION lib/swift_static/${SWIFT_SYSTEM_NAME})

if(BUILD_NETWORKING)
if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING)
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS
CFURLSessionInterface)
install(TARGETS CFURLSessionInterface
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
DESTINATION lib/swift_static/${SWIFT_SYSTEM_NAME})
endif()
endif()

Expand Down
38 changes: 31 additions & 7 deletions CoreFoundation/Base.subproj/CFFileUtilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <pwd.h>

#if !TARGET_OS_WASI
# include <pwd.h>
#endif

#include <fcntl.h>

#define statinfo stat
Expand Down Expand Up @@ -341,7 +345,7 @@ CF_PRIVATE CFMutableArrayRef _CFCreateContentsOfDirectory(CFAllocatorRef alloc,
FindClose(handle);
pathBuf[pathLength] = '\0';

#elif TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
#elif TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
uint8_t extBuff[CFMaxPathSize];
int extBuffInteriorDotCount = 0; //people insist on using extensions like ".trace.plist", so we need to know how many dots back to look :(

Expand Down Expand Up @@ -444,7 +448,7 @@ CF_PRIVATE CFMutableArrayRef _CFCreateContentsOfDirectory(CFAllocatorRef alloc,
dirURL = CFURLCreateFromFileSystemRepresentation(alloc, (uint8_t *)dirPath, pathLength, true);
releaseBase = true;
}
#if !defined(__OpenBSD__)
#if !defined(__OpenBSD__) && !TARGET_OS_WASI
if (dp->d_type == DT_DIR || dp->d_type == DT_UNKNOWN || dp->d_type == DT_LNK || dp->d_type == DT_WHT) {
#else
if (dp->d_type == DT_DIR || dp->d_type == DT_UNKNOWN || dp->d_type == DT_LNK) {
Expand All @@ -461,13 +465,13 @@ CF_PRIVATE CFMutableArrayRef _CFCreateContentsOfDirectory(CFAllocatorRef alloc,
isDir = ((statBuf.st_mode & S_IFMT) == S_IFDIR);
}
}
#if TARGET_OS_LINUX
#if TARGET_OS_LINUX || TARGET_OS_WASI
fileURL = CFURLCreateFromFileSystemRepresentationRelativeToBase(alloc, (uint8_t *)dp->d_name, namelen, isDir, dirURL);
#else
fileURL = CFURLCreateFromFileSystemRepresentationRelativeToBase(alloc, (uint8_t *)dp->d_name, dp->d_namlen, isDir, dirURL);
#endif
} else {
#if TARGET_OS_LINUX
#if TARGET_OS_LINUX || TARGET_OS_WASI
fileURL = CFURLCreateFromFileSystemRepresentationRelativeToBase (alloc, (uint8_t *)dp->d_name, namelen, false, dirURL);
#else
fileURL = CFURLCreateFromFileSystemRepresentationRelativeToBase (alloc, (uint8_t *)dp->d_name, dp->d_namlen, false, dirURL);
Expand Down Expand Up @@ -554,7 +558,7 @@ CF_PRIVATE SInt32 _CFGetPathProperties(CFAllocatorRef alloc, char *path, Boolean

if (modTime != NULL) {
if (fileExists) {
#if TARGET_OS_WIN32 || TARGET_OS_LINUX
#if TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
struct timespec ts = {statBuf.st_mtime, 0};
#else
struct timespec ts = statBuf.st_mtimespec;
Expand Down Expand Up @@ -1118,6 +1122,8 @@ CF_PRIVATE void _CFIterateDirectory(CFStringRef directoryPath, Boolean appendSla
}
}
}
#elif TARGET_OS_WASI
CFIndex nameLen = strlen(dent->d_name);
#else
CFIndex nameLen = dent->d_namlen;
#endif
Expand All @@ -1130,7 +1136,25 @@ CF_PRIVATE void _CFIterateDirectory(CFStringRef directoryPath, Boolean appendSla

// This buffer has to be 1 bigger than the size of the one in the dirent so we can hold the extra '/' if it's required
// Be sure to initialize the first character to null, so that strlcat below works correctly
char fullPathToFile[sizeof(dent->d_name) + 1];
#if TARGET_OS_WASI
// wasi-libc's dirent.d_name is not a fixed-size array but a pointer, so we need to calculate
// the size of buffer at first.
size_t d_name_size = nameLen;
if (stuffToPrefix) {
for (CFIndex i = 0; i < CFArrayGetCount(stuffToPrefix); i++) {
CFStringRef onePrefix = CFArrayGetValueAtIndex(stuffToPrefix, i);
size_t prefixLen = CFStringGetLength(onePrefix);
// Add 1 for concatenating '/'
if (d_name_size > nameLen) {
d_name_size += 1;
}
d_name_size += prefixLen;
}
}
#else
size_t d_name_size = sizeof(dent->d_name);
#endif
char fullPathToFile[d_name_size + 1];
fullPathToFile[0] = 0;
CFIndex startAt = 0;

Expand Down
36 changes: 34 additions & 2 deletions CoreFoundation/Base.subproj/CFInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,37 @@ CF_INLINE int _CFRecursiveMutexUnlock(_CFRecursiveMutex *mutex) {
LeaveCriticalSection(mutex);
return 0;
}
#elif TARGET_OS_WASI
// For wasi-libc without pthread support (_POSIX_THREADS), just assume that it's single-threaded.
// wasi-libc with pthread support is handled by the _POSIX_THREADS case above.
typedef void *_CFMutex;
#define _CF_MUTEX_STATIC_INITIALIZER {}
CF_INLINE int _CFMutexCreate(_CFMutex *lock) {
return 0;
}
CF_INLINE int _CFMutexDestroy(_CFMutex *lock) {
return 0;
}
CF_INLINE int _CFMutexLock(_CFMutex *lock) {
return 0;
}
CF_INLINE int _CFMutexUnlock(_CFMutex *lock) {
return 0;
}

typedef void *_CFRecursiveMutex;
CF_INLINE int _CFRecursiveMutexCreate(_CFRecursiveMutex *mutex) {
return 0;
}
CF_INLINE int _CFRecursiveMutexDestroy(_CFRecursiveMutex *mutex) {
return 0;
}
CF_INLINE int _CFRecursiveMutexLock(_CFRecursiveMutex *mutex) {
return 0;
}
CF_INLINE int _CFRecursiveMutexUnlock(_CFRecursiveMutex *mutex) {
return 0;
}
#else
#error "do not know how to define mutex and recursive mutex for this OS"
#endif
Expand All @@ -677,7 +708,7 @@ typedef uint32_t os_unfair_lock_options_t;
static void os_unfair_lock_lock(os_unfair_lock_t lock) { pthread_mutex_lock(lock); }
static void os_unfair_lock_lock_with_options(os_unfair_lock_t lock, os_unfair_lock_options_t options) { pthread_mutex_lock(lock); }
static void os_unfair_lock_unlock(os_unfair_lock_t lock) { pthread_mutex_unlock(lock); }
#elif defined(_WIN32)
#elif defined(_WIN32) || TARGET_OS_WASI
#define OS_UNFAIR_LOCK_INIT CFLockInit
#define os_unfair_lock CFLock_t
#define os_unfair_lock_lock __CFLock
Expand Down Expand Up @@ -1172,12 +1203,13 @@ CF_INLINE dispatch_queue_t __CFDispatchQueueGetGenericBackground(void) {
return dispatch_get_global_queue(QOS_CLASS_UTILITY, DISPATCH_QUEUE_OVERCOMMIT);
}

CF_PRIVATE dispatch_data_t _CFDataCreateDispatchData(CFDataRef data); //avoids copying in most cases

#endif

CF_PRIVATE CFStringRef _CFStringCopyBundleUnloadingProtectedString(CFStringRef str);

CF_PRIVATE uint8_t *_CFDataGetBytePtrNonObjC(CFDataRef data);
CF_PRIVATE dispatch_data_t _CFDataCreateDispatchData(CFDataRef data); //avoids copying in most cases

// Use this for functions that are intended to be breakpoint hooks. If you do not, the compiler may optimize them away.
// Based on: BREAKPOINT_FUNCTION in objc-os.h
Expand Down
Loading