#include #include void* buffer_init(usize size) { i32 fd = memfd_create("buffer", 0); ftruncate(fd, size); void* ptr = mmap(null, 2 * size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); mmap( ptr, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); mmap((c8*)ptr + size, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); return ptr; }