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 9
9
10
10
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
11
11
import Darwin
12
- #elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android)
13
- @_implementationOnly import CSystem
14
- import Glibc
15
12
#elseif os(Windows)
16
13
import CSystem
17
14
import ucrt
15
+ #elseif canImport(Glibc)
16
+ @_implementationOnly import CSystem
17
+ import Glibc
18
+ #elseif canImport(Musl)
19
+ @_implementationOnly import CSystem
20
+ import Musl
18
21
#else
19
22
#error("Unsupported Platform")
20
23
#endif
Original file line number Diff line number Diff line change 13
13
14
14
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
15
15
import Darwin
16
- #elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android)
17
- import Glibc
18
16
#elseif os(Windows)
19
17
import CSystem
20
18
import ucrt
19
+ #elseif canImport(Glibc)
20
+ import Glibc
21
+ #elseif canImport(Musl)
22
+ import CSystem
23
+ import Musl
21
24
#else
22
25
#error("Unsupported Platform")
23
26
#endif
@@ -454,9 +457,13 @@ internal var _O_WRONLY: CInt { O_WRONLY }
454
457
internal var _O_RDWR : CInt { O_RDWR }
455
458
456
459
#if !os(Windows)
460
+ #if canImport(Musl)
461
+ internal var _O_ACCMODE : CInt { 0x03 |O_SEARCH }
462
+ #else
457
463
// TODO: API?
458
464
@_alwaysEmitIntoClient
459
465
internal var _O_ACCMODE : CInt { O_ACCMODE }
466
+ #endif
460
467
461
468
@_alwaysEmitIntoClient
462
469
internal var _O_NONBLOCK : CInt { O_NONBLOCK }
Original file line number Diff line number Diff line change 14
14
15
15
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
16
16
import Darwin
17
- #elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android)
18
- @_implementationOnly import CSystem
19
- import Glibc
20
17
#elseif os(Windows)
21
18
import CSystem
22
19
import ucrt
20
+ #elseif canImport(Glibc)
21
+ @_implementationOnly import CSystem
22
+ import Glibc
23
+ #elseif canImport(Musl)
24
+ @_implementationOnly import CSystem
25
+ import Musl
23
26
#else
24
27
#error("Unsupported Platform")
25
28
#endif
@@ -45,11 +48,16 @@ internal var system_errno: CInt {
45
48
_ = ucrt. _set_errno ( newValue)
46
49
}
47
50
}
48
- #else
51
+ #elseif canImport(Glibc)
49
52
internal var system_errno : CInt {
50
53
get { Glibc . errno }
51
54
set { Glibc . errno = newValue }
52
55
}
56
+ #elseif canImport(Musl)
57
+ internal var system_errno : CInt {
58
+ get { Musl . errno }
59
+ set { Musl . errno = newValue }
60
+ }
53
61
#endif
54
62
55
63
// MARK: C stdlib decls
Original file line number Diff line number Diff line change 9
9
10
10
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
11
11
import Darwin
12
- #elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android )
12
+ #elseif canImport(Glibc )
13
13
import Glibc
14
+ #elseif canImport(Musl)
15
+ import Musl
14
16
#elseif os(Windows)
15
17
import ucrt
16
18
#else
You can’t perform that action at this time.
0 commit comments