]> git.proxmox.com Git - rustc.git/blame - vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / vendor / libc / src / unix / bsd / freebsdlike / freebsd / freebsd12 / mod.rs
CommitLineData
5869c6ff 1// APIs in FreeBSD 12 that have changed since 11.
416331ca
XL
2
3pub type nlink_t = u64;
4pub type dev_t = u64;
5pub type ino_t = ::c_ulong;
6pub type shmatt_t = ::c_uint;
7
8s! {
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
31s_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
69cfg_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
3dfed10e
XL
193pub const F_ADD_SEALS: ::c_int = 19;
194pub const F_GET_SEALS: ::c_int = 20;
195pub const F_SEAL_SEAL: ::c_int = 0x0001;
196pub const F_SEAL_SHRINK: ::c_int = 0x0002;
197pub const F_SEAL_GROW: ::c_int = 0x0004;
198pub const F_SEAL_WRITE: ::c_int = 0x0008;
199
5869c6ff
XL
200pub const GRND_NONBLOCK: ::c_uint = 0x1;
201pub const GRND_RANDOM: ::c_uint = 0x2;
202
203pub const RAND_MAX: ::c_int = 0x7fff_fffd;
204
205pub const SO_DOMAIN: ::c_int = 0x1019;
206
207pub const ELAST: ::c_int = 96;
e1599b0c 208
e74abb32 209extern "C" {
416331ca 210 pub fn setgrent();
e74abb32
XL
211 pub fn mprotect(
212 addr: *mut ::c_void,
213 len: ::size_t,
214 prot: ::c_int,
215 ) -> ::c_int;
416331ca 216 pub fn freelocale(loc: ::locale_t);
e74abb32
XL
217 pub fn msgrcv(
218 msqid: ::c_int,
219 msgp: *mut ::c_void,
220 msgsz: ::size_t,
221 msgtyp: ::c_long,
222 msgflg: ::c_int,
223 ) -> ::ssize_t;
fc512014
XL
224 pub fn clock_nanosleep(
225 clk_id: ::clockid_t,
226 flags: ::c_int,
227 rqtp: *const ::timespec,
228 rmtp: *mut ::timespec,
229 ) -> ::c_int;
230
231 pub fn fdatasync(fd: ::c_int) -> ::c_int;
5869c6ff
XL
232
233 pub fn getrandom(
234 buf: *mut ::c_void,
235 buflen: ::size_t,
236 flags: ::c_uint,
237 ) -> ::ssize_t;
416331ca
XL
238}
239
240cfg_if! {
3dfed10e
XL
241 if #[cfg(any(target_arch = "x86_64",
242 target_arch = "aarch64"))] {
243 mod b64;
244 pub use self::b64::*;
416331ca
XL
245 }
246}