FreeBSD compability (#57)

This commit is contained in:
Daniel Ylitalo 2017-12-13 21:02:50 +01:00 committed by Derek Mauro
parent 04edad3801
commit 5fe41affba
6 changed files with 15 additions and 9 deletions

View file

@ -254,8 +254,9 @@
// POSIX.1-2001.
#ifdef ABSL_HAVE_MMAP
#error ABSL_HAVE_MMAP cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__ros__) || \
defined(__native_client__) || defined(__asmjs__) || defined(__Fuchsia__)
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
defined(__Fuchsia__)
#define ABSL_HAVE_MMAP 1
#endif
@ -265,7 +266,8 @@
// functions as defined in POSIX.1-2001.
#ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
#error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__ros__)
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__)
#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
#endif

View file

@ -22,6 +22,8 @@
#elif defined(__APPLE__)
// Mac OS X / Darwin features
#include <libkern/OSByteOrder.h>
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#elif defined(__GLIBC__)
#include <byteswap.h> // IWYU pragma: export
#endif

View file

@ -34,7 +34,8 @@
//
// This preprocessor token is also defined in raw_io.cc. If you need to copy
// this, consider moving both to config.h instead.
#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__)
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__Fuchsia__)
#include <unistd.h>
@ -47,7 +48,7 @@
// ABSL_HAVE_SYSCALL_WRITE is defined when the platform provides the syscall
// syscall(SYS_write, /*int*/ fd, /*char* */ buf, /*size_t*/ len);
// for low level operations that want to avoid libc.
#if defined(__linux__) && !defined(__ANDROID__)
#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(__ANDROID__)
#include <sys/syscall.h>
#define ABSL_HAVE_SYSCALL_WRITE 1
#define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1

View file

@ -29,7 +29,7 @@
#include <sys/syscall.h>
#endif
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__FreeBSD__)
#include <sys/sysctl.h>
#endif

View file

@ -25,8 +25,8 @@
#if ABSL_STACKTRACE_INL_HEADER
#error ABSL_STACKTRACE_INL_HEADER cannot be directly set
#elif defined(__native_client__) || defined(__APPLE__) || \
defined(__ANDROID__) || defined(__myriad2__) || defined(asmjs__) || \
defined(__Fuchsia__)
defined(__FreeBSD__) || defined(__ANDROID__) || defined(__myriad2__) || \
defined(asmjs__) || defined(__Fuchsia__)
#define ABSL_STACKTRACE_INL_HEADER \
"absl/debugging/internal/stacktrace_unimplemented-inl.inc"

View file

@ -47,7 +47,8 @@ static inline void *StacktracePowerPCGetLR(void **sp) {
return *(sp+2);
#elif defined(_CALL_SYSV)
return *(sp+1);
#elif defined(__APPLE__) || (defined(__linux__) && defined(__PPC64__))
#elif defined(__APPLE__) || defined(__FreeBSD__) || \
(defined(__linux__) && defined(__PPC64__))
// This check is in case the compiler doesn't define _CALL_AIX/etc.
return *(sp+2);
#elif defined(__linux)