Skip to content

Commit f63e5bb

Browse files
committed
Fixed Android support
1 parent 7308f26 commit f63e5bb

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

Sources/Socket/System/Constants.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ internal var _SOCK_RDM: CInterop.SocketType { SOCK_RDM }
387387
@_alwaysEmitIntoClient
388388
internal var _SOCK_SEQPACKET: CInterop.SocketType { SOCK_SEQPACKET }
389389

390-
#if os(Linux)
390+
#if os(Linux) || os(Android)
391391
@_alwaysEmitIntoClient
392392
internal var _SOCK_DCCP: CInterop.SocketType { SOCK_DCCP }
393393

@@ -454,13 +454,13 @@ internal var _MSG_MORE: CInt { numericCast(MSG_MORE) }
454454

455455
#if os(Linux) || os(Android)
456456
@_alwaysEmitIntoClient
457-
internal var _EFD_CLOEXEC: Int { EFD_CLOEXEC }
457+
internal var _EFD_CLOEXEC: CInt { numericCast(EFD_CLOEXEC) }
458458

459459
@_alwaysEmitIntoClient
460-
internal var _EFD_NONBLOCK: Int { EFD_NONBLOCK }
460+
internal var _EFD_NONBLOCK: CInt { numericCast(EFD_NONBLOCK) }
461461

462462
@_alwaysEmitIntoClient
463-
internal var _EFD_SEMAPHORE: Int { EFD_SEMAPHORE }
463+
internal var _EFD_SEMAPHORE: CInt { numericCast(EFD_SEMAPHORE) }
464464
#endif
465465

466466
@_alwaysEmitIntoClient

Sources/Socket/System/SocketEvent.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public extension SocketDescriptor.Event {
3636
public init(rawValue: CInt) { self.rawValue = rawValue }
3737

3838
@_alwaysEmitIntoClient
39-
private init(_ cValue: Int) {
40-
self.init(rawValue: numericCast(cValue))
39+
private init(_ raw: CInt) {
40+
self.init(rawValue: raw)
4141
}
4242
}
4343
}

Sources/Socket/System/SocketFlags.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ public struct SocketFlags: OptionSet, Hashable, Codable, Sendable {
1313
@_alwaysEmitIntoClient
1414
public init(rawValue: CInt) { self.rawValue = rawValue }
1515

16+
#if os(Linux)
1617
private init(_ cValue: CInterop.SocketType) {
1718
self.init(rawValue: numericCast(cValue.rawValue))
1819
}
20+
#elseif os(Android)
21+
private init(_ cValue: CInt) {
22+
self.init(rawValue: cValue)
23+
}
24+
#endif
1925
}
2026

2127
public extension SocketFlags {

0 commit comments

Comments
 (0)