-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPosix.cs
30 lines (21 loc) · 926 Bytes
/
Posix.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Runtime.InteropServices;
static unsafe class Posix
{
public const int PROT_READ = 1 << 0;
public const int PROT_WRITE = 1 << 1;
public const int PROT_EXEC = 1 << 2;
public const int MAP_PRIVATE = 1 << 1;
public const int MAP_ANONYMOUS = 1 << 5;
[DllImport("c", ExactSpelling = true, SetLastError = true)]
public static extern void* mmap(void* addr, nuint length, int prot, int flags, int fd, uint offset);
[DllImport("c", ExactSpelling = true, SetLastError = true)]
public static extern int munmap(void* addr, nuint length);
[DllImport("c", ExactSpelling = true, SetLastError = true)]
public static extern int mprotect(void* addr, nuint len, int prot);
public static void __builtin___clear_cache(void* begin, void* end)
{
// TODO: Use a native library to expose this
_ = begin;
_ = end;
}
}