summaryrefslogtreecommitdiff
path: root/src/unix/redox/mod.rs
diff options
context:
space:
mode:
authorXavier L'Heureux <dev.xlheureux@gmail.com>2020-05-15 17:31:41 -0400
committerXavier L'Heureux <dev.xlheureux@gmail.com>2020-05-18 10:08:12 -0400
commitd573a99525642d32c6f5b389b4deb92026d1720c (patch)
treefcc1f25405cc25175c6c4f75d8baca681d5750e9 /src/unix/redox/mod.rs
parentbd5815ad41b8c746d374c2178d04aad192b5ba45 (diff)
downloadrust-libc-d573a99525642d32c6f5b389b4deb92026d1720c.tar.gz
Add extra functions & constants from sys/mman.h for Redox
Diffstat (limited to 'src/unix/redox/mod.rs')
-rw-r--r--src/unix/redox/mod.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs
index 7f66f1b41e..7b4b021762 100644
--- a/src/unix/redox/mod.rs
+++ b/src/unix/redox/mod.rs
@@ -587,6 +587,23 @@ pub const TIOCSPGRP: ::c_ulong = 0x5410;
pub const TIOCGWINSZ: ::c_ulong = 0x5413;
pub const TIOCSWINSZ: ::c_ulong = 0x5414;
+// sys/mman.h
+pub const PROT_NONE: ::c_int = 0x0000;
+pub const PROT_READ: ::c_int = 0x0004;
+pub const PROT_WRITE: ::c_int = 0x0002;
+pub const PROT_EXEC: ::c_int = 0x0001;
+
+pub const MAP_SHARED: ::c_int = 0x0001;
+pub const MAP_PRIVATE: ::c_int = 0x0002;
+pub const MAP_ANON: ::c_int = 0x0020;
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
+pub const MAP_FIXED: ::c_int = 0x0010;
+pub const MAP_FAILED: *mut ::c_void = !0 as _;
+
+pub const MS_ASYNC: ::c_int = 0x0001;
+pub const MS_INVALIDATE: ::c_int = 0x0002;
+pub const MS_SYNC: ::c_int = 0x0004;
+
// sys/select.h
pub const FD_SETSIZE: usize = 1024;
@@ -934,6 +951,24 @@ extern "C" {
// sys/ioctl.h
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+ // sys/mman.h
+ pub fn msync(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn mprotect(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ prot: ::c_int,
+ ) -> ::c_int;
+ pub fn shm_open(
+ name: *const c_char,
+ oflag: ::c_int,
+ mode: mode_t,
+ ) -> ::c_int;
+ pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
+
// sys/resource.h
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;