summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDC <devnexen@gmail.com>2021-08-24 17:36:03 +0100
committerDC <devnexen@gmail.com>2021-08-24 17:36:03 +0100
commitda6078725cad7c43b565802fad186e370756b579 (patch)
treea5cfc9674bad9dbe97d3018ae0d9964c9d113703
parentcf5b24fecf4c2ad70e683f8ca27c8c2b886f4e61 (diff)
downloadrust-libc-da6078725cad7c43b565802fad186e370756b579.tar.gz
dragonflybsd further utmpx db fn
-rw-r--r--libc-test/semver/dragonfly.txt10
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs44
2 files changed, 54 insertions, 0 deletions
diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt
index ccfc227744..dc64d5c19c 100644
--- a/libc-test/semver/dragonfly.txt
+++ b/libc-test/semver/dragonfly.txt
@@ -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
@@ -1241,6 +1245,7 @@ getgrouplist
gethostid
getifaddrs
getitimer
+getlastlogx
getline
getloadavg
getnameinfo
@@ -1255,6 +1260,7 @@ getrusage
getservbyport
getservent
getsid
+getutxuser
getutxent
getutxid
getutxline
@@ -1278,6 +1284,7 @@ kevent
killpg
kqueue
labs
+lastlog
lchflags
lio_listio
lockf
@@ -1445,10 +1452,13 @@ truncate
ttyname_r
ucontext_t
unmount
+updatelastlogx
+updwtmpx
useconds_t
uselocale
utimensat
utmpx
+utmpxname
uuid
uuid_t
vm_size_t
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 66e6b65baa..d1e73a548c 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -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,
@@ -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 {
@@ -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;
@@ -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")]