diff options
author | Orlando Arbildo <oarbildo@google.com> | 2023-11-16 22:13:56 +0000 |
---|---|---|
committer | Orlando Arbildo <oarbildo@google.com> | 2024-01-26 23:20:15 +0000 |
commit | 655aa7a62ef9d7455aba7e4563a0d967ce72a1fc (patch) | |
tree | c252d96408967ba77ab33ee5c6a743833bd1dea1 | |
parent | e9a44b53e191ea7061edcb2fecdef17072aaeceb (diff) | |
download | libc-655aa7a62ef9d7455aba7e4563a0d967ce72a1fc.tar.gz |
Add PROT_READ and PROT_WRITE constants to trusty
Adding PROT_READ and PROT_WRITE libc constants to
trusty.
Bug: 284156656
Test: build.py
Change-Id: I80c7d411520a429d6ec35685ff80f1862ccde814
-rw-r--r-- | patches/rules.mk.diff | 3 | ||||
-rw-r--r-- | patches/trusty.patch | 9 | ||||
-rw-r--r-- | rules.mk | 1 | ||||
-rw-r--r-- | src/trusty.rs | 5 |
4 files changed, 15 insertions, 3 deletions
diff --git a/patches/rules.mk.diff b/patches/rules.mk.diff index bad06a22..d44c11fe 100644 --- a/patches/rules.mk.diff +++ b/patches/rules.mk.diff @@ -2,7 +2,7 @@ diff --git a/rules.mk b/rules.mk index 92f34db68..08cf2d6c3 100644 --- a/rules.mk +++ b/rules.mk -@@ -24,5 +24,11 @@ +@@ -24,5 +24,12 @@ --cfg 'libc_ptr_addr_of' \ --cfg 'libc_underscore_const_names' \ --cfg 'libc_union' \ @@ -12,4 +12,5 @@ index 92f34db68..08cf2d6c3 100644 + trusty/user/base/lib/libcompiler_builtins-rust \ + trusty/user/base/lib/libcore-rust \ + trusty/user/base/lib/libc-trusty \ ++ trusty/user/base/lib/trusty-sys \ diff --git a/patches/trusty.patch b/patches/trusty.patch index d73429be..77de58ca 100644 --- a/patches/trusty.patch +++ b/patches/trusty.patch @@ -2,7 +2,7 @@ diff --git b/src/lib.rs a/src/lib.rs index 62748d279..4d8822ec2 100644 --- b/src/lib.rs +++ a/src/lib.rs -@@ -143,6 +143,12 @@ cfg_if! { +@@ -145,6 +145,12 @@ cfg_if! { mod teeos; pub use teeos::*; @@ -20,9 +20,14 @@ new file mode 100644 index 000000000..140fa6dfe --- /dev/null +++ a/src/trusty.rs -@@ -0,0 +1,80 @@ +@@ -0,0 +1,85 @@ ++extern crate trusty_sys; ++ +pub use core::ffi::c_void; + ++pub const PROT_READ: i32 = self::trusty_sys::MMAP_FLAG_PROT_READ as i32; ++pub const PROT_WRITE: i32 = self::trusty_sys::MMAP_FLAG_PROT_WRITE as i32; ++ +pub type size_t = usize; +pub type ssize_t = isize; + @@ -30,5 +30,6 @@ MODULE_LIBRARY_DEPS := \ trusty/user/base/lib/libcompiler_builtins-rust \ trusty/user/base/lib/libcore-rust \ trusty/user/base/lib/libc-trusty \ + trusty/user/base/lib/trusty-sys \ include make/library.mk diff --git a/src/trusty.rs b/src/trusty.rs index 140fa6df..eca27bf7 100644 --- a/src/trusty.rs +++ b/src/trusty.rs @@ -1,5 +1,10 @@ +extern crate trusty_sys; + pub use core::ffi::c_void; +pub const PROT_READ: i32 = self::trusty_sys::MMAP_FLAG_PROT_READ as i32; +pub const PROT_WRITE: i32 = self::trusty_sys::MMAP_FLAG_PROT_WRITE as i32; + pub type size_t = usize; pub type ssize_t = isize; |