mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
make the mmapped buffer configurable
This commit is contained in:
parent
64c2d8d87e
commit
40d7e94a17
5 changed files with 37 additions and 30 deletions
|
@ -13,8 +13,18 @@ const O_CREAT: c_int = 64;
|
|||
pub const PROT_WRITE: c_int = 2;
|
||||
pub const MAP_SHARED: c_int = 0x0001;
|
||||
|
||||
// IMPORTANT: shared memory object names must begin with / and contain no other slashes!
|
||||
var MMAPPED_FILE: []const u8 = "/roc_expect_buffer";
|
||||
|
||||
pub fn setMmappedFile(ptr: [*]u8, length: usize) callconv(.C) usize {
|
||||
MMAPPED_FILE = ptr[0..length];
|
||||
|
||||
// the rust side expects that a pointer is returned
|
||||
return 0;
|
||||
}
|
||||
|
||||
pub fn expectFailedStart() callconv(.C) [*]u8 {
|
||||
const name = "/roc_expect_buffer"; // IMPORTANT: shared memory object names must begin with / and contain no other slashes!
|
||||
const name = MMAPPED_FILE;
|
||||
|
||||
const shared_fd = shm_open(@ptrCast(*const i8, name), O_RDWR | O_CREAT, 0o666);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue