Skip to content

Commit 97e7fea

Browse files
committed
Porting to Cygwin
This is the initial porting. IS_CYGWIN might be changed to some other macro function. A simple function like below code is working in Cygwin. --- import Foundation let swifty = NSURLComponents(string: "https://swift.org")! print("\(swifty.host!)") ---
1 parent cf47315 commit 97e7fea

32 files changed

+162
-46
lines changed

CoreFoundation/Base.subproj/CFInternal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ CF_EXTERN_C_BEGIN
9898
#include <CoreFoundation/CFRuntime.h>
9999
#include <limits.h>
100100
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_FREEBSD
101+
#if TARGET_OS_CYGWIN
102+
#else
101103
#include <xlocale.h>
104+
#endif
102105
#include <unistd.h>
103106
#include <sys/time.h>
104107
#include <signal.h>

CoreFoundation/Base.subproj/CFPlatform.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,15 @@ const char *_CFProcessPath(void) {
156156
#endif
157157

158158
#if DEPLOYMENT_TARGET_LINUX
159+
#if TARGET_OS_CYGWIN
160+
#else
159161
#include <unistd.h>
160162
#include <syscall.h>
161163

162164
Boolean _CFIsMainThread(void) {
163165
return syscall(SYS_gettid) == getpid();
164166
}
167+
#endif
165168

166169
const char *_CFProcessPath(void) {
167170
if (__CFProcessPath) return __CFProcessPath;

CoreFoundation/Base.subproj/CFUtilities.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ CFDictionaryRef __CFGetEnvironment() {
12611261
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED
12621262
extern char ***_NSGetEnviron();
12631263
char **envp = *_NSGetEnviron();
1264-
#elif DEPLOYMENT_TARGET_FREEBSD
1264+
#elif DEPLOYMENT_TARGET_FREEBSD || TARGET_OS_CYGWIN
12651265
extern char **environ;
12661266
char **envp = environ;
12671267
#elif DEPLOYMENT_TARGET_LINUX

CoreFoundation/Base.subproj/CoreFoundation_Prefix.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ typedef int boolean_t;
178178

179179
#include <pthread.h>
180180

181+
#if TARGET_OS_CYGWIN
182+
#else
181183
CF_INLINE size_t
182184
strlcpy(char * dst, const char * src, size_t maxlen) {
183185
const size_t srclen = strlen(src);
@@ -205,6 +207,7 @@ strlcat(char * dst, const char * src, size_t maxlen) {
205207
}
206208

207209
#define issetugid() 0
210+
#endif
208211

209212
// Implemented in CFPlatform.c
210213
bool OSAtomicCompareAndSwapPtr(void *oldp, void *newp, void *volatile *dst);
@@ -263,7 +266,14 @@ void OSMemoryBarrier();
263266

264267
#endif
265268

266-
#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
269+
#if TARGET_OS_CYGWIN
270+
#define HAVE_STRUCT_TIMESPEC 1
271+
#define strncasecmp_l(a, b, c, d) strncasecmp(a, b, c)
272+
#define _NO_BOOL_TYPEDEF
273+
#undef interface
274+
#endif
275+
276+
#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
267277
#if !defined(MIN)
268278
#define MIN(A,B) ((A) < (B) ? (A) : (B))
269279
#endif

CoreFoundation/Base.subproj/SwiftRuntime/TargetConditionals.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
4747
TARGET_OS_WIN32 - Generated code will run under 32-bit Windows
4848
TARGET_OS_UNIX - Generated code will run under some Unix (not OSX)
49+
TARGET_OS_CYGWIN - Generated code will run under 64-bit Cygwin
4950
TARGET_OS_MAC - Generated code will run under Mac OS X variant
5051
TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator
5152
TARGET_OS_IOS - Generated code will run under iOS
@@ -76,21 +77,31 @@
7677
#define TARGET_OS_LINUX 0
7778
#define TARGET_OS_WINDOWS 0
7879
#define TARGET_OS_BSD 0
80+
#define TARGET_OS_CYGWIN 0
7981
#elif __linux__
8082
#define TARGET_OS_DARWIN 0
8183
#define TARGET_OS_LINUX 1
8284
#define TARGET_OS_WINDOWS 0
8385
#define TARGET_OS_BSD 0
86+
#define TARGET_OS_CYGWIN 0
87+
#elif __CYGWIN__
88+
#define TARGET_OS_DARWIN 0
89+
#define TARGET_OS_LINUX 1
90+
#define TARGET_OS_WINDOWS 0
91+
#define TARGET_OS_BSD 0
92+
#define TARGET_OS_CYGWIN 1
8493
#elif _WIN32 || _WIN64
8594
#define TARGET_OS_DARWIN 0
8695
#define TARGET_OS_LINUX 0
8796
#define TARGET_OS_WINDOWS 1
8897
#define TARGET_OS_BSD 0
98+
#define TARGET_OS_CYGWIN 0
8999
#elif __unix__
90100
#define TARGET_OS_DARWIN 0
91101
#define TARGET_OS_LINUX 0
92102
#define TARGET_OS_WINDOWS 0
93103
#define TARGET_OS_BSD 1
104+
#define TARGET_OS_CYGWIN 0
94105
#else
95106
#error unknown operating system
96107
#endif

CoreFoundation/PlugIn.subproj/CFBundle_Binary.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,12 @@ static void *_CFBundleDlfcnGetSymbolByNameWithSearch(CFBundleRef bundle, CFStrin
684684

685685
#if !defined(BINARY_SUPPORT_DYLD)
686686

687+
#if TARGET_OS_CYGWIN
688+
static CFStringRef _CFBundleDlfcnCopyLoadedImagePathForPointer(void *p) {
689+
// Cygwin does not support dladdr()
690+
return NULL;
691+
}
692+
#else
687693
static CFStringRef _CFBundleDlfcnCopyLoadedImagePathForPointer(void *p) {
688694
CFStringRef result = NULL;
689695
Dl_info info;
@@ -693,6 +699,7 @@ static CFStringRef _CFBundleDlfcnCopyLoadedImagePathForPointer(void *p) {
693699
#endif /* LOG_BUNDLE_LOAD */
694700
return result;
695701
}
702+
#endif
696703

697704
#endif /* !BINARY_SUPPORT_DYLD */
698705
#endif /* BINARY_SUPPORT_DLFCN */

CoreFoundation/PlugIn.subproj/CFBundle_InfoPlist.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@
2424
#include <CoreFoundation/CFURLAccess.h>
2525

2626
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_FREEBSD
27+
#if TARGET_OS_CYGWIN
28+
#else
2729
#include <dirent.h>
2830
#include <sys/sysctl.h>
2931
#include <sys/mman.h>
3032
#endif
33+
#endif
3134

3235
// The following strings are initialized 'later' (i.e., not at static initialization time) because static init time is too early for CFSTR to work, on platforms without constant CF strings
3336
#if !__CONSTANT_STRINGS__
@@ -142,7 +145,11 @@ CF_EXPORT CFStringRef _CFGetPlatformName(void) {
142145
#elif DEPLOYMENT_TARGET_HPUX
143146
return _CFBundleHPUXPlatformName;
144147
#elif DEPLOYMENT_TARGET_LINUX
148+
#if TARGET_OS_CYGWIN
149+
return _CFBundleCygwinPlatformName;
150+
#else
145151
return _CFBundleLinuxPlatformName;
152+
#endif
146153
#elif DEPLOYMENT_TARGET_FREEBSD
147154
return _CFBundleFreeBSDPlatformName;
148155
#else
@@ -158,7 +165,11 @@ CF_EXPORT CFStringRef _CFGetAlternatePlatformName(void) {
158165
#elif DEPLOYMENT_TARGET_WINDOWS
159166
return CFSTR("");
160167
#elif DEPLOYMENT_TARGET_LINUX
168+
#if TARGET_OS_CYGWIN
169+
return CFSTR("Cygwin");
170+
#else
161171
return CFSTR("Linux");
172+
#endif
162173
#elif DEPLOYMENT_TARGET_FREEBSD
163174
return CFSTR("FreeBSD");
164175
#else

CoreFoundation/PlugIn.subproj/CFBundle_Internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ extern void _CFPlugInRemoveFactory(CFPlugInRef plugIn, _CFPFactoryRef factory);
346346
#define _CFBundleSolarisPlatformName CFSTR("solaris")
347347
#define _CFBundleLinuxPlatformName CFSTR("linux")
348348
#define _CFBundleFreeBSDPlatformName CFSTR("freebsd")
349+
#define _CFBundleCygwinPlatformName CFSTR("cygwin")
349350

350351
#define _CFBundleDefaultStringTableName CFSTR("Localizable")
351352
#define _CFBundleStringTableType CFSTR("strings")

CoreFoundation/PlugIn.subproj/CFBundle_Resources.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333

3434
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_LINUX
3535
#include <unistd.h>
36+
#if TARGET_OS_CYGWIN
37+
#else
3638
#include <sys/sysctl.h>
39+
#endif
3740
#include <sys/stat.h>
3841
#include <dirent.h>
3942
#endif
@@ -313,7 +316,11 @@ CF_EXPORT CFStringRef _CFBundleGetCurrentPlatform(void) {
313316
#elif DEPLOYMENT_TARGET_HPUX
314317
return CFSTR("HPUX");
315318
#elif DEPLOYMENT_TARGET_LINUX
319+
#if TARGET_OS_CYGWIN
320+
return CFSTR("Cygwin");
321+
#else
316322
return CFSTR("Linux");
323+
#endif
317324
#elif DEPLOYMENT_TARGET_FREEBSD
318325
return CFSTR("FreeBSD");
319326
#else
@@ -331,7 +338,11 @@ CF_PRIVATE CFStringRef _CFBundleGetPlatformExecutablesSubdirectoryName(void) {
331338
#elif DEPLOYMENT_TARGET_HPUX
332339
return CFSTR("HPUX");
333340
#elif DEPLOYMENT_TARGET_LINUX
341+
#if TARGET_OS_CYGWIN
342+
return CFSTR("Cygwin");
343+
#else
334344
return CFSTR("Linux");
345+
#endif
335346
#elif DEPLOYMENT_TARGET_FREEBSD
336347
return CFSTR("FreeBSD");
337348
#else
@@ -349,7 +360,11 @@ CF_PRIVATE CFStringRef _CFBundleGetAlternatePlatformExecutablesSubdirectoryName(
349360
#elif DEPLOYMENT_TARGET_HPUX
350361
return CFSTR("HP-UX");
351362
#elif DEPLOYMENT_TARGET_LINUX
363+
#if TARGET_OS_CYGWIN
364+
return CFSTR("Cygwin");
365+
#else
352366
return CFSTR("Linux");
367+
#endif
353368
#elif DEPLOYMENT_TARGET_FREEBSD
354369
return CFSTR("FreeBSD");
355370
#else

CoreFoundation/RunLoop.subproj/CFRunLoop.c

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ extern pthread_t pthread_main_thread_np(void);
5858
typedef struct voucher_s *voucher_t;
5959
extern mach_port_t _dispatch_get_main_queue_port_4CF(void);
6060
extern void _dispatch_main_queue_callback_4CF(mach_msg_header_t *msg);
61-
#elif DEPLOYMENT_TARGET_WINDOWS
61+
#elif DEPLOYMENT_TARGET_WINDOWS || TARGET_OS_CYGWIN
62+
#include <windows.h>
6263
#include <process.h>
64+
#define DISPATCH_EXPORT extern
6365
DISPATCH_EXPORT HANDLE _dispatch_get_main_queue_handle_4CF(void);
6466
DISPATCH_EXPORT void _dispatch_main_queue_callback_4CF(void*);
6567

@@ -68,9 +70,11 @@ DISPATCH_EXPORT void _dispatch_main_queue_callback_4CF(void*);
6870
#define mach_port_t HANDLE
6971
#define _dispatch_get_main_queue_port_4CF _dispatch_get_main_queue_handle_4CF
7072

71-
#define AbsoluteTime LARGE_INTEGER
73+
#define LARGE_INTEGER uint64_t
7274

7375
#elif DEPLOYMENT_TARGET_LINUX
76+
#if TARGET_OS_CYGWIN
77+
#else
7478
#include <dlfcn.h>
7579
#include <poll.h>
7680
#include <sys/epoll.h>
@@ -79,6 +83,7 @@ DISPATCH_EXPORT void _dispatch_main_queue_callback_4CF(void*);
7983

8084
#define _dispatch_get_main_queue_port_4CF _dispatch_get_main_queue_handle_4CF
8185
#endif
86+
#endif
8287

8388
#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_IPHONESIMULATOR || DEPLOYMENT_TARGET_LINUX
8489
CF_EXPORT pthread_t _CF_pthread_main_thread_np(void);
@@ -347,7 +352,7 @@ CF_INLINE void __CFPortSetFree(__CFPortSet portSet) {
347352
}
348353
}
349354

350-
#elif DEPLOYMENT_TARGET_WINDOWS
355+
#elif DEPLOYMENT_TARGET_WINDOWS || TARGET_OS_CYGWIN
351356

352357
typedef HANDLE __CFPort;
353358
#define CFPORT_NULL NULL
@@ -373,6 +378,8 @@ static __CFPortSet __CFPortSetAllocate(void) {
373378
result->used = 0;
374379
result->size = 4;
375380
result->handles = (HANDLE *)CFAllocatorAllocate(kCFAllocatorSystemDefault, result->size * sizeof(HANDLE), 0);
381+
382+
#define CF_SPINLOCK_INIT_FOR_STRUCTS(X) InitializeCriticalSection(&X)
376383
CF_SPINLOCK_INIT_FOR_STRUCTS(result->lock);
377384
return result;
378385
}
@@ -522,7 +529,7 @@ static uint32_t __CFSendTrivialMachMessage(mach_port_t port, uint32_t msg_id, CF
522529
if (result == MACH_SEND_TIMED_OUT) mach_msg_destroy(&header);
523530
return result;
524531
}
525-
#elif DEPLOYMENT_TARGET_LINUX
532+
#elif DEPLOYMENT_TARGET_LINUX && !TARGET_OS_CYGWIN
526533

527534
static int mk_timer_create(void) {
528535
return timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC);
@@ -552,7 +559,7 @@ CF_INLINE int64_t __CFUInt64ToAbsoluteTime(int64_t x) {
552559
return x;
553560
}
554561

555-
#elif DEPLOYMENT_TARGET_WINDOWS
562+
#elif DEPLOYMENT_TARGET_WINDOWS || TARGET_OS_CYGWIN
556563

557564
static HANDLE mk_timer_create(void) {
558565
return CreateWaitableTimer(NULL, FALSE, NULL);
@@ -572,13 +579,13 @@ static kern_return_t mk_timer_arm(HANDLE name, LARGE_INTEGER expire_time) {
572579
// There is a race we know about here, (timer fire time calculated -> thread suspended -> timer armed == late timer fire), but we don't have a way to avoid it at this time, since the only way to specify an absolute value to the timer is to calculate the relative time first. Fixing that would probably require not using the TSR for timers on Windows.
573580
uint64_t now = mach_absolute_time();
574581
if (now > expire_time) {
575-
result.QuadPart = 0;
582+
result = 0;
576583
} else {
577584
uint64_t timeDiff = expire_time - now;
578585
CFTimeInterval amountOfTimeToWait = __CFTSRToTimeInterval(timeDiff);
579586
// Result is in 100 ns (10**-7 sec) units to be consistent with a FILETIME.
580587
// CFTimeInterval is in seconds.
581-
result.QuadPart = -(amountOfTimeToWait * 10000000);
588+
result = -(amountOfTimeToWait * 10000000);
582589
}
583590

584591
BOOL res = SetWaitableTimer(name, &result, 0, NULL, NULL, FALSE);
@@ -2355,7 +2362,7 @@ static Boolean __CFRunLoopServiceMachPort(mach_port_name_t port, mach_msg_header
23552362
return false;
23562363
}
23572364

2358-
#elif DEPLOYMENT_TARGET_LINUX
2365+
#elif DEPLOYMENT_TARGET_LINUX && !TARGET_OS_CYGWIN
23592366

23602367
#define TIMEOUT_INFINITY UINT64_MAX
23612368

@@ -2444,7 +2451,7 @@ static Boolean __CFRunLoopServiceFileDescriptors(__CFPortSet portSet, __CFPort o
24442451
return true;
24452452
}
24462453

2447-
#elif DEPLOYMENT_TARGET_WINDOWS
2454+
#elif DEPLOYMENT_TARGET_WINDOWS || TARGET_OS_CYGWIN
24482455

24492456
#define TIMEOUT_INFINITY INFINITE
24502457

@@ -2594,7 +2601,7 @@ static int32_t __CFRunLoopRun(CFRunLoopRef rl, CFRunLoopModeRef rlm, CFTimeInter
25942601
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI
25952602
mach_msg_header_t *msg = NULL;
25962603
mach_port_t livePort = MACH_PORT_NULL;
2597-
#elif DEPLOYMENT_TARGET_WINDOWS
2604+
#elif DEPLOYMENT_TARGET_WINDOWS || TARGET_OS_CYGWIN
25982605
HANDLE livePort = NULL;
25992606
Boolean windowsMessageReceived = false;
26002607
#elif DEPLOYMENT_TARGET_LINUX
@@ -2623,11 +2630,11 @@ static int32_t __CFRunLoopRun(CFRunLoopRef rl, CFRunLoopModeRef rlm, CFTimeInter
26232630
if (__CFRunLoopServiceMachPort(dispatchPort, &msg, sizeof(msg_buffer), &livePort, 0, &voucherState, NULL)) {
26242631
goto handle_msg;
26252632
}
2626-
#elif DEPLOYMENT_TARGET_LINUX
2633+
#elif DEPLOYMENT_TARGET_LINUX && !TARGET_OS_CYGWIN
26272634
if (__CFRunLoopServiceFileDescriptors(CFPORTSET_NULL, dispatchPort, 0, &livePort)) {
26282635
goto handle_msg;
26292636
}
2630-
#elif DEPLOYMENT_TARGET_WINDOWS
2637+
#elif DEPLOYMENT_TARGET_WINDOWS || TARGET_OS_CYGWIN
26312638
if (__CFRunLoopWaitForMultipleObjects(NULL, &dispatchPort, 0, 0, &livePort, NULL)) {
26322639
goto handle_msg;
26332640
}
@@ -2695,7 +2702,7 @@ static int32_t __CFRunLoopRun(CFRunLoopRef rl, CFRunLoopModeRef rlm, CFTimeInter
26952702
#elif DEPLOYMENT_TARGET_WINDOWS
26962703
// Here, use the app-supplied message queue mask. They will set this if they are interested in having this run loop receive windows messages.
26972704
__CFRunLoopWaitForMultipleObjects(waitSet, NULL, poll ? 0 : TIMEOUT_INFINITY, rlm->_msgQMask, &livePort, &windowsMessageReceived);
2698-
#elif DEPLOYMENT_TARGET_LINUX
2705+
#elif DEPLOYMENT_TARGET_LINUX && !TARGET_OS_CYGWIN
26992706
__CFRunLoopServiceFileDescriptors(waitSet, CFPORT_NULL, TIMEOUT_INFINITY, &livePort);
27002707
#endif
27012708

@@ -2820,7 +2827,7 @@ static int32_t __CFRunLoopRun(CFRunLoopRef rl, CFRunLoopModeRef rlm, CFTimeInter
28202827
(void)mach_msg(reply, MACH_SEND_MSG, reply->msgh_size, 0, MACH_PORT_NULL, 0, MACH_PORT_NULL);
28212828
CFAllocatorDeallocate(kCFAllocatorSystemDefault, reply);
28222829
}
2823-
#elif DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
2830+
#elif DEPLOYMENT_TARGET_WINDOWS || (DEPLOYMENT_TARGET_LINUX && !TARGET_OS_CYGWIN)
28242831
sourceHandledThisLoop = __CFRunLoopDoSource1(rl, rlm, rls) || sourceHandledThisLoop;
28252832
#endif
28262833
}
@@ -2936,7 +2943,7 @@ void CFRunLoopWakeUp(CFRunLoopRef rl) {
29362943
* wakeup pending, since the queue length is 1. */
29372944
ret = __CFSendTrivialMachMessage(rl->_wakeUpPort, 0, MACH_SEND_TIMEOUT, 0);
29382945
if (ret != MACH_MSG_SUCCESS && ret != MACH_SEND_TIMED_OUT) CRASH("*** Unable to send message to wake up port. (%d) ***", ret);
2939-
#elif DEPLOYMENT_TARGET_LINUX
2946+
#elif DEPLOYMENT_TARGET_LINUX && !TARGET_OS_CYGWIN
29402947
int ret;
29412948
do {
29422949
ret = eventfd_write(rl->_wakeUpPort, 1);
@@ -3481,7 +3488,7 @@ static CFStringRef __CFRunLoopSourceCopyDescription(CFTypeRef cf) { /* DOES CALL
34813488
void *addr = rls->_context.version0.version == 0 ? (void *)rls->_context.version0.perform : (rls->_context.version0.version == 1 ? (void *)rls->_context.version1.perform : NULL);
34823489
#if DEPLOYMENT_TARGET_WINDOWS
34833490
contextDesc = CFStringCreateWithFormat(kCFAllocatorSystemDefault, NULL, CFSTR("<CFRunLoopSource context>{version = %ld, info = %p, callout = %p}"), rls->_context.version0.version, rls->_context.version0.info, addr);
3484-
#elif DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_LINUX
3491+
#elif DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || (DEPLOYMENT_TARGET_LINUX && !TARGET_OS_CYGWIN)
34853492
Dl_info info;
34863493
const char *name = (dladdr(addr, &info) && info.dli_saddr == addr && info.dli_sname) ? info.dli_sname : "???";
34873494
contextDesc = CFStringCreateWithFormat(kCFAllocatorSystemDefault, NULL, CFSTR("<CFRunLoopSource context>{version = %ld, info = %p, callout = %s (%p)}"), rls->_context.version0.version, rls->_context.version0.info, name, addr);
@@ -3682,7 +3689,7 @@ static CFStringRef __CFRunLoopObserverCopyDescription(CFTypeRef cf) { /* DOES CA
36823689
}
36833690
#if DEPLOYMENT_TARGET_WINDOWS
36843691
result = CFStringCreateWithFormat(kCFAllocatorSystemDefault, NULL, CFSTR("<CFRunLoopObserver %p [%p]>{valid = %s, activities = 0x%x, repeats = %s, order = %d, callout = %p, context = %@}"), cf, CFGetAllocator(rlo), __CFIsValid(rlo) ? "Yes" : "No", rlo->_activities, __CFRunLoopObserverRepeats(rlo) ? "Yes" : "No", rlo->_order, rlo->_callout, contextDesc);
3685-
#elif DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_LINUX
3692+
#elif DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || (DEPLOYMENT_TARGET_LINUX && !TARGET_OS_CYGWIN)
36863693
void *addr = rlo->_callout;
36873694
Dl_info info;
36883695
const char *name = (dladdr(addr, &info) && info.dli_saddr == addr && info.dli_sname) ? info.dli_sname : "???";

0 commit comments

Comments
 (0)