|
- #ifndef OS_IMPL_LINUX_CPP
- #define OS_IMPL_LINUX_CPP
-
- #include "os.h"
-
- #include <sys/mman.h>
- #include <sys/stat.h>
- #include <unistd.h>
-
- void *os_alloc(size_t capacity) {
- return mmap(0, capacity, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- }
-
- void os_commit(void *ptr) {
- }
-
- void os_decommit(void *ptr) {
- }
-
- void os_free(void *ptr, size_t size) {
- int err = munmap(ptr, size);
- Assert(err != -1);
- }
-
- #endif
|