11import SystemPackage
22
3- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
3+ #if canImport(Darwin )
44import Darwin
55#elseif os(Linux) || os(FreeBSD) || os(Android)
66import Glibc
@@ -34,7 +34,7 @@ internal var _O_NONBLOCK: CInt { O_NONBLOCK }
3434@_alwaysEmitIntoClient
3535internal var _O_APPEND : CInt { O_APPEND }
3636
37- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
37+ #if canImport(Darwin )
3838@_alwaysEmitIntoClient
3939internal var _O_SHLOCK : CInt { O_SHLOCK }
4040
@@ -60,7 +60,7 @@ internal var _O_TRUNC: CInt { O_TRUNC }
6060@_alwaysEmitIntoClient
6161internal var _O_EXCL : CInt { O_EXCL }
6262
63- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
63+ #if canImport(Darwin )
6464@_alwaysEmitIntoClient
6565internal var _O_EVTONLY : CInt { O_EVTONLY }
6666#endif
@@ -74,7 +74,7 @@ internal var _O_NOCTTY: CInt { O_NOCTTY }
7474internal var _O_DIRECTORY : CInt { O_DIRECTORY }
7575#endif
7676
77- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
77+ #if canImport(Darwin )
7878@_alwaysEmitIntoClient
7979internal var _O_SYMLINK : CInt { O_SYMLINK }
8080#endif
@@ -93,7 +93,7 @@ internal var _SEEK_CUR: CInt { SEEK_CUR }
9393@_alwaysEmitIntoClient
9494internal var _SEEK_END : CInt { SEEK_END }
9595
96- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
96+ #if canImport(Darwin )
9797@_alwaysEmitIntoClient
9898internal var _SEEK_HOLE : CInt { SEEK_HOLE }
9999
@@ -196,7 +196,7 @@ internal var _AF_VSOCK: CInt { AF_VSOCK }
196196internal var _AF_ISDN : CInt { AF_ISDN }
197197#endif
198198
199- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
199+ #if canImport(Darwin )
200200@_alwaysEmitIntoClient
201201internal var _AF_IMPLINK : CInt { AF_IMPLINK }
202202
@@ -341,7 +341,7 @@ internal var _SO_DONTROUTE: CInt { SO_DONTROUTE }
341341@_alwaysEmitIntoClient
342342internal var _SO_BROADCAST : CInt { SO_BROADCAST }
343343
344- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
344+ #if canImport(Darwin )
345345@_alwaysEmitIntoClient
346346internal var _SO_USELOOPBACK : CInt { SO_USELOOPBACK }
347347#endif
@@ -381,7 +381,7 @@ internal var _MSG_WAITALL: CInt { numericCast(MSG_WAITALL) } /* wait for full re
381381@_alwaysEmitIntoClient
382382internal var _MSG_DONTWAIT : CInt { numericCast ( MSG_DONTWAIT) } /* this message should be nonblocking */
383383
384- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
384+ #if canImport(Darwin )
385385@_alwaysEmitIntoClient
386386internal var _MSG_EOF : CInt { numericCast ( MSG_EOF) } /* data completes connection */
387387
@@ -416,7 +416,7 @@ internal var _MSG_MORE: CInt { numericCast(MSG_MORE) }
416416
417417@_alwaysEmitIntoClient
418418internal var _fd_set_count : Int {
419- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS )
419+ #if canImport(Darwin )
420420 // __DARWIN_FD_SETSIZE is number of *bits*, so divide by number bits in each element to get element count
421421 // at present this is 1024 / 32 == 32
422422 return Int ( __DARWIN_FD_SETSIZE) / 32
0 commit comments