summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKnight <knight42@mail.ustc.edu.cn>2016-07-27 20:40:27 +0800
committerKnight <knight42@mail.ustc.edu.cn>2016-07-27 21:29:38 +0800
commit62f9035f4c7bcd26ce209335b345b65a7fffc557 (patch)
tree43a88e5ab561ef5c99220d57fff119d4432f8af5
parent881c4622a5d9078f719a406716b8d915513e6c96 (diff)
downloadrust-libc-62f9035f4c7bcd26ce209335b345b65a7fffc557.tar.gz
Add struct utmp for android
-rw-r--r--src/unix/notbsd/android/b32.rs4
-rw-r--r--src/unix/notbsd/android/b64.rs4
-rw-r--r--src/unix/notbsd/android/mod.rs33
3 files changed, 41 insertions, 0 deletions
diff --git a/src/unix/notbsd/android/b32.rs b/src/unix/notbsd/android/b32.rs
index 91a56a3fca..bd69ccf37d 100644
--- a/src/unix/notbsd/android/b32.rs
+++ b/src/unix/notbsd/android/b32.rs
@@ -142,6 +142,10 @@ pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2;
pub const CPU_SETSIZE: ::size_t = 32;
pub const __CPU_BITS: ::size_t = 32;
+pub const UT_LINESIZE: usize = 8;
+pub const UT_NAMESIZE: usize = 8;
+pub const UT_HOSTSIZE: usize = 16;
+
extern {
pub fn timegm64(tm: *const ::tm) -> ::time64_t;
}
diff --git a/src/unix/notbsd/android/b64.rs b/src/unix/notbsd/android/b64.rs
index 025dabd458..b35dde4216 100644
--- a/src/unix/notbsd/android/b64.rs
+++ b/src/unix/notbsd/android/b64.rs
@@ -152,6 +152,10 @@ pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 4;
pub const CPU_SETSIZE: ::size_t = 1024;
pub const __CPU_BITS: ::size_t = 64;
+pub const UT_LINESIZE: usize = 32;
+pub const UT_NAMESIZE: usize = 32;
+pub const UT_HOSTSIZE: usize = 256;
+
extern {
pub fn timegm(tm: *const ::tm) -> ::time64_t;
}
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index 5dbd39e9cf..6c6d7b087a 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -100,8 +100,37 @@ s! {
pub struct sem_t {
count: ::c_uint,
}
+
+ pub struct lastlog {
+ ll_time: ::time_t,
+ ll_line: [::c_char; UT_LINESIZE],
+ ll_host: [::c_char; UT_HOSTSIZE],
+ }
+
+ pub struct exit_status {
+ pub e_termination: ::c_short,
+ pub e_exit: ::c_short,
+ }
+
+ pub struct utmp {
+ pub ut_type: ::c_short,
+ pub ut_pid: ::pid_t,
+ pub ut_line: [::c_char; UT_LINESIZE],
+ pub ut_id: [::c_char; 4],
+
+ pub ut_user: [::c_char; UT_NAMESIZE],
+ pub ut_host: [::c_char; UT_HOSTSIZE],
+ pub ut_exit: exit_status,
+ pub ut_session: ::c_long,
+ pub ut_tv: ::timeval,
+
+ pub ut_addr_v6: [::int32_t; 4],
+ unused: [::c_char; 20],
+ }
}
+pub const USER_PROCESS: ::c_short = 7;
+
pub const BUFSIZ: ::c_uint = 1024;
pub const FILENAME_MAX: ::c_uint = 1024;
pub const FOPEN_MAX: ::c_uint = 20;
@@ -591,6 +620,10 @@ extern {
pub fn __sched_cpufree(set: *mut ::cpu_set_t);
pub fn __sched_cpucount(setsize: ::size_t, set: *mut cpu_set_t) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
+
+ pub fn utmpname(name: *const ::c_char) -> ::c_int;
+ pub fn setutent();
+ pub fn getutent() -> *mut utmp;
}
cfg_if! {