|
| 1 | +From 694cc281ab301a2b0f9b18d17d59aa8e5f94b65a Mon Sep 17 00:00:00 2001 |
| 2 | +From: Yuta Saito < [email protected]> |
| 3 | +Date: Sat, 14 Dec 2024 09:12:24 +0000 |
| 4 | +Subject: [PATCH 3/4] Add missing constant shims for wasi-libc |
| 5 | + |
| 6 | +--- |
| 7 | + Sources/FoundationEssentials/WASILibc+Extensions.swift | 9 +++++++++ |
| 8 | + Sources/_FoundationCShims/include/platform_shims.h | 4 ++++ |
| 9 | + 2 files changed, 13 insertions(+) |
| 10 | + |
| 11 | +diff --git a/Sources/FoundationEssentials/WASILibc+Extensions.swift b/Sources/FoundationEssentials/WASILibc+Extensions.swift |
| 12 | +index 351fe19..44f3f93 100644 |
| 13 | +--- a/Sources/FoundationEssentials/WASILibc+Extensions.swift |
| 14 | ++++ b/Sources/FoundationEssentials/WASILibc+Extensions.swift |
| 15 | +@@ -49,5 +49,14 @@ internal var O_TRUNC: Int32 { |
| 16 | + internal var O_WRONLY: Int32 { |
| 17 | + return _platform_shims_O_WRONLY() |
| 18 | + } |
| 19 | ++internal var O_RDONLY: Int32 { |
| 20 | ++ return _platform_shims_O_RDONLY() |
| 21 | ++} |
| 22 | ++internal var O_DIRECTORY: Int32 { |
| 23 | ++ return _platform_shims_O_DIRECTORY() |
| 24 | ++} |
| 25 | ++internal var O_NOFOLLOW: Int32 { |
| 26 | ++ return _platform_shims_O_NOFOLLOW() |
| 27 | ++} |
| 28 | + |
| 29 | + #endif // os(WASI) |
| 30 | +diff --git a/Sources/_FoundationCShims/include/platform_shims.h b/Sources/_FoundationCShims/include/platform_shims.h |
| 31 | +index 6bc0a0e..e02b581 100644 |
| 32 | +--- a/Sources/_FoundationCShims/include/platform_shims.h |
| 33 | ++++ b/Sources/_FoundationCShims/include/platform_shims.h |
| 34 | +@@ -102,6 +102,10 @@ static inline int32_t _platform_shims_O_CREAT(void) { return O_CREAT; } |
| 35 | + static inline int32_t _platform_shims_O_EXCL(void) { return O_EXCL; } |
| 36 | + static inline int32_t _platform_shims_O_TRUNC(void) { return O_TRUNC; } |
| 37 | + static inline int32_t _platform_shims_O_WRONLY(void) { return O_WRONLY; } |
| 38 | ++static inline int32_t _platform_shims_O_RDONLY(void) { return O_RDONLY; } |
| 39 | ++static inline int32_t _platform_shims_O_DIRECTORY(void) { return O_DIRECTORY; } |
| 40 | ++static inline int32_t _platform_shims_O_NOFOLLOW(void) { return O_NOFOLLOW; } |
| 41 | ++ |
| 42 | + #endif |
| 43 | + |
| 44 | + #endif /* CSHIMS_PLATFORM_SHIMS */ |
| 45 | +-- |
| 46 | +2.46.0 |
| 47 | + |
0 commit comments