1 // APIs that changed in FreeBSD12 2 3 pub type nlink_t = u64; 4 pub type dev_t = u64; 5 pub type ino_t = ::c_ulong; 6 pub type shmatt_t = ::c_uint; 7 8 s! { 9 pub struct shmid_ds { 10 pub shm_perm: ::ipc_perm, 11 pub shm_segsz: ::size_t, 12 pub shm_lpid: ::pid_t, 13 pub shm_cpid: ::pid_t, 14 pub shm_nattch: ::shmatt_t, 15 pub shm_atime: ::time_t, 16 pub shm_dtime: ::time_t, 17 pub shm_ctime: ::time_t, 18 } 19 20 pub struct kevent { 21 pub ident: ::uintptr_t, 22 pub filter: ::c_short, 23 pub flags: ::c_ushort, 24 pub fflags: ::c_uint, 25 pub data: ::intptr_t, 26 pub udata: *mut ::c_void, 27 pub ext: [u64; 4], 28 } 29 } 30 31 s_no_extra_traits! { 32 pub struct dirent { 33 pub d_fileno: ::ino_t, 34 pub d_off: ::off_t, 35 pub d_reclen: u16, 36 pub d_type: u8, 37 d_pad0: u8, 38 pub d_namlen: u16, 39 d_pad1: u16, 40 pub d_name: [::c_char; 256], 41 } 42 43 pub struct statfs { 44 pub f_version: u32, 45 pub f_type: u32, 46 pub f_flags: u64, 47 pub f_bsize: u64, 48 pub f_iosize: u64, 49 pub f_blocks: u64, 50 pub f_bfree: u64, 51 pub f_bavail: i64, 52 pub f_files: u64, 53 pub f_ffree: i64, 54 pub f_syncwrites: u64, 55 pub f_asyncwrites: u64, 56 pub f_syncreads: u64, 57 pub f_asyncreads: u64, 58 f_spare: [u64; 10], 59 pub f_namemax: u32, 60 pub f_owner: ::uid_t, 61 pub f_fsid: ::fsid_t, 62 f_charspare: [::c_char; 80], 63 pub f_fstypename: [::c_char; 16], 64 pub f_mntfromname: [::c_char; 1024], 65 pub f_mntonname: [::c_char; 1024], 66 } 67 } 68 69 cfg_if! { 70 if #[cfg(feature = "extra_traits")] { 71 impl PartialEq for statfs { 72 fn eq(&self, other: &statfs) -> bool { 73 self.f_version == other.f_version 74 && self.f_type == other.f_type 75 && self.f_flags == other.f_flags 76 && self.f_bsize == other.f_bsize 77 && self.f_iosize == other.f_iosize 78 && self.f_blocks == other.f_blocks 79 && self.f_bfree == other.f_bfree 80 && self.f_bavail == other.f_bavail 81 && self.f_files == other.f_files 82 && self.f_ffree == other.f_ffree 83 && self.f_syncwrites == other.f_syncwrites 84 && self.f_asyncwrites == other.f_asyncwrites 85 && self.f_syncreads == other.f_syncreads 86 && self.f_asyncreads == other.f_asyncreads 87 && self.f_namemax == other.f_namemax 88 && self.f_owner == other.f_owner 89 && self.f_fsid == other.f_fsid 90 && self.f_fstypename == other.f_fstypename 91 && self 92 .f_mntfromname 93 .iter() 94 .zip(other.f_mntfromname.iter()) 95 .all(|(a,b)| a == b) 96 && self 97 .f_mntonname 98 .iter() 99 .zip(other.f_mntonname.iter()) 100 .all(|(a,b)| a == b) 101 } 102 } 103 impl Eq for statfs {} 104 impl ::fmt::Debug for statfs { 105 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 106 f.debug_struct("statfs") 107 .field("f_bsize", &self.f_bsize) 108 .field("f_iosize", &self.f_iosize) 109 .field("f_blocks", &self.f_blocks) 110 .field("f_bfree", &self.f_bfree) 111 .field("f_bavail", &self.f_bavail) 112 .field("f_files", &self.f_files) 113 .field("f_ffree", &self.f_ffree) 114 .field("f_syncwrites", &self.f_syncwrites) 115 .field("f_asyncwrites", &self.f_asyncwrites) 116 .field("f_syncreads", &self.f_syncreads) 117 .field("f_asyncreads", &self.f_asyncreads) 118 .field("f_namemax", &self.f_namemax) 119 .field("f_owner", &self.f_owner) 120 .field("f_fsid", &self.f_fsid) 121 .field("f_fstypename", &self.f_fstypename) 122 .field("f_mntfromname", &&self.f_mntfromname[..]) 123 .field("f_mntonname", &&self.f_mntonname[..]) 124 .finish() 125 } 126 } 127 impl ::hash::Hash for statfs { 128 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 129 self.f_version.hash(state); 130 self.f_type.hash(state); 131 self.f_flags.hash(state); 132 self.f_bsize.hash(state); 133 self.f_iosize.hash(state); 134 self.f_blocks.hash(state); 135 self.f_bfree.hash(state); 136 self.f_bavail.hash(state); 137 self.f_files.hash(state); 138 self.f_ffree.hash(state); 139 self.f_syncwrites.hash(state); 140 self.f_asyncwrites.hash(state); 141 self.f_syncreads.hash(state); 142 self.f_asyncreads.hash(state); 143 self.f_namemax.hash(state); 144 self.f_owner.hash(state); 145 self.f_fsid.hash(state); 146 self.f_charspare.hash(state); 147 self.f_fstypename.hash(state); 148 self.f_mntfromname.hash(state); 149 self.f_mntonname.hash(state); 150 } 151 } 152 153 impl PartialEq for dirent { 154 fn eq(&self, other: &dirent) -> bool { 155 self.d_fileno == other.d_fileno 156 && self.d_off == other.d_off 157 && self.d_reclen == other.d_reclen 158 && self.d_type == other.d_type 159 && self.d_namlen == other.d_namlen 160 && self 161 .d_name[..self.d_namlen as _] 162 .iter() 163 .zip(other.d_name.iter()) 164 .all(|(a,b)| a == b) 165 } 166 } 167 impl Eq for dirent {} 168 impl ::fmt::Debug for dirent { 169 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 170 f.debug_struct("dirent") 171 .field("d_fileno", &self.d_fileno) 172 .field("d_off", &self.d_off) 173 .field("d_reclen", &self.d_reclen) 174 .field("d_type", &self.d_type) 175 .field("d_namlen", &self.d_namlen) 176 .field("d_name", &&self.d_name[..self.d_namlen as _]) 177 .finish() 178 } 179 } 180 impl ::hash::Hash for dirent { 181 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 182 self.d_fileno.hash(state); 183 self.d_off.hash(state); 184 self.d_reclen.hash(state); 185 self.d_type.hash(state); 186 self.d_namlen.hash(state); 187 self.d_name[..self.d_namlen as _].hash(state); 188 } 189 } 190 } 191 } 192 193 cfg_if! { 194 if #[cfg(not(freebsd13))] { 195 pub const ELAST: ::c_int = 96; 196 } else { 197 pub const EINTEGRITY: ::c_int = 97; 198 pub const ELAST: ::c_int = 97; 199 } 200 } 201 202 extern "C" { setgrent()203 pub fn setgrent(); mprotect( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, ) -> ::c_int204 pub fn mprotect( 205 addr: *mut ::c_void, 206 len: ::size_t, 207 prot: ::c_int, 208 ) -> ::c_int; freelocale(loc: ::locale_t)209 pub fn freelocale(loc: ::locale_t); msgrcv( msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, msgtyp: ::c_long, msgflg: ::c_int, ) -> ::ssize_t210 pub fn msgrcv( 211 msqid: ::c_int, 212 msgp: *mut ::c_void, 213 msgsz: ::size_t, 214 msgtyp: ::c_long, 215 msgflg: ::c_int, 216 ) -> ::ssize_t; 217 } 218 219 cfg_if! { 220 if #[cfg(target_arch = "x86_64")] { 221 mod x86_64; 222 pub use self::x86_64::*; 223 } 224 } 225