22 lines
273 B
Plaintext
Raw Normal View History

2024-08-12 15:31:23 +02:00
import sys
2025-02-15 14:38:01 +01:00
const prot {
read 0x1
write 0x2
}
const map {
private 0x02
anonymous 0x20
}
2025-02-09 20:25:37 +01:00
alloc(length Int) -> []Int8 {
2025-02-15 14:38:01 +01:00
x := sys.mmap(0, length+8, prot.read|prot.write, map.private|map.anonymous)
2025-02-09 14:38:01 +01:00
if x < 0x1000 {
return x
}
store(x, 8, length)
return x + 8
2024-08-12 15:31:23 +02:00
}