From 5fe41affbaab5b9ad4876a6295c78f21a86d862d Mon Sep 17 00:00:00 2001 From: Daniel Ylitalo Date: Wed, 13 Dec 2017 21:02:50 +0100 Subject: FreeBSD compability (#57) --- absl/base/config.h | 8 +++++--- absl/base/internal/endian.h | 2 ++ absl/base/internal/raw_logging.cc | 5 +++-- absl/base/internal/sysinfo.cc | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'absl/base') diff --git a/absl/base/config.h b/absl/base/config.h index 6aeceb9b0616..fc48be0b8fc1 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -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 diff --git a/absl/base/internal/endian.h b/absl/base/internal/endian.h index 602129eed207..edc10f10a5aa 100644 --- a/absl/base/internal/endian.h +++ b/absl/base/internal/endian.h @@ -22,6 +22,8 @@ #elif defined(__APPLE__) // Mac OS X / Darwin features #include +#elif defined(__FreeBSD__) +#include #elif defined(__GLIBC__) #include // IWYU pragma: export #endif diff --git a/absl/base/internal/raw_logging.cc b/absl/base/internal/raw_logging.cc index 1b849abfceae..301b108c07e9 100644 --- a/absl/base/internal/raw_logging.cc +++ b/absl/base/internal/raw_logging.cc @@ -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 @@ -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 #define ABSL_HAVE_SYSCALL_WRITE 1 #define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1 diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc index 00e98b662cc6..884c31262877 100644 --- a/absl/base/internal/sysinfo.cc +++ b/absl/base/internal/sysinfo.cc @@ -29,7 +29,7 @@ #include #endif -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) #include #endif -- cgit 1.4.1