uucore: update utmpx
extern crate libc;
-pub use self::utmpx::{UT_NAMESIZE,UT_LINESIZE,DEFAULT_FILE,USER_PROCESS,BOOT_TIME,c_utmp};
+pub use self::utmpx::{UT_NAMESIZE, UT_LINESIZE, DEFAULT_FILE, USER_PROCESS, BOOT_TIME};
+pub use self::utmpx::c_utmp;
+
+extern "C" {
+ pub fn getutxent() -> *const c_utmp;
+ pub fn getutxid(ut: *const c_utmp) -> *const c_utmp;
+ pub fn getutxline(ut: *const c_utmp) -> *const c_utmp;
+ pub fn pututxline(ut: *const c_utmp) -> *const c_utmp;
+ pub fn setutxent();
+ pub fn endutxent();
+
+ #[cfg(any(target_os = "macos", target_os = "linux"))]
+ pub fn utmpxname(file: *const libc::c_char) -> libc::c_int;
+}
+
+#[cfg(target_os = "freebsd")]
+pub unsafe extern fn utmpxname(_file: *const libc::c_char) -> libc::c_int {
+ 0
+}
+
#[cfg(target_os = "linux")]
mod utmpx {
use super::libc;
@@ -26,11 +45,18 @@ mod utmpx {
pub const ACCOUNTING: libc::c_short = 9;
#[repr(C)]
- pub struct c_exit_status {
+ pub struct __exit_status {
pub e_termination: libc::c_short,
pub e_exit: libc::c_short,
}
+ #[repr(C)]
+ #[derive(Copy, Clone)]
+ pub struct __timeval {
+ pub tv_sec: libc::int32_t,
+ pub tv_usec: libc::int32_t,
+ }
+
#[repr(C)]
pub struct c_utmp {
pub ut_type: libc::c_short,
@@ -40,12 +66,20 @@ mod utmpx {
pub ut_user: [libc::c_char; UT_NAMESIZE],
pub ut_host: [libc::c_char; UT_HOSTSIZE],
- pub ut_exit: c_exit_status,
+ pub ut_exit: __exit_status,
+
+ #[cfg(target_pointer_width = "32")]
pub ut_session: libc::c_long,
+ #[cfg(target_pointer_width = "32")]
pub ut_tv: libc::timeval,
+ #[cfg(target_pointer_width = "64")]
+ pub ut_session: libc::int32_t,
+ #[cfg(target_pointer_width = "64")]
+ pub ut_tv: __timeval,
+
pub ut_addr_v6: [libc::int32_t; 4],
- pub __unused: [libc::c_char; 20],
+ __glibc_reserved: [libc::c_char; 20],
}
}
@@ -71,12 +105,6 @@ mod utmpx {
pub const DEAD_PROCESS: libc::c_short = 8;
pub const ACCOUNTING: libc::c_short = 9;
- #[repr(C)]
- pub struct c_exit_status {
- pub e_termination: libc::c_short,
- pub e_exit: libc::c_short,
- }
-
#[repr(C)]
pub struct c_utmp {
pub ut_user: [libc::c_char; UT_NAMESIZE],
@@ -86,7 +114,7 @@ mod utmpx {
pub ut_type: libc::c_short,
pub ut_tv: libc::timeval,
pub ut_host: [libc::c_char; UT_HOSTSIZE],
- pub __unused: [libc::c_char; 16]
+ pub __unused: [libc::uint32_t; 16],
}
}
