2014-03-31 16:40:21 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
#![allow(dead_code)]
|
2014-03-18 12:17:32 +00:00
|
|
|
|
2014-04-26 05:03:08 +00:00
|
|
|
extern crate libc;
|
|
|
|
|
2014-03-25 17:28:31 +00:00
|
|
|
pub use self::utmpx::{DEFAULT_FILE,USER_PROCESS,BOOT_TIME,c_utmp};
|
2014-03-18 12:17:32 +00:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
mod utmpx {
|
2014-04-26 05:03:08 +00:00
|
|
|
use super::libc;
|
2014-03-18 12:17:32 +00:00
|
|
|
|
|
|
|
pub static DEFAULT_FILE: &'static str = "/var/run/utmp";
|
|
|
|
|
2015-01-10 18:07:08 +00:00
|
|
|
pub const UT_LINESIZE: usize = 32;
|
|
|
|
pub const UT_NAMESIZE: usize = 32;
|
|
|
|
pub const UT_IDSIZE: usize = 4;
|
|
|
|
pub const UT_HOSTSIZE: usize = 256;
|
2014-10-10 16:36:35 +00:00
|
|
|
|
|
|
|
pub const EMPTY: libc::c_short = 0;
|
|
|
|
pub const RUN_LVL: libc::c_short = 1;
|
|
|
|
pub const BOOT_TIME: libc::c_short = 2;
|
|
|
|
pub const NEW_TIME: libc::c_short = 3;
|
|
|
|
pub const OLD_TIME: libc::c_short = 4;
|
|
|
|
pub const INIT_PROCESS: libc::c_short = 5;
|
|
|
|
pub const LOGIN_PROCESS: libc::c_short = 6;
|
|
|
|
pub const USER_PROCESS: libc::c_short = 7;
|
|
|
|
pub const DEAD_PROCESS: libc::c_short = 8;
|
|
|
|
pub const ACCOUNTING: libc::c_short = 9;
|
2014-03-18 12:17:32 +00:00
|
|
|
|
2014-08-22 10:21:30 +00:00
|
|
|
#[repr(C)]
|
2014-03-18 12:17:32 +00:00
|
|
|
pub struct c_exit_status {
|
2014-04-26 05:03:08 +00:00
|
|
|
pub e_termination: libc::c_short,
|
|
|
|
pub e_exit: libc::c_short,
|
2014-03-18 12:17:32 +00:00
|
|
|
}
|
|
|
|
|
2014-08-22 10:21:30 +00:00
|
|
|
#[repr(C)]
|
2014-03-18 12:17:32 +00:00
|
|
|
pub struct c_utmp {
|
2014-04-26 05:03:08 +00:00
|
|
|
pub ut_type: libc::c_short,
|
|
|
|
pub ut_pid: libc::pid_t,
|
2015-01-08 12:58:23 +00:00
|
|
|
pub ut_line: [libc::c_char; UT_LINESIZE],
|
|
|
|
pub ut_id: [libc::c_char; UT_IDSIZE],
|
2014-04-26 05:03:08 +00:00
|
|
|
|
2015-01-08 12:58:23 +00:00
|
|
|
pub ut_user: [libc::c_char; UT_NAMESIZE],
|
|
|
|
pub ut_host: [libc::c_char; UT_HOSTSIZE],
|
2014-04-26 05:03:08 +00:00
|
|
|
pub ut_exit: c_exit_status,
|
|
|
|
pub ut_session: libc::c_long,
|
|
|
|
pub ut_tv: libc::timeval,
|
|
|
|
|
2015-01-08 12:58:23 +00:00
|
|
|
pub ut_addr_v6: [libc::int32_t; 4],
|
|
|
|
pub __unused: [libc::c_char; 20],
|
2014-03-18 12:17:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
mod utmpx {
|
2014-04-26 05:03:08 +00:00
|
|
|
use super::libc;
|
2014-03-18 12:17:32 +00:00
|
|
|
|
|
|
|
pub static DEFAULT_FILE: &'static str = "/var/run/utmpx";
|
|
|
|
|
2015-01-10 18:07:08 +00:00
|
|
|
pub const UT_LINESIZE: usize = 32;
|
|
|
|
pub const UT_NAMESIZE: usize = 256;
|
|
|
|
pub const UT_IDSIZE: usize = 4;
|
|
|
|
pub const UT_HOSTSIZE: usize = 256;
|
2014-10-10 16:36:35 +00:00
|
|
|
|
|
|
|
pub const EMPTY: libc::c_short = 0;
|
|
|
|
pub const RUN_LVL: libc::c_short = 1;
|
|
|
|
pub const BOOT_TIME: libc::c_short = 2;
|
|
|
|
pub const OLD_TIME: libc::c_short = 3;
|
|
|
|
pub const NEW_TIME: libc::c_short = 4;
|
|
|
|
pub const INIT_PROCESS: libc::c_short = 5;
|
|
|
|
pub const LOGIN_PROCESS: libc::c_short = 6;
|
|
|
|
pub const USER_PROCESS: libc::c_short = 7;
|
|
|
|
pub const DEAD_PROCESS: libc::c_short = 8;
|
|
|
|
pub const ACCOUNTING: libc::c_short = 9;
|
2014-03-18 12:17:32 +00:00
|
|
|
|
2014-08-22 10:21:30 +00:00
|
|
|
#[repr(C)]
|
2014-03-18 12:17:32 +00:00
|
|
|
pub struct c_exit_status {
|
2014-04-26 05:03:08 +00:00
|
|
|
pub e_termination: libc::c_short,
|
|
|
|
pub e_exit: libc::c_short,
|
2014-03-18 12:17:32 +00:00
|
|
|
}
|
|
|
|
|
2014-08-22 10:21:30 +00:00
|
|
|
#[repr(C)]
|
2014-03-18 12:17:32 +00:00
|
|
|
pub struct c_utmp {
|
2015-01-08 12:58:23 +00:00
|
|
|
pub ut_user: [libc::c_char; UT_NAMESIZE],
|
|
|
|
pub ut_id: [libc::c_char; UT_IDSIZE],
|
|
|
|
pub ut_line: [libc::c_char; UT_LINESIZE],
|
2014-04-26 05:03:08 +00:00
|
|
|
pub ut_pid: libc::pid_t,
|
|
|
|
pub ut_type: libc::c_short,
|
|
|
|
pub ut_tv: libc::timeval,
|
2015-01-08 12:58:23 +00:00
|
|
|
pub ut_host: [libc::c_char; UT_HOSTSIZE],
|
|
|
|
pub __unused: [libc::c_char; 16]
|
2014-03-18 12:17:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-23 13:40:31 +00:00
|
|
|
#[cfg(target_os = "freebsd")]
|
|
|
|
mod utmpx {
|
|
|
|
use super::libc;
|
|
|
|
|
|
|
|
pub static DEFAULT_FILE : &'static str = "";
|
|
|
|
|
2015-01-10 18:07:08 +00:00
|
|
|
pub const UT_LINESIZE : usize = 16;
|
|
|
|
pub const UT_NAMESIZE : usize = 32;
|
|
|
|
pub const UT_IDSIZE : usize = 8;
|
|
|
|
pub const UT_HOSTSIZE : usize = 128;
|
2014-10-10 16:36:35 +00:00
|
|
|
|
|
|
|
pub const EMPTY : libc::c_short = 0;
|
|
|
|
pub const BOOT_TIME : libc::c_short = 1;
|
|
|
|
pub const OLD_TIME : libc::c_short = 2;
|
|
|
|
pub const NEW_TIME : libc::c_short = 3;
|
|
|
|
pub const USER_PROCESS : libc::c_short = 4;
|
|
|
|
pub const INIT_PROCESS : libc::c_short = 5;
|
|
|
|
pub const LOGIN_PROCESS : libc::c_short = 6;
|
|
|
|
pub const DEAD_PROCESS : libc::c_short = 7;
|
|
|
|
pub const SHUTDOWN_TIME : libc::c_short = 8;
|
2014-09-23 13:40:31 +00:00
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
pub struct c_utmp {
|
|
|
|
pub ut_type : libc::c_short,
|
|
|
|
pub ut_tv : libc::timeval,
|
2015-01-08 12:58:23 +00:00
|
|
|
pub ut_id : [libc::c_char; UT_IDSIZE],
|
2014-09-23 13:40:31 +00:00
|
|
|
pub ut_pid : libc::pid_t,
|
2015-01-08 12:58:23 +00:00
|
|
|
pub ut_user : [libc::c_char; UT_NAMESIZE],
|
|
|
|
pub ut_line : [libc::c_char; UT_LINESIZE],
|
|
|
|
pub ut_host : [libc::c_char; UT_HOSTSIZE],
|
|
|
|
pub ut_spare : [libc::c_char; 64],
|
2014-09-23 13:40:31 +00:00
|
|
|
}
|
|
|
|
}
|