]> git.proxmox.com Git - rustc.git/blob - src/liblibc/src/unix/solaris/mod.rs
Imported Upstream version 1.10.0+dfsg1
[rustc.git] / src / liblibc / src / unix / solaris / mod.rs
1 pub type c_char = i8;
2 pub type c_long = i64;
3 pub type c_ulong = u64;
4 pub type clockid_t = ::c_int;
5
6 pub type blkcnt_t = i64;
7 pub type clock_t = i64;
8 pub type daddr_t = i64;
9 pub type dev_t = u64;
10 pub type fsblkcnt_t = u64;
11 pub type fsfilcnt_t = u64;
12 pub type ino_t = i64;
13 pub type key_t = i32;
14 pub type major_t = u32;
15 pub type minor_t = u32;
16 pub type mode_t = u32;
17 pub type nlink_t = u32;
18 pub type rlim_t = u64;
19 pub type speed_t = u32;
20 pub type tcflag_t = u32;
21 pub type time_t = i64;
22 pub type wchar_t = i32;
23 pub type nfds_t = ::c_ulong;
24
25 pub type suseconds_t = ::c_long;
26 pub type off_t = i64;
27 pub type useconds_t = ::c_uint;
28 pub type socklen_t = u32;
29 pub type sa_family_t = u8;
30 pub type pthread_t = ::uintptr_t;
31 pub type pthread_key_t = ::c_uint;
32 pub type blksize_t = u32;
33 pub type fflags_t = u32;
34 pub type nl_item = ::c_int;
35
36 pub enum timezone {}
37
38 s! {
39 pub struct sockaddr {
40 pub sa_family: sa_family_t,
41 pub sa_data: [::c_char; 14],
42 }
43
44 pub struct sockaddr_in {
45 pub sin_family: sa_family_t,
46 pub sin_port: ::in_port_t,
47 pub sin_addr: ::in_addr,
48 pub sin_zero: [::c_char; 8]
49 }
50
51 pub struct sockaddr_in6 {
52 pub sin6_family: sa_family_t,
53 pub sin6_port: ::in_port_t,
54 pub sin6_flowinfo: u32,
55 pub sin6_addr: ::in6_addr,
56 pub sin6_scope_id: u32,
57 pub __sin6_src_id: u32
58 }
59
60 pub struct sockaddr_un {
61 pub sun_family: sa_family_t,
62 pub sun_path: [c_char; 108]
63 }
64
65 pub struct passwd {
66 pub pw_name: *mut ::c_char,
67 pub pw_passwd: *mut ::c_char,
68 pub pw_uid: ::uid_t,
69 pub pw_gid: ::gid_t,
70 pub pw_age: *mut ::c_char,
71 pub pw_comment: *mut ::c_char,
72 pub pw_gecos: *mut ::c_char,
73 pub pw_dir: *mut ::c_char,
74 pub pw_shell: *mut ::c_char
75 }
76
77 pub struct ifaddrs {
78 pub ifa_next: *mut ifaddrs,
79 pub ifa_name: *mut ::c_char,
80 pub ifa_flags: ::c_ulong,
81 pub ifa_addr: *mut ::sockaddr,
82 pub ifa_netmask: *mut ::sockaddr,
83 pub ifa_dstaddr: *mut ::sockaddr,
84 pub ifa_data: *mut ::c_void
85 }
86
87 pub struct tm {
88 pub tm_sec: ::c_int,
89 pub tm_min: ::c_int,
90 pub tm_hour: ::c_int,
91 pub tm_mday: ::c_int,
92 pub tm_mon: ::c_int,
93 pub tm_year: ::c_int,
94 pub tm_wday: ::c_int,
95 pub tm_yday: ::c_int,
96 pub tm_isdst: ::c_int
97 }
98
99 pub struct utsname {
100 pub sysname: [::c_char; 257],
101 pub nodename: [::c_char; 257],
102 pub release: [::c_char; 257],
103 pub version: [::c_char; 257],
104 pub machine: [::c_char; 257],
105 }
106
107 pub struct msghdr {
108 pub msg_name: *mut ::c_void,
109 pub msg_namelen: ::socklen_t,
110 pub msg_iov: *mut ::iovec,
111 pub msg_iovlen: ::c_int,
112 pub msg_control: *mut ::c_void,
113 pub msg_controllen: ::socklen_t,
114 pub msg_flags: ::c_int,
115 }
116
117 pub struct fd_set {
118 fds_bits: [i32; FD_SETSIZE / 32],
119 }
120
121 pub struct pthread_attr_t {
122 __pthread_attrp: *mut ::c_void
123 }
124
125 pub struct pthread_mutex_t {
126 __pthread_mutex_flag1: u16,
127 __pthread_mutex_flag2: u8,
128 __pthread_mutex_ceiling: u8,
129 __pthread_mutex_type: u16,
130 __pthread_mutex_magic: u16,
131 __pthread_mutex_lock: u64,
132 __pthread_mutex_data: u64
133 }
134
135 pub struct pthread_mutexattr_t {
136 __pthread_mutexattrp: *mut ::c_void
137 }
138
139 pub struct pthread_cond_t {
140 __pthread_cond_flag: [u8; 4],
141 __pthread_cond_type: u16,
142 __pthread_cond_magic: u16,
143 __pthread_cond_data: u64
144 }
145
146 pub struct pthread_rwlock_t {
147 __pthread_rwlock_readers: i32,
148 __pthread_rwlock_type: u16,
149 __pthread_rwlock_magic: u16,
150 __pthread_rwlock_mutex: ::pthread_mutex_t,
151 __pthread_rwlock_readercv: ::pthread_cond_t,
152 __pthread_rwlock_writercv: ::pthread_cond_t
153 }
154
155 pub struct dirent {
156 pub d_ino: ::ino_t,
157 pub d_off: ::off_t,
158 pub d_reclen: u16,
159 pub d_name: [::c_char; 1]
160 }
161
162 pub struct glob_t {
163 pub gl_pathc: ::size_t,
164 pub gl_pathv: *mut *mut ::c_char,
165 pub gl_offs: ::size_t,
166 __unused1: *mut ::c_void,
167 __unused2: ::c_int,
168 __unused3: ::c_int,
169 __unused4: ::c_int,
170 __unused5: *mut ::c_void,
171 __unused6: *mut ::c_void,
172 __unused7: *mut ::c_void,
173 __unused8: *mut ::c_void,
174 __unused9: *mut ::c_void,
175 __unused10: *mut ::c_void,
176 }
177
178 pub struct sockaddr_storage {
179 pub ss_family: ::sa_family_t,
180 __ss_pad1: [u8; 6],
181 __ss_align: i64,
182 __ss_pad2: [u8; 240],
183 }
184
185 pub struct addrinfo {
186 pub ai_flags: ::c_int,
187 pub ai_family: ::c_int,
188 pub ai_socktype: ::c_int,
189 pub ai_protocol: ::c_int,
190 pub ai_addrlen: ::socklen_t,
191 pub ai_canonname: *mut ::c_char,
192 pub ai_addr: *mut ::sockaddr,
193 pub ai_next: *mut addrinfo,
194 }
195
196 pub struct sigset_t {
197 bits: [u32; 4],
198 }
199
200 pub struct siginfo_t {
201 pub si_signo: ::c_int,
202 pub si_code: ::c_int,
203 pub si_errno: ::c_int,
204 pub si_pad: ::c_int,
205 pub si_addr: *mut ::c_void,
206 __pad: [u8; 232],
207 }
208
209 pub struct sigaction {
210 pub sa_flags: ::c_int,
211 pub sa_sigaction: ::sighandler_t,
212 pub sa_mask: sigset_t,
213 }
214
215 pub struct stack_t {
216 pub ss_sp: *mut ::c_void,
217 pub ss_size: ::size_t,
218 pub ss_flags: ::c_int,
219 }
220
221 pub struct statvfs {
222 pub f_bsize: ::c_ulong,
223 pub f_frsize: ::c_ulong,
224 pub f_blocks: ::fsblkcnt_t,
225 pub f_bfree: ::fsblkcnt_t,
226 pub f_bavail: ::fsblkcnt_t,
227 pub f_files: ::fsfilcnt_t,
228 pub f_ffree: ::fsfilcnt_t,
229 pub f_favail: ::fsfilcnt_t,
230 pub f_fsid: ::c_ulong,
231 pub f_basetype: [::c_char; 16],
232 pub f_flag: ::c_ulong,
233 pub f_namemax: ::c_ulong,
234 pub f_fstr: [::c_char; 32]
235 }
236
237 pub struct sched_param {
238 pub sched_priority: ::c_int,
239 sched_pad: [::c_int; 8]
240 }
241
242 pub struct Dl_info {
243 pub dli_fname: *const ::c_char,
244 pub dli_fbase: *mut ::c_void,
245 pub dli_sname: *const ::c_char,
246 pub dli_saddr: *mut ::c_void,
247 }
248
249 pub struct stat {
250 pub st_dev: ::dev_t,
251 pub st_ino: ::ino_t,
252 pub st_mode: ::mode_t,
253 pub st_nlink: ::nlink_t,
254 pub st_uid: ::uid_t,
255 pub st_gid: ::gid_t,
256 pub st_rdev: ::dev_t,
257 pub st_size: ::off_t,
258 pub st_atime: ::time_t,
259 pub st_atime_nsec: ::c_long,
260 pub st_mtime: ::time_t,
261 pub st_mtime_nsec: ::c_long,
262 pub st_ctime: ::time_t,
263 pub st_ctime_nsec: ::c_long,
264 pub st_blksize: ::blksize_t,
265 pub st_blocks: ::blkcnt_t,
266 __unused: [::c_char; 16]
267 }
268
269 pub struct termios {
270 pub c_iflag: ::tcflag_t,
271 pub c_oflag: ::tcflag_t,
272 pub c_cflag: ::tcflag_t,
273 pub c_lflag: ::tcflag_t,
274 pub c_cc: [::cc_t; ::NCCS]
275 }
276
277 pub struct lconv {
278 pub decimal_point: *mut ::c_char,
279 pub thousands_sep: *mut ::c_char,
280 pub grouping: *mut ::c_char,
281 pub int_curr_symbol: *mut ::c_char,
282 pub currency_symbol: *mut ::c_char,
283 pub mon_decimal_point: *mut ::c_char,
284 pub mon_thousands_sep: *mut ::c_char,
285 pub mon_grouping: *mut ::c_char,
286 pub positive_sign: *mut ::c_char,
287 pub negative_sign: *mut ::c_char,
288 pub int_frac_digits: ::c_char,
289 pub frac_digits: ::c_char,
290 pub p_cs_precedes: ::c_char,
291 pub p_sep_by_space: ::c_char,
292 pub n_cs_precedes: ::c_char,
293 pub n_sep_by_space: ::c_char,
294 pub p_sign_posn: ::c_char,
295 pub n_sign_posn: ::c_char,
296 pub int_p_cs_precedes: ::c_char,
297 pub int_p_sep_by_space: ::c_char,
298 pub int_n_cs_precedes: ::c_char,
299 pub int_n_sep_by_space: ::c_char,
300 pub int_p_sign_posn: ::c_char,
301 pub int_n_sign_posn: ::c_char,
302 }
303 }
304
305 pub const LC_CTYPE: ::c_int = 0;
306 pub const LC_NUMERIC: ::c_int = 1;
307 pub const LC_TIME: ::c_int = 2;
308 pub const LC_COLLATE: ::c_int = 3;
309 pub const LC_MONETARY: ::c_int = 4;
310 pub const LC_MESSAGES: ::c_int = 5;
311 pub const LC_ALL: ::c_int = 6;
312 pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
313 pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
314 pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
315 pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
316 pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
317 pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
318 pub const LC_ALL_MASK: ::c_int = LC_CTYPE_MASK
319 | LC_NUMERIC_MASK
320 | LC_TIME_MASK
321 | LC_COLLATE_MASK
322 | LC_MONETARY_MASK
323 | LC_MESSAGES_MASK;
324
325 pub const DAY_1: ::nl_item = 1;
326 pub const DAY_2: ::nl_item = 2;
327 pub const DAY_3: ::nl_item = 3;
328 pub const DAY_4: ::nl_item = 4;
329 pub const DAY_5: ::nl_item = 5;
330 pub const DAY_6: ::nl_item = 6;
331 pub const DAY_7: ::nl_item = 7;
332
333 pub const ABDAY_1: ::nl_item = 8;
334 pub const ABDAY_2: ::nl_item = 9;
335 pub const ABDAY_3: ::nl_item = 10;
336 pub const ABDAY_4: ::nl_item = 11;
337 pub const ABDAY_5: ::nl_item = 12;
338 pub const ABDAY_6: ::nl_item = 13;
339 pub const ABDAY_7: ::nl_item = 14;
340
341 pub const MON_1: ::nl_item = 15;
342 pub const MON_2: ::nl_item = 16;
343 pub const MON_3: ::nl_item = 17;
344 pub const MON_4: ::nl_item = 18;
345 pub const MON_5: ::nl_item = 19;
346 pub const MON_6: ::nl_item = 20;
347 pub const MON_7: ::nl_item = 21;
348 pub const MON_8: ::nl_item = 22;
349 pub const MON_9: ::nl_item = 23;
350 pub const MON_10: ::nl_item = 24;
351 pub const MON_11: ::nl_item = 25;
352 pub const MON_12: ::nl_item = 26;
353
354 pub const ABMON_1: ::nl_item = 27;
355 pub const ABMON_2: ::nl_item = 28;
356 pub const ABMON_3: ::nl_item = 29;
357 pub const ABMON_4: ::nl_item = 30;
358 pub const ABMON_5: ::nl_item = 31;
359 pub const ABMON_6: ::nl_item = 32;
360 pub const ABMON_7: ::nl_item = 33;
361 pub const ABMON_8: ::nl_item = 34;
362 pub const ABMON_9: ::nl_item = 35;
363 pub const ABMON_10: ::nl_item = 36;
364 pub const ABMON_11: ::nl_item = 37;
365 pub const ABMON_12: ::nl_item = 38;
366
367 pub const RADIXCHAR: ::nl_item = 39;
368 pub const THOUSEP: ::nl_item = 40;
369 pub const YESSTR: ::nl_item = 41;
370 pub const NOSTR: ::nl_item = 42;
371 pub const CRNCYSTR: ::nl_item = 43;
372
373 pub const D_T_FMT: ::nl_item = 44;
374 pub const D_FMT: ::nl_item = 45;
375 pub const T_FMT: ::nl_item = 46;
376 pub const AM_STR: ::nl_item = 47;
377 pub const PM_STR: ::nl_item = 48;
378
379 pub const CODESET: ::nl_item = 49;
380 pub const T_FMT_AMPM: ::nl_item = 50;
381 pub const ERA: ::nl_item = 51;
382 pub const ERA_D_FMT: ::nl_item = 52;
383 pub const ERA_D_T_FMT: ::nl_item = 53;
384 pub const ERA_T_FMT: ::nl_item = 54;
385 pub const ALT_DIGITS: ::nl_item = 55;
386 pub const YESEXPR: ::nl_item = 56;
387 pub const NOEXPR: ::nl_item = 57;
388 pub const _DATE_FMT: ::nl_item = 58;
389 pub const MAXSTRMSG: ::nl_item = 58;
390
391 pub const SA_ONSTACK: ::c_int = 0x00000001;
392 pub const SA_RESETHAND: ::c_int = 0x00000002;
393 pub const SA_RESTART: ::c_int = 0x00000004;
394 pub const SA_SIGINFO: ::c_int = 0x00000008;
395 pub const SA_NODEFER: ::c_int = 0x00000010;
396 pub const SA_NOCLDWAIT: ::c_int = 0x00010000;
397 pub const SA_NOCLDSTOP: ::c_int = 0x00020000;
398
399 pub const SS_ONSTACK: ::c_int = 1;
400 pub const SS_DISABLE: ::c_int = 2;
401
402 pub const FIONBIO: ::c_int = 0x8004667e;
403
404 pub const SIGCHLD: ::c_int = 18;
405 pub const SIGBUS: ::c_int = 10;
406 pub const SIG_SETMASK: ::c_int = 3;
407
408 pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8;
409 pub const IPV6_V6ONLY: ::c_int = 0x27;
410
411 pub const FD_SETSIZE: usize = 1024;
412
413 pub const ST_RDONLY: ::c_ulong = 1;
414 pub const ST_NOSUID: ::c_ulong = 2;
415
416 pub const NI_MAXHOST: ::socklen_t = 1025;
417
418 pub const EXIT_FAILURE: ::c_int = 1;
419 pub const EXIT_SUCCESS: ::c_int = 0;
420 pub const RAND_MAX: ::c_int = 32767;
421 pub const EOF: ::c_int = -1;
422 pub const SEEK_SET: ::c_int = 0;
423 pub const SEEK_CUR: ::c_int = 1;
424 pub const SEEK_END: ::c_int = 2;
425 pub const _IOFBF: ::c_int = 0;
426 pub const _IONBF: ::c_int = 4;
427 pub const _IOLBF: ::c_int = 64;
428 pub const BUFSIZ: ::c_uint = 1024;
429 pub const FOPEN_MAX: ::c_uint = 20;
430 pub const FILENAME_MAX: ::c_uint = 1024;
431 pub const L_tmpnam: ::c_uint = 25;
432 pub const TMP_MAX: ::c_uint = 17576;
433
434 pub const O_RDONLY: ::c_int = 0;
435 pub const O_WRONLY: ::c_int = 1;
436 pub const O_RDWR: ::c_int = 2;
437 pub const O_APPEND: ::c_int = 8;
438 pub const O_CREAT: ::c_int = 256;
439 pub const O_EXCL: ::c_int = 1024;
440 pub const O_NOCTTY: ::c_int = 2048;
441 pub const O_TRUNC: ::c_int = 512;
442 pub const O_CLOEXEC: ::c_int = 0x800000;
443 pub const O_ACCMODE: ::c_int = 0x600003;
444 pub const S_IFIFO: mode_t = 4096;
445 pub const S_IFCHR: mode_t = 8192;
446 pub const S_IFBLK: mode_t = 24576;
447 pub const S_IFDIR: mode_t = 16384;
448 pub const S_IFREG: mode_t = 32768;
449 pub const S_IFLNK: mode_t = 40960;
450 pub const S_IFSOCK: mode_t = 49152;
451 pub const S_IFMT: mode_t = 61440;
452 pub const S_IEXEC: mode_t = 64;
453 pub const S_IWRITE: mode_t = 128;
454 pub const S_IREAD: mode_t = 256;
455 pub const S_IRWXU: mode_t = 448;
456 pub const S_IXUSR: mode_t = 64;
457 pub const S_IWUSR: mode_t = 128;
458 pub const S_IRUSR: mode_t = 256;
459 pub const S_IRWXG: mode_t = 56;
460 pub const S_IXGRP: mode_t = 8;
461 pub const S_IWGRP: mode_t = 16;
462 pub const S_IRGRP: mode_t = 32;
463 pub const S_IRWXO: mode_t = 7;
464 pub const S_IXOTH: mode_t = 1;
465 pub const S_IWOTH: mode_t = 2;
466 pub const S_IROTH: mode_t = 4;
467 pub const F_OK: ::c_int = 0;
468 pub const R_OK: ::c_int = 4;
469 pub const W_OK: ::c_int = 2;
470 pub const X_OK: ::c_int = 1;
471 pub const STDIN_FILENO: ::c_int = 0;
472 pub const STDOUT_FILENO: ::c_int = 1;
473 pub const STDERR_FILENO: ::c_int = 2;
474 pub const F_LOCK: ::c_int = 1;
475 pub const F_TEST: ::c_int = 3;
476 pub const F_TLOCK: ::c_int = 2;
477 pub const F_ULOCK: ::c_int = 0;
478 pub const F_DUPFD_CLOEXEC: ::c_int = 37;
479 pub const SIGHUP: ::c_int = 1;
480 pub const SIGINT: ::c_int = 2;
481 pub const SIGQUIT: ::c_int = 3;
482 pub const SIGILL: ::c_int = 4;
483 pub const SIGABRT: ::c_int = 6;
484 pub const SIGFPE: ::c_int = 8;
485 pub const SIGKILL: ::c_int = 9;
486 pub const SIGSEGV: ::c_int = 11;
487 pub const SIGPIPE: ::c_int = 13;
488 pub const SIGALRM: ::c_int = 14;
489 pub const SIGTERM: ::c_int = 15;
490
491 pub const WNOHANG: ::c_int = 0x40;
492
493 pub const PROT_NONE: ::c_int = 0;
494 pub const PROT_READ: ::c_int = 1;
495 pub const PROT_WRITE: ::c_int = 2;
496 pub const PROT_EXEC: ::c_int = 4;
497
498 pub const MAP_SHARED: ::c_int = 0x0001;
499 pub const MAP_PRIVATE: ::c_int = 0x0002;
500 pub const MAP_FIXED: ::c_int = 0x0010;
501 pub const MAP_ANON: ::c_int = 0x0100;
502
503 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
504
505 pub const MCL_CURRENT: ::c_int = 0x0001;
506 pub const MCL_FUTURE: ::c_int = 0x0002;
507
508 pub const MS_SYNC: ::c_int = 0x0004;
509 pub const MS_ASYNC: ::c_int = 0x0001;
510 pub const MS_INVALIDATE: ::c_int = 0x0002;
511
512 pub const EPERM: ::c_int = 1;
513 pub const ENOENT: ::c_int = 2;
514 pub const ESRCH: ::c_int = 3;
515 pub const EINTR: ::c_int = 4;
516 pub const EIO: ::c_int = 5;
517 pub const ENXIO: ::c_int = 6;
518 pub const E2BIG: ::c_int = 7;
519 pub const ENOEXEC: ::c_int = 8;
520 pub const EBADF: ::c_int = 9;
521 pub const ECHILD: ::c_int = 10;
522 pub const EDEADLK: ::c_int = 45;
523 pub const ENOMEM: ::c_int = 12;
524 pub const EACCES: ::c_int = 13;
525 pub const EFAULT: ::c_int = 14;
526 pub const ENOTBLK: ::c_int = 15;
527 pub const EBUSY: ::c_int = 16;
528 pub const EEXIST: ::c_int = 17;
529 pub const EXDEV: ::c_int = 18;
530 pub const ENODEV: ::c_int = 19;
531 pub const ENOTDIR: ::c_int = 20;
532 pub const EISDIR: ::c_int = 21;
533 pub const EINVAL: ::c_int = 22;
534 pub const ENFILE: ::c_int = 23;
535 pub const EMFILE: ::c_int = 24;
536 pub const ENOTTY: ::c_int = 25;
537 pub const ETXTBSY: ::c_int = 26;
538 pub const EFBIG: ::c_int = 27;
539 pub const ENOSPC: ::c_int = 28;
540 pub const ESPIPE: ::c_int = 29;
541 pub const EROFS: ::c_int = 30;
542 pub const EMLINK: ::c_int = 31;
543 pub const EPIPE: ::c_int = 32;
544 pub const EDOM: ::c_int = 33;
545 pub const ERANGE: ::c_int = 34;
546 pub const EAGAIN: ::c_int = 11;
547 pub const EWOULDBLOCK: ::c_int = 11;
548 pub const EINPROGRESS: ::c_int = 150;
549 pub const EALREADY: ::c_int = 149;
550 pub const ENOTSOCK: ::c_int = 95;
551 pub const EDESTADDRREQ: ::c_int = 96;
552 pub const EMSGSIZE: ::c_int = 97;
553 pub const EPROTOTYPE: ::c_int = 98;
554 pub const ENOPROTOOPT: ::c_int = 99;
555 pub const EPROTONOSUPPORT: ::c_int = 120;
556 pub const ESOCKTNOSUPPORT: ::c_int = 121;
557 pub const EOPNOTSUPP: ::c_int = 122;
558 pub const EPFNOSUPPORT: ::c_int = 123;
559 pub const EAFNOSUPPORT: ::c_int = 124;
560 pub const EADDRINUSE: ::c_int = 125;
561 pub const EADDRNOTAVAIL: ::c_int = 126;
562 pub const ENETDOWN: ::c_int = 127;
563 pub const ENETUNREACH: ::c_int = 128;
564 pub const ENETRESET: ::c_int = 129;
565 pub const ECONNABORTED: ::c_int = 130;
566 pub const ECONNRESET: ::c_int = 131;
567 pub const ENOBUFS: ::c_int = 132;
568 pub const EISCONN: ::c_int = 133;
569 pub const ENOTCONN: ::c_int = 134;
570 pub const ESHUTDOWN: ::c_int = 143;
571 pub const ETOOMANYREFS: ::c_int = 144;
572 pub const ETIMEDOUT: ::c_int = 145;
573 pub const ECONNREFUSED: ::c_int = 146;
574 pub const ELOOP: ::c_int = 90;
575 pub const ENAMETOOLONG: ::c_int = 78;
576 pub const EHOSTDOWN: ::c_int = 147;
577 pub const EHOSTUNREACH: ::c_int = 148;
578 pub const ENOTEMPTY: ::c_int = 93;
579 pub const EUSERS: ::c_int = 94;
580 pub const EDQUOT: ::c_int = 49;
581 pub const ESTALE: ::c_int = 151;
582 pub const EREMOTE: ::c_int = 66;
583 pub const ENOLCK: ::c_int = 46;
584 pub const ENOSYS: ::c_int = 89;
585 pub const EIDRM: ::c_int = 36;
586 pub const ENOMSG: ::c_int = 35;
587 pub const EOVERFLOW: ::c_int = 79;
588 pub const ECANCELED: ::c_int = 47;
589 pub const EILSEQ: ::c_int = 88;
590 pub const EBADMSG: ::c_int = 77;
591 pub const EMULTIHOP: ::c_int = 74;
592 pub const ENOLINK: ::c_int = 67;
593 pub const EPROTO: ::c_int = 71;
594
595 pub const F_DUPFD: ::c_int = 0;
596 pub const F_GETFD: ::c_int = 1;
597 pub const F_SETFD: ::c_int = 2;
598 pub const F_GETFL: ::c_int = 3;
599 pub const F_SETFL: ::c_int = 4;
600
601 pub const SIGTRAP: ::c_int = 5;
602
603 pub const GLOB_APPEND : ::c_int = 32;
604 pub const GLOB_DOOFFS : ::c_int = 16;
605 pub const GLOB_ERR : ::c_int = 1;
606 pub const GLOB_MARK : ::c_int = 2;
607 pub const GLOB_NOCHECK : ::c_int = 8;
608 pub const GLOB_NOSORT : ::c_int = 4;
609 pub const GLOB_NOESCAPE: ::c_int = 64;
610
611 pub const GLOB_NOSPACE : ::c_int = -2;
612 pub const GLOB_ABORTED : ::c_int = -1;
613 pub const GLOB_NOMATCH : ::c_int = -3;
614
615 pub const POSIX_MADV_NORMAL: ::c_int = 0;
616 pub const POSIX_MADV_RANDOM: ::c_int = 1;
617 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
618 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
619 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
620
621 pub const _SC_IOV_MAX: ::c_int = 77;
622 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 569;
623 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 570;
624 pub const _SC_LOGIN_NAME_MAX: ::c_int = 571;
625 pub const _SC_MQ_PRIO_MAX: ::c_int = 30;
626 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 577;
627 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 578;
628 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 568;
629 pub const _SC_THREAD_KEYS_MAX: ::c_int = 572;
630 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 580;
631 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 581;
632 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 579;
633 pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 582;
634 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 583;
635 pub const _SC_THREAD_STACK_MIN: ::c_int = 573;
636 pub const _SC_THREAD_THREADS_MAX: ::c_int = 574;
637 pub const _SC_THREADS: ::c_int = 576;
638 pub const _SC_TTY_NAME_MAX: ::c_int = 575;
639 pub const _SC_ATEXIT_MAX: ::c_int = 76;
640 pub const _SC_XOPEN_CRYPT: ::c_int = 62;
641 pub const _SC_XOPEN_ENH_I18N: ::c_int = 63;
642 pub const _SC_XOPEN_LEGACY: ::c_int = 717;
643 pub const _SC_XOPEN_REALTIME: ::c_int = 718;
644 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 719;
645 pub const _SC_XOPEN_SHM: ::c_int = 64;
646 pub const _SC_XOPEN_UNIX: ::c_int = 78;
647 pub const _SC_XOPEN_VERSION: ::c_int = 12;
648 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 67;
649
650 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
651 pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x40;
652 pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
653 pub const PTHREAD_PROCESS_PRIVATE: u16 = 0;
654 pub const PTHREAD_STACK_MIN: ::size_t = 4096;
655
656 pub const SIGSTKSZ: ::size_t = 8192;
657
658 // https://illumos.org/man/3c/clock_gettime
659 // https://github.com/illumos/illumos-gate/
660 // blob/HEAD/usr/src/lib/libc/amd64/sys/__clock_gettime.s
661 // clock_gettime(3c) doesn't seem to accept anything other than CLOCK_REALTIME
662 // or __CLOCK_REALTIME0
663 //
664 // https://github.com/illumos/illumos-gate/
665 // blob/HEAD/usr/src/uts/common/sys/time_impl.h
666 // Confusing! CLOCK_HIGHRES==CLOCK_MONOTONIC==4
667 // __CLOCK_REALTIME0==0 is an obsoleted version of CLOCK_REALTIME==3
668 pub const CLOCK_REALTIME: clockid_t = 3;
669 pub const CLOCK_MONOTONIC: clockid_t = 4;
670
671 pub const RLIMIT_CPU: ::c_int = 0;
672 pub const RLIMIT_FSIZE: ::c_int = 1;
673 pub const RLIMIT_DATA: ::c_int = 2;
674 pub const RLIMIT_STACK: ::c_int = 3;
675 pub const RLIMIT_CORE: ::c_int = 4;
676 pub const RLIMIT_NOFILE: ::c_int = 5;
677 pub const RLIMIT_VMEM: ::c_int = 6;
678 pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM;
679
680 pub const RLIM_NLIMITS: rlim_t = 7;
681 pub const RLIM_INFINITY: rlim_t = 0x7fffffff;
682
683 pub const RUSAGE_SELF: ::c_int = 0;
684 pub const RUSAGE_CHILDREN: ::c_int = -1;
685
686 pub const MADV_NORMAL: ::c_int = 0;
687 pub const MADV_RANDOM: ::c_int = 1;
688 pub const MADV_SEQUENTIAL: ::c_int = 2;
689 pub const MADV_WILLNEED: ::c_int = 3;
690 pub const MADV_DONTNEED: ::c_int = 4;
691 pub const MADV_FREE: ::c_int = 5;
692
693 pub const AF_INET: ::c_int = 2;
694 pub const AF_INET6: ::c_int = 26;
695 pub const AF_UNIX: ::c_int = 1;
696 pub const SOCK_DGRAM: ::c_int = 1;
697 pub const SOCK_STREAM: ::c_int = 2;
698 pub const SOCK_RAW: ::c_int = 4;
699 pub const IPPROTO_TCP: ::c_int = 6;
700 pub const IPPROTO_IP: ::c_int = 0;
701 pub const IPPROTO_IPV6: ::c_int = 41;
702 pub const IP_MULTICAST_TTL: ::c_int = 17;
703 pub const IP_MULTICAST_LOOP: ::c_int = 18;
704 pub const IP_TTL: ::c_int = 4;
705 pub const IP_HDRINCL: ::c_int = 2;
706 pub const IP_ADD_MEMBERSHIP: ::c_int = 19;
707 pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
708 pub const IPV6_JOIN_GROUP: ::c_int = 9;
709 pub const IPV6_LEAVE_GROUP: ::c_int = 10;
710
711 pub const TCP_NODELAY: ::c_int = 1;
712 pub const TCP_KEEPIDLE: ::c_int = 34;
713 pub const SOL_SOCKET: ::c_int = 0xffff;
714 pub const SO_DEBUG: ::c_int = 0x01;
715 pub const SO_ACCEPTCONN: ::c_int = 0x0002;
716 pub const SO_REUSEADDR: ::c_int = 0x0004;
717 pub const SO_KEEPALIVE: ::c_int = 0x0008;
718 pub const SO_DONTROUTE: ::c_int = 0x0010;
719 pub const SO_BROADCAST: ::c_int = 0x0020;
720 pub const SO_USELOOPBACK: ::c_int = 0x0040;
721 pub const SO_LINGER: ::c_int = 0x0080;
722 pub const SO_OOBINLINE: ::c_int = 0x0100;
723 pub const SO_SNDBUF: ::c_int = 0x1001;
724 pub const SO_RCVBUF: ::c_int = 0x1002;
725 pub const SO_SNDLOWAT: ::c_int = 0x1003;
726 pub const SO_RCVLOWAT: ::c_int = 0x1004;
727 pub const SO_SNDTIMEO: ::c_int = 0x1005;
728 pub const SO_RCVTIMEO: ::c_int = 0x1006;
729 pub const SO_ERROR: ::c_int = 0x1007;
730 pub const SO_TYPE: ::c_int = 0x1008;
731
732 pub const IFF_LOOPBACK: ::c_int = 0x8;
733
734 pub const SHUT_RD: ::c_int = 0;
735 pub const SHUT_WR: ::c_int = 1;
736 pub const SHUT_RDWR: ::c_int = 2;
737
738 pub const LOCK_SH: ::c_int = 1;
739 pub const LOCK_EX: ::c_int = 2;
740 pub const LOCK_NB: ::c_int = 4;
741 pub const LOCK_UN: ::c_int = 8;
742
743 pub const O_SYNC: ::c_int = 16;
744 pub const O_NONBLOCK: ::c_int = 128;
745
746 pub const IPPROTO_RAW: ::c_int = 255;
747
748 pub const _SC_ARG_MAX: ::c_int = 1;
749 pub const _SC_CHILD_MAX: ::c_int = 2;
750 pub const _SC_CLK_TCK: ::c_int = 3;
751 pub const _SC_NGROUPS_MAX: ::c_int = 4;
752 pub const _SC_OPEN_MAX: ::c_int = 5;
753 pub const _SC_JOB_CONTROL: ::c_int = 6;
754 pub const _SC_SAVED_IDS: ::c_int = 7;
755 pub const _SC_VERSION: ::c_int = 8;
756 pub const _SC_PAGESIZE: ::c_int = 11;
757 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
758 pub const _SC_NPROCESSORS_ONLN: ::c_int = 15;
759 pub const _SC_STREAM_MAX: ::c_int = 16;
760 pub const _SC_TZNAME_MAX: ::c_int = 17;
761 pub const _SC_AIO_LISTIO_MAX: ::c_int = 18;
762 pub const _SC_AIO_MAX: ::c_int = 19;
763 pub const _SC_BC_BASE_MAX: ::c_int = 54;
764 pub const _SC_BC_DIM_MAX: ::c_int = 55;
765 pub const _SC_BC_SCALE_MAX: ::c_int = 56;
766 pub const _SC_BC_STRING_MAX: ::c_int = 57;
767 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 58;
768 pub const _SC_EXPR_NEST_MAX: ::c_int = 59;
769 pub const _SC_LINE_MAX: ::c_int = 60;
770 pub const _SC_RE_DUP_MAX: ::c_int = 61;
771 pub const _SC_2_VERSION: ::c_int = 53;
772 pub const _SC_2_C_BIND: ::c_int = 45;
773 pub const _SC_2_C_DEV: ::c_int = 46;
774 pub const _SC_2_CHAR_TERM: ::c_int = 66;
775 pub const _SC_2_FORT_DEV: ::c_int = 48;
776 pub const _SC_2_FORT_RUN: ::c_int = 49;
777 pub const _SC_2_LOCALEDEF: ::c_int = 50;
778 pub const _SC_2_SW_DEV: ::c_int = 51;
779 pub const _SC_2_UPE: ::c_int = 52;
780 pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21;
781 pub const _SC_MAPPED_FILES: ::c_int = 24;
782 pub const _SC_MEMLOCK: ::c_int = 25;
783 pub const _SC_MEMLOCK_RANGE: ::c_int = 26;
784 pub const _SC_MEMORY_PROTECTION: ::c_int = 27;
785 pub const _SC_MESSAGE_PASSING: ::c_int = 28;
786 pub const _SC_PRIORITIZED_IO: ::c_int = 31;
787 pub const _SC_PRIORITY_SCHEDULING: ::c_int = 32;
788 pub const _SC_REALTIME_SIGNALS: ::c_int = 33;
789 pub const _SC_SEMAPHORES: ::c_int = 35;
790 pub const _SC_FSYNC: ::c_int = 23;
791 pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 38;
792 pub const _SC_SYNCHRONIZED_IO: ::c_int = 42;
793 pub const _SC_TIMERS: ::c_int = 43;
794 pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 20;
795 pub const _SC_DELAYTIMER_MAX: ::c_int = 22;
796 pub const _SC_MQ_OPEN_MAX: ::c_int = 29;
797 pub const _SC_RTSIG_MAX: ::c_int = 34;
798 pub const _SC_SEM_NSEMS_MAX: ::c_int = 36;
799 pub const _SC_SEM_VALUE_MAX: ::c_int = 37;
800 pub const _SC_SIGQUEUE_MAX: ::c_int = 39;
801 pub const _SC_TIMER_MAX: ::c_int = 44;
802
803 pub const _MUTEX_MAGIC: u16 = 0x4d58; // MX
804 pub const _COND_MAGIC: u16 = 0x4356; // CV
805 pub const _RWL_MAGIC: u16 = 0x5257; // RW
806
807 pub const NCCS: usize = 19;
808
809 pub const LOG_CRON: ::c_int = 15 << 3;
810
811 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
812 __pthread_mutex_flag1: 0,
813 __pthread_mutex_flag2: 0,
814 __pthread_mutex_ceiling: 0,
815 __pthread_mutex_type: PTHREAD_PROCESS_PRIVATE,
816 __pthread_mutex_magic: _MUTEX_MAGIC,
817 __pthread_mutex_lock: 0,
818 __pthread_mutex_data: 0
819 };
820 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
821 __pthread_cond_flag: [0; 4],
822 __pthread_cond_type: PTHREAD_PROCESS_PRIVATE,
823 __pthread_cond_magic: _COND_MAGIC,
824 __pthread_cond_data: 0
825 };
826 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
827 __pthread_rwlock_readers: 0,
828 __pthread_rwlock_type: PTHREAD_PROCESS_PRIVATE,
829 __pthread_rwlock_magic: _RWL_MAGIC,
830 __pthread_rwlock_mutex: PTHREAD_MUTEX_INITIALIZER,
831 __pthread_rwlock_readercv: PTHREAD_COND_INITIALIZER,
832 __pthread_rwlock_writercv: PTHREAD_COND_INITIALIZER
833 };
834 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 4;
835
836 f! {
837 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
838 let fd = fd as usize;
839 (*set).fds_bits[fd / 32] &= !(1 << (fd % 32));
840 return
841 }
842
843 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
844 let fd = fd as usize;
845 return ((*set).fds_bits[fd / 32] & (1 << (fd % 32))) != 0
846 }
847
848 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
849 let fd = fd as usize;
850 (*set).fds_bits[fd / 32] |= 1 << (fd % 32);
851 return
852 }
853
854 pub fn FD_ZERO(set: *mut fd_set) -> () {
855 for slot in (*set).fds_bits.iter_mut() {
856 *slot = 0;
857 }
858 }
859
860 pub fn WIFEXITED(status: ::c_int) -> bool {
861 (status & 0xFF) == 0
862 }
863
864 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
865 (status >> 8) & 0xFF
866 }
867
868 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
869 status & 0x7F
870 }
871 }
872
873 extern {
874 pub fn stack_getbounds(sp: *mut ::stack_t) -> ::c_int;
875 pub fn mincore(addr: *const ::c_void, len: ::size_t,
876 vec: *mut c_char) -> ::c_int;
877 pub fn setgroups(ngroups: ::c_int,
878 ptr: *const ::gid_t) -> ::c_int;
879 pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int;
880 pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
881 -> ::c_int;
882 pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
883 pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
884 pub fn getnameinfo(sa: *const ::sockaddr,
885 salen: ::socklen_t,
886 host: *mut ::c_char,
887 hostlen: ::socklen_t,
888 serv: *mut ::c_char,
889 sevlen: ::socklen_t,
890 flags: ::c_int) -> ::c_int;
891 pub fn getpwuid_r(uid: ::uid_t,
892 pwd: *mut passwd,
893 buf: *mut ::c_char,
894 buflen: ::size_t) -> *const passwd;
895 pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent;
896 pub fn fdatasync(fd: ::c_int) -> ::c_int;
897 pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
898 pub fn duplocale(base: ::locale_t) -> ::locale_t;
899 pub fn freelocale(loc: ::locale_t);
900 pub fn newlocale(mask: ::c_int,
901 locale: *const ::c_char,
902 base: ::locale_t) -> ::locale_t;
903 pub fn uselocale(loc: ::locale_t) -> ::locale_t;
904 pub fn getprogname() -> *const ::c_char;
905 pub fn setprogname(name: *const ::c_char);
906 pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
907 }
908