Skip to content

Commit d015466

Browse files
tinysun212parkera
authored andcommitted
Porting to Cygwin (#381)
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 1681a38 commit d015466

32 files changed

+159
-47
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,6 +156,8 @@ const char *_CFProcessPath(void) {
156156
#endif
157157

158158
#if DEPLOYMENT_TARGET_LINUX
159+
#if TARGET_OS_CYGWIN
160+
#else
159161
#include <unistd.h>
160162
#if __has_include(<syscall.h>)
161163
#include <syscall.h>
@@ -166,6 +168,7 @@ const char *_CFProcessPath(void) {
166168
Boolean _CFIsMainThread(void) {
167169
return syscall(SYS_gettid) == getpid();
168170
}
171+
#endif
169172

170173
const char *_CFProcessPath(void) {
171174
if (__CFProcessPath) return __CFProcessPath;

CoreFoundation/Base.subproj/CFUtilities.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ CFDictionaryRef __CFGetEnvironment() {
13081308
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED
13091309
extern char ***_NSGetEnviron();
13101310
char **envp = *_NSGetEnviron();
1311-
#elif DEPLOYMENT_TARGET_FREEBSD
1311+
#elif DEPLOYMENT_TARGET_FREEBSD || TARGET_OS_CYGWIN
13121312
extern char **environ;
13131313
char **envp = environ;
13141314
#elif DEPLOYMENT_TARGET_LINUX

CoreFoundation/Base.subproj/CoreFoundation_Prefix.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ typedef int boolean_t;
182182
typedef unsigned long fd_mask;
183183
#endif
184184

185-
#ifndef __ANDROID__
185+
#if !defined(__ANDROID__) && !TARGET_OS_CYGWIN
186186
CF_INLINE size_t
187187
strlcpy(char * dst, const char * src, size_t maxlen) {
188188
const size_t srclen = strlen(src);
@@ -210,7 +210,9 @@ strlcat(char * dst, const char * src, size_t maxlen) {
210210
}
211211
#endif
212212

213+
#if !TARGET_OS_CYGWIN
213214
#define issetugid() 0
215+
#endif
214216

215217
// Implemented in CFPlatform.c
216218
bool OSAtomicCompareAndSwapPtr(void *oldp, void *newp, void *volatile *dst);
@@ -269,7 +271,14 @@ void OSMemoryBarrier();
269271

270272
#endif
271273

272-
#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
274+
#if TARGET_OS_CYGWIN
275+
#define HAVE_STRUCT_TIMESPEC 1
276+
#define strncasecmp_l(a, b, c, d) strncasecmp(a, b, c)
277+
#define _NO_BOOL_TYPEDEF
278+
#undef interface
279+
#endif
280+
281+
#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
273282
#if !defined(MIN)
274283
#define MIN(A,B) ((A) < (B) ? (A) : (B))
275284
#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,12 +24,15 @@
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
#if __has_include(<sys/sysctl.h>)
2931
#include <sys/sysctl.h>
3032
#endif
3133
#include <sys/mman.h>
3234
#endif
35+
#endif
3336

3437
// 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
3538
#if !__CONSTANT_STRINGS__
@@ -144,7 +147,11 @@ CF_EXPORT CFStringRef _CFGetPlatformName(void) {
144147
#elif DEPLOYMENT_TARGET_HPUX
145148
return _CFBundleHPUXPlatformName;
146149
#elif DEPLOYMENT_TARGET_LINUX
150+
#if TARGET_OS_CYGWIN
151+
return _CFBundleCygwinPlatformName;
152+
#else
147153
return _CFBundleLinuxPlatformName;
154+
#endif
148155
#elif DEPLOYMENT_TARGET_FREEBSD
149156
return _CFBundleFreeBSDPlatformName;
150157
#else
@@ -160,7 +167,11 @@ CF_EXPORT CFStringRef _CFGetAlternatePlatformName(void) {
160167
#elif DEPLOYMENT_TARGET_WINDOWS
161168
return CFSTR("");
162169
#elif DEPLOYMENT_TARGET_LINUX
170+
#if TARGET_OS_CYGWIN
171+
return CFSTR("Cygwin");
172+
#else
163173
return CFSTR("Linux");
174+
#endif
164175
#elif DEPLOYMENT_TARGET_FREEBSD
165176
return CFSTR("FreeBSD");
166177
#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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,11 @@ CF_EXPORT CFStringRef _CFBundleGetCurrentPlatform(void) {
315315
#elif DEPLOYMENT_TARGET_HPUX
316316
return CFSTR("HPUX");
317317
#elif DEPLOYMENT_TARGET_LINUX
318+
#if TARGET_OS_CYGWIN
319+
return CFSTR("Cygwin");
320+
#else
318321
return CFSTR("Linux");
322+
#endif
319323
#elif DEPLOYMENT_TARGET_FREEBSD
320324
return CFSTR("FreeBSD");
321325
#else
@@ -333,7 +337,11 @@ CF_PRIVATE CFStringRef _CFBundleGetPlatformExecutablesSubdirectoryName(void) {
333337
#elif DEPLOYMENT_TARGET_HPUX
334338
return CFSTR("HPUX");
335339
#elif DEPLOYMENT_TARGET_LINUX
340+
#if TARGET_OS_CYGWIN
341+
return CFSTR("Cygwin");
342+
#else
336343
return CFSTR("Linux");
344+
#endif
337345
#elif DEPLOYMENT_TARGET_FREEBSD
338346
return CFSTR("FreeBSD");
339347
#else
@@ -351,7 +359,11 @@ CF_PRIVATE CFStringRef _CFBundleGetAlternatePlatformExecutablesSubdirectoryName(
351359
#elif DEPLOYMENT_TARGET_HPUX
352360
return CFSTR("HP-UX");
353361
#elif DEPLOYMENT_TARGET_LINUX
362+
#if TARGET_OS_CYGWIN
363+
return CFSTR("Cygwin");
364+
#else
354365
return CFSTR("Linux");
366+
#endif
355367
#elif DEPLOYMENT_TARGET_FREEBSD
356368
return CFSTR("FreeBSD");
357369
#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)