1 // APIs in FreeBSD 13 that have changed since 11. 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 pub struct sockcred2 { 31 pub sc_version: ::c_int, 32 pub sc_pid: ::pid_t, 33 pub sc_uid: ::uid_t, 34 pub sc_euid: ::uid_t, 35 pub sc_gid: ::gid_t, 36 pub sc_egid: ::gid_t, 37 pub sc_ngroups: ::c_int, 38 pub sc_groups: [::gid_t; 1], 39 } 40 } 41 42 s_no_extra_traits! { 43 pub struct dirent { 44 pub d_fileno: ::ino_t, 45 pub d_off: ::off_t, 46 pub d_reclen: u16, 47 pub d_type: u8, 48 d_pad0: u8, 49 pub d_namlen: u16, 50 d_pad1: u16, 51 pub d_name: [::c_char; 256], 52 } 53 54 pub struct statfs { 55 pub f_version: u32, 56 pub f_type: u32, 57 pub f_flags: u64, 58 pub f_bsize: u64, 59 pub f_iosize: u64, 60 pub f_blocks: u64, 61 pub f_bfree: u64, 62 pub f_bavail: i64, 63 pub f_files: u64, 64 pub f_ffree: i64, 65 pub f_syncwrites: u64, 66 pub f_asyncwrites: u64, 67 pub f_syncreads: u64, 68 pub f_asyncreads: u64, 69 f_spare: [u64; 10], 70 pub f_namemax: u32, 71 pub f_owner: ::uid_t, 72 pub f_fsid: ::fsid_t, 73 f_charspare: [::c_char; 80], 74 pub f_fstypename: [::c_char; 16], 75 pub f_mntfromname: [::c_char; 1024], 76 pub f_mntonname: [::c_char; 1024], 77 } 78 } 79 80 cfg_if! { 81 if #[cfg(feature = "extra_traits")] { 82 impl PartialEq for statfs { 83 fn eq(&self, other: &statfs) -> bool { 84 self.f_version == other.f_version 85 && self.f_type == other.f_type 86 && self.f_flags == other.f_flags 87 && self.f_bsize == other.f_bsize 88 && self.f_iosize == other.f_iosize 89 && self.f_blocks == other.f_blocks 90 && self.f_bfree == other.f_bfree 91 && self.f_bavail == other.f_bavail 92 && self.f_files == other.f_files 93 && self.f_ffree == other.f_ffree 94 && self.f_syncwrites == other.f_syncwrites 95 && self.f_asyncwrites == other.f_asyncwrites 96 && self.f_syncreads == other.f_syncreads 97 && self.f_asyncreads == other.f_asyncreads 98 && self.f_namemax == other.f_namemax 99 && self.f_owner == other.f_owner 100 && self.f_fsid == other.f_fsid 101 && self.f_fstypename == other.f_fstypename 102 && self 103 .f_mntfromname 104 .iter() 105 .zip(other.f_mntfromname.iter()) 106 .all(|(a,b)| a == b) 107 && self 108 .f_mntonname 109 .iter() 110 .zip(other.f_mntonname.iter()) 111 .all(|(a,b)| a == b) 112 } 113 } 114 impl Eq for statfs {} 115 impl ::fmt::Debug for statfs { 116 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 117 f.debug_struct("statfs") 118 .field("f_bsize", &self.f_bsize) 119 .field("f_iosize", &self.f_iosize) 120 .field("f_blocks", &self.f_blocks) 121 .field("f_bfree", &self.f_bfree) 122 .field("f_bavail", &self.f_bavail) 123 .field("f_files", &self.f_files) 124 .field("f_ffree", &self.f_ffree) 125 .field("f_syncwrites", &self.f_syncwrites) 126 .field("f_asyncwrites", &self.f_asyncwrites) 127 .field("f_syncreads", &self.f_syncreads) 128 .field("f_asyncreads", &self.f_asyncreads) 129 .field("f_namemax", &self.f_namemax) 130 .field("f_owner", &self.f_owner) 131 .field("f_fsid", &self.f_fsid) 132 .field("f_fstypename", &self.f_fstypename) 133 .field("f_mntfromname", &&self.f_mntfromname[..]) 134 .field("f_mntonname", &&self.f_mntonname[..]) 135 .finish() 136 } 137 } 138 impl ::hash::Hash for statfs { 139 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 140 self.f_version.hash(state); 141 self.f_type.hash(state); 142 self.f_flags.hash(state); 143 self.f_bsize.hash(state); 144 self.f_iosize.hash(state); 145 self.f_blocks.hash(state); 146 self.f_bfree.hash(state); 147 self.f_bavail.hash(state); 148 self.f_files.hash(state); 149 self.f_ffree.hash(state); 150 self.f_syncwrites.hash(state); 151 self.f_asyncwrites.hash(state); 152 self.f_syncreads.hash(state); 153 self.f_asyncreads.hash(state); 154 self.f_namemax.hash(state); 155 self.f_owner.hash(state); 156 self.f_fsid.hash(state); 157 self.f_charspare.hash(state); 158 self.f_fstypename.hash(state); 159 self.f_mntfromname.hash(state); 160 self.f_mntonname.hash(state); 161 } 162 } 163 164 impl PartialEq for dirent { 165 fn eq(&self, other: &dirent) -> bool { 166 self.d_fileno == other.d_fileno 167 && self.d_off == other.d_off 168 && self.d_reclen == other.d_reclen 169 && self.d_type == other.d_type 170 && self.d_namlen == other.d_namlen 171 && self 172 .d_name[..self.d_namlen as _] 173 .iter() 174 .zip(other.d_name.iter()) 175 .all(|(a,b)| a == b) 176 } 177 } 178 impl Eq for dirent {} 179 impl ::fmt::Debug for dirent { 180 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 181 f.debug_struct("dirent") 182 .field("d_fileno", &self.d_fileno) 183 .field("d_off", &self.d_off) 184 .field("d_reclen", &self.d_reclen) 185 .field("d_type", &self.d_type) 186 .field("d_namlen", &self.d_namlen) 187 .field("d_name", &&self.d_name[..self.d_namlen as _]) 188 .finish() 189 } 190 } 191 impl ::hash::Hash for dirent { 192 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 193 self.d_fileno.hash(state); 194 self.d_off.hash(state); 195 self.d_reclen.hash(state); 196 self.d_type.hash(state); 197 self.d_namlen.hash(state); 198 self.d_name[..self.d_namlen as _].hash(state); 199 } 200 } 201 } 202 } 203 204 pub const F_ADD_SEALS: ::c_int = 19; 205 pub const F_GET_SEALS: ::c_int = 20; 206 pub const F_SEAL_SEAL: ::c_int = 0x0001; 207 pub const F_SEAL_SHRINK: ::c_int = 0x0002; 208 pub const F_SEAL_GROW: ::c_int = 0x0004; 209 pub const F_SEAL_WRITE: ::c_int = 0x0008; 210 211 pub const GRND_NONBLOCK: ::c_uint = 0x1; 212 pub const GRND_RANDOM: ::c_uint = 0x2; 213 214 pub const RAND_MAX: ::c_int = 0x7fff_ffff; 215 216 pub const SO_DOMAIN: ::c_int = 0x1019; 217 218 pub const EINTEGRITY: ::c_int = 97; 219 pub const ELAST: ::c_int = 97; 220 pub const GRND_INSECURE: ::c_uint = 0x4; 221 222 pub const PROC_ASLR_CTL: ::c_int = 13; 223 pub const PROC_ASLR_STATUS: ::c_int = 14; 224 pub const PROC_PROTMAX_CTL: ::c_int = 15; 225 pub const PROC_PROTMAX_STATUS: ::c_int = 16; 226 pub const PROC_PROCCTL_MD_MIN: ::c_int = 0x10000000; 227 228 pub const LOCAL_CREDS_PERSISTENT: ::c_int = 3; 229 pub const SCM_CREDS2: ::c_int = 0x08; 230 231 f! { 232 pub fn SOCKCRED2SIZE(ngrps: usize) -> usize { 233 let ngrps = if ngrps > 0 { 234 ngrps - 1 235 } else { 236 0 237 }; 238 ::mem::size_of::<sockcred2>() + ::mem::size_of::<::gid_t>() * ngrps 239 } 240 } 241 242 extern "C" { aio_readv(aiocbp: *mut ::aiocb) -> ::c_int243 pub fn aio_readv(aiocbp: *mut ::aiocb) -> ::c_int; aio_writev(aiocbp: *mut ::aiocb) -> ::c_int244 pub fn aio_writev(aiocbp: *mut ::aiocb) -> ::c_int; setgrent()245 pub fn setgrent(); mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int246 pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; freelocale(loc: ::locale_t)247 pub fn freelocale(loc: ::locale_t); msgrcv( msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, msgtyp: ::c_long, msgflg: ::c_int, ) -> ::ssize_t248 pub fn msgrcv( 249 msqid: ::c_int, 250 msgp: *mut ::c_void, 251 msgsz: ::size_t, 252 msgtyp: ::c_long, 253 msgflg: ::c_int, 254 ) -> ::ssize_t; clock_nanosleep( clk_id: ::clockid_t, flags: ::c_int, rqtp: *const ::timespec, rmtp: *mut ::timespec, ) -> ::c_int255 pub fn clock_nanosleep( 256 clk_id: ::clockid_t, 257 flags: ::c_int, 258 rqtp: *const ::timespec, 259 rmtp: *mut ::timespec, 260 ) -> ::c_int; 261 fdatasync(fd: ::c_int) -> ::c_int262 pub fn fdatasync(fd: ::c_int) -> ::c_int; 263 getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t264 pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int265 pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int266 pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; setproctitle_fast(fmt: *const ::c_char, ...)267 pub fn setproctitle_fast(fmt: *const ::c_char, ...); timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int268 pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int269 pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; 270 } 271 272 cfg_if! { 273 if #[cfg(any(target_arch = "x86_64", 274 target_arch = "aarch64"))] { 275 mod b64; 276 pub use self::b64::*; 277 } 278 } 279 280 cfg_if! { 281 if #[cfg(target_arch = "x86_64")] { 282 mod x86_64; 283 pub use self::x86_64::*; 284 } 285 } 286