// vim:fileencoding=utf-8:foldmethod=marker

#ifndef MEM_OS_POSIX_H
#define MEM_OS_POSIX_H

#include "../../../common/platform/platform.h"

#ifdef WAPP_PLATFORM_CPP
BEGIN_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP

#ifdef WAPP_PLATFORM_POSIX

#include <sys/mman.h>

typedef enum mem_alloc_flags {
#if defined(WAPP_PLATFORM_LINUX) || defined(WAPP_PLATFORM_GNU)
  WAPP_MEM_ALLOC_RESERVE = 0,
  WAPP_MEM_ALLOC_COMMIT  = MAP_POPULATE,
#elif defined(WAPP_PLATFORM_FREE_BSD)
  WAPP_MEM_ALLOC_RESERVE = 0,
  WAPP_MEM_ALLOC_COMMIT  = MAP_PREFAULT_READ,
#elif defined(WAPP_PLATFORM_BSD) || defined(WAPP_PLATFORM_UNIX) || defined(WAPP_PLATFORM_APPLE)
  WAPP_MEM_ALLOC_RESERVE = 0,
  WAPP_MEM_ALLOC_COMMIT  = 0,
#endif
} MemAllocFlags;

#endif // !WAPP_PLATFORM_POSIX

#ifdef WAPP_PLATFORM_CPP
END_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP

#endif // !MEM_OS_POSIX_H
