Skip to content

Commit ee0a812

Browse files
committed
Add utmpx on freebsd
1 parent cc1a0c2 commit ee0a812

File tree

1 file changed

+32
-0
lines changed
  • src/unix/bsd/freebsdlike

1 file changed

+32
-0
lines changed

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ pub type sem_t = _sem;
1717
pub enum timezone {}
1818

1919
s! {
20+
pub struct utmpx {
21+
pub ut_type: ::c_short,
22+
pub ut_tv: ::timeval,
23+
pub ut_id: [::c_char; 8],
24+
pub ut_pid: ::pid_t,
25+
pub ut_user: [::c_char; 32],
26+
pub ut_line: [::c_char; 16],
27+
pub ut_host: [::c_char; 128],
28+
pub __ut_spare: [::c_char; 64],
29+
}
30+
2031
pub struct glob_t {
2132
pub gl_pathc: ::size_t,
2233
__unused1: ::size_t,
@@ -158,6 +169,16 @@ s! {
158169
}
159170
}
160171

172+
pub const EMPTY: ::c_short = 0;
173+
pub const BOOT_TIME: ::c_short = 1;
174+
pub const OLD_TIME: ::c_short = 2;
175+
pub const NEW_TIME: ::c_short = 3;
176+
pub const USER_PROCESS: ::c_short = 4;
177+
pub const INIT_PROCESS: ::c_short = 5;
178+
pub const LOGIN_PROCESS: ::c_short = 6;
179+
pub const DEAD_PROCESS: ::c_short = 7;
180+
pub const SHUTDOWN_TIME: ::c_short = 8;
181+
161182
pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
162183
pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
163184
pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
@@ -701,6 +722,17 @@ f! {
701722
}
702723
}
703724

725+
extern {
726+
pub fn endutxent();
727+
pub fn getutxent() -> *mut utmpx;
728+
pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
729+
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
730+
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
731+
pub fn setutxent();
732+
pub fn getutxuser(user: *const ::c_char) -> *mut utmpx;
733+
pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int;
734+
}
735+
704736
#[link(name = "util")]
705737
extern {
706738
pub fn getnameinfo(sa: *const ::sockaddr,

0 commit comments

Comments
 (0)