diff options
author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2021-11-22 11:31:45 +0100 |
---|---|---|
committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2021-11-23 10:00:39 +0100 |
commit | 4297ec18327b836e752cd5e79dad66332d071871 (patch) | |
tree | 140f3e28e6695a68f455ed2ae58a37dc84f104af /src/unix/bsd/freebsdlike/freebsd/freebsd12 | |
parent | 57b1d921a0e0bfb4c67ddbfceb3de742a04dca8b (diff) | |
download | rust-libc-4297ec18327b836e752cd5e79dad66332d071871.tar.gz |
Add missing procstat items for FreeBSD
Diffstat (limited to 'src/unix/bsd/freebsdlike/freebsd/freebsd12')
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index 59d70977a9..8d575d93ae 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -256,6 +256,17 @@ s_no_extra_traits! { pub f_mntfromname: [::c_char; 1024], pub f_mntonname: [::c_char; 1024], } + + pub struct vnstat { + pub vn_fileid: u64, + pub vn_size: u64, + pub vn_dev: u64, + pub vn_fsid: u64, + pub vn_mntdir: *mut ::c_char, + pub vn_type: ::c_int, + pub vn_mode: u16, + pub vn_devname: [::c_char; ::SPECNAMELEN as usize + 1], + } } cfg_if! { @@ -379,6 +390,53 @@ cfg_if! { self.d_name[..self.d_namlen as _].hash(state); } } + + impl PartialEq for vnstat { + fn eq(&self, other: &vnstat) -> bool { + let self_vn_devname: &[::c_char] = &self.vn_devname; + let other_vn_devname: &[::c_char] = &other.vn_devname; + + self.vn_fileid == other.vn_fileid && + self.vn_size == other.vn_size && + self.vn_dev == other.vn_dev && + self.vn_fsid == other.vn_fsid && + self.vn_mntdir == other.vn_mntdir && + self.vn_type == other.vn_type && + self.vn_mode == other.vn_mode && + self_vn_devname == other_vn_devname + } + } + impl Eq for vnstat {} + impl ::fmt::Debug for vnstat { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + let self_vn_devname: &[::c_char] = &self.vn_devname; + + f.debug_struct("vnstat") + .field("vn_fileid", &self.vn_fileid) + .field("vn_size", &self.vn_size) + .field("vn_dev", &self.vn_dev) + .field("vn_fsid", &self.vn_fsid) + .field("vn_mntdir", &self.vn_mntdir) + .field("vn_type", &self.vn_type) + .field("vn_mode", &self.vn_mode) + .field("vn_devname", &self_vn_devname) + .finish() + } + } + impl ::hash::Hash for vnstat { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + let self_vn_devname: &[::c_char] = &self.vn_devname; + + self.vn_fileid.hash(state); + self.vn_size.hash(state); + self.vn_dev.hash(state); + self.vn_fsid.hash(state); + self.vn_mntdir.hash(state); + self.vn_type.hash(state); + self.vn_mode.hash(state); + self_vn_devname.hash(state); + } + } } } |