Home | History | Annotate | Line # | Download | only in os
      1 #ifndef JEMALLOC_INTERNAL_OS_DETECT_H
      2 #define JEMALLOC_INTERNAL_OS_DETECT_H
      3 
      4 /*
      5  * Platform detection for the OS-layer dispatchers.
      6  *
      7  * Defines JEMALLOC_OS_POSIX when the target is POSIX, so a module dispatcher
      8  * can fall back to os/posix/<module>.h for ANY POSIX platform without that
      9  * platform being enumerated.  We treat the target as POSIX if the C library
     10  * advertises _POSIX_VERSION (via <unistd.h>) or the compiler predefines
     11  * __unix__/__unix.  Windows is handled by its own _WIN32 branch and never
     12  * reaches here.
     13  *
     14  * Included (idempotently) by os.h and by every module dispatcher, so the
     15  * dispatchers work whether reached through os.h or directly.
     16  */
     17 #if !defined(_WIN32)
     18 #  if !defined(__has_include) || __has_include(<unistd.h>)
     19 #    include <unistd.h>
     20 #  endif
     21 #  if defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix)
     22 #    define JEMALLOC_OS_POSIX
     23 #  endif
     24 #endif
     25 
     26 #endif /* JEMALLOC_INTERNAL_OS_DETECT_H */
     27