#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
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);
*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;
*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;
#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
# 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()