Skip to content
Snippets Groups Projects
Commit 5f8f0923 authored by Knight's avatar Knight
Browse files

Move struct utmpx to Linux level

parent 866c9e4c
No related branches found
No related tags found
No related merge requests found
......@@ -83,27 +83,6 @@ s! {
pub mem_unit: ::c_uint,
pub _f: [::c_char; 8],
}
pub struct __exit_status {
pub e_termination: ::c_short,
pub e_exit: ::c_short,
}
pub struct utmpx {
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],
__glibc_reserved: [::c_char; 20],
}
}
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
......@@ -118,29 +97,6 @@ pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
pub const __UT_LINESIZE: usize = 32;
pub const __UT_NAMESIZE: usize = 32;
pub const __UT_HOSTSIZE: usize = 256;
pub const EMPTY: ::c_short = 0;
pub const RUN_LVL: ::c_short = 1;
pub const BOOT_TIME: ::c_short = 2;
pub const NEW_TIME: ::c_short = 3;
pub const OLD_TIME: ::c_short = 4;
pub const INIT_PROCESS: ::c_short = 5;
pub const LOGIN_PROCESS: ::c_short = 6;
pub const USER_PROCESS: ::c_short = 7;
pub const DEAD_PROCESS: ::c_short = 8;
pub const ACCOUNTING: ::c_short = 9;
extern {
pub fn getutxent() -> *mut utmpx;
pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pub fn setutxent();
pub fn endutxent();
}
cfg_if! {
if #[cfg(target_arch = "x86")] {
mod x86;
......
......@@ -4,6 +4,40 @@ pub type rlim_t = c_ulong;
pub type __priority_which_t = ::c_uint;
s! {
pub struct __exit_status {
pub e_termination: ::c_short,
pub e_exit: ::c_short,
}
pub struct __timeval {
pub tv_sec: ::int32_t,
pub tv_usec: ::int32_t,
}
pub struct utmpx {
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,
#[cfg(any(target_arch = "aarch64", target_pointer_width = "32"))]
pub ut_session: ::c_long,
#[cfg(any(target_arch = "aarch64", target_pointer_width = "32"))]
pub ut_tv: ::timeval,
#[cfg(not(any(target_arch = "aarch64", target_pointer_width = "32")))]
pub ut_session: ::int32_t,
#[cfg(not(any(target_arch = "aarch64", target_pointer_width = "32")))]
pub ut_tv: __timeval,
pub ut_addr_v6: [::int32_t; 4],
__glibc_reserved: [::c_char; 20],
}
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
pub sa_mask: ::sigset_t,
......@@ -132,6 +166,20 @@ s! {
}
}
pub const __UT_LINESIZE: usize = 32;
pub const __UT_NAMESIZE: usize = 32;
pub const __UT_HOSTSIZE: usize = 256;
pub const EMPTY: ::c_short = 0;
pub const RUN_LVL: ::c_short = 1;
pub const BOOT_TIME: ::c_short = 2;
pub const NEW_TIME: ::c_short = 3;
pub const OLD_TIME: ::c_short = 4;
pub const INIT_PROCESS: ::c_short = 5;
pub const LOGIN_PROCESS: ::c_short = 6;
pub const USER_PROCESS: ::c_short = 7;
pub const DEAD_PROCESS: ::c_short = 8;
pub const ACCOUNTING: ::c_short = 9;
pub const RLIMIT_RSS: ::c_int = 5;
pub const RLIMIT_NOFILE: ::c_int = 7;
pub const RLIMIT_AS: ::c_int = 9;
......@@ -498,6 +546,16 @@ cfg_if! {
}
}
extern {
pub fn utmpxname(file: *const ::c_char) -> ::c_int;
pub fn getutxent() -> *mut utmpx;
pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pub fn setutxent();
pub fn endutxent();
}
#[link(name = "util")]
extern {
pub fn sysctl(name: *mut ::c_int,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment