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

#ifndef MEM_OS_POSIX_H
#define MEM_OS_POSIX_H

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

#ifdef WP_PLATFORM_CPP
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP

#ifdef WP_PLATFORM_POSIX

#include <sys/mman.h>

typedef enum {
#if defined(WP_PLATFORM_LINUX) || defined(WP_PLATFORM_GNU)
	WP_MEM_ALLOC_RESERVE = 0,
	WP_MEM_ALLOC_COMMIT  = MAP_POPULATE,
#elif defined(WP_PLATFORM_FREE_BSD)
	WP_MEM_ALLOC_RESERVE = 0,
	WP_MEM_ALLOC_COMMIT  = MAP_PREFAULT_READ,
#elif defined(WP_PLATFORM_BSD) || defined(WP_PLATFORM_UNIX) || defined(WP_PLATFORM_APPLE)
	WP_MEM_ALLOC_RESERVE = 0,
	WP_MEM_ALLOC_COMMIT  = 0,
#endif
} WpMemAllocFlags;

#endif // !WP_PLATFORM_POSIX

#ifdef WP_PLATFORM_CPP
END_C_LINKAGE
#endif // !WP_PLATFORM_CPP

#endif // !MEM_OS_POSIX_H
