Skip to content

Commit 7403035

Browse files
Add time_t and strlen to Trusty support patch am: 122e586
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/libc/+/2132739 Change-Id: I2909cc274bf419624efd7fd92960e4e7b9f027c5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2 parents e8f5819 + 122e586 commit 7403035

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

patches/trusty.patch

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
From e8131d6a00005b4686f26d25d8617dd83540e98d Mon Sep 17 00:00:00 2001
1+
From b81e3bd53bb4c60e6a778fa230cb8fd2a73b3683 Mon Sep 17 00:00:00 2001
22
From: David LeGare <legare@google.com>
3-
Date: Mon, 13 Jun 2022 22:23:23 +0000
3+
Date: Wed, 22 Jun 2022 18:39:50 +0000
44
Subject: [PATCH] Add support for the Trusty OS
55

6+
Change-Id: I7f99f36b85ff5ed2bf71c0d8f6561e32fa25105d
67
---
7-
src/lib.rs | 6 ++++++
8-
src/trusty.rs | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++
9-
2 files changed, 66 insertions(+)
8+
src/lib.rs | 6 +++++
9+
src/trusty.rs | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++
10+
2 files changed, 69 insertions(+)
1011
create mode 100644 src/trusty.rs
1112

1213
diff --git a/src/lib.rs b/src/lib.rs
13-
index cce80f8c..a7eddaf2 100644
14+
index ac86322b..cf307958 100644
1415
--- a/src/lib.rs
1516
+++ b/src/lib.rs
16-
@@ -144,6 +144,12 @@ cfg_if! {
17+
@@ -145,6 +145,12 @@ cfg_if! {
1718

1819
mod hermit;
1920
pub use hermit::*;
@@ -28,10 +29,10 @@ index cce80f8c..a7eddaf2 100644
2829
pub use fixed_width_ints::*;
2930
diff --git a/src/trusty.rs b/src/trusty.rs
3031
new file mode 100644
31-
index 00000000..f06c0760
32+
index 00000000..c7e4e4fa
3233
--- /dev/null
3334
+++ b/src/trusty.rs
34-
@@ -0,0 +1,60 @@
35+
@@ -0,0 +1,63 @@
3536
+pub use core::ffi::c_void;
3637
+
3738
+pub type size_t = usize;
@@ -72,6 +73,8 @@ index 00000000..f06c0760
7273
+pub type c_int32_t = i32;
7374
+pub type c_int64_t = i64;
7475
+
76+
+pub type time_t = c_long;
77+
+
7578
+pub const STDOUT_FILENO: ::c_int = 1;
7679
+pub const STDERR_FILENO: ::c_int = 2;
7780
+
@@ -84,6 +87,7 @@ index 00000000..f06c0760
8487
+ pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int;
8588
+ pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
8689
+ pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
90+
+ pub fn strlen(cs: *const c_char) -> size_t;
8791
+}
8892
+
8993
+s! {
@@ -93,4 +97,5 @@ index 00000000..f06c0760
9397
+ }
9498
+}
9599
--
96-
2.36.1.476.g0c4daa206d-goog
100+
2.37.0.rc0.104.g0611611a94-goog
101+

src/trusty.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pub type c_int16_t = i16;
3838
pub type c_int32_t = i32;
3939
pub type c_int64_t = i64;
4040

41+
pub type time_t = c_long;
42+
4143
pub const STDOUT_FILENO: ::c_int = 1;
4244
pub const STDERR_FILENO: ::c_int = 2;
4345

@@ -50,6 +52,7 @@ extern "C" {
5052
pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int;
5153
pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
5254
pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
55+
pub fn strlen(cs: *const c_char) -> size_t;
5356
}
5457

5558
s! {

0 commit comments

Comments
 (0)