]> git.proxmox.com Git - cargo.git/blob - vendor/libc-0.2.31/src/unix/bsd/netbsdlike/mod.rs
New upstream version 0.23.0
[cargo.git] / vendor / libc-0.2.31 / src / unix / bsd / netbsdlike / mod.rs
1 pub type time_t = i64;
2 pub type mode_t = u32;
3 pub type nlink_t = ::uint32_t;
4 pub type ino_t = ::uint64_t;
5 pub type pthread_key_t = ::c_int;
6 pub type rlim_t = u64;
7 pub type speed_t = ::c_uint;
8 pub type tcflag_t = ::c_uint;
9 pub type nl_item = c_long;
10 pub type clockid_t = ::c_int;
11 pub type id_t = ::uint32_t;
12 pub type sem_t = *mut sem;
13
14 pub enum timezone {}
15 pub enum sem {}
16
17 s! {
18 pub struct sigaction {
19 pub sa_sigaction: ::sighandler_t,
20 pub sa_mask: ::sigset_t,
21 pub sa_flags: ::c_int,
22 }
23
24 pub struct stack_t {
25 pub ss_sp: *mut ::c_void,
26 pub ss_size: ::size_t,
27 pub ss_flags: ::c_int,
28 }
29
30 pub struct sockaddr_in {
31 pub sin_len: u8,
32 pub sin_family: ::sa_family_t,
33 pub sin_port: ::in_port_t,
34 pub sin_addr: ::in_addr,
35 pub sin_zero: [::int8_t; 8],
36 }
37
38 pub struct termios {
39 pub c_iflag: ::tcflag_t,
40 pub c_oflag: ::tcflag_t,
41 pub c_cflag: ::tcflag_t,
42 pub c_lflag: ::tcflag_t,
43 pub c_cc: [::cc_t; ::NCCS],
44 pub c_ispeed: ::c_int,
45 pub c_ospeed: ::c_int,
46 }
47
48 pub struct flock {
49 pub l_start: ::off_t,
50 pub l_len: ::off_t,
51 pub l_pid: ::pid_t,
52 pub l_type: ::c_short,
53 pub l_whence: ::c_short,
54 }
55 }
56
57 pub const D_T_FMT: ::nl_item = 0;
58 pub const D_FMT: ::nl_item = 1;
59 pub const T_FMT: ::nl_item = 2;
60 pub const T_FMT_AMPM: ::nl_item = 3;
61 pub const AM_STR: ::nl_item = 4;
62 pub const PM_STR: ::nl_item = 5;
63
64 pub const DAY_1: ::nl_item = 6;
65 pub const DAY_2: ::nl_item = 7;
66 pub const DAY_3: ::nl_item = 8;
67 pub const DAY_4: ::nl_item = 9;
68 pub const DAY_5: ::nl_item = 10;
69 pub const DAY_6: ::nl_item = 11;
70 pub const DAY_7: ::nl_item = 12;
71
72 pub const ABDAY_1: ::nl_item = 13;
73 pub const ABDAY_2: ::nl_item = 14;
74 pub const ABDAY_3: ::nl_item = 15;
75 pub const ABDAY_4: ::nl_item = 16;
76 pub const ABDAY_5: ::nl_item = 17;
77 pub const ABDAY_6: ::nl_item = 18;
78 pub const ABDAY_7: ::nl_item = 19;
79
80 pub const MON_1: ::nl_item = 20;
81 pub const MON_2: ::nl_item = 21;
82 pub const MON_3: ::nl_item = 22;
83 pub const MON_4: ::nl_item = 23;
84 pub const MON_5: ::nl_item = 24;
85 pub const MON_6: ::nl_item = 25;
86 pub const MON_7: ::nl_item = 26;
87 pub const MON_8: ::nl_item = 27;
88 pub const MON_9: ::nl_item = 28;
89 pub const MON_10: ::nl_item = 29;
90 pub const MON_11: ::nl_item = 30;
91 pub const MON_12: ::nl_item = 31;
92
93 pub const ABMON_1: ::nl_item = 32;
94 pub const ABMON_2: ::nl_item = 33;
95 pub const ABMON_3: ::nl_item = 34;
96 pub const ABMON_4: ::nl_item = 35;
97 pub const ABMON_5: ::nl_item = 36;
98 pub const ABMON_6: ::nl_item = 37;
99 pub const ABMON_7: ::nl_item = 38;
100 pub const ABMON_8: ::nl_item = 39;
101 pub const ABMON_9: ::nl_item = 40;
102 pub const ABMON_10: ::nl_item = 41;
103 pub const ABMON_11: ::nl_item = 42;
104 pub const ABMON_12: ::nl_item = 43;
105
106 pub const RADIXCHAR: ::nl_item = 44;
107 pub const THOUSEP: ::nl_item = 45;
108 pub const YESSTR: ::nl_item = 46;
109 pub const YESEXPR: ::nl_item = 47;
110 pub const NOSTR: ::nl_item = 48;
111 pub const NOEXPR: ::nl_item = 49;
112 pub const CRNCYSTR: ::nl_item = 50;
113
114 pub const CODESET: ::nl_item = 51;
115
116 pub const EXIT_FAILURE : ::c_int = 1;
117 pub const EXIT_SUCCESS : ::c_int = 0;
118 pub const RAND_MAX : ::c_int = 2147483647;
119 pub const EOF : ::c_int = -1;
120 pub const SEEK_SET : ::c_int = 0;
121 pub const SEEK_CUR : ::c_int = 1;
122 pub const SEEK_END : ::c_int = 2;
123 pub const _IOFBF : ::c_int = 0;
124 pub const _IONBF : ::c_int = 2;
125 pub const _IOLBF : ::c_int = 1;
126 pub const BUFSIZ : ::c_uint = 1024;
127 pub const FOPEN_MAX : ::c_uint = 20;
128 pub const FILENAME_MAX : ::c_uint = 1024;
129 pub const L_tmpnam : ::c_uint = 1024;
130 pub const O_NOCTTY : ::c_int = 32768;
131 pub const S_IFIFO : mode_t = 4096;
132 pub const S_IFCHR : mode_t = 8192;
133 pub const S_IFBLK : mode_t = 24576;
134 pub const S_IFDIR : mode_t = 16384;
135 pub const S_IFREG : mode_t = 32768;
136 pub const S_IFLNK : mode_t = 40960;
137 pub const S_IFSOCK : mode_t = 49152;
138 pub const S_IFMT : mode_t = 61440;
139 pub const S_IEXEC : mode_t = 64;
140 pub const S_IWRITE : mode_t = 128;
141 pub const S_IREAD : mode_t = 256;
142 pub const S_IRWXU : mode_t = 448;
143 pub const S_IXUSR : mode_t = 64;
144 pub const S_IWUSR : mode_t = 128;
145 pub const S_IRUSR : mode_t = 256;
146 pub const S_IRWXG : mode_t = 56;
147 pub const S_IXGRP : mode_t = 8;
148 pub const S_IWGRP : mode_t = 16;
149 pub const S_IRGRP : mode_t = 32;
150 pub const S_IRWXO : mode_t = 7;
151 pub const S_IXOTH : mode_t = 1;
152 pub const S_IWOTH : mode_t = 2;
153 pub const S_IROTH : mode_t = 4;
154 pub const F_OK : ::c_int = 0;
155 pub const R_OK : ::c_int = 4;
156 pub const W_OK : ::c_int = 2;
157 pub const X_OK : ::c_int = 1;
158 pub const STDIN_FILENO : ::c_int = 0;
159 pub const STDOUT_FILENO : ::c_int = 1;
160 pub const STDERR_FILENO : ::c_int = 2;
161 pub const F_LOCK : ::c_int = 1;
162 pub const F_TEST : ::c_int = 3;
163 pub const F_TLOCK : ::c_int = 2;
164 pub const F_ULOCK : ::c_int = 0;
165 pub const F_GETLK: ::c_int = 7;
166 pub const F_SETLK: ::c_int = 8;
167 pub const F_SETLKW: ::c_int = 9;
168 pub const SIGHUP : ::c_int = 1;
169 pub const SIGINT : ::c_int = 2;
170 pub const SIGQUIT : ::c_int = 3;
171 pub const SIGILL : ::c_int = 4;
172 pub const SIGABRT : ::c_int = 6;
173 pub const SIGEMT: ::c_int = 7;
174 pub const SIGFPE : ::c_int = 8;
175 pub const SIGKILL : ::c_int = 9;
176 pub const SIGSEGV : ::c_int = 11;
177 pub const SIGPIPE : ::c_int = 13;
178 pub const SIGALRM : ::c_int = 14;
179 pub const SIGTERM : ::c_int = 15;
180 pub const SIGSTKSZ : ::size_t = 40960;
181
182 pub const PROT_NONE : ::c_int = 0;
183 pub const PROT_READ : ::c_int = 1;
184 pub const PROT_WRITE : ::c_int = 2;
185 pub const PROT_EXEC : ::c_int = 4;
186
187 pub const MAP_FILE : ::c_int = 0x0000;
188 pub const MAP_SHARED : ::c_int = 0x0001;
189 pub const MAP_PRIVATE : ::c_int = 0x0002;
190 pub const MAP_FIXED : ::c_int = 0x0010;
191 pub const MAP_ANON : ::c_int = 0x1000;
192
193 pub const MAP_FAILED : *mut ::c_void = !0 as *mut ::c_void;
194
195 pub const MCL_CURRENT : ::c_int = 0x0001;
196 pub const MCL_FUTURE : ::c_int = 0x0002;
197
198 pub const MS_ASYNC : ::c_int = 0x0001;
199
200 pub const EPERM : ::c_int = 1;
201 pub const ENOENT : ::c_int = 2;
202 pub const ESRCH : ::c_int = 3;
203 pub const EINTR : ::c_int = 4;
204 pub const EIO : ::c_int = 5;
205 pub const ENXIO : ::c_int = 6;
206 pub const E2BIG : ::c_int = 7;
207 pub const ENOEXEC : ::c_int = 8;
208 pub const EBADF : ::c_int = 9;
209 pub const ECHILD : ::c_int = 10;
210 pub const EDEADLK : ::c_int = 11;
211 pub const ENOMEM : ::c_int = 12;
212 pub const EACCES : ::c_int = 13;
213 pub const EFAULT : ::c_int = 14;
214 pub const ENOTBLK : ::c_int = 15;
215 pub const EBUSY : ::c_int = 16;
216 pub const EEXIST : ::c_int = 17;
217 pub const EXDEV : ::c_int = 18;
218 pub const ENODEV : ::c_int = 19;
219 pub const ENOTDIR : ::c_int = 20;
220 pub const EISDIR : ::c_int = 21;
221 pub const EINVAL : ::c_int = 22;
222 pub const ENFILE : ::c_int = 23;
223 pub const EMFILE : ::c_int = 24;
224 pub const ENOTTY : ::c_int = 25;
225 pub const ETXTBSY : ::c_int = 26;
226 pub const EFBIG : ::c_int = 27;
227 pub const ENOSPC : ::c_int = 28;
228 pub const ESPIPE : ::c_int = 29;
229 pub const EROFS : ::c_int = 30;
230 pub const EMLINK : ::c_int = 31;
231 pub const EPIPE : ::c_int = 32;
232 pub const EDOM : ::c_int = 33;
233 pub const ERANGE : ::c_int = 34;
234 pub const EAGAIN : ::c_int = 35;
235 pub const EWOULDBLOCK : ::c_int = 35;
236 pub const EINPROGRESS : ::c_int = 36;
237 pub const EALREADY : ::c_int = 37;
238 pub const ENOTSOCK : ::c_int = 38;
239 pub const EDESTADDRREQ : ::c_int = 39;
240 pub const EMSGSIZE : ::c_int = 40;
241 pub const EPROTOTYPE : ::c_int = 41;
242 pub const ENOPROTOOPT : ::c_int = 42;
243 pub const EPROTONOSUPPORT : ::c_int = 43;
244 pub const ESOCKTNOSUPPORT : ::c_int = 44;
245 pub const EOPNOTSUPP : ::c_int = 45;
246 pub const EPFNOSUPPORT : ::c_int = 46;
247 pub const EAFNOSUPPORT : ::c_int = 47;
248 pub const EADDRINUSE : ::c_int = 48;
249 pub const EADDRNOTAVAIL : ::c_int = 49;
250 pub const ENETDOWN : ::c_int = 50;
251 pub const ENETUNREACH : ::c_int = 51;
252 pub const ENETRESET : ::c_int = 52;
253 pub const ECONNABORTED : ::c_int = 53;
254 pub const ECONNRESET : ::c_int = 54;
255 pub const ENOBUFS : ::c_int = 55;
256 pub const EISCONN : ::c_int = 56;
257 pub const ENOTCONN : ::c_int = 57;
258 pub const ESHUTDOWN : ::c_int = 58;
259 pub const ETOOMANYREFS : ::c_int = 59;
260 pub const ETIMEDOUT : ::c_int = 60;
261 pub const ECONNREFUSED : ::c_int = 61;
262 pub const ELOOP : ::c_int = 62;
263 pub const ENAMETOOLONG : ::c_int = 63;
264 pub const EHOSTDOWN : ::c_int = 64;
265 pub const EHOSTUNREACH : ::c_int = 65;
266 pub const ENOTEMPTY : ::c_int = 66;
267 pub const EPROCLIM : ::c_int = 67;
268 pub const EUSERS : ::c_int = 68;
269 pub const EDQUOT : ::c_int = 69;
270 pub const ESTALE : ::c_int = 70;
271 pub const EREMOTE : ::c_int = 71;
272 pub const EBADRPC : ::c_int = 72;
273 pub const ERPCMISMATCH : ::c_int = 73;
274 pub const EPROGUNAVAIL : ::c_int = 74;
275 pub const EPROGMISMATCH : ::c_int = 75;
276 pub const EPROCUNAVAIL : ::c_int = 76;
277 pub const ENOLCK : ::c_int = 77;
278 pub const ENOSYS : ::c_int = 78;
279 pub const EFTYPE : ::c_int = 79;
280 pub const EAUTH : ::c_int = 80;
281 pub const ENEEDAUTH : ::c_int = 81;
282
283 pub const F_DUPFD : ::c_int = 0;
284 pub const F_GETFD : ::c_int = 1;
285 pub const F_SETFD : ::c_int = 2;
286 pub const F_GETFL : ::c_int = 3;
287 pub const F_SETFL : ::c_int = 4;
288
289 pub const SIGTRAP : ::c_int = 5;
290
291 pub const GLOB_APPEND : ::c_int = 0x0001;
292 pub const GLOB_DOOFFS : ::c_int = 0x0002;
293 pub const GLOB_ERR : ::c_int = 0x0004;
294 pub const GLOB_MARK : ::c_int = 0x0008;
295 pub const GLOB_NOCHECK : ::c_int = 0x0010;
296 pub const GLOB_NOSORT : ::c_int = 0x0020;
297 pub const GLOB_NOESCAPE : ::c_int = 0x1000;
298
299 pub const GLOB_NOSPACE : ::c_int = -1;
300 pub const GLOB_ABORTED : ::c_int = -2;
301 pub const GLOB_NOMATCH : ::c_int = -3;
302 pub const GLOB_NOSYS : ::c_int = -4;
303
304 pub const POSIX_MADV_NORMAL : ::c_int = 0;
305 pub const POSIX_MADV_RANDOM : ::c_int = 1;
306 pub const POSIX_MADV_SEQUENTIAL : ::c_int = 2;
307 pub const POSIX_MADV_WILLNEED : ::c_int = 3;
308 pub const POSIX_MADV_DONTNEED : ::c_int = 4;
309
310 pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0;
311 pub const PTHREAD_CREATE_DETACHED : ::c_int = 1;
312
313 // http://man.openbsd.org/OpenBSD-current/man2/clock_getres.2
314 // The man page says clock_gettime(3) can accept various values as clockid_t but
315 // http://fxr.watson.org/fxr/source/kern/kern_time.c?v=OPENBSD;im=excerpts#L161
316 // the implementation rejects anything other than the below two
317 //
318 // http://netbsd.gw.com/cgi-bin/man-cgi?clock_gettime
319 // https://github.com/jsonn/src/blob/HEAD/sys/kern/subr_time.c#L222
320 // Basically the same goes for NetBSD
321 pub const CLOCK_REALTIME: ::clockid_t = 0;
322 pub const CLOCK_MONOTONIC: ::clockid_t = 3;
323
324 pub const RLIMIT_CPU: ::c_int = 0;
325 pub const RLIMIT_FSIZE: ::c_int = 1;
326 pub const RLIMIT_DATA: ::c_int = 2;
327 pub const RLIMIT_STACK: ::c_int = 3;
328 pub const RLIMIT_CORE: ::c_int = 4;
329 pub const RLIMIT_RSS: ::c_int = 5;
330 pub const RLIMIT_MEMLOCK: ::c_int = 6;
331 pub const RLIMIT_NPROC: ::c_int = 7;
332 pub const RLIMIT_NOFILE: ::c_int = 8;
333
334 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
335 pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
336 pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
337
338 pub const RUSAGE_SELF: ::c_int = 0;
339 pub const RUSAGE_CHILDREN: ::c_int = -1;
340
341 pub const MADV_NORMAL : ::c_int = 0;
342 pub const MADV_RANDOM : ::c_int = 1;
343 pub const MADV_SEQUENTIAL : ::c_int = 2;
344 pub const MADV_WILLNEED : ::c_int = 3;
345 pub const MADV_DONTNEED : ::c_int = 4;
346 pub const MADV_FREE : ::c_int = 6;
347
348 pub const AF_UNSPEC: ::c_int = 0;
349 pub const AF_LOCAL: ::c_int = 1;
350 pub const AF_UNIX: ::c_int = AF_LOCAL;
351 pub const AF_INET: ::c_int = 2;
352 pub const AF_IMPLINK: ::c_int = 3;
353 pub const AF_PUP: ::c_int = 4;
354 pub const AF_CHAOS: ::c_int = 5;
355 pub const AF_NS: ::c_int = 6;
356 pub const AF_ISO: ::c_int = 7;
357 pub const AF_OSI: ::c_int = AF_ISO;
358 pub const AF_DATAKIT: ::c_int = 9;
359 pub const AF_CCITT: ::c_int = 10;
360 pub const AF_SNA: ::c_int = 11;
361 pub const AF_DECnet: ::c_int = 12;
362 pub const AF_DLI: ::c_int = 13;
363 pub const AF_LAT: ::c_int = 14;
364 pub const AF_HYLINK: ::c_int = 15;
365 pub const AF_APPLETALK: ::c_int = 16;
366 pub const AF_LINK: ::c_int = 18;
367 pub const pseudo_AF_XTP: ::c_int = 19;
368 pub const AF_COIP: ::c_int = 20;
369 pub const AF_CNT: ::c_int = 21;
370 pub const pseudo_AF_RTIP: ::c_int = 22;
371 pub const AF_IPX: ::c_int = 23;
372 pub const AF_INET6: ::c_int = 24;
373 pub const pseudo_AF_PIP: ::c_int = 25;
374 pub const AF_ISDN: ::c_int = 26;
375 pub const AF_E164: ::c_int = AF_ISDN;
376 pub const AF_NATM: ::c_int = 27;
377
378 pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
379 pub const PF_LOCAL: ::c_int = AF_LOCAL;
380 pub const PF_UNIX: ::c_int = PF_LOCAL;
381 pub const PF_INET: ::c_int = AF_INET;
382 pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
383 pub const PF_PUP: ::c_int = AF_PUP;
384 pub const PF_CHAOS: ::c_int = AF_CHAOS;
385 pub const PF_NS: ::c_int = AF_NS;
386 pub const PF_ISO: ::c_int = AF_ISO;
387 pub const PF_OSI: ::c_int = AF_ISO;
388 pub const PF_DATAKIT: ::c_int = AF_DATAKIT;
389 pub const PF_CCITT: ::c_int = AF_CCITT;
390 pub const PF_SNA: ::c_int = AF_SNA;
391 pub const PF_DECnet: ::c_int = AF_DECnet;
392 pub const PF_DLI: ::c_int = AF_DLI;
393 pub const PF_LAT: ::c_int = AF_LAT;
394 pub const PF_HYLINK: ::c_int = AF_HYLINK;
395 pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
396 pub const PF_LINK: ::c_int = AF_LINK;
397 pub const PF_XTP: ::c_int = pseudo_AF_XTP;
398 pub const PF_COIP: ::c_int = AF_COIP;
399 pub const PF_CNT: ::c_int = AF_CNT;
400 pub const PF_IPX: ::c_int = AF_IPX;
401 pub const PF_INET6: ::c_int = AF_INET6;
402 pub const PF_RTIP: ::c_int = pseudo_AF_RTIP;
403 pub const PF_PIP: ::c_int = pseudo_AF_PIP;
404 pub const PF_ISDN: ::c_int = AF_ISDN;
405 pub const PF_NATM: ::c_int = AF_NATM;
406
407 pub const SOCK_STREAM: ::c_int = 1;
408 pub const SOCK_DGRAM: ::c_int = 2;
409 pub const SOCK_RAW: ::c_int = 3;
410 pub const SOCK_RDM: ::c_int = 4;
411 pub const SOCK_SEQPACKET: ::c_int = 5;
412 pub const IP_TTL: ::c_int = 4;
413 pub const IP_HDRINCL: ::c_int = 2;
414 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
415 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
416
417 pub const TCP_NODELAY: ::c_int = 0x01;
418 pub const SOL_SOCKET: ::c_int = 0xffff;
419 pub const SO_DEBUG: ::c_int = 0x01;
420 pub const SO_ACCEPTCONN: ::c_int = 0x0002;
421 pub const SO_REUSEADDR: ::c_int = 0x0004;
422 pub const SO_KEEPALIVE: ::c_int = 0x0008;
423 pub const SO_DONTROUTE: ::c_int = 0x0010;
424 pub const SO_BROADCAST: ::c_int = 0x0020;
425 pub const SO_USELOOPBACK: ::c_int = 0x0040;
426 pub const SO_LINGER: ::c_int = 0x0080;
427 pub const SO_OOBINLINE: ::c_int = 0x0100;
428 pub const SO_REUSEPORT: ::c_int = 0x0200;
429 pub const SO_SNDBUF: ::c_int = 0x1001;
430 pub const SO_RCVBUF: ::c_int = 0x1002;
431 pub const SO_SNDLOWAT: ::c_int = 0x1003;
432 pub const SO_RCVLOWAT: ::c_int = 0x1004;
433 pub const SO_ERROR: ::c_int = 0x1007;
434 pub const SO_TYPE: ::c_int = 0x1008;
435
436 pub const SOMAXCONN: ::c_int = 128;
437
438 pub const MSG_OOB: ::c_int = 0x1;
439 pub const MSG_PEEK: ::c_int = 0x2;
440 pub const MSG_DONTROUTE: ::c_int = 0x4;
441 pub const MSG_EOR: ::c_int = 0x8;
442 pub const MSG_TRUNC: ::c_int = 0x10;
443 pub const MSG_CTRUNC: ::c_int = 0x20;
444 pub const MSG_WAITALL: ::c_int = 0x40;
445 pub const MSG_DONTWAIT: ::c_int = 0x80;
446 pub const MSG_BCAST: ::c_int = 0x100;
447 pub const MSG_MCAST: ::c_int = 0x200;
448 pub const MSG_NOSIGNAL: ::c_int = 0x400;
449 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
450
451 pub const IFF_LOOPBACK: ::c_int = 0x8;
452
453 pub const SHUT_RD: ::c_int = 0;
454 pub const SHUT_WR: ::c_int = 1;
455 pub const SHUT_RDWR: ::c_int = 2;
456
457 pub const LOCK_SH: ::c_int = 1;
458 pub const LOCK_EX: ::c_int = 2;
459 pub const LOCK_NB: ::c_int = 4;
460 pub const LOCK_UN: ::c_int = 8;
461
462 pub const IPPROTO_RAW : ::c_int = 255;
463
464 pub const _SC_ARG_MAX : ::c_int = 1;
465 pub const _SC_CHILD_MAX : ::c_int = 2;
466 pub const _SC_NGROUPS_MAX : ::c_int = 4;
467 pub const _SC_OPEN_MAX : ::c_int = 5;
468 pub const _SC_JOB_CONTROL : ::c_int = 6;
469 pub const _SC_SAVED_IDS : ::c_int = 7;
470 pub const _SC_VERSION : ::c_int = 8;
471 pub const _SC_BC_BASE_MAX : ::c_int = 9;
472 pub const _SC_BC_DIM_MAX : ::c_int = 10;
473 pub const _SC_BC_SCALE_MAX : ::c_int = 11;
474 pub const _SC_BC_STRING_MAX : ::c_int = 12;
475 pub const _SC_COLL_WEIGHTS_MAX : ::c_int = 13;
476 pub const _SC_EXPR_NEST_MAX : ::c_int = 14;
477 pub const _SC_LINE_MAX : ::c_int = 15;
478 pub const _SC_RE_DUP_MAX : ::c_int = 16;
479 pub const _SC_2_VERSION : ::c_int = 17;
480 pub const _SC_2_C_BIND : ::c_int = 18;
481 pub const _SC_2_C_DEV : ::c_int = 19;
482 pub const _SC_2_CHAR_TERM : ::c_int = 20;
483 pub const _SC_2_FORT_DEV : ::c_int = 21;
484 pub const _SC_2_FORT_RUN : ::c_int = 22;
485 pub const _SC_2_LOCALEDEF : ::c_int = 23;
486 pub const _SC_2_SW_DEV : ::c_int = 24;
487 pub const _SC_2_UPE : ::c_int = 25;
488 pub const _SC_STREAM_MAX : ::c_int = 26;
489 pub const _SC_TZNAME_MAX : ::c_int = 27;
490 pub const _SC_PAGESIZE : ::c_int = 28;
491 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
492 pub const _SC_FSYNC : ::c_int = 29;
493 pub const _SC_XOPEN_SHM : ::c_int = 30;
494
495 pub const Q_GETQUOTA: ::c_int = 0x300;
496 pub const Q_SETQUOTA: ::c_int = 0x400;
497
498 pub const RTLD_GLOBAL: ::c_int = 0x100;
499
500 pub const LOG_NFACILITIES: ::c_int = 24;
501
502 pub const HW_NCPU: ::c_int = 3;
503
504 pub const B0: speed_t = 0;
505 pub const B50: speed_t = 50;
506 pub const B75: speed_t = 75;
507 pub const B110: speed_t = 110;
508 pub const B134: speed_t = 134;
509 pub const B150: speed_t = 150;
510 pub const B200: speed_t = 200;
511 pub const B300: speed_t = 300;
512 pub const B600: speed_t = 600;
513 pub const B1200: speed_t = 1200;
514 pub const B1800: speed_t = 1800;
515 pub const B2400: speed_t = 2400;
516 pub const B4800: speed_t = 4800;
517 pub const B9600: speed_t = 9600;
518 pub const B19200: speed_t = 19200;
519 pub const B38400: speed_t = 38400;
520 pub const B7200: speed_t = 7200;
521 pub const B14400: speed_t = 14400;
522 pub const B28800: speed_t = 28800;
523 pub const B57600: speed_t = 57600;
524 pub const B76800: speed_t = 76800;
525 pub const B115200: speed_t = 115200;
526 pub const B230400: speed_t = 230400;
527 pub const EXTA: speed_t = 19200;
528 pub const EXTB: speed_t = 38400;
529
530 pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
531
532 pub const CRTSCTS: ::tcflag_t = 0x00010000;
533 pub const CRTS_IFLOW: ::tcflag_t = CRTSCTS;
534 pub const CCTS_OFLOW: ::tcflag_t = CRTSCTS;
535 pub const OCRNL: ::tcflag_t = 0x10;
536
537 pub const TIOCM_LE: ::c_int = 0o0001;
538 pub const TIOCM_DTR: ::c_int = 0o0002;
539 pub const TIOCM_RTS: ::c_int = 0o0004;
540 pub const TIOCM_ST: ::c_int = 0o0010;
541 pub const TIOCM_SR: ::c_int = 0o0020;
542 pub const TIOCM_CTS: ::c_int = 0o0040;
543 pub const TIOCM_CAR: ::c_int = 0o0100;
544 pub const TIOCM_RNG: ::c_int = 0o0200;
545 pub const TIOCM_DSR: ::c_int = 0o0400;
546 pub const TIOCM_CD: ::c_int = TIOCM_CAR;
547 pub const TIOCM_RI: ::c_int = TIOCM_RNG;
548
549 f! {
550 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
551 status >> 8
552 }
553
554 pub fn WIFSIGNALED(status: ::c_int) -> bool {
555 (status & 0o177) != 0o177 && (status & 0o177) != 0
556 }
557
558 pub fn WIFSTOPPED(status: ::c_int) -> bool {
559 (status & 0o177) == 0o177
560 }
561 }
562
563 #[link(name = "util")]
564 extern {
565 pub fn mincore(addr: *mut ::c_void, len: ::size_t,
566 vec: *mut ::c_char) -> ::c_int;
567 #[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
568 pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
569 #[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
570 pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
571 #[cfg_attr(target_os = "netbsd", link_name = "__clock_settime50")]
572 pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
573 pub fn __errno() -> *mut ::c_int;
574 pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
575 -> ::c_int;
576 pub fn memrchr(cx: *const ::c_void,
577 c: ::c_int,
578 n: ::size_t) -> *mut ::c_void;
579 pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
580 pub fn mkostemps(template: *mut ::c_char,
581 suffixlen: ::c_int,
582 flags: ::c_int) -> ::c_int;
583 pub fn pwritev(fd: ::c_int,
584 iov: *const ::iovec,
585 iovcnt: ::c_int,
586 offset: ::off_t) -> ::ssize_t;
587 pub fn preadv(fd: ::c_int,
588 iov: *const ::iovec,
589 iovcnt: ::c_int,
590 offset: ::off_t) -> ::ssize_t;
591 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
592 pub fn fdatasync(fd: ::c_int) -> ::c_int;
593 pub fn openpty(amaster: *mut ::c_int,
594 aslave: *mut ::c_int,
595 name: *mut ::c_char,
596 termp: *mut termios,
597 winp: *mut ::winsize) -> ::c_int;
598 pub fn forkpty(amaster: *mut ::c_int,
599 name: *mut ::c_char,
600 termp: *mut termios,
601 winp: *mut ::winsize) -> ::pid_t;
602 pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
603 pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
604
605 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
606
607 pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
608 mode: ::mode_t, dev: dev_t) -> ::c_int;
609 pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
610 mode: ::mode_t) -> ::c_int;
611 pub fn sem_timedwait(sem: *mut sem_t,
612 abstime: *const ::timespec) -> ::c_int;
613 pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
614 clock_id: ::clockid_t) -> ::c_int;
615 pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
616 pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
617 abstime: *const ::timespec) -> ::c_int;
618 pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
619
620 pub fn getgrouplist(name: *const ::c_char,
621 basegid: ::gid_t,
622 groups: *mut ::gid_t,
623 ngroups: *mut ::c_int) -> ::c_int;
624 pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
625 pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
626 envp: *const *const ::c_char)
627 -> ::c_int;
628 }
629
630 cfg_if! {
631 if #[cfg(target_os = "netbsd")] {
632 mod netbsd;
633 pub use self::netbsd::*;
634 } else if #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] {
635 mod openbsdlike;
636 pub use self::openbsdlike::*;
637 } else {
638 // Unknown target_os
639 }
640 }