mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
Work around awkward SO_TIMESTAMP definition. (#1866)
Motivation: On some Linux platforms the definition of SO_TIMESTAMP is too complex for the clang importer to handle. Delegate to C to find out what it should be. The same problem applies to SO_RCVTIMEO. Modifications: - Define SO_TIMESTAMP in CNIOLinux instead. - Define SO_RCVTIMEO in CNIOLinux instead. Result: Should build on the awkward Linux platforms.
This commit is contained in:
1 parent
b23f40b4fa
commit
0b3a8e4e34
3 files changed
+13
No files matched your search
@@ -72,5 +72,9 @@ const void *CNIOLinux_CMSG_DATA(const struct cmsghdr *);
|
||||
void *CNIOLinux_CMSG_DATA_MUTABLE(struct cmsghdr *);
|
||||
size_t CNIOLinux_CMSG_LEN(size_t);
|
||||
size_t CNIOLinux_CMSG_SPACE(size_t);
|
||||
|
||||
// awkward time_T pain
|
||||
extern int CNIOLinux_SO_TIMESTAMP;
|
||||
extern int CNIOLinux_SO_RCVTIMEO;
|
||||
#endif
|
||||
#endif
|
||||
@@ -143,4 +143,7 @@ size_t CNIOLinux_CMSG_LEN(size_t payloadSizeBytes) {
|
||||
size_t CNIOLinux_CMSG_SPACE(size_t payloadSizeBytes) {
|
||||
return CMSG_SPACE(payloadSizeBytes);
|
||||
}
|
||||
|
||||
int CNIOLinux_SO_TIMESTAMP = SO_TIMESTAMP;
|
||||
int CNIOLinux_SO_RCVTIMEO = SO_RCVTIMEO;
|
||||
#endif
|
||||
@@ -58,6 +58,12 @@ let S_IFBLK = UInt32(SwiftGlibc.S_IFBLK)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Work around SO_TIMESTAMP/SO_RCVTIMEO being awkwardly defined in glibc.
|
||||
#if os(Linux)
|
||||
let SO_TIMESTAMP = CNIOLinux_SO_TIMESTAMP
|
||||
let SO_RCVTIMEO = CNIOLinux_SO_RCVTIMEO
|
||||
#endif
|
||||
|
||||
// Declare aliases to share more code and not need to repeat #if #else blocks
|
||||
#if !os(Windows)
|
||||
private let sysClose = close
|
||||
|
||||
Reference in new issue
Block a user