Skip to content

[CF] Add TARGET_OS_BSD in some places. #2590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CoreFoundation/Base.subproj/CFPlatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const char *_CFProcessPath(void) {
}
#endif

#if TARGET_OS_MAC || TARGET_OS_WIN32
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_BSD
CF_CROSS_PLATFORM_EXPORT Boolean _CFIsMainThread(void) {
return pthread_main_np() == 1;
}
Expand Down Expand Up @@ -619,7 +619,7 @@ CF_PRIVATE void __CFTSDInitialize() {
static void __CFTSDSetSpecific(void *arg) {
#if TARGET_OS_MAC
pthread_setspecific(__CFTSDIndexKey, arg);
#elif TARGET_OS_LINUX
#elif TARGET_OS_LINUX || TARGET_OS_BSD
pthread_setspecific(__CFTSDIndexKey, arg);
#elif TARGET_OS_WIN32
FlsSetValue(__CFTSDIndexKey, arg);
Expand All @@ -629,7 +629,7 @@ static void __CFTSDSetSpecific(void *arg) {
static void *__CFTSDGetSpecific() {
#if TARGET_OS_MAC
return pthread_getspecific(__CFTSDIndexKey);
#elif TARGET_OS_LINUX
#elif TARGET_OS_LINUX || TARGET_OS_BSD
return pthread_getspecific(__CFTSDIndexKey);
#elif TARGET_OS_WIN32
return FlsGetValue(__CFTSDIndexKey);
Expand Down
6 changes: 3 additions & 3 deletions CoreFoundation/Base.subproj/CoreFoundation_Prefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ typedef int boolean_t;
typedef unsigned long fd_mask;
#endif

#if !TARGET_OS_ANDROID && !TARGET_OS_CYGWIN
#if !TARGET_OS_ANDROID && !TARGET_OS_CYGWIN && !TARGET_OS_BSD
CF_INLINE size_t
strlcpy(char * dst, const char * src, size_t maxlen) {
const size_t srclen = strlen(src);
Expand Down Expand Up @@ -180,7 +180,7 @@ strlcat(char * dst, const char * src, size_t maxlen) {
}
#endif

#if !TARGET_OS_CYGWIN
#if !TARGET_OS_CYGWIN && !TARGET_OS_BSD
#define issetugid() 0
#endif

Expand Down Expand Up @@ -250,7 +250,7 @@ void OSMemoryBarrier();

#endif

#if TARGET_OS_LINUX
#if TARGET_OS_LINUX || TARGET_OS_BSD
#include <sys/param.h>
#endif
#if TARGET_OS_WIN32 || TARGET_OS_LINUX
Expand Down
2 changes: 1 addition & 1 deletion CoreFoundation/Collections.subproj/CFData.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ CF_INLINE unsigned long __CFPageSize() {
GetSystemInfo(&sysInfo);
return sysInfo.dwPageSize;
}
#elif TARGET_OS_LINUX
#elif TARGET_OS_LINUX || TARGET_OS_BSD
#include <unistd.h>
CF_INLINE unsigned long __CFPageSize() {
return (unsigned long)getpagesize();
Expand Down
2 changes: 1 addition & 1 deletion CoreFoundation/PlugIn.subproj/CFBundle_Resources.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <errno.h>
#include <sys/types.h>

#if TARGET_OS_MAC || TARGET_OS_LINUX
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
#include <unistd.h>
#if !TARGET_OS_ANDROID
#include <sys/sysctl.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void __CFMilliSleep(uint32_t msecs) {
SleepEx(msecs, false);
#elif defined(__svr4__) || defined(__hpux__)
sleep((msecs + 900) / 1000);
#elif TARGET_OS_OSX || TARGET_OS_LINUX
#elif TARGET_OS_OSX || TARGET_OS_LINUX || TARGET_OS_BSD
struct timespec input;
input.tv_sec = msecs / 1000;
input.tv_nsec = (msecs - input.tv_sec * 1000) * 1000000;
Expand Down
2 changes: 1 addition & 1 deletion CoreFoundation/String.subproj/CFBurstTrie.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <limits.h>
#if TARGET_OS_MAC || TARGET_OS_LINUX
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
#include <unistd.h>
#include <sys/param.h>
#include <sys/mman.h>
Expand Down