5 * Allow old BSD naming too, it would be a pity to have to make a
6 * separate file just for this.
9 #define MAP_ANONYMOUS MAP_ANON
13 * Our blob allocator enforces the strict CHUNK size
14 * requirement, as a portability check.
16 void *blob_alloc(unsigned long size
)
21 die("internal error: bad allocation size (%lu bytes)", size
);
22 ptr
= mmap(NULL
, size
, PROT_READ
| PROT_WRITE
, MAP_PRIVATE
| MAP_ANONYMOUS
, -1, 0);
23 if (ptr
== MAP_FAILED
)
28 void blob_free(void *addr
, unsigned long size
)
30 if (!size
|| (size
& ~CHUNK
) || ((unsigned long) addr
& 512))
31 die("internal error: bad blob free (%lu bytes at %p)", size
, addr
);
35 mprotect(addr
, size
, PROT_NONE
);