From 6629f2947be5d43d8ebddaa1ebf3c56c094123b4 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:01:36 -0500 Subject: [PATCH 01/11] Update GitHub CI --- .github/workflows/swift.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index d658cf2..5cb71af 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -23,7 +23,7 @@ jobs: name: Linux strategy: matrix: - container: ["swift:6.0.3", "swift:6.1.2"] + container: ["swift:6.0.3", "swift:6.1.2", "swift:6.2.3"] config: ["debug", "release"] options: ["", "SWIFT_BUILD_DYNAMIC_LIBRARY=1"] runs-on: ubuntu-latest @@ -41,8 +41,8 @@ jobs: strategy: fail-fast: false matrix: - swift: ['6.1', 'nightly-6.2'] - arch: ["aarch64", "x86_64"] + swift: ['6.2.3', 'nightly-6.3'] + arch: ['aarch64', 'x86_64', 'armv7'] runs-on: macos-15 timeout-minutes: 30 steps: From 6e8a6dd17a028873cafdeacaa9aafc663192c2a9 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:19:14 -0500 Subject: [PATCH 02/11] Add support for Android armv7 --- Sources/Socket/System/Syscalls.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/Socket/System/Syscalls.swift b/Sources/Socket/System/Syscalls.swift index 35a573a..56b1b34 100644 --- a/Sources/Socket/System/Syscalls.swift +++ b/Sources/Socket/System/Syscalls.swift @@ -162,7 +162,7 @@ internal func system_inet_pton( return inet_pton(family, cString, address) } -internal func system_inet_ntop(_ family: Int32, _ pointer : UnsafeRawPointer, _ string: UnsafeMutablePointer, _ length: UInt32) -> UnsafePointer? { +internal func system_inet_ntop(_ family: Int32, _ pointer : UnsafeRawPointer, _ string: UnsafeMutablePointer, _ length: socklen_t) -> UnsafePointer? { #if ENABLE_MOCKING //if mockingEnabled { return _mock(family, pointer, string, length) } #endif @@ -176,7 +176,7 @@ internal func system_socket(_ fd: Int32, _ fd2: Int32, _ fd3: Int32) -> Int32 { return socket(fd, fd2, fd3) } -internal func system_setsockopt(_ fd: Int32, _ fd2: Int32, _ fd3: Int32, _ pointer: UnsafeRawPointer, _ dataLength: UInt32) -> Int32 { +internal func system_setsockopt(_ fd: Int32, _ fd2: Int32, _ fd3: Int32, _ pointer: UnsafeRawPointer, _ dataLength: socklen_t) -> Int32 { #if ENABLE_MOCKING if mockingEnabled { return _mock(fd, fd2, fd3, pointer, dataLength) } #endif @@ -188,7 +188,7 @@ internal func system_getsockopt( _ level: CInt, _ option: CInt, _ value: UnsafeMutableRawPointer?, - _ length: UnsafeMutablePointer + _ length: UnsafeMutablePointer ) -> CInt { #if ENABLE_MOCKING if mockingEnabled { return _mock(socket, level, option, value, length) } @@ -199,7 +199,7 @@ internal func system_getsockopt( internal func system_bind( _ socket: CInt, _ address: UnsafePointer, - _ length: UInt32 + _ length: socklen_t ) -> CInt { #if ENABLE_MOCKING if mockingEnabled { return _mock(socket, address, length) } @@ -247,7 +247,7 @@ internal func system_getaddrinfo( internal func system_getnameinfo( _ sa: UnsafePointer, - _ salen: UInt32, + _ salen: socklen_t, _ host: UnsafeMutablePointer?, _ hostlen: socklen_t, _ serv: UnsafeMutablePointer?, @@ -325,7 +325,7 @@ internal func system_sendto( _ length: Int, _ flags: CInt, _ dest_addr: UnsafePointer?, - _ dest_len: UInt32 + _ dest_len: socklen_t ) -> Int { #if ENABLE_MOCKING if mockingEnabled { @@ -341,7 +341,7 @@ internal func system_recvfrom( _ length: Int, _ flags: CInt, _ address: UnsafeMutablePointer?, - _ addres_len: UnsafeMutablePointer? + _ addres_len: UnsafeMutablePointer? ) -> Int { #if ENABLE_MOCKING if mockingEnabled { @@ -509,14 +509,14 @@ internal func system_link_ntoa(_ address: UnsafePointer) -> UnsafeM } #endif -internal func system_getsockname(_ fd: CInt, _ address: UnsafeMutablePointer, _ length: UnsafeMutablePointer) -> CInt { +internal func system_getsockname(_ fd: CInt, _ address: UnsafeMutablePointer, _ length: UnsafeMutablePointer) -> CInt { #if ENABLE_MOCKING if mockingEnabled { return _mock(fd, address) } #endif return getsockname(fd, address, length) } -internal func system_getpeername(_ fd: CInt, _ address: UnsafeMutablePointer, _ length: UnsafeMutablePointer) -> CInt { +internal func system_getpeername(_ fd: CInt, _ address: UnsafeMutablePointer, _ length: UnsafeMutablePointer) -> CInt { #if ENABLE_MOCKING if mockingEnabled { return _mock(fd, address) } #endif From 0ebae3369e6f4fd3f38c9bf413f3ae7fe01a03d0 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:22:50 -0500 Subject: [PATCH 03/11] Add `CInterop.SocketLength` --- Sources/Socket/System/CInterop.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Socket/System/CInterop.swift b/Sources/Socket/System/CInterop.swift index e72e132..fa5669f 100644 --- a/Sources/Socket/System/CInterop.swift +++ b/Sources/Socket/System/CInterop.swift @@ -54,6 +54,8 @@ public extension CInterop { typealias SocketType = CInt #endif + typealias SocketLength = socklen_t + /// The C `addrinfo` type typealias AddressInfo = addrinfo From b5897cc17f273730c6cbf31cc1cddf9d6af7c0f6 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:23:21 -0500 Subject: [PATCH 04/11] Fix `CInternetAddress` for Android Armv7 --- Sources/Socket/System/CInternetAddress.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Socket/System/CInternetAddress.swift b/Sources/Socket/System/CInternetAddress.swift index 3289726..bd1083c 100644 --- a/Sources/Socket/System/CInternetAddress.swift +++ b/Sources/Socket/System/CInternetAddress.swift @@ -38,7 +38,7 @@ internal extension String { T.family.rawValue, $0, cString, - numericCast(T.stringLength) + CInterop.SocketLength(T.stringLength) ) != nil } guard success else { From 7a75f2fce9db3031f06042db70da7d27e4883a5f Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:23:35 -0500 Subject: [PATCH 05/11] Update `SocketAddress` --- Sources/Socket/System/SocketAddress.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Socket/System/SocketAddress.swift b/Sources/Socket/System/SocketAddress.swift index 7b529f5..5f8d8d1 100644 --- a/Sources/Socket/System/SocketAddress.swift +++ b/Sources/Socket/System/SocketAddress.swift @@ -8,7 +8,7 @@ public protocol SocketAddress: Sendable { /// Unsafe pointer closure func withUnsafePointer( - _ body: (UnsafePointer, UInt32) throws(Error) -> Result + _ body: (UnsafePointer, CInterop.SocketLength) throws(Error) -> Result ) rethrows -> Result where Error: Swift.Error static func withUnsafePointer( @@ -16,7 +16,7 @@ public protocol SocketAddress: Sendable { ) -> Self static func withUnsafePointer( - _ body: (UnsafeMutablePointer, UInt32) throws -> () + _ body: (UnsafeMutablePointer, CInterop.SocketLength) throws -> () ) rethrows -> Self } From 3953a37e6630624fd68d49b4e95fc3bc2e457ca1 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:32:41 -0500 Subject: [PATCH 06/11] Update `CSocketAddress` --- Sources/Socket/System/CSocketAddress.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Socket/System/CSocketAddress.swift b/Sources/Socket/System/CSocketAddress.swift index 201dd17..682e98b 100644 --- a/Sources/Socket/System/CSocketAddress.swift +++ b/Sources/Socket/System/CSocketAddress.swift @@ -10,18 +10,18 @@ internal protocol CSocketAddress { internal extension CSocketAddress { func withUnsafePointer( - _ body: (UnsafePointer, UInt32) throws -> Result + _ body: (UnsafePointer, CInterop.SocketLength) throws -> Result ) rethrows -> Result { return try Swift.withUnsafeBytes(of: self) { - return try body($0.baseAddress!.assumingMemoryBound(to: CInterop.SocketAddress.self), UInt32(MemoryLayout.size)) + return try body($0.baseAddress!.assumingMemoryBound(to: CInterop.SocketAddress.self), CInterop.SocketLength(MemoryLayout.size)) } } mutating func withUnsafeMutablePointer( - _ body: (UnsafeMutablePointer, UInt32) throws -> Result + _ body: (UnsafeMutablePointer, CInterop.SocketLength) throws -> Result ) rethrows -> Result { return try Swift.withUnsafeMutableBytes(of: &self) { - return try body($0.baseAddress!.assumingMemoryBound(to: CInterop.SocketAddress.self), UInt32(MemoryLayout.size)) + return try body($0.baseAddress!.assumingMemoryBound(to: CInterop.SocketAddress.self), CInterop.SocketLength(MemoryLayout.size)) } } } From 4eed7008f2158c57d72ea25fa0e268b0f42d778d Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:32:49 -0500 Subject: [PATCH 07/11] Update `SocketDescriptor` --- Sources/Socket/System/SocketOperations.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Socket/System/SocketOperations.swift b/Sources/Socket/System/SocketOperations.swift index 6d1e3ed..1cd2bb9 100644 --- a/Sources/Socket/System/SocketOperations.swift +++ b/Sources/Socket/System/SocketOperations.swift @@ -179,7 +179,7 @@ extension SocketDescriptor { ) -> Result<(), Errno> { nothingOrErrno(retryOnInterrupt: retryOnInterrupt) { option.withUnsafeBytes { bufferPointer in - system_setsockopt(self.rawValue, Option.ID.optionLevel.rawValue, Option.id.rawValue, bufferPointer.baseAddress!, UInt32(bufferPointer.count)) + system_setsockopt(self.rawValue, Option.ID.optionLevel.rawValue, Option.id.rawValue, bufferPointer.baseAddress!, CInterop.SocketLength(bufferPointer.count)) } } } @@ -208,7 +208,7 @@ extension SocketDescriptor { ) -> Result { do { let value = try Option.withUnsafeBytes { bufferPointer throws(Errno) -> () in - var length = UInt32(bufferPointer.count) + var length = CInterop.SocketLength(bufferPointer.count) guard system_getsockopt(self.rawValue, Option.ID.optionLevel.rawValue, Option.id.rawValue, bufferPointer.baseAddress!, &length) != -1 else { throw Errno.current } @@ -498,7 +498,7 @@ extension SocketDescriptor { internal func _accept( retryOnInterrupt: Bool ) -> Result { - var length: UInt32 = 0 + var length: CInterop.SocketLength = 0 return valueOrErrno(retryOnInterrupt: retryOnInterrupt) { system_accept(self.rawValue, nil, &length) }.map(SocketDescriptor.init(rawValue:)) From 0fc0c07196f442f5df8c7b3ead961be0b40f2790 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:32:57 -0500 Subject: [PATCH 08/11] Update `IPv4SocketAddress` --- Sources/Socket/System/SocketAddress/IPv4SocketAddress.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Socket/System/SocketAddress/IPv4SocketAddress.swift b/Sources/Socket/System/SocketAddress/IPv4SocketAddress.swift index 756a5ba..0f76470 100644 --- a/Sources/Socket/System/SocketAddress/IPv4SocketAddress.swift +++ b/Sources/Socket/System/SocketAddress/IPv4SocketAddress.swift @@ -32,7 +32,7 @@ public struct IPv4SocketAddress: SocketAddress, Equatable, Hashable { } public func withUnsafePointer( - _ body: (UnsafePointer, UInt32) throws(Error) -> Result + _ body: (UnsafePointer, CInterop.SocketLength) throws(Error) -> Result ) rethrows -> Result where Error: Swift.Error { var socketAddress = CInterop.IPv4SocketAddress() @@ -51,7 +51,7 @@ public struct IPv4SocketAddress: SocketAddress, Equatable, Hashable { } public static func withUnsafePointer( - _ body: (UnsafeMutablePointer, UInt32) throws -> () + _ body: (UnsafeMutablePointer, CInterop.SocketLength) throws -> () ) rethrows -> Self { var socketAddress = CInterop.IPv4SocketAddress() try socketAddress.withUnsafeMutablePointer(body) From 1b5b7eaf5528b7e84d81c028c67188fde7bc8fd9 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:33:06 -0500 Subject: [PATCH 09/11] Update `IPv6SocketAddress` --- Sources/Socket/System/SocketAddress/IPv6SocketAddress.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Socket/System/SocketAddress/IPv6SocketAddress.swift b/Sources/Socket/System/SocketAddress/IPv6SocketAddress.swift index fc0fbe4..51cdc6e 100644 --- a/Sources/Socket/System/SocketAddress/IPv6SocketAddress.swift +++ b/Sources/Socket/System/SocketAddress/IPv6SocketAddress.swift @@ -32,7 +32,7 @@ public struct IPv6SocketAddress: SocketAddress, Equatable, Hashable { } public func withUnsafePointer( - _ body: (UnsafePointer, UInt32) throws(Error) -> Result + _ body: (UnsafePointer, CInterop.SocketLength) throws(Error) -> Result ) rethrows -> Result where Error: Swift.Error { var socketAddress = CInterop.IPv6SocketAddress() @@ -51,7 +51,7 @@ public struct IPv6SocketAddress: SocketAddress, Equatable, Hashable { } public static func withUnsafePointer( - _ body: (UnsafeMutablePointer, UInt32) throws -> () + _ body: (UnsafeMutablePointer, CInterop.SocketLength) throws -> () ) rethrows -> Self { var socketAddress = CInterop.IPv6SocketAddress() try socketAddress.withUnsafeMutablePointer(body) From 2c386b12fbf037777bff0705e00615f473bdf8db Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:33:15 -0500 Subject: [PATCH 10/11] Update `LinkLayerSocketAddress` --- .../Socket/System/SocketAddress/LinkLayerSocketAddress.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Socket/System/SocketAddress/LinkLayerSocketAddress.swift b/Sources/Socket/System/SocketAddress/LinkLayerSocketAddress.swift index 3c0941e..9fa278f 100644 --- a/Sources/Socket/System/SocketAddress/LinkLayerSocketAddress.swift +++ b/Sources/Socket/System/SocketAddress/LinkLayerSocketAddress.swift @@ -51,7 +51,7 @@ public struct LinkLayerSocketAddress: SocketAddress, Equatable, Hashable { } public func withUnsafePointer( - _ body: (UnsafePointer, UInt32) throws(Error) -> Result + _ body: (UnsafePointer, CInterop.SocketLength) throws(Error) -> Result ) rethrows -> Result where Error: Swift.Error { var socketAddress = CSocketAddressType() @@ -76,7 +76,7 @@ public struct LinkLayerSocketAddress: SocketAddress, Equatable, Hashable { } public static func withUnsafePointer( - _ body: (UnsafeMutablePointer, UInt32) throws -> () + _ body: (UnsafeMutablePointer, CInterop.SocketLength) throws -> () ) rethrows -> Self { var socketAddress = CSocketAddressType() try socketAddress.withUnsafeMutablePointer(body) From 55c898c5b2b1d2431d62cd7ac5e66353d7f192c2 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 27 Feb 2026 22:33:25 -0500 Subject: [PATCH 11/11] Update `UnixSocketAddress` --- Sources/Socket/System/SocketAddress/UnixSocketAddress.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Socket/System/SocketAddress/UnixSocketAddress.swift b/Sources/Socket/System/SocketAddress/UnixSocketAddress.swift index 6e9e782..a4507c2 100644 --- a/Sources/Socket/System/SocketAddress/UnixSocketAddress.swift +++ b/Sources/Socket/System/SocketAddress/UnixSocketAddress.swift @@ -27,7 +27,7 @@ public struct UnixSocketAddress: SocketAddress, Equatable, Hashable { } public func withUnsafePointer( - _ body: (UnsafePointer, UInt32) throws(Error) -> Result + _ body: (UnsafePointer, CInterop.SocketLength) throws(Error) -> Result ) rethrows -> Result where Error: Swift.Error { return try path.withPlatformString { platformString in var socketAddress = CInterop.UnixSocketAddress() @@ -43,7 +43,7 @@ public struct UnixSocketAddress: SocketAddress, Equatable, Hashable { } public static func withUnsafePointer( - _ body: (UnsafeMutablePointer, UInt32) throws -> () + _ body: (UnsafeMutablePointer, CInterop.SocketLength) throws -> () ) rethrows -> Self { var socketAddress = CInterop.UnixSocketAddress() try socketAddress.withUnsafeMutablePointer(body) @@ -64,4 +64,4 @@ extension CInterop.UnixSocketAddress: CSocketAddress { @_alwaysEmitIntoClient static var family: SocketAddressFamily { .unix } } -#endif \ No newline at end of file +#endif