diff --git a/Sources/NIOSSL/ByteBufferBIO.swift b/Sources/NIOSSL/ByteBufferBIO.swift index 5264ff58..1a8144fb 100644 --- a/Sources/NIOSSL/ByteBufferBIO.swift +++ b/Sources/NIOSSL/ByteBufferBIO.swift @@ -19,8 +19,10 @@ import NIOCore import Darwin.C #elseif canImport(Musl) import Musl -#elseif os(Linux) || os(FreeBSD) || os(Android) +#elseif canImport(Glibc) import Glibc +#elseif canImport(Bionic) +import Bionic #else #error("unsupported os") #endif diff --git a/Sources/NIOSSL/IdentityVerification.swift b/Sources/NIOSSL/IdentityVerification.swift index fd4a2b36..5306ed58 100644 --- a/Sources/NIOSSL/IdentityVerification.swift +++ b/Sources/NIOSSL/IdentityVerification.swift @@ -18,8 +18,10 @@ import NIOCore import Darwin.C #elseif canImport(Musl) import Musl -#elseif os(Linux) || os(FreeBSD) || os(Android) +#elseif canImport(Glibc) import Glibc +#elseif canImport(Android) +import Android #else #error("unsupported os") #endif diff --git a/Sources/NIOSSL/NIOSSLClientHandler.swift b/Sources/NIOSSL/NIOSSLClientHandler.swift index 907b03f9..7133da7c 100644 --- a/Sources/NIOSSL/NIOSSLClientHandler.swift +++ b/Sources/NIOSSL/NIOSSLClientHandler.swift @@ -18,8 +18,10 @@ import NIOCore import Darwin.C #elseif canImport(Musl) import Musl -#elseif os(Linux) || os(FreeBSD) || os(Android) +#elseif canImport(Glibc) import Glibc +#elseif canImport(Android) +import Android #else #error("unsupported os") #endif diff --git a/Sources/NIOSSL/PosixPort.swift b/Sources/NIOSSL/PosixPort.swift index 80533de3..2000a801 100644 --- a/Sources/NIOSSL/PosixPort.swift +++ b/Sources/NIOSSL/PosixPort.swift @@ -24,8 +24,10 @@ import Darwin.C #elseif canImport(Musl) import Musl -#elseif os(Linux) || os(FreeBSD) || os(Android) +#elseif canImport(Glibc) import Glibc +#elseif canImport(Android) +import Android #else #error("unsupported os") #endif diff --git a/Sources/NIOSSL/SSLCallbacks.swift b/Sources/NIOSSL/SSLCallbacks.swift index 0b34c18e..bff71d53 100644 --- a/Sources/NIOSSL/SSLCallbacks.swift +++ b/Sources/NIOSSL/SSLCallbacks.swift @@ -19,8 +19,10 @@ import NIOCore import Darwin.C #elseif canImport(Musl) import Musl -#elseif os(Linux) || os(FreeBSD) || os(Android) +#elseif canImport(Glibc) import Glibc +#elseif canImport(Bionic) +import Bionic #else #error("unsupported os") #endif diff --git a/Sources/NIOSSL/SSLCertificate.swift b/Sources/NIOSSL/SSLCertificate.swift index 38e153d7..cfa37bb7 100644 --- a/Sources/NIOSSL/SSLCertificate.swift +++ b/Sources/NIOSSL/SSLCertificate.swift @@ -20,8 +20,10 @@ import NIOCore import Darwin.C #elseif canImport(Musl) import Musl -#elseif os(Linux) || os(FreeBSD) || os(Android) +#elseif canImport(Glibc) import Glibc +#elseif canImport(Bionic) +import Bionic #else #error("unsupported os") #endif diff --git a/Sources/NIOSSL/SSLContext.swift b/Sources/NIOSSL/SSLContext.swift index afd25392..158a4582 100644 --- a/Sources/NIOSSL/SSLContext.swift +++ b/Sources/NIOSSL/SSLContext.swift @@ -20,8 +20,10 @@ import NIOCore import Darwin.C #elseif canImport(Musl) import Musl -#elseif os(Linux) || os(FreeBSD) || os(Android) +#elseif canImport(Glibc) import Glibc +#elseif canImport(Android) +import Android #else #error("unsupported os") #endif @@ -44,7 +46,7 @@ internal enum FileSystemObject { } #if os(Android) && arch(arm) - return (statObj.st_mode & UInt32(Glibc.S_IFDIR)) != 0 ? .directory : .file + return (statObj.st_mode & UInt32(S_IFDIR)) != 0 ? .directory : .file #else return (statObj.st_mode & S_IFDIR) != 0 ? .directory : .file #endif @@ -733,7 +735,7 @@ extension NIOSSLContext { let _ = try Posix.lstat(path: path, buf: &buffer) // Check the mode to make sure this is a symlink #if os(Android) && arch(arm) - if (buffer.st_mode & UInt32(Glibc.S_IFMT)) != UInt32(Glibc.S_IFLNK) { return false } + if (buffer.st_mode & UInt32(S_IFMT)) != UInt32(S_IFLNK) { return false } #else if (buffer.st_mode & S_IFMT) != S_IFLNK { return false } #endif diff --git a/Sources/NIOSSL/SubjectAlternativeName.swift b/Sources/NIOSSL/SubjectAlternativeName.swift index be4bc50f..28ad5eee 100644 --- a/Sources/NIOSSL/SubjectAlternativeName.swift +++ b/Sources/NIOSSL/SubjectAlternativeName.swift @@ -20,8 +20,10 @@ import NIOCore import Darwin.C #elseif canImport(Musl) import Musl -#elseif os(Linux) || os(FreeBSD) || os(Android) +#elseif canImport(Glibc) import Glibc +#elseif canImport(Android) +import Android #else #error("unsupported os") #endif