Skip to content

Commit 62f9035

Browse files
author
Knight
committed
Add struct utmp for android
1 parent 881c462 commit 62f9035

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

src/unix/notbsd/android/b32.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2;
142142
pub const CPU_SETSIZE: ::size_t = 32;
143143
pub const __CPU_BITS: ::size_t = 32;
144144

145+
pub const UT_LINESIZE: usize = 8;
146+
pub const UT_NAMESIZE: usize = 8;
147+
pub const UT_HOSTSIZE: usize = 16;
148+
145149
extern {
146150
pub fn timegm64(tm: *const ::tm) -> ::time64_t;
147151
}

src/unix/notbsd/android/b64.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 4;
152152
pub const CPU_SETSIZE: ::size_t = 1024;
153153
pub const __CPU_BITS: ::size_t = 64;
154154

155+
pub const UT_LINESIZE: usize = 32;
156+
pub const UT_NAMESIZE: usize = 32;
157+
pub const UT_HOSTSIZE: usize = 256;
158+
155159
extern {
156160
pub fn timegm(tm: *const ::tm) -> ::time64_t;
157161
}

src/unix/notbsd/android/mod.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,37 @@ s! {
100100
pub struct sem_t {
101101
count: ::c_uint,
102102
}
103+
104+
pub struct lastlog {
105+
ll_time: ::time_t,
106+
ll_line: [::c_char; UT_LINESIZE],
107+
ll_host: [::c_char; UT_HOSTSIZE],
108+
}
109+
110+
pub struct exit_status {
111+
pub e_termination: ::c_short,
112+
pub e_exit: ::c_short,
113+
}
114+
115+
pub struct utmp {
116+
pub ut_type: ::c_short,
117+
pub ut_pid: ::pid_t,
118+
pub ut_line: [::c_char; UT_LINESIZE],
119+
pub ut_id: [::c_char; 4],
120+
121+
pub ut_user: [::c_char; UT_NAMESIZE],
122+
pub ut_host: [::c_char; UT_HOSTSIZE],
123+
pub ut_exit: exit_status,
124+
pub ut_session: ::c_long,
125+
pub ut_tv: ::timeval,
126+
127+
pub ut_addr_v6: [::int32_t; 4],
128+
unused: [::c_char; 20],
129+
}
103130
}
104131

132+
pub const USER_PROCESS: ::c_short = 7;
133+
105134
pub const BUFSIZ: ::c_uint = 1024;
106135
pub const FILENAME_MAX: ::c_uint = 1024;
107136
pub const FOPEN_MAX: ::c_uint = 20;
@@ -591,6 +620,10 @@ extern {
591620
pub fn __sched_cpufree(set: *mut ::cpu_set_t);
592621
pub fn __sched_cpucount(setsize: ::size_t, set: *mut cpu_set_t) -> ::c_int;
593622
pub fn sched_getcpu() -> ::c_int;
623+
624+
pub fn utmpname(name: *const ::c_char) -> ::c_int;
625+
pub fn setutent();
626+
pub fn getutent() -> *mut utmp;
594627
}
595628

596629
cfg_if! {

0 commit comments

Comments
 (0)