interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / libc / src / new / qurt / sys / mman.rs

55 lines · 1696 bytes Raw Blame History
1//! Header: `sys/mman.h`
2//!
3//! Memory mapping functions and constants from Hexagon toolchain.
4
5use super::super::*;
6use crate::prelude::*;
7
8// Memory protection constants
9pub const PROT_NONE: c_int = 0x00;
10pub const PROT_READ: c_int = 0x01;
11pub const PROT_WRITE: c_int = 0x02;
12pub const PROT_EXEC: c_int = 0x04;
13
14// Memory mapping constants
15pub const MAP_SHARED: c_int = 0x0001;
16pub const MAP_PRIVATE: c_int = 0x0002;
17pub const MAP_FIXED: c_int = 0x0010;
18pub const MAP_ANON: c_int = 0x1000;
19pub const MAP_ANONYMOUS: c_int = MAP_ANON;
20pub const MAP_FILE: c_int = 0x0000;
21pub const MAP_RENAME: c_int = 0x0020;
22pub const MAP_NORESERVE: c_int = 0x0040;
23pub const MAP_INHERIT: c_int = 0x0080;
24pub const MAP_HASSEMAPHORE: c_int = 0x0200;
25pub const MAP_TRYFIXED: c_int = 0x0400;
26pub const MAP_WIRED: c_int = 0x0800;
27
28pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
29
30// Memory sync constants
31pub const MS_ASYNC: c_int = 0x01;
32pub const MS_INVALIDATE: c_int = 0x02;
33pub const MS_SYNC: c_int = 0x04;
34
35// Memory lock constants
36pub const MCL_CURRENT: c_int = 0x01;
37pub const MCL_FUTURE: c_int = 0x02;
38
39extern "C" {
40 pub fn mmap(
41 addr: *mut c_void,
42 len: size_t,
43 prot: c_int,
44 flags: c_int,
45 fd: c_int,
46 offset: off_t,
47 ) -> *mut c_void;
48 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
49 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
50 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
51 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
52 pub fn mlockall(flags: c_int) -> c_int;
53 pub fn munlockall() -> c_int;
54 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int;
55}