-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[WebAssembly] Add ifdefs for the WASI target #29530
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ import SwiftPrivateLibcExtras | |
import SwiftPrivateThreadExtras | ||
#if os(macOS) || os(iOS) | ||
import Darwin | ||
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) | ||
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI) | ||
import Glibc | ||
#elseif os(Windows) | ||
import MSVCRT | ||
|
@@ -562,7 +562,9 @@ class _InterruptibleSleep { | |
return | ||
} | ||
|
||
var timeout = timeval(tv_sec: duration, tv_usec: 0) | ||
// WebAssembly/WASI on wasm32 is the only 32-bit platform with Int64 time_t, | ||
// needs an explicit conversion to `time_t` because of this. | ||
var timeout = timeval(tv_sec: time_t(duration), tv_usec: 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the code would still compile on other platforms if you the |
||
|
||
var readFDs = _stdlib_fd_set() | ||
var writeFDs = _stdlib_fd_set() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -366,6 +366,8 @@ public var SIG_IGN: _crt_signal_t { | |
public var SIG_ERR: _crt_signal_t { | ||
return unsafeBitCast(-1, to: _crt_signal_t.self) | ||
} | ||
#elseif os(WASI) | ||
// No signals support on WASI yet, see https://github.com/WebAssembly/WASI/issues/166. | ||
#else | ||
internal var _ignore = _UnsupportedPlatformError() | ||
#endif | ||
|
@@ -380,7 +382,7 @@ public var SEM_FAILED: UnsafeMutablePointer<sem_t>? { | |
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) | ||
// The value is ABI. Value verified to be correct for OS X, iOS, watchOS, tvOS. | ||
return UnsafeMutablePointer<sem_t>(bitPattern: -1) | ||
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) | ||
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does exist and whole |
||
// The value is ABI. Value verified to be correct on Glibc. | ||
return UnsafeMutablePointer<sem_t>(bitPattern: 0) | ||
#else | ||
|
Uh oh!
There was an error while loading. Please reload this page.