diff options
author | Eric Engestrom <[email protected]> | 2019-08-01 22:33:05 +0100 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2019-08-02 18:38:52 +0100 |
commit | 7f12a66ad5be2ec190000622dddff58600bc9053 (patch) | |
tree | 053e4c9def32d3ece2750cfa434b478b5ee01c91 /src | |
parent | 87adc898b32778f86a488e22c3f7d0744eae245e (diff) |
util/os_misc: use detect_os.h to start uncoupling from gallium
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/util/os_misc.c | 24 | ||||
-rw-r--r-- | src/util/os_misc.h | 5 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/util/os_misc.c b/src/util/os_misc.c index b6359ed195c..755970430b0 100644 --- a/src/util/os_misc.c +++ b/src/util/os_misc.c @@ -47,13 +47,13 @@ #endif -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HURD) +#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD # include <unistd.h> -#elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_BSD) +#elif DETECT_OS_APPLE || DETECT_OS_BSD # include <sys/sysctl.h> -#elif defined(PIPE_OS_HAIKU) +#elif DETECT_OS_HAIKU # include <kernel/OS.h> -#elif defined(PIPE_OS_WINDOWS) +#elif DETECT_OS_WINDOWS # include <windows.h> #else #error unexpected platform in os_sysinfo.c @@ -124,7 +124,7 @@ os_get_option(const char *name) bool os_get_total_physical_memory(uint64_t *size) { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HURD) +#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD const long phys_pages = sysconf(_SC_PHYS_PAGES); const long page_size = sysconf(_SC_PAGE_SIZE); @@ -133,25 +133,25 @@ os_get_total_physical_memory(uint64_t *size) *size = (uint64_t)phys_pages * (uint64_t)page_size; return true; -#elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_BSD) +#elif DETECT_OS_APPLE || DETECT_OS_BSD size_t len = sizeof(*size); int mib[2]; mib[0] = CTL_HW; -#if defined(PIPE_OS_APPLE) +#if DETECT_OS_APPLE mib[1] = HW_MEMSIZE; -#elif defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) +#elif DETECT_OS_NETBSD || DETECT_OS_OPENBSD mib[1] = HW_PHYSMEM64; -#elif defined(PIPE_OS_FREEBSD) +#elif DETECT_OS_FREEBSD mib[1] = HW_REALMEM; -#elif defined(PIPE_OS_DRAGONFLY) +#elif DETECT_OS_DRAGONFLY mib[1] = HW_PHYSMEM; #else #error Unsupported *BSD #endif return (sysctl(mib, 2, size, &len, NULL, 0) == 0); -#elif defined(PIPE_OS_HAIKU) +#elif DETECT_OS_HAIKU system_info info; status_t ret; @@ -161,7 +161,7 @@ os_get_total_physical_memory(uint64_t *size) *size = (uint64_t)info.max_pages * (uint64_t)B_PAGE_SIZE; return true; -#elif defined(PIPE_OS_WINDOWS) +#elif DETECT_OS_WINDOWS MEMORYSTATUSEX status; BOOL ret; diff --git a/src/util/os_misc.h b/src/util/os_misc.h index 403c8ee6ec5..8ac3eeff377 100644 --- a/src/util/os_misc.h +++ b/src/util/os_misc.h @@ -35,10 +35,11 @@ #define _OS_MISC_H_ +#include "detect_os.h" #include "pipe/p_compiler.h" -#if defined(PIPE_OS_UNIX) +#if DETECT_OS_UNIX # include <signal.h> /* for kill() */ # include <unistd.h> /* getpid() */ #endif @@ -56,7 +57,7 @@ extern "C" { # define os_break() __asm("int3") #elif defined(PIPE_CC_MSVC) # define os_break() __debugbreak() -#elif defined(PIPE_OS_UNIX) +#elif DETECT_OS_UNIX # define os_break() kill(getpid(), SIGTRAP) #else # define os_break() abort() |