Skip to content

Commit 21447ec

Browse files
authored
Merge pull request #1762 from AdminXVII/redox-mman
Add extra functions & constants from sys/mman.h for Redox
2 parents bd5815a + d573a99 commit 21447ec

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/unix/redox/mod.rs

+35
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,23 @@ pub const TIOCSPGRP: ::c_ulong = 0x5410;
587587
pub const TIOCGWINSZ: ::c_ulong = 0x5413;
588588
pub const TIOCSWINSZ: ::c_ulong = 0x5414;
589589

590+
// sys/mman.h
591+
pub const PROT_NONE: ::c_int = 0x0000;
592+
pub const PROT_READ: ::c_int = 0x0004;
593+
pub const PROT_WRITE: ::c_int = 0x0002;
594+
pub const PROT_EXEC: ::c_int = 0x0001;
595+
596+
pub const MAP_SHARED: ::c_int = 0x0001;
597+
pub const MAP_PRIVATE: ::c_int = 0x0002;
598+
pub const MAP_ANON: ::c_int = 0x0020;
599+
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
600+
pub const MAP_FIXED: ::c_int = 0x0010;
601+
pub const MAP_FAILED: *mut ::c_void = !0 as _;
602+
603+
pub const MS_ASYNC: ::c_int = 0x0001;
604+
pub const MS_INVALIDATE: ::c_int = 0x0002;
605+
pub const MS_SYNC: ::c_int = 0x0004;
606+
590607
// sys/select.h
591608
pub const FD_SETSIZE: usize = 1024;
592609

@@ -934,6 +951,24 @@ extern "C" {
934951
// sys/ioctl.h
935952
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
936953

954+
// sys/mman.h
955+
pub fn msync(
956+
addr: *mut ::c_void,
957+
len: ::size_t,
958+
flags: ::c_int,
959+
) -> ::c_int;
960+
pub fn mprotect(
961+
addr: *mut ::c_void,
962+
len: ::size_t,
963+
prot: ::c_int,
964+
) -> ::c_int;
965+
pub fn shm_open(
966+
name: *const c_char,
967+
oflag: ::c_int,
968+
mode: mode_t,
969+
) -> ::c_int;
970+
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
971+
937972
// sys/resource.h
938973
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
939974
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;

0 commit comments

Comments
 (0)