]> git.proxmox.com Git - rustc.git/blob - src/liblibc/src/unix/bsd/freebsdlike/freebsd/mod.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / liblibc / src / unix / bsd / freebsdlike / freebsd / mod.rs
1 pub type fflags_t = u32;
2 pub type clock_t = i32;
3 pub type ino_t = u32;
4 pub type lwpid_t = i32;
5 pub type nlink_t = u16;
6 pub type blksize_t = u32;
7 pub type clockid_t = ::c_int;
8 pub type sem_t = _sem;
9
10 pub type fsblkcnt_t = ::uint64_t;
11 pub type fsfilcnt_t = ::uint64_t;
12 pub type idtype_t = ::c_uint;
13
14 pub type key_t = ::c_long;
15 pub type msglen_t = ::c_ulong;
16 pub type msgqnum_t = ::c_ulong;
17
18 s! {
19 pub struct utmpx {
20 pub ut_type: ::c_short,
21 pub ut_tv: ::timeval,
22 pub ut_id: [::c_char; 8],
23 pub ut_pid: ::pid_t,
24 pub ut_user: [::c_char; 32],
25 pub ut_line: [::c_char; 16],
26 pub ut_host: [::c_char; 128],
27 pub __ut_spare: [::c_char; 64],
28 }
29
30 pub struct aiocb {
31 pub aio_fildes: ::c_int,
32 pub aio_offset: ::off_t,
33 pub aio_buf: *mut ::c_void,
34 pub aio_nbytes: ::size_t,
35 __unused1: [::c_int; 2],
36 __unused2: *mut ::c_void,
37 pub aio_lio_opcode: ::c_int,
38 pub aio_reqprio: ::c_int,
39 // unused 3 through 5 are the __aiocb_private structure
40 __unused3: ::c_long,
41 __unused4: ::c_long,
42 __unused5: *mut ::c_void,
43 pub aio_sigevent: sigevent
44 }
45
46 pub struct dirent {
47 pub d_fileno: u32,
48 pub d_reclen: u16,
49 pub d_type: u8,
50 pub d_namlen: u8,
51 pub d_name: [::c_char; 256],
52 }
53
54 pub struct jail {
55 pub version: u32,
56 pub path: *mut ::c_char,
57 pub hostname: *mut ::c_char,
58 pub jailname: *mut ::c_char,
59 pub ip4s: ::c_uint,
60 pub ip6s: ::c_uint,
61 pub ip4: *mut ::in_addr,
62 pub ip6: *mut ::in6_addr,
63 }
64
65 pub struct sigevent {
66 pub sigev_notify: ::c_int,
67 pub sigev_signo: ::c_int,
68 pub sigev_value: ::sigval,
69 //The rest of the structure is actually a union. We expose only
70 //sigev_notify_thread_id because it's the most useful union member.
71 pub sigev_notify_thread_id: ::lwpid_t,
72 #[cfg(target_pointer_width = "64")]
73 __unused1: ::c_int,
74 __unused2: [::c_long; 7]
75 }
76
77 pub struct statvfs {
78 pub f_bavail: ::fsblkcnt_t,
79 pub f_bfree: ::fsblkcnt_t,
80 pub f_blocks: ::fsblkcnt_t,
81 pub f_favail: ::fsfilcnt_t,
82 pub f_ffree: ::fsfilcnt_t,
83 pub f_files: ::fsfilcnt_t,
84 pub f_bsize: ::c_ulong,
85 pub f_flag: ::c_ulong,
86 pub f_frsize: ::c_ulong,
87 pub f_fsid: ::c_ulong,
88 pub f_namemax: ::c_ulong,
89 }
90
91 // internal structure has changed over time
92 pub struct _sem {
93 data: [u32; 4],
94 }
95
96 pub struct ipc_perm {
97 pub cuid: ::uid_t,
98 pub cgid: ::gid_t,
99 pub uid: ::uid_t,
100 pub gid: ::gid_t,
101 pub mode: ::mode_t,
102 pub seq: ::c_ushort,
103 pub key: ::key_t,
104 }
105
106 pub struct msqid_ds {
107 pub msg_perm: ::ipc_perm,
108 __unused1: *mut ::c_void,
109 __unused2: *mut ::c_void,
110 pub msg_cbytes: ::msglen_t,
111 pub msg_qnum: ::msgqnum_t,
112 pub msg_qbytes: ::msglen_t,
113 pub msg_lspid: ::pid_t,
114 pub msg_lrpid: ::pid_t,
115 pub msg_stime: ::time_t,
116 pub msg_rtime: ::time_t,
117 pub msg_ctime: ::time_t,
118 }
119
120 pub struct shmid_ds {
121 pub shm_perm: ::ipc_perm,
122 pub shm_segsz: ::size_t,
123 pub shm_lpid: ::pid_t,
124 pub shm_cpid: ::pid_t,
125 pub shm_nattch: ::c_int,
126 pub shm_atime: ::time_t,
127 pub shm_dtime: ::time_t,
128 pub shm_ctime: ::time_t,
129 }
130
131 pub struct xucred {
132 pub cr_version: ::c_uint,
133 pub cr_uid: ::uid_t,
134 pub cr_ngroups: ::c_short,
135 pub cr_groups: [::gid_t;16],
136 __cr_unused1: *mut ::c_void,
137 }
138 }
139
140 pub const SIGEV_THREAD_ID: ::c_int = 4;
141
142 pub const RAND_MAX: ::c_int = 0x7fff_fffd;
143 pub const PTHREAD_STACK_MIN: ::size_t = 2048;
144 pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
145 pub const SIGSTKSZ: ::size_t = 34816;
146 pub const SF_NODISKIO: ::c_int = 0x00000001;
147 pub const SF_MNOWAIT: ::c_int = 0x00000002;
148 pub const SF_SYNC: ::c_int = 0x00000004;
149 pub const O_CLOEXEC: ::c_int = 0x00100000;
150 pub const O_DIRECTORY: ::c_int = 0x00020000;
151 pub const O_EXEC: ::c_int = 0x00040000;
152 pub const O_TTY_INIT: ::c_int = 0x00080000;
153 pub const F_GETLK: ::c_int = 11;
154 pub const F_SETLK: ::c_int = 12;
155 pub const F_SETLKW: ::c_int = 13;
156 pub const ELAST: ::c_int = 96;
157 pub const RLIMIT_NPTS: ::c_int = 11;
158 pub const RLIMIT_SWAP: ::c_int = 12;
159 pub const RLIM_NLIMITS: ::rlim_t = 13;
160
161 pub const Q_GETQUOTA: ::c_int = 0x700;
162 pub const Q_SETQUOTA: ::c_int = 0x800;
163
164 pub const POSIX_FADV_NORMAL: ::c_int = 0;
165 pub const POSIX_FADV_RANDOM: ::c_int = 1;
166 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
167 pub const POSIX_FADV_WILLNEED: ::c_int = 3;
168 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
169 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
170
171 pub const POLLINIGNEOF: ::c_short = 0x2000;
172
173 pub const EVFILT_READ: ::int16_t = -1;
174 pub const EVFILT_WRITE: ::int16_t = -2;
175 pub const EVFILT_AIO: ::int16_t = -3;
176 pub const EVFILT_VNODE: ::int16_t = -4;
177 pub const EVFILT_PROC: ::int16_t = -5;
178 pub const EVFILT_SIGNAL: ::int16_t = -6;
179 pub const EVFILT_TIMER: ::int16_t = -7;
180 pub const EVFILT_FS: ::int16_t = -9;
181 pub const EVFILT_LIO: ::int16_t = -10;
182 pub const EVFILT_USER: ::int16_t = -11;
183
184 pub const EV_ADD: ::uint16_t = 0x1;
185 pub const EV_DELETE: ::uint16_t = 0x2;
186 pub const EV_ENABLE: ::uint16_t = 0x4;
187 pub const EV_DISABLE: ::uint16_t = 0x8;
188 pub const EV_ONESHOT: ::uint16_t = 0x10;
189 pub const EV_CLEAR: ::uint16_t = 0x20;
190 pub const EV_RECEIPT: ::uint16_t = 0x40;
191 pub const EV_DISPATCH: ::uint16_t = 0x80;
192 pub const EV_DROP: ::uint16_t = 0x1000;
193 pub const EV_FLAG1: ::uint16_t = 0x2000;
194 pub const EV_ERROR: ::uint16_t = 0x4000;
195 pub const EV_EOF: ::uint16_t = 0x8000;
196 pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
197
198 pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
199 pub const NOTE_FFNOP: ::uint32_t = 0x00000000;
200 pub const NOTE_FFAND: ::uint32_t = 0x40000000;
201 pub const NOTE_FFOR: ::uint32_t = 0x80000000;
202 pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
203 pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
204 pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
205 pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
206 pub const NOTE_DELETE: ::uint32_t = 0x00000001;
207 pub const NOTE_WRITE: ::uint32_t = 0x00000002;
208 pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
209 pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
210 pub const NOTE_LINK: ::uint32_t = 0x00000010;
211 pub const NOTE_RENAME: ::uint32_t = 0x00000020;
212 pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
213 pub const NOTE_EXIT: ::uint32_t = 0x80000000;
214 pub const NOTE_FORK: ::uint32_t = 0x40000000;
215 pub const NOTE_EXEC: ::uint32_t = 0x20000000;
216 pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
217 pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
218 pub const NOTE_TRACK: ::uint32_t = 0x00000001;
219 pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
220 pub const NOTE_CHILD: ::uint32_t = 0x00000004;
221 pub const NOTE_SECONDS: ::uint32_t = 0x00000001;
222 pub const NOTE_MSECONDS: ::uint32_t = 0x00000002;
223 pub const NOTE_USECONDS: ::uint32_t = 0x00000004;
224 pub const NOTE_NSECONDS: ::uint32_t = 0x00000008;
225
226 pub const MADV_PROTECT: ::c_int = 10;
227 pub const RUSAGE_THREAD: ::c_int = 1;
228
229 pub const CLOCK_REALTIME: ::clockid_t = 0;
230 pub const CLOCK_VIRTUAL: ::clockid_t = 1;
231 pub const CLOCK_PROF: ::clockid_t = 2;
232 pub const CLOCK_MONOTONIC: ::clockid_t = 4;
233 pub const CLOCK_UPTIME: ::clockid_t = 5;
234 pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
235 pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
236 pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
237 pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
238 pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
239 pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
240 pub const CLOCK_SECOND: ::clockid_t = 13;
241 pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
242 pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
243
244 pub const CTL_UNSPEC: ::c_int = 0;
245 pub const CTL_KERN: ::c_int = 1;
246 pub const CTL_VM: ::c_int = 2;
247 pub const CTL_VFS: ::c_int = 3;
248 pub const CTL_NET: ::c_int = 4;
249 pub const CTL_DEBUG: ::c_int = 5;
250 pub const CTL_HW: ::c_int = 6;
251 pub const CTL_MACHDEP: ::c_int = 7;
252 pub const CTL_USER: ::c_int = 8;
253 pub const CTL_P1003_1B: ::c_int = 9;
254 pub const KERN_OSTYPE: ::c_int = 1;
255 pub const KERN_OSRELEASE: ::c_int = 2;
256 pub const KERN_OSREV: ::c_int = 3;
257 pub const KERN_VERSION: ::c_int = 4;
258 pub const KERN_MAXVNODES: ::c_int = 5;
259 pub const KERN_MAXPROC: ::c_int = 6;
260 pub const KERN_MAXFILES: ::c_int = 7;
261 pub const KERN_ARGMAX: ::c_int = 8;
262 pub const KERN_SECURELVL: ::c_int = 9;
263 pub const KERN_HOSTNAME: ::c_int = 10;
264 pub const KERN_HOSTID: ::c_int = 11;
265 pub const KERN_CLOCKRATE: ::c_int = 12;
266 pub const KERN_VNODE: ::c_int = 13;
267 pub const KERN_PROC: ::c_int = 14;
268 pub const KERN_FILE: ::c_int = 15;
269 pub const KERN_PROF: ::c_int = 16;
270 pub const KERN_POSIX1: ::c_int = 17;
271 pub const KERN_NGROUPS: ::c_int = 18;
272 pub const KERN_JOB_CONTROL: ::c_int = 19;
273 pub const KERN_SAVED_IDS: ::c_int = 20;
274 pub const KERN_BOOTTIME: ::c_int = 21;
275 pub const KERN_NISDOMAINNAME: ::c_int = 22;
276 pub const KERN_UPDATEINTERVAL: ::c_int = 23;
277 pub const KERN_OSRELDATE: ::c_int = 24;
278 pub const KERN_NTP_PLL: ::c_int = 25;
279 pub const KERN_BOOTFILE: ::c_int = 26;
280 pub const KERN_MAXFILESPERPROC: ::c_int = 27;
281 pub const KERN_MAXPROCPERUID: ::c_int = 28;
282 pub const KERN_DUMPDEV: ::c_int = 29;
283 pub const KERN_IPC: ::c_int = 30;
284 pub const KERN_DUMMY: ::c_int = 31;
285 pub const KERN_PS_STRINGS: ::c_int = 32;
286 pub const KERN_USRSTACK: ::c_int = 33;
287 pub const KERN_LOGSIGEXIT: ::c_int = 34;
288 pub const KERN_IOV_MAX: ::c_int = 35;
289 pub const KERN_HOSTUUID: ::c_int = 36;
290 pub const KERN_ARND: ::c_int = 37;
291 pub const KERN_PROC_ALL: ::c_int = 0;
292 pub const KERN_PROC_PID: ::c_int = 1;
293 pub const KERN_PROC_PGRP: ::c_int = 2;
294 pub const KERN_PROC_SESSION: ::c_int = 3;
295 pub const KERN_PROC_TTY: ::c_int = 4;
296 pub const KERN_PROC_UID: ::c_int = 5;
297 pub const KERN_PROC_RUID: ::c_int = 6;
298 pub const KERN_PROC_ARGS: ::c_int = 7;
299 pub const KERN_PROC_PROC: ::c_int = 8;
300 pub const KERN_PROC_SV_NAME: ::c_int = 9;
301 pub const KERN_PROC_RGID: ::c_int = 10;
302 pub const KERN_PROC_GID: ::c_int = 11;
303 pub const KERN_PROC_PATHNAME: ::c_int = 12;
304 pub const KERN_PROC_OVMMAP: ::c_int = 13;
305 pub const KERN_PROC_OFILEDESC: ::c_int = 14;
306 pub const KERN_PROC_KSTACK: ::c_int = 15;
307 pub const KERN_PROC_INC_THREAD: ::c_int = 0x10;
308 pub const KERN_PROC_VMMAP: ::c_int = 32;
309 pub const KERN_PROC_FILEDESC: ::c_int = 33;
310 pub const KERN_PROC_GROUPS: ::c_int = 34;
311 pub const KERN_PROC_ENV: ::c_int = 35;
312 pub const KERN_PROC_AUXV: ::c_int = 36;
313 pub const KERN_PROC_RLIMIT: ::c_int = 37;
314 pub const KERN_PROC_PS_STRINGS: ::c_int = 38;
315 pub const KERN_PROC_UMASK: ::c_int = 39;
316 pub const KERN_PROC_OSREL: ::c_int = 40;
317 pub const KERN_PROC_SIGTRAMP: ::c_int = 41;
318 pub const KIPC_MAXSOCKBUF: ::c_int = 1;
319 pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
320 pub const KIPC_SOMAXCONN: ::c_int = 3;
321 pub const KIPC_MAX_LINKHDR: ::c_int = 4;
322 pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
323 pub const KIPC_MAX_HDR: ::c_int = 6;
324 pub const KIPC_MAX_DATALEN: ::c_int = 7;
325 pub const HW_MACHINE: ::c_int = 1;
326 pub const HW_MODEL: ::c_int = 2;
327 pub const HW_NCPU: ::c_int = 3;
328 pub const HW_BYTEORDER: ::c_int = 4;
329 pub const HW_PHYSMEM: ::c_int = 5;
330 pub const HW_USERMEM: ::c_int = 6;
331 pub const HW_PAGESIZE: ::c_int = 7;
332 pub const HW_DISKNAMES: ::c_int = 8;
333 pub const HW_DISKSTATS: ::c_int = 9;
334 pub const HW_FLOATINGPT: ::c_int = 10;
335 pub const HW_MACHINE_ARCH: ::c_int = 11;
336 pub const HW_REALMEM: ::c_int = 12;
337 pub const USER_CS_PATH: ::c_int = 1;
338 pub const USER_BC_BASE_MAX: ::c_int = 2;
339 pub const USER_BC_DIM_MAX: ::c_int = 3;
340 pub const USER_BC_SCALE_MAX: ::c_int = 4;
341 pub const USER_BC_STRING_MAX: ::c_int = 5;
342 pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
343 pub const USER_EXPR_NEST_MAX: ::c_int = 7;
344 pub const USER_LINE_MAX: ::c_int = 8;
345 pub const USER_RE_DUP_MAX: ::c_int = 9;
346 pub const USER_POSIX2_VERSION: ::c_int = 10;
347 pub const USER_POSIX2_C_BIND: ::c_int = 11;
348 pub const USER_POSIX2_C_DEV: ::c_int = 12;
349 pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
350 pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
351 pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
352 pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
353 pub const USER_POSIX2_SW_DEV: ::c_int = 17;
354 pub const USER_POSIX2_UPE: ::c_int = 18;
355 pub const USER_STREAM_MAX: ::c_int = 19;
356 pub const USER_TZNAME_MAX: ::c_int = 20;
357 pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
358 pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
359 pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
360 pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4;
361 pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5;
362 pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6;
363 pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7;
364 pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8;
365 pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9;
366 pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10;
367 pub const CTL_P1003_1B_FSYNC: ::c_int = 11;
368 pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12;
369 pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13;
370 pub const CTL_P1003_1B_TIMERS: ::c_int = 14;
371 pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15;
372 pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16;
373 pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17;
374 pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18;
375 pub const CTL_P1003_1B_MQ_OPEN_MAX: ::c_int = 19;
376 pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20;
377 pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21;
378 pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
379 pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
380 pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
381 pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
382 pub const TIOCGPTN: ::c_uint = 0x4004740f;
383 pub const TIOCPTMASTER: ::c_uint = 0x2000741c;
384 pub const TIOCSIG: ::c_uint = 0x2004745f;
385 pub const TIOCM_DCD: ::c_int = 0x40;
386 pub const H4DISC: ::c_int = 0x7;
387
388 pub const JAIL_API_VERSION: u32 = 2;
389 pub const JAIL_CREATE: ::c_int = 0x01;
390 pub const JAIL_UPDATE: ::c_int = 0x02;
391 pub const JAIL_ATTACH: ::c_int = 0x04;
392 pub const JAIL_DYING: ::c_int = 0x08;
393 pub const JAIL_SET_MASK: ::c_int = 0x0f;
394 pub const JAIL_GET_MASK: ::c_int = 0x08;
395 pub const JAIL_SYS_DISABLE: ::c_int = 0;
396 pub const JAIL_SYS_NEW: ::c_int = 1;
397 pub const JAIL_SYS_INHERIT: ::c_int = 2;
398
399 pub const SO_BINTIME: ::c_int = 0x2000;
400 pub const SO_NO_OFFLOAD: ::c_int = 0x4000;
401 pub const SO_NO_DDP: ::c_int = 0x8000;
402 pub const SO_LABEL: ::c_int = 0x1009;
403 pub const SO_PEERLABEL: ::c_int = 0x1010;
404 pub const SO_LISTENQLIMIT: ::c_int = 0x1011;
405 pub const SO_LISTENQLEN: ::c_int = 0x1012;
406 pub const SO_LISTENINCQLEN: ::c_int = 0x1013;
407 pub const SO_SETFIB: ::c_int = 0x1014;
408 pub const SO_USER_COOKIE: ::c_int = 0x1015;
409 pub const SO_PROTOCOL: ::c_int = 0x1016;
410 pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
411 pub const SO_VENDOR: ::c_int = 0x80000000;
412
413 pub const LOCAL_PEERCRED: ::c_int = 1;
414 pub const LOCAL_CREDS: ::c_int = 2;
415 pub const LOCAL_CONNWAIT: ::c_int = 4;
416 pub const LOCAL_VENDOR: ::c_int = SO_VENDOR;
417
418 pub const AF_SLOW: ::c_int = 33;
419 pub const AF_SCLUSTER: ::c_int = 34;
420 pub const AF_ARP: ::c_int = 35;
421 pub const AF_BLUETOOTH: ::c_int = 36;
422 pub const AF_IEEE80211: ::c_int = 37;
423 pub const AF_INET_SDP: ::c_int = 40;
424 pub const AF_INET6_SDP: ::c_int = 42;
425 #[doc(hidden)]
426 pub const AF_MAX: ::c_int = 42;
427
428 // https://github.com/freebsd/freebsd/blob/master/sys/net/if.h#L140
429 pub const IFF_UP: ::c_int = 0x1; // (n) interface is up
430 pub const IFF_BROADCAST: ::c_int = 0x2; // (i) broadcast address valid
431 pub const IFF_DEBUG: ::c_int = 0x4; // (n) turn on debugging
432 pub const IFF_LOOPBACK: ::c_int = 0x8; // (i) is a loopback net
433 pub const IFF_POINTOPOINT: ::c_int = 0x10; // (i) is a point-to-point link
434 // 0x20 was IFF_SMART
435 pub const IFF_DRV_RUNNING: ::c_int = 0x40; // (d) resources allocated
436 pub const IFF_NOARP: ::c_int = 0x80; // (n) no address resolution protocol
437 pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets
438 pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets
439 pub const IFF_DRV_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full
440 pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions
441 pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
442 pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
443 pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
444 pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
445 pub const IFF_MULTICAST: ::c_int = 0x8000; // (i) supports multicast
446 // (i) unconfigurable using ioctl(2)
447 pub const IFF_CANTCONFIG: ::c_int = 0x10000;
448 pub const IFF_PPROMISC: ::c_int = 0x20000; // (n) user-requested promisc mode
449 pub const IFF_MONITOR: ::c_int = 0x40000; // (n) user-requested monitor mode
450 pub const IFF_STATICARP: ::c_int = 0x80000; // (n) static ARP
451 pub const IFF_DYING: ::c_int = 0x200000; // (n) interface is winding down
452 pub const IFF_RENAMING: ::c_int = 0x400000; // (n) interface is being renamed
453
454 // sys/netinet/in.h
455 // Protocols (RFC 1700)
456 // NOTE: These are in addition to the constants defined in src/unix/mod.rs
457
458 // IPPROTO_IP defined in src/unix/mod.rs
459 /// IP6 hop-by-hop options
460 pub const IPPROTO_HOPOPTS: ::c_int = 0;
461 // IPPROTO_ICMP defined in src/unix/mod.rs
462 /// group mgmt protocol
463 pub const IPPROTO_IGMP: ::c_int = 2;
464 /// gateway^2 (deprecated)
465 pub const IPPROTO_GGP: ::c_int = 3;
466 /// for compatibility
467 pub const IPPROTO_IPIP: ::c_int = 4;
468 // IPPROTO_TCP defined in src/unix/mod.rs
469 /// Stream protocol II.
470 pub const IPPROTO_ST: ::c_int = 7;
471 /// exterior gateway protocol
472 pub const IPPROTO_EGP: ::c_int = 8;
473 /// private interior gateway
474 pub const IPPROTO_PIGP: ::c_int = 9;
475 /// BBN RCC Monitoring
476 pub const IPPROTO_RCCMON: ::c_int = 10;
477 /// network voice protocol
478 pub const IPPROTO_NVPII: ::c_int = 11;
479 /// pup
480 pub const IPPROTO_PUP: ::c_int = 12;
481 /// Argus
482 pub const IPPROTO_ARGUS: ::c_int = 13;
483 /// EMCON
484 pub const IPPROTO_EMCON: ::c_int = 14;
485 /// Cross Net Debugger
486 pub const IPPROTO_XNET: ::c_int = 15;
487 /// Chaos
488 pub const IPPROTO_CHAOS: ::c_int = 16;
489 // IPPROTO_UDP defined in src/unix/mod.rs
490 /// Multiplexing
491 pub const IPPROTO_MUX: ::c_int = 18;
492 /// DCN Measurement Subsystems
493 pub const IPPROTO_MEAS: ::c_int = 19;
494 /// Host Monitoring
495 pub const IPPROTO_HMP: ::c_int = 20;
496 /// Packet Radio Measurement
497 pub const IPPROTO_PRM: ::c_int = 21;
498 /// xns idp
499 pub const IPPROTO_IDP: ::c_int = 22;
500 /// Trunk-1
501 pub const IPPROTO_TRUNK1: ::c_int = 23;
502 /// Trunk-2
503 pub const IPPROTO_TRUNK2: ::c_int = 24;
504 /// Leaf-1
505 pub const IPPROTO_LEAF1: ::c_int = 25;
506 /// Leaf-2
507 pub const IPPROTO_LEAF2: ::c_int = 26;
508 /// Reliable Data
509 pub const IPPROTO_RDP: ::c_int = 27;
510 /// Reliable Transaction
511 pub const IPPROTO_IRTP: ::c_int = 28;
512 /// tp-4 w/ class negotiation
513 pub const IPPROTO_TP: ::c_int = 29;
514 /// Bulk Data Transfer
515 pub const IPPROTO_BLT: ::c_int = 30;
516 /// Network Services
517 pub const IPPROTO_NSP: ::c_int = 31;
518 /// Merit Internodal
519 pub const IPPROTO_INP: ::c_int = 32;
520 /// Sequential Exchange
521 pub const IPPROTO_SEP: ::c_int = 33;
522 /// Third Party Connect
523 pub const IPPROTO_3PC: ::c_int = 34;
524 /// InterDomain Policy Routing
525 pub const IPPROTO_IDPR: ::c_int = 35;
526 /// XTP
527 pub const IPPROTO_XTP: ::c_int = 36;
528 /// Datagram Delivery
529 pub const IPPROTO_DDP: ::c_int = 37;
530 /// Control Message Transport
531 pub const IPPROTO_CMTP: ::c_int = 38;
532 /// TP++ Transport
533 pub const IPPROTO_TPXX: ::c_int = 39;
534 /// IL transport protocol
535 pub const IPPROTO_IL: ::c_int = 40;
536 // IPPROTO_IPV6 defined in src/unix/mod.rs
537 /// Source Demand Routing
538 pub const IPPROTO_SDRP: ::c_int = 42;
539 /// IP6 routing header
540 pub const IPPROTO_ROUTING: ::c_int = 43;
541 /// IP6 fragmentation header
542 pub const IPPROTO_FRAGMENT: ::c_int = 44;
543 /// InterDomain Routing
544 pub const IPPROTO_IDRP: ::c_int = 45;
545 /// resource reservation
546 pub const IPPROTO_RSVP: ::c_int = 46;
547 /// General Routing Encap.
548 pub const IPPROTO_GRE: ::c_int = 47;
549 /// Mobile Host Routing
550 pub const IPPROTO_MHRP: ::c_int = 48;
551 /// BHA
552 pub const IPPROTO_BHA: ::c_int = 49;
553 /// IP6 Encap Sec. Payload
554 pub const IPPROTO_ESP: ::c_int = 50;
555 /// IP6 Auth Header
556 pub const IPPROTO_AH: ::c_int = 51;
557 /// Integ. Net Layer Security
558 pub const IPPROTO_INLSP: ::c_int = 52;
559 /// IP with encryption
560 pub const IPPROTO_SWIPE: ::c_int = 53;
561 /// Next Hop Resolution
562 pub const IPPROTO_NHRP: ::c_int = 54;
563 /// IP Mobility
564 pub const IPPROTO_MOBILE: ::c_int = 55;
565 /// Transport Layer Security
566 pub const IPPROTO_TLSP: ::c_int = 56;
567 /// SKIP
568 pub const IPPROTO_SKIP: ::c_int = 57;
569 // IPPROTO_ICMPV6 defined in src/unix/mod.rs
570 /// IP6 no next header
571 pub const IPPROTO_NONE: ::c_int = 59;
572 /// IP6 destination option
573 pub const IPPROTO_DSTOPTS: ::c_int = 60;
574 /// any host internal protocol
575 pub const IPPROTO_AHIP: ::c_int = 61;
576 /// CFTP
577 pub const IPPROTO_CFTP: ::c_int = 62;
578 /// "hello" routing protocol
579 pub const IPPROTO_HELLO: ::c_int = 63;
580 /// SATNET/Backroom EXPAK
581 pub const IPPROTO_SATEXPAK: ::c_int = 64;
582 /// Kryptolan
583 pub const IPPROTO_KRYPTOLAN: ::c_int = 65;
584 /// Remote Virtual Disk
585 pub const IPPROTO_RVD: ::c_int = 66;
586 /// Pluribus Packet Core
587 pub const IPPROTO_IPPC: ::c_int = 67;
588 /// Any distributed FS
589 pub const IPPROTO_ADFS: ::c_int = 68;
590 /// Satnet Monitoring
591 pub const IPPROTO_SATMON: ::c_int = 69;
592 /// VISA Protocol
593 pub const IPPROTO_VISA: ::c_int = 70;
594 /// Packet Core Utility
595 pub const IPPROTO_IPCV: ::c_int = 71;
596 /// Comp. Prot. Net. Executive
597 pub const IPPROTO_CPNX: ::c_int = 72;
598 /// Comp. Prot. HeartBeat
599 pub const IPPROTO_CPHB: ::c_int = 73;
600 /// Wang Span Network
601 pub const IPPROTO_WSN: ::c_int = 74;
602 /// Packet Video Protocol
603 pub const IPPROTO_PVP: ::c_int = 75;
604 /// BackRoom SATNET Monitoring
605 pub const IPPROTO_BRSATMON: ::c_int = 76;
606 /// Sun net disk proto (temp.)
607 pub const IPPROTO_ND: ::c_int = 77;
608 /// WIDEBAND Monitoring
609 pub const IPPROTO_WBMON: ::c_int = 78;
610 /// WIDEBAND EXPAK
611 pub const IPPROTO_WBEXPAK: ::c_int = 79;
612 /// ISO cnlp
613 pub const IPPROTO_EON: ::c_int = 80;
614 /// VMTP
615 pub const IPPROTO_VMTP: ::c_int = 81;
616 /// Secure VMTP
617 pub const IPPROTO_SVMTP: ::c_int = 82;
618 /// Banyon VINES
619 pub const IPPROTO_VINES: ::c_int = 83;
620 /// TTP
621 pub const IPPROTO_TTP: ::c_int = 84;
622 /// NSFNET-IGP
623 pub const IPPROTO_IGP: ::c_int = 85;
624 /// dissimilar gateway prot.
625 pub const IPPROTO_DGP: ::c_int = 86;
626 /// TCF
627 pub const IPPROTO_TCF: ::c_int = 87;
628 /// Cisco/GXS IGRP
629 pub const IPPROTO_IGRP: ::c_int = 88;
630 /// OSPFIGP
631 pub const IPPROTO_OSPFIGP: ::c_int = 89;
632 /// Strite RPC protocol
633 pub const IPPROTO_SRPC: ::c_int = 90;
634 /// Locus Address Resoloution
635 pub const IPPROTO_LARP: ::c_int = 91;
636 /// Multicast Transport
637 pub const IPPROTO_MTP: ::c_int = 92;
638 /// AX.25 Frames
639 pub const IPPROTO_AX25: ::c_int = 93;
640 /// IP encapsulated in IP
641 pub const IPPROTO_IPEIP: ::c_int = 94;
642 /// Mobile Int.ing control
643 pub const IPPROTO_MICP: ::c_int = 95;
644 /// Semaphore Comm. security
645 pub const IPPROTO_SCCSP: ::c_int = 96;
646 /// Ethernet IP encapsulation
647 pub const IPPROTO_ETHERIP: ::c_int = 97;
648 /// encapsulation header
649 pub const IPPROTO_ENCAP: ::c_int = 98;
650 /// any private encr. scheme
651 pub const IPPROTO_APES: ::c_int = 99;
652 /// GMTP
653 pub const IPPROTO_GMTP: ::c_int = 100;
654 /// payload compression (IPComp)
655 pub const IPPROTO_IPCOMP: ::c_int = 108;
656 /// SCTP
657 pub const IPPROTO_SCTP: ::c_int = 132;
658 /// IPv6 Mobility Header
659 pub const IPPROTO_MH: ::c_int = 135;
660 /// UDP-Lite
661 pub const IPPROTO_UDPLITE: ::c_int = 136;
662 /// IP6 Host Identity Protocol
663 pub const IPPROTO_HIP: ::c_int = 139;
664 /// IP6 Shim6 Protocol
665 pub const IPPROTO_SHIM6: ::c_int = 140;
666
667 /* 101-254: Partly Unassigned */
668 /// Protocol Independent Mcast
669 pub const IPPROTO_PIM: ::c_int = 103;
670 /// CARP
671 pub const IPPROTO_CARP: ::c_int = 112;
672 /// PGM
673 pub const IPPROTO_PGM: ::c_int = 113;
674 /// MPLS-in-IP
675 pub const IPPROTO_MPLS: ::c_int = 137;
676 /// PFSYNC
677 pub const IPPROTO_PFSYNC: ::c_int = 240;
678
679 /* 255: Reserved */
680 /* BSD Private, local use, namespace incursion, no longer used */
681 /// OLD divert pseudo-proto
682 pub const IPPROTO_OLD_DIVERT: ::c_int = 254;
683 pub const IPPROTO_MAX: ::c_int = 256;
684 /// last return value of *_input(), meaning "all job for this pkt is done".
685 pub const IPPROTO_DONE: ::c_int = 257;
686
687 /* Only used internally, so can be outside the range of valid IP protocols. */
688 /// divert pseudo-protocol
689 pub const IPPROTO_DIVERT: ::c_int = 258;
690 /// SeND pseudo-protocol
691 pub const IPPROTO_SEND: ::c_int = 259;
692
693 pub const IP_BINDANY: ::c_int = 24;
694
695 pub const PF_SLOW: ::c_int = AF_SLOW;
696 pub const PF_SCLUSTER: ::c_int = AF_SCLUSTER;
697 pub const PF_ARP: ::c_int = AF_ARP;
698 pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
699 pub const PF_IEEE80211: ::c_int = AF_IEEE80211;
700 pub const PF_INET_SDP: ::c_int = AF_INET_SDP;
701 pub const PF_INET6_SDP: ::c_int = AF_INET6_SDP;
702 #[doc(hidden)]
703 pub const PF_MAX: ::c_int = AF_MAX;
704
705 pub const NET_RT_DUMP: ::c_int = 1;
706 pub const NET_RT_FLAGS: ::c_int = 2;
707 pub const NET_RT_IFLIST: ::c_int = 3;
708 pub const NET_RT_IFMALIST: ::c_int = 4;
709 pub const NET_RT_IFLISTL: ::c_int = 5;
710
711 // System V IPC
712 pub const IPC_PRIVATE: ::key_t = 0;
713 pub const IPC_CREAT: ::c_int = 0o1000;
714 pub const IPC_EXCL: ::c_int = 0o2000;
715 pub const IPC_NOWAIT: ::c_int = 0o4000;
716 pub const IPC_RMID: ::c_int = 0;
717 pub const IPC_SET: ::c_int = 1;
718 pub const IPC_STAT: ::c_int = 2;
719 pub const IPC_INFO: ::c_int = 3;
720 pub const IPC_R : ::c_int = 0o400;
721 pub const IPC_W : ::c_int = 0o200;
722 pub const IPC_M : ::c_int = 0o10000;
723 pub const MSG_NOERROR: ::c_int = 0o10000;
724 pub const SHM_RDONLY: ::c_int = 0o10000;
725 pub const SHM_RND: ::c_int = 0o20000;
726 pub const SHM_R: ::c_int = 0o400;
727 pub const SHM_W: ::c_int = 0o200;
728 pub const SHM_LOCK: ::c_int = 11;
729 pub const SHM_UNLOCK: ::c_int = 12;
730 pub const SHM_STAT: ::c_int = 13;
731 pub const SHM_INFO: ::c_int = 14;
732 pub const SHM_ANON: *mut ::c_char = 1 as *mut ::c_char;
733
734 // The *_MAXID constants never should've been used outside of the
735 // FreeBSD base system. And with the exception of CTL_P1003_1B_MAXID,
736 // they were all removed in svn r262489. They remain here for backwards
737 // compatibility only, and are scheduled to be removed in libc 1.0.0.
738 #[doc(hidden)]
739 pub const NET_MAXID: ::c_int = AF_MAX;
740 #[doc(hidden)]
741 pub const CTL_MAXID: ::c_int = 10;
742 #[doc(hidden)]
743 pub const KERN_MAXID: ::c_int = 38;
744 #[doc(hidden)]
745 pub const HW_MAXID: ::c_int = 13;
746 #[doc(hidden)]
747 pub const USER_MAXID: ::c_int = 21;
748 #[doc(hidden)]
749 pub const CTL_P1003_1B_MAXID: ::c_int = 26;
750
751 pub const MSG_NOTIFICATION: ::c_int = 0x00002000;
752 pub const MSG_NBIO: ::c_int = 0x00004000;
753 pub const MSG_COMPAT: ::c_int = 0x00008000;
754 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00040000;
755 pub const MSG_NOSIGNAL: ::c_int = 0x20000;
756
757 pub const EMPTY: ::c_short = 0;
758 pub const BOOT_TIME: ::c_short = 1;
759 pub const OLD_TIME: ::c_short = 2;
760 pub const NEW_TIME: ::c_short = 3;
761 pub const USER_PROCESS: ::c_short = 4;
762 pub const INIT_PROCESS: ::c_short = 5;
763 pub const LOGIN_PROCESS: ::c_short = 6;
764 pub const DEAD_PROCESS: ::c_short = 7;
765 pub const SHUTDOWN_TIME: ::c_short = 8;
766
767 pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
768 pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
769 pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
770 pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
771 pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
772 pub const LC_TIME_MASK: ::c_int = (1 << 5);
773 pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
774 | LC_CTYPE_MASK
775 | LC_MESSAGES_MASK
776 | LC_MONETARY_MASK
777 | LC_NUMERIC_MASK
778 | LC_TIME_MASK;
779
780 pub const WSTOPPED: ::c_int = 2; // same as WUNTRACED
781 pub const WCONTINUED: ::c_int = 4;
782 pub const WNOWAIT: ::c_int = 8;
783 pub const WEXITED: ::c_int = 16;
784 pub const WTRAPPED: ::c_int = 32;
785
786 // FreeBSD defines a great many more of these, we only expose the
787 // standardized ones.
788 pub const P_PID: idtype_t = 0;
789 pub const P_PGID: idtype_t = 2;
790 pub const P_ALL: idtype_t = 7;
791
792 pub const B460800: ::speed_t = 460800;
793 pub const B921600: ::speed_t = 921600;
794
795 pub const AT_FDCWD: ::c_int = -100;
796 pub const AT_EACCESS: ::c_int = 0x100;
797 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
798 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
799 pub const AT_REMOVEDIR: ::c_int = 0x800;
800
801 pub const TABDLY: ::tcflag_t = 0x00000004;
802 pub const TAB0: ::tcflag_t = 0x00000000;
803 pub const TAB3: ::tcflag_t = 0x00000004;
804
805 pub const _PC_ACL_NFS4: ::c_int = 64;
806
807 pub const _SC_CPUSET_SIZE: ::c_int = 122;
808
809 pub const XU_NGROUPS: ::c_int = 16;
810 pub const XUCRED_VERSION: ::c_uint = 0;
811
812 extern {
813 pub fn __error() -> *mut ::c_int;
814
815 pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
816 -> ::c_int;
817
818 pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
819 pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
820 pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
821
822 pub fn jail(jail: *mut ::jail) -> ::c_int;
823 pub fn jail_attach(jid: ::c_int) -> ::c_int;
824 pub fn jail_remove(jid: ::c_int) -> ::c_int;
825 pub fn jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int)
826 -> ::c_int;
827 pub fn jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int)
828 -> ::c_int;
829
830 pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
831 len: ::off_t) -> ::c_int;
832 pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
833 advise: ::c_int) -> ::c_int;
834 pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
835 pub fn mkostemps(template: *mut ::c_char,
836 suffixlen: ::c_int,
837 flags: ::c_int) -> ::c_int;
838
839 pub fn getutxuser(user: *const ::c_char) -> *mut utmpx;
840 pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int;
841
842 pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
843 timeout: *mut ::timespec) -> ::ssize_t;
844
845 pub fn freelocale(loc: ::locale_t) -> ::c_int;
846 pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t,
847 options: ::c_int) -> ::c_int;
848
849 pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
850 pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
851 pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void,
852 shmflg: ::c_int) -> *mut ::c_void;
853 pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
854 pub fn shmctl(shmid: ::c_int, cmd: ::c_int,
855 buf: *mut ::shmid_ds) -> ::c_int;
856 pub fn msgctl(msqid: ::c_int, cmd: ::c_int,
857 buf: *mut ::msqid_ds) -> ::c_int;
858 pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
859 pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
860 msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int;
861 pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
862 msgflg: ::c_int) -> ::c_int;
863 pub fn cfmakesane(termios: *mut ::termios);
864 }
865
866 cfg_if! {
867 if #[cfg(target_arch = "x86")] {
868 mod x86;
869 pub use self::x86::*;
870 } else if #[cfg(target_arch = "x86_64")] {
871 mod x86_64;
872 pub use self::x86_64::*;
873 } else if #[cfg(target_arch = "aarch64")] {
874 mod aarch64;
875 pub use self::aarch64::*;
876 } else {
877 // Unknown target_arch
878 }
879 }