defines for building on Hurd and BSD kernels

This commit is contained in:
Alberto Luaces 2016-05-31 12:58:57 +01:00 committed by Robert Osfield
parent a4c9cac2a8
commit af9d8889c8
5 changed files with 14 additions and 4 deletions

View File

@ -33,7 +33,7 @@
#if defined(__linux) #if defined(__linux)
#include <unistd.h> #include <unistd.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#elif defined(__FreeBSD__) || defined(__DragonFly__) #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#include <unistd.h> #include <unistd.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#elif defined(__sgi) #elif defined(__sgi)
@ -41,6 +41,8 @@
#include <net/soioctl.h> #include <net/soioctl.h>
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
#include <unistd.h> #include <unistd.h>
#elif defined (__GNU__)
#include <unistd.h>
#elif defined(__sun) #elif defined(__sun)
#include <unistd.h> #include <unistd.h>
#include <sys/sockio.h> #include <sys/sockio.h>
@ -338,7 +340,7 @@ void Receiver::sync( void )
} }
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \ #if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
defined(__DragonFly__) defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
socklen_t socklen_t
#else #else
int int

View File

@ -45,6 +45,8 @@
#include <net/soioctl.h> #include <net/soioctl.h>
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
#include <unistd.h> #include <unistd.h>
#elif defined (__GNU__)
#include <unistd.h>
#elif defined(__sun) #elif defined(__sun)
#include <unistd.h> #include <unistd.h>
#include <sys/sockio.h> #include <sys/sockio.h>

View File

@ -122,7 +122,7 @@ void Receiver::sync( void )
return; return;
} }
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) #if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || defined(__FreeBSD_kernel__) || defined(__GNU__)
socklen_t size; socklen_t size;
#else #else
int size; int size;

View File

@ -43,8 +43,10 @@
#endif #endif
#if defined (__FreeBSD__) || defined (__APPLE__) || defined (__MACH__) #if defined (__FreeBSD__) || defined (__APPLE__) || defined (__MACH__)
#include <sys/types.h> #include <sys/types.h>
#if !defined (__GNU__)
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif
#endif
#if defined(__ANDROID__) #if defined(__ANDROID__)
#ifndef PAGE_SIZE #ifndef PAGE_SIZE
@ -1012,7 +1014,7 @@ int Thread::microSleep(unsigned int microsec)
// //
int OpenThreads::GetNumberOfProcessors() int OpenThreads::GetNumberOfProcessors()
{ {
#if defined(__linux__) #if defined(__linux__) || defined(__GNU__)
long ret = sysconf(_SC_NPROCESSORS_ONLN); long ret = sysconf(_SC_NPROCESSORS_ONLN);
if (ret == -1) if (ret == -1)
return 0; return 0;

View File

@ -30,6 +30,10 @@
using std::tolower; using std::tolower;
#endif #endif
#if defined(__GNU__) && !defined(PATH_MAX)
#define PATH_MAX 4096
#endif
using namespace std; using namespace std;
static const char * const PATH_SEPARATORS = "/\\"; static const char * const PATH_SEPARATORS = "/\\";