Skip to content

Commit 320c583

Browse files
[wasm] Add O_NONBLOCK shim (#1235)
0597595 added a use of `O_NONBLOCK` but the constant cannot be imported from wasi-libc through ClangImporter directly, so we need to add a shim for it as well as other constants.
1 parent dcd762f commit 320c583

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Sources/FoundationEssentials/WASILibc+Extensions.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ internal var O_TRUNC: Int32 {
4949
internal var O_WRONLY: Int32 {
5050
return _platform_shims_O_WRONLY()
5151
}
52+
internal var O_NONBLOCK: Int32 {
53+
return _platform_shims_O_NONBLOCK()
54+
}
5255
internal var O_RDONLY: Int32 {
5356
return _platform_shims_O_RDONLY()
5457
}

Sources/_FoundationCShims/include/platform_shims.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static inline int32_t _platform_shims_O_CREAT(void) { return O_CREAT; }
102102
static inline int32_t _platform_shims_O_EXCL(void) { return O_EXCL; }
103103
static inline int32_t _platform_shims_O_TRUNC(void) { return O_TRUNC; }
104104
static inline int32_t _platform_shims_O_WRONLY(void) { return O_WRONLY; }
105+
static inline int32_t _platform_shims_O_NONBLOCK(void) { return O_NONBLOCK; }
105106
static inline int32_t _platform_shims_O_RDONLY(void) { return O_RDONLY; }
106107
static inline int32_t _platform_shims_O_DIRECTORY(void) { return O_DIRECTORY; }
107108
static inline int32_t _platform_shims_O_NOFOLLOW(void) { return O_NOFOLLOW; }

0 commit comments

Comments
 (0)