Skip to content

Commit

Permalink
dragonflybsd further utmpx db fn
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Aug 24, 2021
1 parent cf5b24f commit da60787
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libc-test/semver/dragonfly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,10 @@ _SC_XOPEN_STREAMS
_SC_XOPEN_UNIX
_SC_XOPEN_VERSION
_SC_XOPEN_XCU_VERSION
_UTX_HOSTSIZE
_UTX_IDSIZE
_UTX_LINESIZE
_UTX_USERSIZE
__errno_location
abs
accept4
Expand Down Expand Up @@ -1241,6 +1245,7 @@ getgrouplist
gethostid
getifaddrs
getitimer
getlastlogx
getline
getloadavg
getnameinfo
Expand All @@ -1255,6 +1260,7 @@ getrusage
getservbyport
getservent
getsid
getutxuser
getutxent
getutxid
getutxline
Expand All @@ -1278,6 +1284,7 @@ kevent
killpg
kqueue
labs
lastlog
lchflags
lio_listio
lockf
Expand Down Expand Up @@ -1445,10 +1452,13 @@ truncate
ttyname_r
ucontext_t
unmount
updatelastlogx
updwtmpx
useconds_t
uselocale
utimensat
utmpx
utmpxname
uuid
uuid_t
vm_size_t
Expand Down
44 changes: 44 additions & 0 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ s_no_extra_traits! {
pub ut_unused2: [u8; 16],
}

pub struct lastlogx {
pub ll_tv: ::timeval,
pub ll_line: [::c_char; _UTX_LINESIZE],
pub ll_host: [::c_char; _UTX_HOSTSIZE],
pub ll_ss: ::sockaddr_storage,
}

pub struct dirent {
pub d_fileno: ::ino_t,
pub d_namlen: u16,
Expand Down Expand Up @@ -376,6 +383,33 @@ cfg_if! {
self.ut_unused2.hash(state);
}
}
impl PartialEq for lastlogx {
fn eq(&self, other: &lastlogx) -> bool {
self.ll_tv == other.ll_tv
&& self.ll_line == other.ll_line
&& self.ll_host == other.ll_host
&& self.ll_ss == other.ll_ss
}
}
impl Eq for lastlogx {}
impl ::fmt::Debug for lastlogx {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("lastlogx")
.field("ll_tv", &self.ll_tv)
.field("ll_line", &self.ll_line)
.field("ll_host", &self.ll_host)
.field("ll_ss", &self.ll_ss)
.finish()
}
}
impl ::hash::Hash for lastlogx {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.ll_tv.hash(state);
self.ll_line.hash(state);
self.ll_host.hash(state);
self.ll_ss.hash(state);
}
}

impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
Expand Down Expand Up @@ -1120,6 +1154,10 @@ pub const DOWNTIME: ::c_short = 11;
pub const UTX_DB_UTMPX: ::c_uint = 0;
pub const UTX_DB_WTMPX: ::c_uint = 1;
pub const UTX_DB_LASTLOG: ::c_uint = 2;
pub const _UTX_LINESIZE: usize = 32;
pub const _UTX_USERSIZE: usize = 32;
pub const _UTX_IDSIZE: usize = 4;
pub const _UTX_HOSTSIZE: usize = 256;

pub const LC_COLLATE_MASK: ::c_int = 1 << 0;
pub const LC_CTYPE_MASK: ::c_int = 1 << 1;
Expand Down Expand Up @@ -1308,6 +1346,12 @@ extern "C" {
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int;

pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int;
pub fn getlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> *mut lastlogx;
pub fn updlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> ::c_int;
pub fn getutxuser(name: *const ::c_char) -> utmpx;
pub fn utmpxname(file: *const ::c_char) -> ::c_int;
}

#[link(name = "rt")]
Expand Down

0 comments on commit da60787

Please sign in to comment.