Skip to content

Commit 1b12594

Browse files
authored
Merge pull request swiftlang#2635 from 3405691582/CFSocket_Rehab
[CF] Apply missing includes and cleanups.
2 parents c2ac394 + 24b7396 commit 1b12594

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

CoreFoundation/RunLoop.subproj/CFSocket.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -942,14 +942,15 @@ Boolean __CFSocketGetBytesAvailable(CFSocketRef s, CFIndex* ctBytesAvailable) {
942942
#include <sys/un.h>
943943
#include <libc.h>
944944
#include <dlfcn.h>
945-
#if TARGET_OS_CYGWIN
946-
#include <sys/socket.h>
947945
#endif
946+
#if TARGET_OS_CYGWIN || TARGET_OS_BSD
947+
#include <sys/socket.h>
948948
#endif
949949
#if TARGET_OS_WIN32
950950
#include <WinSock2.h>
951951
#else
952952
#include <arpa/inet.h>
953+
#include <netinet/in.h>
953954
#endif
954955
#if !TARGET_OS_WIN32
955956
#include <sys/ioctl.h>
@@ -1117,7 +1118,7 @@ static void __cfSocketLogWithSocket(CFSocketRef s, const char* function, int lin
11171118
#endif
11181119

11191120

1120-
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_UNIX
1121+
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
11211122
#define INVALID_SOCKET (CFSocketNativeHandle)(-1)
11221123
#define closesocket(a) close((a))
11231124
#define ioctlsocket(a,b,c) ioctl((a),(b),(c))
@@ -2174,10 +2175,9 @@ manageSelectError()
21742175

21752176
static void *__CFSocketManager(void * arg)
21762177
{
2177-
#if (TARGET_OS_LINUX && !TARGET_OS_CYGWIN) || TARGET_OS_BSD
2178+
#if TARGET_OS_LINUX && !TARGET_OS_CYGWIN
21782179
pthread_setname_np(pthread_self(), "com.apple.CFSocket.private");
2179-
#elif TARGET_OS_CYGWIN
2180-
#else
2180+
#elif !TARGET_OS_CYGWIN && !TARGET_OS_BSD
21812181
pthread_setname_np("com.apple.CFSocket.private");
21822182
#endif
21832183
SInt32 nrfds, maxnrfds, fdentries = 1;

0 commit comments

Comments
 (0)