]> git.proxmox.com Git - rustc.git/blob - src/liblibc/src/unix/bsd/freebsdlike/mod.rs
New upstream version 1.12.0+dfsg1
[rustc.git] / src / liblibc / src / unix / bsd / freebsdlike / mod.rs
1 pub type dev_t = u32;
2 pub type mode_t = u16;
3 pub type pthread_attr_t = *mut ::c_void;
4 pub type rlim_t = i64;
5 pub type pthread_mutex_t = *mut ::c_void;
6 pub type pthread_mutexattr_t = *mut ::c_void;
7 pub type pthread_cond_t = *mut ::c_void;
8 pub type pthread_condattr_t = *mut ::c_void;
9 pub type pthread_rwlock_t = *mut ::c_void;
10 pub type pthread_key_t = ::c_int;
11 pub type tcflag_t = ::c_uint;
12 pub type speed_t = ::c_uint;
13 pub type nl_item = ::c_int;
14 pub type id_t = i64;
15 pub type sem_t = _sem;
16
17 pub enum timezone {}
18
19 s! {
20 pub struct glob_t {
21 pub gl_pathc: ::size_t,
22 __unused1: ::size_t,
23 pub gl_offs: ::size_t,
24 __unused2: ::c_int,
25 pub gl_pathv: *mut *mut ::c_char,
26
27 __unused3: *mut ::c_void,
28
29 __unused4: *mut ::c_void,
30 __unused5: *mut ::c_void,
31 __unused6: *mut ::c_void,
32 __unused7: *mut ::c_void,
33 __unused8: *mut ::c_void,
34 }
35
36 pub struct sockaddr_storage {
37 pub ss_len: u8,
38 pub ss_family: ::sa_family_t,
39 __ss_pad1: [u8; 6],
40 __ss_align: i64,
41 __ss_pad2: [u8; 112],
42 }
43
44 pub struct addrinfo {
45 pub ai_flags: ::c_int,
46 pub ai_family: ::c_int,
47 pub ai_socktype: ::c_int,
48 pub ai_protocol: ::c_int,
49 pub ai_addrlen: ::socklen_t,
50 pub ai_canonname: *mut ::c_char,
51 pub ai_addr: *mut ::sockaddr,
52 pub ai_next: *mut addrinfo,
53 }
54
55 pub struct sigset_t {
56 bits: [u32; 4],
57 }
58
59 pub struct siginfo_t {
60 pub si_signo: ::c_int,
61 pub si_errno: ::c_int,
62 pub si_code: ::c_int,
63 pub si_pid: ::pid_t,
64 pub si_uid: ::uid_t,
65 pub si_status: ::c_int,
66 pub si_addr: *mut ::c_void,
67 _pad: [::c_int; 12],
68 }
69
70 pub struct sigaction {
71 pub sa_sigaction: ::sighandler_t,
72 pub sa_flags: ::c_int,
73 pub sa_mask: sigset_t,
74 }
75
76 pub struct stack_t {
77 pub ss_sp: *mut ::c_char,
78 pub ss_size: ::size_t,
79 pub ss_flags: ::c_int,
80 }
81
82 pub struct sched_param {
83 pub sched_priority: ::c_int,
84 }
85
86 pub struct Dl_info {
87 pub dli_fname: *const ::c_char,
88 pub dli_fbase: *mut ::c_void,
89 pub dli_sname: *const ::c_char,
90 pub dli_saddr: *mut ::c_void,
91 }
92
93 pub struct sockaddr_in {
94 pub sin_len: u8,
95 pub sin_family: ::sa_family_t,
96 pub sin_port: ::in_port_t,
97 pub sin_addr: ::in_addr,
98 pub sin_zero: [::c_char; 8],
99 }
100
101 pub struct termios {
102 pub c_iflag: ::tcflag_t,
103 pub c_oflag: ::tcflag_t,
104 pub c_cflag: ::tcflag_t,
105 pub c_lflag: ::tcflag_t,
106 pub c_cc: [::cc_t; ::NCCS],
107 pub c_ispeed: ::speed_t,
108 pub c_ospeed: ::speed_t,
109 }
110
111 pub struct flock {
112 pub l_start: ::off_t,
113 pub l_len: ::off_t,
114 pub l_pid: ::pid_t,
115 pub l_type: ::c_short,
116 pub l_whence: ::c_short,
117 #[cfg(not(target_os = "dragonfly"))]
118 pub l_sysid: ::c_int,
119 }
120
121 pub struct sf_hdtr {
122 pub headers: *mut ::iovec,
123 pub hdr_cnt: ::c_int,
124 pub trailers: *mut ::iovec,
125 pub trl_cnt: ::c_int,
126 }
127
128 pub struct lconv {
129 pub decimal_point: *mut ::c_char,
130 pub thousands_sep: *mut ::c_char,
131 pub grouping: *mut ::c_char,
132 pub int_curr_symbol: *mut ::c_char,
133 pub currency_symbol: *mut ::c_char,
134 pub mon_decimal_point: *mut ::c_char,
135 pub mon_thousands_sep: *mut ::c_char,
136 pub mon_grouping: *mut ::c_char,
137 pub positive_sign: *mut ::c_char,
138 pub negative_sign: *mut ::c_char,
139 pub int_frac_digits: ::c_char,
140 pub frac_digits: ::c_char,
141 pub p_cs_precedes: ::c_char,
142 pub p_sep_by_space: ::c_char,
143 pub n_cs_precedes: ::c_char,
144 pub n_sep_by_space: ::c_char,
145 pub p_sign_posn: ::c_char,
146 pub n_sign_posn: ::c_char,
147 pub int_p_cs_precedes: ::c_char,
148 pub int_n_cs_precedes: ::c_char,
149 pub int_p_sep_by_space: ::c_char,
150 pub int_n_sep_by_space: ::c_char,
151 pub int_p_sign_posn: ::c_char,
152 pub int_n_sign_posn: ::c_char,
153 }
154
155 // internal structure has changed over time
156 pub struct _sem {
157 data: [u32; 4],
158 }
159 }
160
161 pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
162 pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
163 pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
164 pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
165 pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
166 pub const LC_TIME_MASK: ::c_int = (1 << 5);
167 pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
168 | LC_CTYPE_MASK
169 | LC_MESSAGES_MASK
170 | LC_MONETARY_MASK
171 | LC_NUMERIC_MASK
172 | LC_TIME_MASK;
173
174 pub const CODESET: ::nl_item = 0;
175 pub const D_T_FMT: ::nl_item = 1;
176 pub const D_FMT: ::nl_item = 2;
177 pub const T_FMT: ::nl_item = 3;
178 pub const T_FMT_AMPM: ::nl_item = 4;
179 pub const AM_STR: ::nl_item = 5;
180 pub const PM_STR: ::nl_item = 6;
181
182 pub const DAY_1: ::nl_item = 7;
183 pub const DAY_2: ::nl_item = 8;
184 pub const DAY_3: ::nl_item = 9;
185 pub const DAY_4: ::nl_item = 10;
186 pub const DAY_5: ::nl_item = 11;
187 pub const DAY_6: ::nl_item = 12;
188 pub const DAY_7: ::nl_item = 13;
189
190 pub const ABDAY_1: ::nl_item = 14;
191 pub const ABDAY_2: ::nl_item = 15;
192 pub const ABDAY_3: ::nl_item = 16;
193 pub const ABDAY_4: ::nl_item = 17;
194 pub const ABDAY_5: ::nl_item = 18;
195 pub const ABDAY_6: ::nl_item = 19;
196 pub const ABDAY_7: ::nl_item = 20;
197
198 pub const MON_1: ::nl_item = 21;
199 pub const MON_2: ::nl_item = 22;
200 pub const MON_3: ::nl_item = 23;
201 pub const MON_4: ::nl_item = 24;
202 pub const MON_5: ::nl_item = 25;
203 pub const MON_6: ::nl_item = 26;
204 pub const MON_7: ::nl_item = 27;
205 pub const MON_8: ::nl_item = 28;
206 pub const MON_9: ::nl_item = 29;
207 pub const MON_10: ::nl_item = 30;
208 pub const MON_11: ::nl_item = 31;
209 pub const MON_12: ::nl_item = 32;
210
211 pub const ABMON_1: ::nl_item = 33;
212 pub const ABMON_2: ::nl_item = 34;
213 pub const ABMON_3: ::nl_item = 35;
214 pub const ABMON_4: ::nl_item = 36;
215 pub const ABMON_5: ::nl_item = 37;
216 pub const ABMON_6: ::nl_item = 38;
217 pub const ABMON_7: ::nl_item = 39;
218 pub const ABMON_8: ::nl_item = 40;
219 pub const ABMON_9: ::nl_item = 41;
220 pub const ABMON_10: ::nl_item = 42;
221 pub const ABMON_11: ::nl_item = 43;
222 pub const ABMON_12: ::nl_item = 44;
223
224 pub const ERA: ::nl_item = 45;
225 pub const ERA_D_FMT: ::nl_item = 46;
226 pub const ERA_D_T_FMT: ::nl_item = 47;
227 pub const ERA_T_FMT: ::nl_item = 48;
228 pub const ALT_DIGITS: ::nl_item = 49;
229
230 pub const RADIXCHAR: ::nl_item = 50;
231 pub const THOUSEP: ::nl_item = 51;
232
233 pub const YESEXPR: ::nl_item = 52;
234 pub const NOEXPR: ::nl_item = 53;
235
236 pub const YESSTR: ::nl_item = 54;
237 pub const NOSTR: ::nl_item = 55;
238
239 pub const CRNCYSTR: ::nl_item = 56;
240
241 pub const D_MD_ORDER: ::nl_item = 57;
242
243 pub const ALTMON_1: ::nl_item = 58;
244 pub const ALTMON_2: ::nl_item = 59;
245 pub const ALTMON_3: ::nl_item = 60;
246 pub const ALTMON_4: ::nl_item = 61;
247 pub const ALTMON_5: ::nl_item = 62;
248 pub const ALTMON_6: ::nl_item = 63;
249 pub const ALTMON_7: ::nl_item = 64;
250 pub const ALTMON_8: ::nl_item = 65;
251 pub const ALTMON_9: ::nl_item = 66;
252 pub const ALTMON_10: ::nl_item = 67;
253 pub const ALTMON_11: ::nl_item = 68;
254 pub const ALTMON_12: ::nl_item = 69;
255
256 pub const EXIT_FAILURE: ::c_int = 1;
257 pub const EXIT_SUCCESS: ::c_int = 0;
258 pub const EOF: ::c_int = -1;
259 pub const SEEK_SET: ::c_int = 0;
260 pub const SEEK_CUR: ::c_int = 1;
261 pub const SEEK_END: ::c_int = 2;
262 pub const _IOFBF: ::c_int = 0;
263 pub const _IONBF: ::c_int = 2;
264 pub const _IOLBF: ::c_int = 1;
265 pub const BUFSIZ: ::c_uint = 1024;
266 pub const FOPEN_MAX: ::c_uint = 20;
267 pub const FILENAME_MAX: ::c_uint = 1024;
268 pub const L_tmpnam: ::c_uint = 1024;
269 pub const TMP_MAX: ::c_uint = 308915776;
270
271 pub const O_RDONLY: ::c_int = 0;
272 pub const O_WRONLY: ::c_int = 1;
273 pub const O_RDWR: ::c_int = 2;
274 pub const O_ACCMODE: ::c_int = 3;
275 pub const O_APPEND: ::c_int = 8;
276 pub const O_CREAT: ::c_int = 512;
277 pub const O_EXCL: ::c_int = 2048;
278 pub const O_NOCTTY: ::c_int = 32768;
279 pub const O_TRUNC: ::c_int = 1024;
280 pub const S_IFIFO: mode_t = 4096;
281 pub const S_IFCHR: mode_t = 8192;
282 pub const S_IFBLK: mode_t = 24576;
283 pub const S_IFDIR: mode_t = 16384;
284 pub const S_IFREG: mode_t = 32768;
285 pub const S_IFLNK: mode_t = 40960;
286 pub const S_IFSOCK: mode_t = 49152;
287 pub const S_IFMT: mode_t = 61440;
288 pub const S_IEXEC: mode_t = 64;
289 pub const S_IWRITE: mode_t = 128;
290 pub const S_IREAD: mode_t = 256;
291 pub const S_IRWXU: mode_t = 448;
292 pub const S_IXUSR: mode_t = 64;
293 pub const S_IWUSR: mode_t = 128;
294 pub const S_IRUSR: mode_t = 256;
295 pub const S_IRWXG: mode_t = 56;
296 pub const S_IXGRP: mode_t = 8;
297 pub const S_IWGRP: mode_t = 16;
298 pub const S_IRGRP: mode_t = 32;
299 pub const S_IRWXO: mode_t = 7;
300 pub const S_IXOTH: mode_t = 1;
301 pub const S_IWOTH: mode_t = 2;
302 pub const S_IROTH: mode_t = 4;
303 pub const F_OK: ::c_int = 0;
304 pub const R_OK: ::c_int = 4;
305 pub const W_OK: ::c_int = 2;
306 pub const X_OK: ::c_int = 1;
307 pub const STDIN_FILENO: ::c_int = 0;
308 pub const STDOUT_FILENO: ::c_int = 1;
309 pub const STDERR_FILENO: ::c_int = 2;
310 pub const F_LOCK: ::c_int = 1;
311 pub const F_TEST: ::c_int = 3;
312 pub const F_TLOCK: ::c_int = 2;
313 pub const F_ULOCK: ::c_int = 0;
314 pub const F_DUPFD_CLOEXEC: ::c_int = 17;
315 pub const SIGHUP: ::c_int = 1;
316 pub const SIGINT: ::c_int = 2;
317 pub const SIGQUIT: ::c_int = 3;
318 pub const SIGILL: ::c_int = 4;
319 pub const SIGABRT: ::c_int = 6;
320 pub const SIGEMT: ::c_int = 7;
321 pub const SIGFPE: ::c_int = 8;
322 pub const SIGKILL: ::c_int = 9;
323 pub const SIGSEGV: ::c_int = 11;
324 pub const SIGPIPE: ::c_int = 13;
325 pub const SIGALRM: ::c_int = 14;
326 pub const SIGTERM: ::c_int = 15;
327
328 pub const PROT_NONE: ::c_int = 0;
329 pub const PROT_READ: ::c_int = 1;
330 pub const PROT_WRITE: ::c_int = 2;
331 pub const PROT_EXEC: ::c_int = 4;
332
333 pub const MAP_FILE: ::c_int = 0x0000;
334 pub const MAP_SHARED: ::c_int = 0x0001;
335 pub const MAP_PRIVATE: ::c_int = 0x0002;
336 pub const MAP_FIXED: ::c_int = 0x0010;
337 pub const MAP_ANON: ::c_int = 0x1000;
338
339 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
340
341 pub const MCL_CURRENT: ::c_int = 0x0001;
342 pub const MCL_FUTURE: ::c_int = 0x0002;
343
344 pub const MS_SYNC: ::c_int = 0x0000;
345 pub const MS_ASYNC: ::c_int = 0x0001;
346 pub const MS_INVALIDATE: ::c_int = 0x0002;
347
348 pub const EPERM: ::c_int = 1;
349 pub const ENOENT: ::c_int = 2;
350 pub const ESRCH: ::c_int = 3;
351 pub const EINTR: ::c_int = 4;
352 pub const EIO: ::c_int = 5;
353 pub const ENXIO: ::c_int = 6;
354 pub const E2BIG: ::c_int = 7;
355 pub const ENOEXEC: ::c_int = 8;
356 pub const EBADF: ::c_int = 9;
357 pub const ECHILD: ::c_int = 10;
358 pub const EDEADLK: ::c_int = 11;
359 pub const ENOMEM: ::c_int = 12;
360 pub const EACCES: ::c_int = 13;
361 pub const EFAULT: ::c_int = 14;
362 pub const ENOTBLK: ::c_int = 15;
363 pub const EBUSY: ::c_int = 16;
364 pub const EEXIST: ::c_int = 17;
365 pub const EXDEV: ::c_int = 18;
366 pub const ENODEV: ::c_int = 19;
367 pub const ENOTDIR: ::c_int = 20;
368 pub const EISDIR: ::c_int = 21;
369 pub const EINVAL: ::c_int = 22;
370 pub const ENFILE: ::c_int = 23;
371 pub const EMFILE: ::c_int = 24;
372 pub const ENOTTY: ::c_int = 25;
373 pub const ETXTBSY: ::c_int = 26;
374 pub const EFBIG: ::c_int = 27;
375 pub const ENOSPC: ::c_int = 28;
376 pub const ESPIPE: ::c_int = 29;
377 pub const EROFS: ::c_int = 30;
378 pub const EMLINK: ::c_int = 31;
379 pub const EPIPE: ::c_int = 32;
380 pub const EDOM: ::c_int = 33;
381 pub const ERANGE: ::c_int = 34;
382 pub const EAGAIN: ::c_int = 35;
383 pub const EWOULDBLOCK: ::c_int = 35;
384 pub const EINPROGRESS: ::c_int = 36;
385 pub const EALREADY: ::c_int = 37;
386 pub const ENOTSOCK: ::c_int = 38;
387 pub const EDESTADDRREQ: ::c_int = 39;
388 pub const EMSGSIZE: ::c_int = 40;
389 pub const EPROTOTYPE: ::c_int = 41;
390 pub const ENOPROTOOPT: ::c_int = 42;
391 pub const EPROTONOSUPPORT: ::c_int = 43;
392 pub const ESOCKTNOSUPPORT: ::c_int = 44;
393 pub const EOPNOTSUPP: ::c_int = 45;
394 pub const EPFNOSUPPORT: ::c_int = 46;
395 pub const EAFNOSUPPORT: ::c_int = 47;
396 pub const EADDRINUSE: ::c_int = 48;
397 pub const EADDRNOTAVAIL: ::c_int = 49;
398 pub const ENETDOWN: ::c_int = 50;
399 pub const ENETUNREACH: ::c_int = 51;
400 pub const ENETRESET: ::c_int = 52;
401 pub const ECONNABORTED: ::c_int = 53;
402 pub const ECONNRESET: ::c_int = 54;
403 pub const ENOBUFS: ::c_int = 55;
404 pub const EISCONN: ::c_int = 56;
405 pub const ENOTCONN: ::c_int = 57;
406 pub const ESHUTDOWN: ::c_int = 58;
407 pub const ETOOMANYREFS: ::c_int = 59;
408 pub const ETIMEDOUT: ::c_int = 60;
409 pub const ECONNREFUSED: ::c_int = 61;
410 pub const ELOOP: ::c_int = 62;
411 pub const ENAMETOOLONG: ::c_int = 63;
412 pub const EHOSTDOWN: ::c_int = 64;
413 pub const EHOSTUNREACH: ::c_int = 65;
414 pub const ENOTEMPTY: ::c_int = 66;
415 pub const EPROCLIM: ::c_int = 67;
416 pub const EUSERS: ::c_int = 68;
417 pub const EDQUOT: ::c_int = 69;
418 pub const ESTALE: ::c_int = 70;
419 pub const EREMOTE: ::c_int = 71;
420 pub const EBADRPC: ::c_int = 72;
421 pub const ERPCMISMATCH: ::c_int = 73;
422 pub const EPROGUNAVAIL: ::c_int = 74;
423 pub const EPROGMISMATCH: ::c_int = 75;
424 pub const EPROCUNAVAIL: ::c_int = 76;
425 pub const ENOLCK: ::c_int = 77;
426 pub const ENOSYS: ::c_int = 78;
427 pub const EFTYPE: ::c_int = 79;
428 pub const EAUTH: ::c_int = 80;
429 pub const ENEEDAUTH: ::c_int = 81;
430 pub const EIDRM: ::c_int = 82;
431 pub const ENOMSG: ::c_int = 83;
432 pub const EOVERFLOW: ::c_int = 84;
433 pub const ECANCELED: ::c_int = 85;
434 pub const EILSEQ: ::c_int = 86;
435 pub const ENOATTR: ::c_int = 87;
436 pub const EDOOFUS: ::c_int = 88;
437 pub const EBADMSG: ::c_int = 89;
438 pub const EMULTIHOP: ::c_int = 90;
439 pub const ENOLINK: ::c_int = 91;
440 pub const EPROTO: ::c_int = 92;
441
442 pub const F_DUPFD: ::c_int = 0;
443 pub const F_GETFD: ::c_int = 1;
444 pub const F_SETFD: ::c_int = 2;
445 pub const F_GETFL: ::c_int = 3;
446 pub const F_SETFL: ::c_int = 4;
447
448 pub const SIGTRAP: ::c_int = 5;
449
450 pub const GLOB_APPEND : ::c_int = 0x0001;
451 pub const GLOB_DOOFFS : ::c_int = 0x0002;
452 pub const GLOB_ERR : ::c_int = 0x0004;
453 pub const GLOB_MARK : ::c_int = 0x0008;
454 pub const GLOB_NOCHECK : ::c_int = 0x0010;
455 pub const GLOB_NOSORT : ::c_int = 0x0020;
456 pub const GLOB_NOESCAPE: ::c_int = 0x2000;
457
458 pub const GLOB_NOSPACE : ::c_int = -1;
459 pub const GLOB_ABORTED : ::c_int = -2;
460 pub const GLOB_NOMATCH : ::c_int = -3;
461
462 pub const POSIX_MADV_NORMAL: ::c_int = 0;
463 pub const POSIX_MADV_RANDOM: ::c_int = 1;
464 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
465 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
466 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
467
468 pub const _SC_IOV_MAX: ::c_int = 56;
469 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
470 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
471 pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
472 pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
473 pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
474 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
475 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
476 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
477 pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
478 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
479 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
480 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
481 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
482 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
483 pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
484 pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
485 pub const _SC_THREADS: ::c_int = 96;
486 pub const _SC_TTY_NAME_MAX: ::c_int = 101;
487 pub const _SC_ATEXIT_MAX: ::c_int = 107;
488 pub const _SC_XOPEN_CRYPT: ::c_int = 108;
489 pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
490 pub const _SC_XOPEN_LEGACY: ::c_int = 110;
491 pub const _SC_XOPEN_REALTIME: ::c_int = 111;
492 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
493 pub const _SC_XOPEN_SHM: ::c_int = 113;
494 pub const _SC_XOPEN_UNIX: ::c_int = 115;
495 pub const _SC_XOPEN_VERSION: ::c_int = 116;
496 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117;
497
498 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
499 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
500
501 pub const RLIMIT_CPU: ::c_int = 0;
502 pub const RLIMIT_FSIZE: ::c_int = 1;
503 pub const RLIMIT_DATA: ::c_int = 2;
504 pub const RLIMIT_STACK: ::c_int = 3;
505 pub const RLIMIT_CORE: ::c_int = 4;
506 pub const RLIMIT_RSS: ::c_int = 5;
507 pub const RLIMIT_MEMLOCK: ::c_int = 6;
508 pub const RLIMIT_NPROC: ::c_int = 7;
509 pub const RLIMIT_NOFILE: ::c_int = 8;
510 pub const RLIMIT_SBSIZE: ::c_int = 9;
511 pub const RLIMIT_VMEM: ::c_int = 10;
512 pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM;
513 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
514
515 pub const RUSAGE_SELF: ::c_int = 0;
516 pub const RUSAGE_CHILDREN: ::c_int = -1;
517
518 pub const MADV_NORMAL: ::c_int = 0;
519 pub const MADV_RANDOM: ::c_int = 1;
520 pub const MADV_SEQUENTIAL: ::c_int = 2;
521 pub const MADV_WILLNEED: ::c_int = 3;
522 pub const MADV_DONTNEED: ::c_int = 4;
523 pub const MADV_FREE: ::c_int = 5;
524 pub const MADV_NOSYNC: ::c_int = 6;
525 pub const MADV_AUTOSYNC: ::c_int = 7;
526 pub const MADV_NOCORE: ::c_int = 8;
527 pub const MADV_CORE: ::c_int = 9;
528
529 pub const MINCORE_INCORE: ::c_int = 0x1;
530 pub const MINCORE_REFERENCED: ::c_int = 0x2;
531 pub const MINCORE_MODIFIED: ::c_int = 0x4;
532 pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8;
533 pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10;
534 pub const MINCORE_SUPER: ::c_int = 0x20;
535
536 pub const AF_INET: ::c_int = 2;
537 pub const AF_INET6: ::c_int = 28;
538 pub const AF_UNIX: ::c_int = 1;
539 pub const SOCK_STREAM: ::c_int = 1;
540 pub const SOCK_DGRAM: ::c_int = 2;
541 pub const SOCK_RAW: ::c_int = 3;
542 pub const SOCK_SEQPACKET: ::c_int = 5;
543 pub const IPPROTO_TCP: ::c_int = 6;
544 pub const IPPROTO_IP: ::c_int = 0;
545 pub const IPPROTO_IPV6: ::c_int = 41;
546 pub const IP_MULTICAST_TTL: ::c_int = 10;
547 pub const IP_MULTICAST_LOOP: ::c_int = 11;
548 pub const IP_TTL: ::c_int = 4;
549 pub const IP_HDRINCL: ::c_int = 2;
550 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
551 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
552 pub const IPV6_JOIN_GROUP: ::c_int = 12;
553 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
554
555 pub const TCP_NODELAY: ::c_int = 1;
556 pub const TCP_KEEPIDLE: ::c_int = 256;
557 pub const SOL_SOCKET: ::c_int = 0xffff;
558 pub const SO_DEBUG: ::c_int = 0x01;
559 pub const SO_ACCEPTCONN: ::c_int = 0x0002;
560 pub const SO_REUSEADDR: ::c_int = 0x0004;
561 pub const SO_KEEPALIVE: ::c_int = 0x0008;
562 pub const SO_DONTROUTE: ::c_int = 0x0010;
563 pub const SO_BROADCAST: ::c_int = 0x0020;
564 pub const SO_USELOOPBACK: ::c_int = 0x0040;
565 pub const SO_LINGER: ::c_int = 0x0080;
566 pub const SO_OOBINLINE: ::c_int = 0x0100;
567 pub const SO_REUSEPORT: ::c_int = 0x0200;
568 pub const SO_SNDBUF: ::c_int = 0x1001;
569 pub const SO_RCVBUF: ::c_int = 0x1002;
570 pub const SO_SNDLOWAT: ::c_int = 0x1003;
571 pub const SO_RCVLOWAT: ::c_int = 0x1004;
572 pub const SO_SNDTIMEO: ::c_int = 0x1005;
573 pub const SO_RCVTIMEO: ::c_int = 0x1006;
574 pub const SO_ERROR: ::c_int = 0x1007;
575 pub const SO_TYPE: ::c_int = 0x1008;
576
577 pub const IFF_LOOPBACK: ::c_int = 0x8;
578
579 pub const SHUT_RD: ::c_int = 0;
580 pub const SHUT_WR: ::c_int = 1;
581 pub const SHUT_RDWR: ::c_int = 2;
582
583 pub const LOCK_SH: ::c_int = 1;
584 pub const LOCK_EX: ::c_int = 2;
585 pub const LOCK_NB: ::c_int = 4;
586 pub const LOCK_UN: ::c_int = 8;
587
588 pub const O_SYNC: ::c_int = 128;
589 pub const O_NONBLOCK: ::c_int = 4;
590
591 pub const MAP_COPY: ::c_int = 0x0002;
592 pub const MAP_RENAME: ::c_int = 0x0020;
593 pub const MAP_NORESERVE: ::c_int = 0x0040;
594 pub const MAP_HASSEMAPHORE: ::c_int = 0x0200;
595 pub const MAP_STACK: ::c_int = 0x0400;
596 pub const MAP_NOSYNC: ::c_int = 0x0800;
597 pub const MAP_NOCORE: ::c_int = 0x020000;
598
599 pub const IPPROTO_RAW: ::c_int = 255;
600
601 pub const _SC_ARG_MAX: ::c_int = 1;
602 pub const _SC_CHILD_MAX: ::c_int = 2;
603 pub const _SC_CLK_TCK: ::c_int = 3;
604 pub const _SC_NGROUPS_MAX: ::c_int = 4;
605 pub const _SC_OPEN_MAX: ::c_int = 5;
606 pub const _SC_JOB_CONTROL: ::c_int = 6;
607 pub const _SC_SAVED_IDS: ::c_int = 7;
608 pub const _SC_VERSION: ::c_int = 8;
609 pub const _SC_BC_BASE_MAX: ::c_int = 9;
610 pub const _SC_BC_DIM_MAX: ::c_int = 10;
611 pub const _SC_BC_SCALE_MAX: ::c_int = 11;
612 pub const _SC_BC_STRING_MAX: ::c_int = 12;
613 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13;
614 pub const _SC_EXPR_NEST_MAX: ::c_int = 14;
615 pub const _SC_LINE_MAX: ::c_int = 15;
616 pub const _SC_RE_DUP_MAX: ::c_int = 16;
617 pub const _SC_2_VERSION: ::c_int = 17;
618 pub const _SC_2_C_BIND: ::c_int = 18;
619 pub const _SC_2_C_DEV: ::c_int = 19;
620 pub const _SC_2_CHAR_TERM: ::c_int = 20;
621 pub const _SC_2_FORT_DEV: ::c_int = 21;
622 pub const _SC_2_FORT_RUN: ::c_int = 22;
623 pub const _SC_2_LOCALEDEF: ::c_int = 23;
624 pub const _SC_2_SW_DEV: ::c_int = 24;
625 pub const _SC_2_UPE: ::c_int = 25;
626 pub const _SC_STREAM_MAX: ::c_int = 26;
627 pub const _SC_TZNAME_MAX: ::c_int = 27;
628 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 28;
629 pub const _SC_MAPPED_FILES: ::c_int = 29;
630 pub const _SC_MEMLOCK: ::c_int = 30;
631 pub const _SC_MEMLOCK_RANGE: ::c_int = 31;
632 pub const _SC_MEMORY_PROTECTION: ::c_int = 32;
633 pub const _SC_MESSAGE_PASSING: ::c_int = 33;
634 pub const _SC_PRIORITIZED_IO: ::c_int = 34;
635 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 35;
636 pub const _SC_REALTIME_SIGNALS: ::c_int = 36;
637 pub const _SC_SEMAPHORES: ::c_int = 37;
638 pub const _SC_FSYNC: ::c_int = 38;
639 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 39;
640 pub const _SC_SYNCHRONIZED_IO: ::c_int = 40;
641 pub const _SC_TIMERS: ::c_int = 41;
642 pub const _SC_AIO_LISTIO_MAX: ::c_int = 42;
643 pub const _SC_AIO_MAX: ::c_int = 43;
644 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44;
645 pub const _SC_DELAYTIMER_MAX: ::c_int = 45;
646 pub const _SC_MQ_OPEN_MAX: ::c_int = 46;
647 pub const _SC_PAGESIZE: ::c_int = 47;
648 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
649 pub const _SC_RTSIG_MAX: ::c_int = 48;
650 pub const _SC_SEM_NSEMS_MAX: ::c_int = 49;
651 pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
652 pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
653 pub const _SC_TIMER_MAX: ::c_int = 52;
654 pub const _SC_HOST_NAME_MAX: ::c_int = 72;
655
656 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
657 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
658 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
659 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
660 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
661 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
662 pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
663 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_ERRORCHECK;
664
665 pub const SCHED_FIFO: ::c_int = 1;
666 pub const SCHED_OTHER: ::c_int = 2;
667 pub const SCHED_RR: ::c_int = 3;
668
669 pub const FD_SETSIZE: usize = 1024;
670
671 pub const ST_NOSUID: ::c_ulong = 2;
672
673 pub const NI_MAXHOST: ::size_t = 1025;
674
675 pub const RTLD_LOCAL: ::c_int = 0;
676 pub const RTLD_NODELETE: ::c_int = 0x1000;
677 pub const RTLD_NOLOAD: ::c_int = 0x2000;
678 pub const RTLD_GLOBAL: ::c_int = 0x100;
679
680 pub const LOG_NTP: ::c_int = 12 << 3;
681 pub const LOG_SECURITY: ::c_int = 13 << 3;
682 pub const LOG_CONSOLE: ::c_int = 14 << 3;
683 pub const LOG_NFACILITIES: ::c_int = 24;
684
685 pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
686 pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
687
688 pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
689
690 f! {
691 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
692 status >> 8
693 }
694
695 pub fn WIFSIGNALED(status: ::c_int) -> bool {
696 (status & 0o177) != 0o177 && (status & 0o177) != 0
697 }
698
699 pub fn WIFSTOPPED(status: ::c_int) -> bool {
700 (status & 0o177) == 0o177
701 }
702 }
703
704 #[link(name = "util")]
705 extern {
706 pub fn getnameinfo(sa: *const ::sockaddr,
707 salen: ::socklen_t,
708 host: *mut ::c_char,
709 hostlen: ::size_t,
710 serv: *mut ::c_char,
711 servlen: ::size_t,
712 flags: ::c_int) -> ::c_int;
713 pub fn mincore(addr: *const ::c_void, len: ::size_t,
714 vec: *mut ::c_char) -> ::c_int;
715 pub fn sysctlnametomib(name: *const ::c_char,
716 mibp: *mut ::c_int,
717 sizep: *mut ::size_t)
718 -> ::c_int;
719 pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
720 -> ::c_int;
721 pub fn sysctl(name: *const ::c_int,
722 namelen: ::c_uint,
723 oldp: *mut ::c_void,
724 oldlenp: *mut ::size_t,
725 newp: *const ::c_void,
726 newlen: ::size_t)
727 -> ::c_int;
728 pub fn sysctlbyname(name: *const ::c_char,
729 oldp: *mut ::c_void,
730 oldlenp: *mut ::size_t,
731 newp: *const ::c_void,
732 newlen: ::size_t)
733 -> ::c_int;
734 pub fn sched_setscheduler(pid: ::pid_t,
735 policy: ::c_int,
736 param: *const sched_param) -> ::c_int;
737 pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
738 pub fn memrchr(cx: *const ::c_void,
739 c: ::c_int,
740 n: ::size_t) -> *mut ::c_void;
741 pub fn sendfile(fd: ::c_int,
742 s: ::c_int,
743 offset: ::off_t,
744 nbytes: ::size_t,
745 hdtr: *mut ::sf_hdtr,
746 sbytes: *mut ::off_t,
747 flags: ::c_int) -> ::c_int;
748 pub fn sigtimedwait(set: *const sigset_t,
749 info: *mut siginfo_t,
750 timeout: *const ::timespec) -> ::c_int;
751 pub fn sigwaitinfo(set: *const sigset_t,
752 info: *mut siginfo_t) -> ::c_int;
753 pub fn openpty(amaster: *mut ::c_int,
754 aslave: *mut ::c_int,
755 name: *mut ::c_char,
756 termp: *mut termios,
757 winp: *mut ::winsize) -> ::c_int;
758 pub fn forkpty(amaster: *mut ::c_int,
759 name: *mut ::c_char,
760 termp: *mut termios,
761 winp: *mut ::winsize) -> ::pid_t;
762 pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
763 pub fn duplocale(base: ::locale_t) -> ::locale_t;
764 pub fn freelocale(loc: ::locale_t) -> ::c_int;
765 pub fn newlocale(mask: ::c_int,
766 locale: *const ::c_char,
767 base: ::locale_t) -> ::locale_t;
768 pub fn uselocale(loc: ::locale_t) -> ::locale_t;
769 pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
770 pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
771 pub fn pthread_attr_get_np(tid: ::pthread_t,
772 attr: *mut ::pthread_attr_t) -> ::c_int;
773 pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
774 guardsize: *mut ::size_t) -> ::c_int;
775 pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
776 stackaddr: *mut *mut ::c_void,
777 stacksize: *mut ::size_t) -> ::c_int;
778 pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
779 pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
780
781 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
782 flags: ::c_int, ...) -> ::c_int;
783 pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
784 mode: ::c_int, flags: ::c_int) -> ::c_int;
785 pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
786 mode: ::mode_t, flags: ::c_int) -> ::c_int;
787 pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
788 owner: ::uid_t, group: ::gid_t,
789 flags: ::c_int) -> ::c_int;
790 pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
791 buf: *mut stat, flags: ::c_int) -> ::c_int;
792 pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
793 newdirfd: ::c_int, newpath: *const ::c_char,
794 flags: ::c_int) -> ::c_int;
795 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
796 mode: ::mode_t) -> ::c_int;
797 pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
798 mode: ::mode_t, dev: dev_t) -> ::c_int;
799 pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
800 buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
801 pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
802 newdirfd: ::c_int, newpath: *const ::c_char)
803 -> ::c_int;
804 pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
805 linkpath: *const ::c_char) -> ::c_int;
806 pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
807 flags: ::c_int) -> ::c_int;
808 pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
809 mode: ::mode_t) -> ::c_int;
810 pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
811 clock_id: *mut clockid_t) -> ::c_int;
812 pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
813 clock_id: clockid_t) -> ::c_int;
814 pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
815 }
816
817 cfg_if! {
818 if #[cfg(target_os = "freebsd")] {
819 mod freebsd;
820 pub use self::freebsd::*;
821 } else if #[cfg(target_os = "dragonfly")] {
822 mod dragonfly;
823 pub use self::dragonfly::*;
824 } else {
825 // ...
826 }
827 }