Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/libc/src/new/netbsd/utmpx_.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / libc / src / new / netbsd / utmpx_.rs` 92 lines ยท 2915 bytes Raw Blame History 1 //! Header: `utmpx.h` 2 //! 3 //! 4 5 use crate::prelude::*; 6 7 // pub const _PATH_UTMPX: &[c_char; 14] = b"/var/run/utmpx"; 8 // pub const _PATH_WTMPX: &[c_char; 14] = b"/var/log/wtmpx"; 9 // pub const _PATH_LASTLOGX: &[c_char; 17] = b"/var/log/lastlogx"; 10 // pub const _PATH_UTMP_UPDATE: &[c_char; 24] = b"/usr/libexec/utmp_update"; 11 12 pub const _UTX_USERSIZE: usize = 32; 13 pub const _UTX_LINESIZE: usize = 32; 14 pub const _UTX_IDSIZE: usize = 4; 15 pub const _UTX_HOSTSIZE: usize = 256; 16 17 pub const EMPTY: u16 = 0; 18 pub const RUN_LVL: u16 = 1; 19 pub const BOOT_TIME: u16 = 2; 20 pub const OLD_TIME: u16 = 3; 21 pub const NEW_TIME: u16 = 4; 22 pub const INIT_PROCESS: u16 = 5; 23 pub const LOGIN_PROCESS: u16 = 6; 24 pub const USER_PROCESS: u16 = 7; 25 pub const DEAD_PROCESS: u16 = 8; 26 pub const ACCOUNTING: u16 = 9; 27 pub const SIGNATURE: u16 = 10; 28 pub const DOWN_TIME: u16 = 11; 29 30 // Expression based on the comment in NetBSD source. 31 pub const _UTX_PADSIZE: usize = if cfg!(target_pointer_width = "64") { 32 36 33 } else { 34 40 35 }; 36 37 s! { 38 pub struct utmpx { 39 pub ut_name: [c_char; _UTX_USERSIZE], 40 pub ut_id: [c_char; _UTX_IDSIZE], 41 pub ut_line: [c_char; _UTX_LINESIZE], 42 pub ut_host: [c_char; _UTX_HOSTSIZE], 43 pub ut_session: u16, 44 pub ut_type: u16, 45 pub ut_pid: crate::pid_t, 46 pub ut_exit: __exit_status, // FIXME(netbsd): when anonymous struct are supported 47 pub ut_ss: crate::sockaddr_storage, 48 pub ut_tv: crate::timeval, 49 ut_pad: Padding<[u8; _UTX_PADSIZE]>, 50 } 51 52 pub struct __exit_status { 53 pub e_termination: u16, 54 pub e_exit: u16, 55 } 56 57 pub struct lastlogx { 58 pub ll_tv: crate::timeval, 59 pub ll_line: [c_char; _UTX_LINESIZE], 60 pub ll_host: [c_char; _UTX_HOSTSIZE], 61 pub ll_ss: crate::sockaddr_storage, 62 } 63 } 64 65 #[link(name = "util")] 66 extern "C" { 67 pub fn setutxent(); 68 pub fn endutxent(); 69 70 #[link_name = "__getutxent50"] 71 pub fn getutxent() -> *mut utmpx; 72 #[link_name = "__getutxid50"] 73 pub fn getutxid(ut: *const utmpx) -> *mut utmpx; 74 #[link_name = "__getutxline50"] 75 pub fn getutxline(ut: *const utmpx) -> *mut utmpx; 76 #[link_name = "__pututxline50"] 77 pub fn pututxline(ut: *const utmpx) -> *mut utmpx; 78 79 #[link_name = "__updwtmpx50"] 80 pub fn updwtmpx(file: *const c_char, ut: *const utmpx) -> c_int; 81 #[link_name = "__getlastlogx50"] 82 pub fn getlastlogx(fname: *const c_char, uid: crate::uid_t, ll: *mut lastlogx) 83 -> *mut lastlogx; 84 85 #[link_name = "__updlastlogx50"] 86 pub fn updlastlogx(fname: *const c_char, uid: crate::uid_t, ll: *mut lastlogx) -> c_int; 87 #[link_name = "__getutmp50"] 88 pub fn getutmp(ux: *const utmpx, u: *mut crate::utmp); 89 #[link_name = "__getutmpx50"] 90 pub fn getutmpx(u: *const crate::utmp, ux: *mut utmpx); 91 pub fn utmpxname(file: *const c_char) -> c_int; 92 }