File tree Expand file tree Collapse file tree 4 files changed +30
-10
lines changed Expand file tree Collapse file tree 4 files changed +30
-10
lines changed Original file line number Diff line number Diff line change 99
1010#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1111import Darwin
12- #elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android)
13- @_implementationOnly import CSystem
14- import Glibc
1512#elseif os(Windows)
1613import CSystem
1714import ucrt
15+ #elseif canImport(Glibc)
16+ @_implementationOnly import CSystem
17+ import Glibc
18+ #elseif canImport(Musl)
19+ @_implementationOnly import CSystem
20+ import Musl
1821#else
1922#error("Unsupported Platform")
2023#endif
Original file line number Diff line number Diff line change 1313
1414#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1515import Darwin
16- #elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android)
17- import Glibc
1816#elseif os(Windows)
1917import CSystem
2018import ucrt
19+ #elseif canImport(Glibc)
20+ import Glibc
21+ #elseif canImport(Musl)
22+ import CSystem
23+ import Musl
2124#else
2225#error("Unsupported Platform")
2326#endif
@@ -454,9 +457,13 @@ internal var _O_WRONLY: CInt { O_WRONLY }
454457internal var _O_RDWR : CInt { O_RDWR }
455458
456459#if !os(Windows)
460+ #if canImport(Musl)
461+ internal var _O_ACCMODE : CInt { 0x03 |O_SEARCH }
462+ #else
457463// TODO: API?
458464@_alwaysEmitIntoClient
459465internal var _O_ACCMODE : CInt { O_ACCMODE }
466+ #endif
460467
461468@_alwaysEmitIntoClient
462469internal var _O_NONBLOCK : CInt { O_NONBLOCK }
Original file line number Diff line number Diff line change 1414
1515#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1616import Darwin
17- #elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android)
18- @_implementationOnly import CSystem
19- import Glibc
2017#elseif os(Windows)
2118import CSystem
2219import ucrt
20+ #elseif canImport(Glibc)
21+ @_implementationOnly import CSystem
22+ import Glibc
23+ #elseif canImport(Musl)
24+ @_implementationOnly import CSystem
25+ import Musl
2326#else
2427#error("Unsupported Platform")
2528#endif
@@ -45,11 +48,16 @@ internal var system_errno: CInt {
4548 _ = ucrt. _set_errno ( newValue)
4649 }
4750}
48- #else
51+ #elseif canImport(Glibc)
4952internal var system_errno : CInt {
5053 get { Glibc . errno }
5154 set { Glibc . errno = newValue }
5255}
56+ #elseif canImport(Musl)
57+ internal var system_errno : CInt {
58+ get { Musl . errno }
59+ set { Musl . errno = newValue }
60+ }
5361#endif
5462
5563// MARK: C stdlib decls
Original file line number Diff line number Diff line change 99
1010#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1111import Darwin
12- #elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android )
12+ #elseif canImport(Glibc )
1313import Glibc
14+ #elseif canImport(Musl)
15+ import Musl
1416#elseif os(Windows)
1517import ucrt
1618#else
You can’t perform that action at this time.
0 commit comments