]> git.proxmox.com Git - rustc.git/blame - vendor/libc/src/unix/haiku/mod.rs
New upstream version 1.47.0~beta.2+dfsg1
[rustc.git] / vendor / libc / src / unix / haiku / mod.rs
CommitLineData
476ff2be
SL
1pub type rlim_t = ::uintptr_t;
2pub type sa_family_t = u8;
3pub type pthread_key_t = ::c_int;
4pub type nfds_t = ::c_long;
5pub type tcflag_t = ::c_uint;
6pub type speed_t = ::c_uint;
7pub type c_char = i8;
8pub type clock_t = i32;
9pub type clockid_t = i32;
476ff2be
SL
10pub type suseconds_t = i32;
11pub type wchar_t = i32;
12pub type off_t = i64;
13pub type ino_t = i64;
14pub type blkcnt_t = i64;
15pub type blksize_t = i32;
16pub type dev_t = i32;
17pub type mode_t = u32;
18pub type nlink_t = i32;
19pub type useconds_t = u32;
20pub type socklen_t = u32;
21pub type pthread_t = ::uintptr_t;
22pub type pthread_mutexattr_t = ::uintptr_t;
041b39d2 23pub type pthread_rwlockattr_t = ::uintptr_t;
476ff2be
SL
24pub type sigset_t = u64;
25pub type fsblkcnt_t = i64;
26pub type fsfilcnt_t = i64;
27pub type pthread_attr_t = *mut ::c_void;
28pub type nl_item = ::c_int;
8bb4bdeb
XL
29pub type id_t = i32;
30pub type idtype_t = ::c_uint;
476ff2be 31
532ac7d7 32#[cfg_attr(feature = "extra_traits", derive(Debug))]
476ff2be 33pub enum timezone {}
532ac7d7
XL
34impl ::Copy for timezone {}
35impl ::Clone for timezone {
e74abb32
XL
36 fn clone(&self) -> timezone {
37 *self
38 }
532ac7d7 39}
476ff2be 40
3dfed10e
XL
41impl siginfo_t {
42 pub unsafe fn si_addr(&self) -> *mut ::c_void {
43 self.si_addr
44 }
45
46 pub unsafe fn si_pid(&self) -> ::pid_t {
47 self.si_pid
48 }
49
50 pub unsafe fn si_uid(&self) -> ::uid_t {
51 self.si_uid
52 }
53}
54
476ff2be 55s! {
532ac7d7
XL
56 pub struct in_addr {
57 pub s_addr: ::in_addr_t,
58 }
59
60 pub struct ip_mreq {
61 pub imr_multiaddr: in_addr,
62 pub imr_interface: in_addr,
63 }
64
476ff2be
SL
65 pub struct sockaddr {
66 pub sa_len: u8,
67 pub sa_family: sa_family_t,
68 pub sa_data: [::c_char; 30],
69 }
70
71 pub struct sockaddr_in {
72 pub sin_len: u8,
73 pub sin_family: sa_family_t,
74 pub sin_port: ::in_port_t,
75 pub sin_addr: ::in_addr,
76 pub sin_zero: [u8; 24],
77 }
78
79 pub struct sockaddr_in6 {
80 pub sin6_len: u8,
81 pub sin6_family: sa_family_t,
82 pub sin6_port: ::in_port_t,
83 pub sin6_flowinfo: u32,
84 pub sin6_addr: ::in6_addr,
85 pub sin6_scope_id: u32,
86 }
87
476ff2be
SL
88 pub struct addrinfo {
89 pub ai_flags: ::c_int,
90 pub ai_family: ::c_int,
91 pub ai_socktype: ::c_int,
92 pub ai_protocol: ::c_int,
93 pub ai_addrlen: socklen_t,
94 pub ai_canonname: *mut c_char,
95 pub ai_addr: *mut ::sockaddr,
96 pub ai_next: *mut addrinfo,
97 }
98
99 pub struct fd_set {
100 fds_bits: [c_ulong; FD_SETSIZE / ULONG_SIZE],
101 }
102
103 pub struct tm {
104 pub tm_sec: ::c_int,
105 pub tm_min: ::c_int,
106 pub tm_hour: ::c_int,
107 pub tm_mday: ::c_int,
108 pub tm_mon: ::c_int,
109 pub tm_year: ::c_int,
110 pub tm_wday: ::c_int,
111 pub tm_yday: ::c_int,
112 pub tm_isdst: ::c_int,
113 pub tm_gmtoff: ::c_long,
114 pub tm_zone: *const ::c_char,
115 }
116
117 pub struct utsname {
118 pub sysname: [::c_char; 32],
119 pub nodename: [::c_char; 32],
120 pub release: [::c_char; 32],
121 pub version: [::c_char; 32],
122 pub machine: [::c_char; 32],
123 }
124
125 pub struct lconv {
126 pub decimal_point: *mut ::c_char,
127 pub thousands_sep: *mut ::c_char,
128 pub grouping: *mut ::c_char,
129 pub int_curr_symbol: *mut ::c_char,
130 pub currency_symbol: *mut ::c_char,
131 pub mon_decimal_point: *mut ::c_char,
132 pub mon_thousands_sep: *mut ::c_char,
133 pub mon_grouping: *mut ::c_char,
134 pub positive_sign: *mut ::c_char,
135 pub negative_sign: *mut ::c_char,
136 pub int_frac_digits: ::c_char,
137 pub frac_digits: ::c_char,
138 pub p_cs_precedes: ::c_char,
139 pub p_sep_by_space: ::c_char,
140 pub n_cs_precedes: ::c_char,
141 pub n_sep_by_space: ::c_char,
142 pub p_sign_posn: ::c_char,
143 pub n_sign_posn: ::c_char,
144 pub int_p_cs_precedes: ::c_char,
145 pub int_p_sep_by_space: ::c_char,
146 pub int_n_cs_precedes: ::c_char,
147 pub int_n_sep_by_space: ::c_char,
148 pub int_p_sign_posn: ::c_char,
149 pub int_n_sign_posn: ::c_char,
150 }
151
152 pub struct msghdr {
153 pub msg_name: *mut ::c_void,
154 pub msg_namelen: ::socklen_t,
155 pub msg_iov: *mut ::iovec,
156 pub msg_iovlen: ::c_int,
157 pub msg_control: *mut ::c_void,
158 pub msg_controllen: ::socklen_t,
159 pub msg_flags: ::c_int,
160 }
161
8bb4bdeb
XL
162 pub struct cmsghdr {
163 pub cmsg_len: ::size_t,
164 pub cmsg_level: ::c_int,
165 pub cmsg_type: ::c_int,
166 }
167
476ff2be
SL
168 pub struct Dl_info {
169 pub dli_fname: *const ::c_char,
170 pub dli_fbase: *mut ::c_void,
171 pub dli_sname: *const ::c_char,
172 pub dli_saddr: *mut ::c_void,
173 }
174
175 pub struct termios {
176 pub c_iflag: ::tcflag_t,
177 pub c_oflag: ::tcflag_t,
178 pub c_cflag: ::tcflag_t,
179 pub c_lflag: ::tcflag_t,
180 pub c_line: ::c_char,
181 pub c_ispeed: ::speed_t,
182 pub c_ospeed: ::speed_t,
183 pub c_cc: [::cc_t; ::NCCS],
184 }
185
abe05a73
XL
186 pub struct flock {
187 pub l_type: ::c_short,
188 pub l_whence: ::c_short,
189 pub l_start: ::off_t,
190 pub l_len: ::off_t,
191 pub l_pid: ::pid_t,
192 }
193
476ff2be
SL
194 pub struct stat {
195 pub st_dev: dev_t,
196 pub st_ino: ino_t,
197 pub st_mode: mode_t,
198 pub st_nlink: nlink_t,
199 pub st_uid: ::uid_t,
200 pub st_gid: ::gid_t,
201 pub st_size: off_t,
202 pub st_rdev: dev_t,
203 pub st_blksize: blksize_t,
204 pub st_atime: time_t,
205 pub st_atime_nsec: c_long,
206 pub st_mtime: time_t,
207 pub st_mtime_nsec: c_long,
208 pub st_ctime: time_t,
209 pub st_ctime_nsec: c_long,
210 pub st_crtime: time_t,
211 pub st_crtime_nsec: c_long,
212 pub st_type: u32,
213 pub st_blocks: blkcnt_t,
214 }
215
476ff2be
SL
216 pub struct glob_t {
217 pub gl_pathc: ::size_t,
218 __unused1: ::size_t,
219 pub gl_offs: ::size_t,
220 __unused2: ::size_t,
221 pub gl_pathv: *mut *mut c_char,
222
223 __unused3: *mut ::c_void,
224 __unused4: *mut ::c_void,
225 __unused5: *mut ::c_void,
226 __unused6: *mut ::c_void,
227 __unused7: *mut ::c_void,
228 __unused8: *mut ::c_void,
229 }
230
231 pub struct pthread_mutex_t {
232 flags: u32,
233 lock: i32,
234 unused: i32,
235 owner: i32,
236 owner_count: i32,
237 }
238
239 pub struct pthread_cond_t {
240 flags: u32,
241 unused: i32,
242 mutex: *mut ::c_void,
243 waiter_count: i32,
244 lock: i32,
245 }
246
247 pub struct pthread_rwlock_t {
248 flags: u32,
249 owner: i32,
250 lock_sem: i32, // this is actually a union
251 lock_count: i32,
252 reader_count: i32,
253 writer_count: i32,
254 waiters: [*mut ::c_void; 2],
255 }
256
257 pub struct passwd {
258 pub pw_name: *mut ::c_char,
259 pub pw_passwd: *mut ::c_char,
260 pub pw_uid: ::uid_t,
261 pub pw_gid: ::gid_t,
262 pub pw_dir: *mut ::c_char,
263 pub pw_shell: *mut ::c_char,
264 pub pw_gecos: *mut ::c_char,
265 }
266
267 pub struct statvfs {
268 pub f_bsize: ::c_ulong,
269 pub f_frsize: ::c_ulong,
270 pub f_blocks: ::fsblkcnt_t,
271 pub f_bfree: ::fsblkcnt_t,
272 pub f_bavail: ::fsblkcnt_t,
273 pub f_files: ::fsfilcnt_t,
274 pub f_ffree: ::fsfilcnt_t,
275 pub f_favail: ::fsfilcnt_t,
276 pub f_fsid: ::c_ulong,
277 pub f_flag: ::c_ulong,
278 pub f_namemax: ::c_ulong,
279 }
280
281 pub struct stack_t {
282 pub ss_sp: *mut ::c_void,
283 pub ss_size: ::size_t,
284 pub ss_flags: ::c_int,
285 }
286
287 pub struct siginfo_t {
288 pub si_signo: ::c_int,
289 pub si_code: ::c_int,
290 pub si_errno: ::c_int,
291 pub si_pid: ::pid_t,
292 pub si_uid: ::uid_t,
293 pub si_addr: *mut ::c_void,
294 pub si_status: ::c_int,
295 pub si_band: c_long,
296 pub sigval: *mut ::c_void,
297 }
298
299 pub struct sigaction {
300 pub sa_sigaction: ::sighandler_t,
301 pub sa_mask: ::sigset_t,
302 pub sa_flags: ::c_int,
303 sa_userdata: *mut ::c_void,
304 }
305
306 pub struct sem_t {
307 pub se_type: i32,
308 pub se_named_id: i32, // this is actually a union
309 pub se_unnamed: i32,
310 pub se_padding: [i32; 4],
311 }
312
313 pub struct pthread_condattr_t {
314 pub process_shared: bool,
315 pub clock_id: i32,
316 }
317}
318
532ac7d7
XL
319s_no_extra_traits! {
320 pub struct sockaddr_un {
321 pub sun_len: u8,
322 pub sun_family: sa_family_t,
323 pub sun_path: [::c_char; 126]
324 }
325 pub struct sockaddr_storage {
326 pub ss_len: u8,
327 pub ss_family: sa_family_t,
328 __ss_pad1: [u8; 6],
329 __ss_pad2: u64,
330 __ss_pad3: [u8; 112],
331 }
332 pub struct dirent {
333 pub d_dev: dev_t,
334 pub d_pdev: dev_t,
335 pub d_ino: ino_t,
336 pub d_pino: i64,
337 pub d_reclen: ::c_ushort,
338 pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
339 }
416331ca
XL
340
341 pub struct sigevent {
342 pub sigev_notify: ::c_int,
343 pub sigev_signo: ::c_int,
344 pub sigev_value: ::sigval,
345 __unused1: *mut ::c_void, // actually a function pointer
346 pub sigev_notify_attributes: *mut ::pthread_attr_t,
347 }
532ac7d7
XL
348}
349
350cfg_if! {
351 if #[cfg(feature = "extra_traits")] {
352 impl PartialEq for sockaddr_un {
353 fn eq(&self, other: &sockaddr_un) -> bool {
354 self.sun_len == other.sun_len
355 && self.sun_family == other.sun_family
356 && self
357 .sun_path
358 .iter()
359 .zip(other.sun_path.iter())
360 .all(|(a,b)| a == b)
361 }
362 }
363 impl Eq for sockaddr_un {}
364 impl ::fmt::Debug for sockaddr_un {
365 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
366 f.debug_struct("sockaddr_un")
367 .field("sun_len", &self.sun_len)
368 .field("sun_family", &self.sun_family)
369 // FIXME: .field("sun_path", &self.sun_path)
370 .finish()
371 }
372 }
373 impl ::hash::Hash for sockaddr_un {
374 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
375 self.sun_len.hash(state);
376 self.sun_family.hash(state);
377 self.sun_path.hash(state);
378 }
379 }
380
381 impl PartialEq for sockaddr_storage {
382 fn eq(&self, other: &sockaddr_storage) -> bool {
383 self.ss_len == other.ss_len
384 && self.ss_family == other.ss_family
385 && self
386 .__ss_pad1
387 .iter()
388 .zip(other.__ss_pad1.iter())
389 .all(|(a, b)| a == b)
390 && self.__ss_pad2 == other.__ss_pad2
391 && self
392 .__ss_pad3
393 .iter()
394 .zip(other.__ss_pad3.iter())
395 .all(|(a, b)| a == b)
396 }
397 }
398 impl Eq for sockaddr_storage {}
399 impl ::fmt::Debug for sockaddr_storage {
400 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
401 f.debug_struct("sockaddr_storage")
402 .field("ss_len", &self.ss_len)
403 .field("ss_family", &self.ss_family)
404 .field("__ss_pad1", &self.__ss_pad1)
405 .field("__ss_pad2", &self.__ss_pad2)
406 // FIXME: .field("__ss_pad3", &self.__ss_pad3)
407 .finish()
408 }
409 }
410 impl ::hash::Hash for sockaddr_storage {
411 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
412 self.ss_len.hash(state);
413 self.ss_family.hash(state);
414 self.__ss_pad1.hash(state);
415 self.__ss_pad2.hash(state);
416 self.__ss_pad3.hash(state);
417 }
418 }
419
420 impl PartialEq for dirent {
421 fn eq(&self, other: &dirent) -> bool {
422 self.d_dev == other.d_dev
423 && self.d_pdev == other.d_pdev
424 && self.d_ino == other.d_ino
425 && self.d_pino == other.d_pino
426 && self.d_reclen == other.d_reclen
427 && self
428 .d_name
429 .iter()
430 .zip(other.d_name.iter())
431 .all(|(a,b)| a == b)
432 }
433 }
434 impl Eq for dirent {}
435 impl ::fmt::Debug for dirent {
436 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
437 f.debug_struct("dirent")
438 .field("d_dev", &self.d_dev)
439 .field("d_pdev", &self.d_pdev)
440 .field("d_ino", &self.d_ino)
441 .field("d_pino", &self.d_pino)
442 .field("d_reclen", &self.d_reclen)
443 // FIXME: .field("d_name", &self.d_name)
444 .finish()
445 }
446 }
447 impl ::hash::Hash for dirent {
448 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
449 self.d_dev.hash(state);
450 self.d_pdev.hash(state);
451 self.d_ino.hash(state);
452 self.d_pino.hash(state);
453 self.d_reclen.hash(state);
454 self.d_name.hash(state);
455 }
456 }
416331ca
XL
457
458 impl PartialEq for sigevent {
459 fn eq(&self, other: &sigevent) -> bool {
460 self.sigev_notify == other.sigev_notify
461 && self.sigev_signo == other.sigev_signo
462 && self.sigev_value == other.sigev_value
463 && self.sigev_notify_attributes
464 == other.sigev_notify_attributes
465 }
466 }
467 impl Eq for sigevent {}
468 impl ::fmt::Debug for sigevent {
469 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
470 f.debug_struct("sigevent")
471 .field("sigev_notify", &self.sigev_notify)
472 .field("sigev_signo", &self.sigev_signo)
473 .field("sigev_value", &self.sigev_value)
474 .field("sigev_notify_attributes",
475 &self.sigev_notify_attributes)
476 .finish()
477 }
478 }
479 impl ::hash::Hash for sigevent {
480 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
481 self.sigev_notify.hash(state);
482 self.sigev_signo.hash(state);
483 self.sigev_value.hash(state);
484 self.sigev_notify_attributes.hash(state);
485 }
486 }
532ac7d7
XL
487 }
488}
489
476ff2be
SL
490// intentionally not public, only used for fd_set
491cfg_if! {
492 if #[cfg(target_pointer_width = "32")] {
493 const ULONG_SIZE: usize = 32;
494 } else if #[cfg(target_pointer_width = "64")] {
495 const ULONG_SIZE: usize = 64;
496 } else {
497 // Unknown target_pointer_width
498 }
499}
500
501pub const EXIT_FAILURE: ::c_int = 1;
502pub const EXIT_SUCCESS: ::c_int = 0;
503pub const RAND_MAX: ::c_int = 2147483647;
504pub const EOF: ::c_int = -1;
505pub const SEEK_SET: ::c_int = 0;
506pub const SEEK_CUR: ::c_int = 1;
507pub const SEEK_END: ::c_int = 2;
508pub const _IOFBF: ::c_int = 0;
509pub const _IONBF: ::c_int = 2;
510pub const _IOLBF: ::c_int = 1;
511
512pub const F_DUPFD: ::c_int = 0x0001;
513pub const F_GETFD: ::c_int = 0x0002;
514pub const F_SETFD: ::c_int = 0x0004;
515pub const F_GETFL: ::c_int = 0x0008;
516pub const F_SETFL: ::c_int = 0x0010;
abe05a73
XL
517pub const F_GETLK: ::c_int = 0x0020;
518pub const F_SETLK: ::c_int = 0x0080;
519pub const F_SETLKW: ::c_int = 0x0100;
520pub const F_DUPFD_CLOEXEC: ::c_int = 0x0200;
521
69743fb6
XL
522pub const F_RDLCK: ::c_int = 0x0040;
523pub const F_UNLCK: ::c_int = 0x0200;
524pub const F_WRLCK: ::c_int = 0x0400;
525
abe05a73
XL
526pub const AT_FDCWD: ::c_int = -1;
527pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01;
528pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02;
529pub const AT_REMOVEDIR: ::c_int = 0x04;
530pub const AT_EACCESS: ::c_int = 0x08;
531
532pub const POLLIN: ::c_short = 0x0001;
533pub const POLLOUT: ::c_short = 0x0002;
534pub const POLLRDNORM: ::c_short = POLLIN;
535pub const POLLWRNORM: ::c_short = POLLOUT;
536pub const POLLRDBAND: ::c_short = 0x0008;
537pub const POLLWRBAND: ::c_short = 0x0010;
538pub const POLLPRI: ::c_short = 0x0020;
539pub const POLLERR: ::c_short = 0x0004;
540pub const POLLHUP: ::c_short = 0x0080;
541pub const POLLNVAL: ::c_short = 0x1000;
476ff2be 542
476ff2be
SL
543pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
544pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
545
546pub const CLOCK_REALTIME: ::c_int = -1;
547pub const CLOCK_MONOTONIC: ::c_int = 0;
548
549pub const RLIMIT_CORE: ::c_int = 0;
550pub const RLIMIT_CPU: ::c_int = 1;
551pub const RLIMIT_DATA: ::c_int = 2;
552pub const RLIMIT_FSIZE: ::c_int = 3;
553pub const RLIMIT_NOFILE: ::c_int = 4;
8faf50e0 554pub const RLIMIT_STACK: ::c_int = 5;
476ff2be
SL
555pub const RLIMIT_AS: ::c_int = 6;
556// Haiku specific
557pub const RLIMIT_NOVMON: ::c_int = 7;
558pub const RLIMIT_NLIMITS: ::c_int = 8;
559
560pub const RUSAGE_SELF: ::c_int = 0;
561
8faf50e0 562pub const RTLD_LAZY: ::c_int = 0;
abe05a73 563
476ff2be
SL
564pub const NCCS: usize = 11;
565
566pub const O_RDONLY: ::c_int = 0x0000;
567pub const O_WRONLY: ::c_int = 0x0001;
568pub const O_RDWR: ::c_int = 0x0002;
569pub const O_ACCMODE: ::c_int = 0x0003;
570
571pub const O_EXCL: ::c_int = 0x0100;
572pub const O_CREAT: ::c_int = 0x0200;
573pub const O_TRUNC: ::c_int = 0x0400;
574pub const O_NOCTTY: ::c_int = 0x1000;
575pub const O_NOTRAVERSE: ::c_int = 0x2000;
576
577pub const O_CLOEXEC: ::c_int = 0x00000040;
578pub const O_NONBLOCK: ::c_int = 0x00000080;
579pub const O_APPEND: ::c_int = 0x00000800;
580pub const O_SYNC: ::c_int = 0x00010000;
581pub const O_RSYNC: ::c_int = 0x00020000;
582pub const O_DSYNC: ::c_int = 0x00040000;
583pub const O_NOFOLLOW: ::c_int = 0x00080000;
584pub const O_NOCACHE: ::c_int = 0x00100000;
585pub const O_DIRECTORY: ::c_int = 0x00200000;
586
e74abb32
XL
587pub const S_IFIFO: ::mode_t = 4096;
588pub const S_IFCHR: ::mode_t = 8192;
476ff2be
SL
589pub const S_IFBLK: ::mode_t = 24576;
590pub const S_IFDIR: ::mode_t = 16384;
591pub const S_IFREG: ::mode_t = 32768;
592pub const S_IFLNK: ::mode_t = 40960;
593pub const S_IFSOCK: ::mode_t = 49152;
594pub const S_IFMT: ::mode_t = 61440;
595pub const S_IRWXU: ::mode_t = 448;
596pub const S_IXUSR: ::mode_t = 64;
597pub const S_IWUSR: ::mode_t = 128;
598pub const S_IRUSR: ::mode_t = 256;
599pub const S_IRWXG: ::mode_t = 70;
600pub const S_IXGRP: ::mode_t = 10;
601pub const S_IWGRP: ::mode_t = 20;
602pub const S_IRGRP: ::mode_t = 40;
603pub const S_IRWXO: ::mode_t = 7;
604pub const S_IXOTH: ::mode_t = 1;
605pub const S_IWOTH: ::mode_t = 2;
606pub const S_IROTH: ::mode_t = 4;
607pub const F_OK: ::c_int = 0;
608pub const R_OK: ::c_int = 4;
609pub const W_OK: ::c_int = 2;
610pub const X_OK: ::c_int = 1;
611pub const STDIN_FILENO: ::c_int = 0;
612pub const STDOUT_FILENO: ::c_int = 1;
613pub const STDERR_FILENO: ::c_int = 2;
ea8adc8c 614
476ff2be
SL
615pub const SIGHUP: ::c_int = 1;
616pub const SIGINT: ::c_int = 2;
617pub const SIGQUIT: ::c_int = 3;
618pub const SIGILL: ::c_int = 4;
ea8adc8c 619pub const SIGCHLD: ::c_int = 5;
476ff2be 620pub const SIGABRT: ::c_int = 6;
ea8adc8c 621pub const SIGPIPE: ::c_int = 7;
476ff2be
SL
622pub const SIGFPE: ::c_int = 8;
623pub const SIGKILL: ::c_int = 9;
ea8adc8c 624pub const SIGSTOP: ::c_int = 10;
476ff2be 625pub const SIGSEGV: ::c_int = 11;
ea8adc8c
XL
626pub const SIGCONT: ::c_int = 12;
627pub const SIGTSTP: ::c_int = 13;
476ff2be
SL
628pub const SIGALRM: ::c_int = 14;
629pub const SIGTERM: ::c_int = 15;
ea8adc8c
XL
630pub const SIGTTIN: ::c_int = 16;
631pub const SIGTTOU: ::c_int = 17;
632pub const SIGUSR1: ::c_int = 18;
633pub const SIGUSR2: ::c_int = 19;
634pub const SIGWINCH: ::c_int = 20;
635pub const SIGKILLTHR: ::c_int = 21;
636pub const SIGTRAP: ::c_int = 22;
637pub const SIGPOLL: ::c_int = 23;
638pub const SIGPROF: ::c_int = 24;
639pub const SIGSYS: ::c_int = 25;
640pub const SIGURG: ::c_int = 26;
641pub const SIGVTALRM: ::c_int = 27;
642pub const SIGXCPU: ::c_int = 28;
643pub const SIGXFSZ: ::c_int = 29;
644pub const SIGBUS: ::c_int = 30;
476ff2be 645
abe05a73
XL
646pub const SIG_BLOCK: ::c_int = 1;
647pub const SIG_UNBLOCK: ::c_int = 2;
648pub const SIG_SETMASK: ::c_int = 3;
649
650pub const SIGEV_NONE: ::c_int = 0;
651pub const SIGEV_SIGNAL: ::c_int = 1;
652pub const SIGEV_THREAD: ::c_int = 2;
653
2c00a5a8
XL
654pub const EAI_AGAIN: ::c_int = 2;
655pub const EAI_BADFLAGS: ::c_int = 3;
656pub const EAI_FAIL: ::c_int = 4;
657pub const EAI_FAMILY: ::c_int = 5;
658pub const EAI_MEMORY: ::c_int = 6;
659pub const EAI_NODATA: ::c_int = 7;
660pub const EAI_NONAME: ::c_int = 8;
661pub const EAI_SERVICE: ::c_int = 9;
662pub const EAI_SOCKTYPE: ::c_int = 10;
476ff2be 663pub const EAI_SYSTEM: ::c_int = 11;
2c00a5a8 664pub const EAI_OVERFLOW: ::c_int = 14;
476ff2be
SL
665
666pub const PROT_NONE: ::c_int = 0;
667pub const PROT_READ: ::c_int = 1;
668pub const PROT_WRITE: ::c_int = 2;
669pub const PROT_EXEC: ::c_int = 4;
670
671pub const LC_ALL: ::c_int = 0;
672pub const LC_COLLATE: ::c_int = 1;
673pub const LC_CTYPE: ::c_int = 2;
674pub const LC_MONETARY: ::c_int = 3;
675pub const LC_NUMERIC: ::c_int = 4;
676pub const LC_TIME: ::c_int = 5;
677pub const LC_MESSAGES: ::c_int = 6;
678
ba9703b0 679// FIXME: Haiku does not have MAP_FILE, but libstd/os.rs requires it
476ff2be
SL
680pub const MAP_FILE: ::c_int = 0x00;
681pub const MAP_SHARED: ::c_int = 0x01;
682pub const MAP_PRIVATE: ::c_int = 0x02;
abe05a73
XL
683pub const MAP_FIXED: ::c_int = 0x04;
684pub const MAP_ANONYMOUS: ::c_int = 0x08;
685pub const MAP_ANON: ::c_int = MAP_ANONYMOUS;
476ff2be
SL
686
687pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
688
689pub const MS_ASYNC: ::c_int = 0x01;
690pub const MS_INVALIDATE: ::c_int = 0x04;
691pub const MS_SYNC: ::c_int = 0x02;
692
e74abb32
XL
693pub const E2BIG: ::c_int = -2147454975;
694pub const ECHILD: ::c_int = -2147454974;
695pub const EDEADLK: ::c_int = -2147454973;
696pub const EFBIG: ::c_int = -2147454972;
697pub const EMLINK: ::c_int = -2147454971;
698pub const ENFILE: ::c_int = -2147454970;
699pub const ENODEV: ::c_int = -2147454969;
700pub const ENOLCK: ::c_int = -2147454968;
701pub const ENOSYS: ::c_int = -2147454967;
702pub const ENOTTY: ::c_int = -2147454966;
703pub const ENXIO: ::c_int = -2147454965;
704pub const ESPIPE: ::c_int = -2147454964;
705pub const ESRCH: ::c_int = -2147454963;
706pub const EFPOS: ::c_int = -2147457962;
707pub const ESIGPARM: ::c_int = -2147457961;
708pub const EDOM: ::c_int = -2147454960;
709pub const ERANGE: ::c_int = -2147454959;
710pub const EPROTOTYPE: ::c_int = -2147454958;
711pub const EPROTONOSUPPORT: ::c_int = -2147454957;
712pub const EPFNOSUPPORT: ::c_int = -2147454956;
713pub const EAFNOSUPPORT: ::c_int = -2147454955;
714pub const EADDRINUSE: ::c_int = -2147454954;
715pub const EADDRNOTAVAIL: ::c_int = -2147454953;
716pub const ENETDOWN: ::c_int = -2147454952;
717pub const ENETUNREACH: ::c_int = -2147454951;
718pub const ENETRESET: ::c_int = -2147454950;
719pub const ECONNABORTED: ::c_int = -2147454949;
720pub const ECONNRESET: ::c_int = -2147454948;
721pub const EISCONN: ::c_int = -2147454947;
722pub const ENOTCONN: ::c_int = -2147454946;
723pub const ESHUTDOWN: ::c_int = -2147454945;
724pub const ECONNREFUSED: ::c_int = -2147454944;
725pub const EHOSTUNREACH: ::c_int = -2147454943;
726pub const ENOPROTOOPT: ::c_int = -2147454942;
727pub const ENOBUFS: ::c_int = -2147454941;
728pub const EINPROGRESS: ::c_int = -2147454940;
729pub const EALREADY: ::c_int = -2147454939;
730pub const EILSEQ: ::c_int = -2147454938;
731pub const ENOMSG: ::c_int = -2147454937;
732pub const ESTALE: ::c_int = -2147454936;
733pub const EOVERFLOW: ::c_int = -2147454935;
734pub const EMSGSIZE: ::c_int = -2147454934;
735pub const EOPNOTSUPP: ::c_int = -2147454933;
736pub const ENOTSOCK: ::c_int = -2147454932;
737pub const EHOSTDOWN: ::c_int = -2147454931;
738pub const EBADMSG: ::c_int = -2147454930;
739pub const ECANCELED: ::c_int = -2147454929;
740pub const EDESTADDRREQ: ::c_int = -2147454928;
741pub const EDQUOT: ::c_int = -2147454927;
742pub const EIDRM: ::c_int = -2147454926;
743pub const EMULTIHOP: ::c_int = -2147454925;
744pub const ENODATA: ::c_int = -2147454924;
745pub const ENOLINK: ::c_int = -2147454923;
746pub const ENOSR: ::c_int = -2147454922;
747pub const ENOSTR: ::c_int = -2147454921;
748pub const ENOTSUP: ::c_int = -2147454920;
749pub const EPROTO: ::c_int = -2147454919;
750pub const ETIME: ::c_int = -2147454918;
751pub const ETXTBSY: ::c_int = -2147454917;
752pub const ENOATTR: ::c_int = -2147454916;
ea8adc8c
XL
753
754// INT_MIN
e74abb32 755pub const ENOMEM: ::c_int = -2147454976;
ea8adc8c
XL
756
757// POSIX errors that can be mapped to BeOS error codes
e74abb32
XL
758pub const EACCES: ::c_int = -2147483646;
759pub const EINTR: ::c_int = -2147483638;
760pub const EIO: ::c_int = -2147483647;
761pub const EBUSY: ::c_int = -2147483634;
762pub const EFAULT: ::c_int = -2147478783;
763pub const ETIMEDOUT: ::c_int = -2147483639;
764pub const EAGAIN: ::c_int = -2147483637;
765pub const EWOULDBLOCK: ::c_int = -2147483637;
766pub const EBADF: ::c_int = -2147459072;
767pub const EEXIST: ::c_int = -2147459070;
768pub const EINVAL: ::c_int = -2147483643;
769pub const ENAMETOOLONG: ::c_int = -2147459068;
770pub const ENOENT: ::c_int = -2147459069;
771pub const EPERM: ::c_int = -2147483633;
772pub const ENOTDIR: ::c_int = -2147459067;
773pub const EISDIR: ::c_int = -2147459063;
774pub const ENOTEMPTY: ::c_int = -2147459066;
775pub const ENOSPC: ::c_int = -2147459065;
776pub const EROFS: ::c_int = -2147459064;
777pub const EMFILE: ::c_int = -2147459062;
778pub const EXDEV: ::c_int = -2147459061;
779pub const ELOOP: ::c_int = -2147459060;
780pub const ENOEXEC: ::c_int = -2147478782;
781pub const EPIPE: ::c_int = -2147459059;
476ff2be
SL
782
783pub const IPPROTO_RAW: ::c_int = 255;
784
785// These are prefixed with POSIX_ on Haiku
786pub const MADV_NORMAL: ::c_int = 1;
787pub const MADV_SEQUENTIAL: ::c_int = 2;
788pub const MADV_RANDOM: ::c_int = 3;
789pub const MADV_WILLNEED: ::c_int = 4;
790pub const MADV_DONTNEED: ::c_int = 5;
791
ff7c6d11
XL
792// https://github.com/haiku/haiku/blob/master/headers/posix/net/if.h#L80
793pub const IFF_UP: ::c_int = 0x0001;
794pub const IFF_BROADCAST: ::c_int = 0x0002; // valid broadcast address
476ff2be 795pub const IFF_LOOPBACK: ::c_int = 0x0008;
ff7c6d11
XL
796pub const IFF_POINTOPOINT: ::c_int = 0x0010; // point-to-point link
797pub const IFF_NOARP: ::c_int = 0x0040; // no address resolution
798pub const IFF_AUTOUP: ::c_int = 0x0080; // auto dial
799pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
800pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
801pub const IFF_SIMPLEX: ::c_int = 0x0800; // doesn't receive own transmissions
802pub const IFF_LINK: ::c_int = 0x1000; // has link
803pub const IFF_AUTO_CONFIGURED: ::c_int = 0x2000;
804pub const IFF_CONFIGURING: ::c_int = 0x4000;
805pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
476ff2be 806
f035d41b 807pub const AF_UNSPEC: ::c_int = 0;
476ff2be 808pub const AF_INET: ::c_int = 1;
abe05a73
XL
809pub const AF_APPLETALK: ::c_int = 2;
810pub const AF_ROUTE: ::c_int = 3;
811pub const AF_LINK: ::c_int = 4;
812pub const AF_INET6: ::c_int = 5;
813pub const AF_DLI: ::c_int = 6;
814pub const AF_IPX: ::c_int = 7;
815pub const AF_NOTIFY: ::c_int = 8;
816pub const AF_LOCAL: ::c_int = 9;
817pub const AF_UNIX: ::c_int = AF_LOCAL;
818pub const AF_BLUETOOTH: ::c_int = 10;
abe05a73 819
b7449926
XL
820pub const IP_OPTIONS: ::c_int = 1;
821pub const IP_HDRINCL: ::c_int = 2;
822pub const IP_TOS: ::c_int = 3;
823pub const IP_TTL: ::c_int = 4;
824pub const IP_RECVOPTS: ::c_int = 5;
825pub const IP_RECVRETOPTS: ::c_int = 6;
826pub const IP_RECVDSTADDR: ::c_int = 7;
827pub const IP_RETOPTS: ::c_int = 8;
828pub const IP_MULTICAST_IF: ::c_int = 9;
476ff2be
SL
829pub const IP_MULTICAST_TTL: ::c_int = 10;
830pub const IP_MULTICAST_LOOP: ::c_int = 11;
476ff2be
SL
831pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
832pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
b7449926
XL
833pub const IP_BLOCK_SOURCE: ::c_int = 14;
834pub const IP_UNBLOCK_SOURCE: ::c_int = 15;
835pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 16;
836pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 17;
476ff2be
SL
837
838pub const TCP_NODELAY: ::c_int = 0x01;
839pub const TCP_MAXSEG: ::c_int = 0x02;
840pub const TCP_NOPUSH: ::c_int = 0x04;
841pub const TCP_NOOPT: ::c_int = 0x08;
842
b7449926
XL
843pub const IPV6_MULTICAST_IF: ::c_int = 24;
844pub const IPV6_MULTICAST_HOPS: ::c_int = 25;
476ff2be 845pub const IPV6_MULTICAST_LOOP: ::c_int = 26;
b7449926 846pub const IPV6_UNICAST_HOPS: ::c_int = 27;
476ff2be
SL
847pub const IPV6_JOIN_GROUP: ::c_int = 28;
848pub const IPV6_LEAVE_GROUP: ::c_int = 29;
849pub const IPV6_V6ONLY: ::c_int = 30;
b7449926
XL
850pub const IPV6_PKTINFO: ::c_int = 31;
851pub const IPV6_RECVPKTINFO: ::c_int = 32;
852pub const IPV6_HOPLIMIT: ::c_int = 33;
853pub const IPV6_REVCHOPLIMIT: ::c_int = 34;
854pub const IPV6_HOPOPTS: ::c_int = 35;
855pub const IPV6_DSTOPTS: ::c_int = 36;
856pub const IPV6_RTHDR: ::c_int = 37;
476ff2be 857
abe05a73
XL
858pub const MSG_OOB: ::c_int = 0x0001;
859pub const MSG_PEEK: ::c_int = 0x0002;
860pub const MSG_DONTROUTE: ::c_int = 0x0004;
861pub const MSG_EOR: ::c_int = 0x0008;
862pub const MSG_TRUNC: ::c_int = 0x0010;
863pub const MSG_CTRUNC: ::c_int = 0x0020;
864pub const MSG_WAITALL: ::c_int = 0x0040;
865pub const MSG_DONTWAIT: ::c_int = 0x0080;
866pub const MSG_BCAST: ::c_int = 0x0100;
867pub const MSG_MCAST: ::c_int = 0x0200;
868pub const MSG_EOF: ::c_int = 0x0400;
476ff2be
SL
869pub const MSG_NOSIGNAL: ::c_int = 0x0800;
870
871pub const SHUT_RD: ::c_int = 0;
872pub const SHUT_WR: ::c_int = 1;
873pub const SHUT_RDWR: ::c_int = 2;
874
875pub const LOCK_SH: ::c_int = 0x01;
876pub const LOCK_EX: ::c_int = 0x02;
877pub const LOCK_NB: ::c_int = 0x04;
878pub const LOCK_UN: ::c_int = 0x08;
879
880pub const SIGSTKSZ: ::size_t = 16384;
881
abe05a73
XL
882pub const PATH_MAX: ::c_int = 1024;
883
884pub const SA_NOCLDSTOP: ::c_int = 0x01;
885pub const SA_NOCLDWAIT: ::c_int = 0x02;
476ff2be 886pub const SA_RESETHAND: ::c_int = 0x04;
abe05a73 887pub const SA_NODEFER: ::c_int = 0x08;
476ff2be 888pub const SA_RESTART: ::c_int = 0x10;
abe05a73
XL
889pub const SA_ONSTACK: ::c_int = 0x20;
890pub const SA_SIGINFO: ::c_int = 0x40;
891pub const SA_NOMASK: ::c_int = SA_NODEFER;
892pub const SA_STACK: ::c_int = SA_ONSTACK;
893pub const SA_ONESHOT: ::c_int = SA_RESETHAND;
476ff2be
SL
894
895pub const FD_SETSIZE: usize = 1024;
896
8faf50e0 897pub const RTLD_LOCAL: ::c_int = 0x0;
476ff2be 898pub const RTLD_NOW: ::c_int = 0x1;
8faf50e0 899pub const RTLD_GLOBAL: ::c_int = 0x2;
476ff2be
SL
900pub const RTLD_DEFAULT: *mut ::c_void = 0isize as *mut ::c_void;
901
902pub const BUFSIZ: ::c_uint = 8192;
903pub const FILENAME_MAX: ::c_uint = 256;
904pub const FOPEN_MAX: ::c_uint = 128;
905pub const L_tmpnam: ::c_uint = 512;
906pub const TMP_MAX: ::c_uint = 32768;
abe05a73
XL
907
908pub const _PC_CHOWN_RESTRICTED: ::c_int = 1;
909pub const _PC_MAX_CANON: ::c_int = 2;
910pub const _PC_MAX_INPUT: ::c_int = 3;
476ff2be 911pub const _PC_NAME_MAX: ::c_int = 4;
abe05a73
XL
912pub const _PC_NO_TRUNC: ::c_int = 5;
913pub const _PC_PATH_MAX: ::c_int = 6;
914pub const _PC_PIPE_BUF: ::c_int = 7;
915pub const _PC_VDISABLE: ::c_int = 8;
916pub const _PC_LINK_MAX: ::c_int = 25;
917pub const _PC_SYNC_IO: ::c_int = 26;
918pub const _PC_ASYNC_IO: ::c_int = 27;
919pub const _PC_PRIO_IO: ::c_int = 28;
920pub const _PC_SOCK_MAXBUF: ::c_int = 29;
921pub const _PC_FILESIZEBITS: ::c_int = 30;
922pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 31;
923pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 32;
924pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 33;
925pub const _PC_REC_XFER_ALIGN: ::c_int = 34;
926pub const _PC_ALLOC_SIZE_MIN: ::c_int = 35;
927pub const _PC_SYMLINK_MAX: ::c_int = 36;
928pub const _PC_2_SYMLINKS: ::c_int = 37;
929pub const _PC_XATTR_EXISTS: ::c_int = 38;
930pub const _PC_XATTR_ENABLED: ::c_int = 39;
476ff2be
SL
931
932pub const FIONBIO: ::c_int = 0xbe000000;
933
e74abb32
XL
934pub const _SC_ARG_MAX: ::c_int = 15;
935pub const _SC_CHILD_MAX: ::c_int = 16;
936pub const _SC_CLK_TCK: ::c_int = 17;
937pub const _SC_JOB_CONTROL: ::c_int = 18;
938pub const _SC_NGROUPS_MAX: ::c_int = 19;
939pub const _SC_OPEN_MAX: ::c_int = 20;
940pub const _SC_SAVED_IDS: ::c_int = 21;
941pub const _SC_STREAM_MAX: ::c_int = 22;
942pub const _SC_TZNAME_MAX: ::c_int = 23;
943pub const _SC_VERSION: ::c_int = 24;
944pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 25;
945pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 26;
946pub const _SC_PAGESIZE: ::c_int = 27;
947pub const _SC_PAGE_SIZE: ::c_int = 27;
948pub const _SC_SEM_NSEMS_MAX: ::c_int = 28;
949pub const _SC_SEM_VALUE_MAX: ::c_int = 29;
950pub const _SC_SEMAPHORES: ::c_int = 30;
951pub const _SC_THREADS: ::c_int = 31;
952pub const _SC_IOV_MAX: ::c_int = 32;
953pub const _SC_UIO_MAXIOV: ::c_int = 32;
954pub const _SC_NPROCESSORS_CONF: ::c_int = 34;
955pub const _SC_NPROCESSORS_ONLN: ::c_int = 35;
956pub const _SC_ATEXIT_MAX: ::c_int = 37;
957pub const _SC_PASS_MAX: ::c_int = 39;
958pub const _SC_PHYS_PAGES: ::c_int = 40;
959pub const _SC_AVPHYS_PAGES: ::c_int = 41;
960pub const _SC_PIPE: ::c_int = 42;
961pub const _SC_SELECT: ::c_int = 43;
962pub const _SC_POLL: ::c_int = 44;
963pub const _SC_MAPPED_FILES: ::c_int = 45;
964pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 46;
965pub const _SC_THREAD_STACK_MIN: ::c_int = 47;
966pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 48;
967pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 49;
968pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 50;
969pub const _SC_REALTIME_SIGNALS: ::c_int = 51;
970pub const _SC_MEMORY_PROTECTION: ::c_int = 52;
971pub const _SC_SIGQUEUE_MAX: ::c_int = 53;
972pub const _SC_RTSIG_MAX: ::c_int = 54;
973pub const _SC_MONOTONIC_CLOCK: ::c_int = 55;
974pub const _SC_DELAYTIMER_MAX: ::c_int = 56;
975pub const _SC_TIMER_MAX: ::c_int = 57;
976pub const _SC_TIMERS: ::c_int = 58;
977pub const _SC_CPUTIME: ::c_int = 59;
978pub const _SC_THREAD_CPUTIME: ::c_int = 60;
3dfed10e
XL
979pub const _SC_HOST_NAME_MAX: ::c_int = 61;
980pub const _SC_REGEXP: ::c_int = 62;
981pub const _SC_SYMLOOP_MAX: ::c_int = 63;
982pub const _SC_SHELL: ::c_int = 64;
476ff2be
SL
983
984pub const PTHREAD_STACK_MIN: ::size_t = 8192;
985
986pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
987 flags: 0,
988 lock: 0,
989 unused: -42,
990 owner: -1,
991 owner_count: 0,
992};
993pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
994 flags: 0,
995 unused: -42,
996 mutex: 0 as *mut _,
997 waiter_count: 0,
998 lock: 0,
999};
1000pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1001 flags: 0,
ea8adc8c 1002 owner: -1,
476ff2be
SL
1003 lock_sem: 0,
1004 lock_count: 0,
1005 reader_count: 0,
1006 writer_count: 0,
1007 waiters: [0 as *mut _; 2],
1008};
1009
1010pub const PTHREAD_MUTEX_DEFAULT: ::c_int = 0;
1011pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1;
1012pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
1013pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
1014
ba9703b0 1015pub const FIOCLEX: c_ulong = 0; // FIXME: does not exist on Haiku!
476ff2be 1016
476ff2be
SL
1017pub const RUSAGE_CHILDREN: ::c_int = -1;
1018
1019pub const SOCK_STREAM: ::c_int = 1;
1020pub const SOCK_DGRAM: ::c_int = 2;
ea8adc8c
XL
1021pub const SOCK_RAW: ::c_int = 3;
1022pub const SOCK_SEQPACKET: ::c_int = 5;
476ff2be
SL
1023
1024pub const SOL_SOCKET: ::c_int = -1;
1025pub const SO_ACCEPTCONN: ::c_int = 0x00000001;
1026pub const SO_BROADCAST: ::c_int = 0x00000002;
abe05a73 1027pub const SO_DEBUG: ::c_int = 0x00000004;
476ff2be
SL
1028pub const SO_DONTROUTE: ::c_int = 0x00000008;
1029pub const SO_KEEPALIVE: ::c_int = 0x00000010;
1030pub const SO_OOBINLINE: ::c_int = 0x00000020;
1031pub const SO_REUSEADDR: ::c_int = 0x00000040;
1032pub const SO_REUSEPORT: ::c_int = 0x00000080;
1033pub const SO_USELOOPBACK: ::c_int = 0x00000100;
1034pub const SO_LINGER: ::c_int = 0x00000200;
1035pub const SO_SNDBUF: ::c_int = 0x40000001;
1036pub const SO_SNDLOWAT: ::c_int = 0x40000002;
1037pub const SO_SNDTIMEO: ::c_int = 0x40000003;
1038pub const SO_RCVBUF: ::c_int = 0x40000004;
1039pub const SO_RCVLOWAT: ::c_int = 0x40000005;
1040pub const SO_RCVTIMEO: ::c_int = 0x40000006;
1041pub const SO_ERROR: ::c_int = 0x40000007;
1042pub const SO_TYPE: ::c_int = 0x40000008;
1043pub const SO_NONBLOCK: ::c_int = 0x40000009;
1044pub const SO_BINDTODEVICE: ::c_int = 0x4000000a;
1045pub const SO_PEERCRED: ::c_int = 0x4000000b;
1046
abe05a73
XL
1047pub const SCM_RIGHTS: ::c_int = 0x01;
1048
476ff2be
SL
1049pub const NI_MAXHOST: ::size_t = 1025;
1050
8bb4bdeb
XL
1051pub const WNOHANG: ::c_int = 0x01;
1052pub const WUNTRACED: ::c_int = 0x02;
1053pub const WCONTINUED: ::c_int = 0x04;
1054pub const WEXITED: ::c_int = 0x08;
1055pub const WSTOPPED: ::c_int = 0x10;
1056pub const WNOWAIT: ::c_int = 0x20;
1057
1058pub const P_ALL: idtype_t = 0;
1059pub const P_PID: idtype_t = 1;
1060pub const P_PGID: idtype_t = 2;
1061
e74abb32
XL
1062pub const UTIME_OMIT: c_long = 1000000001;
1063pub const UTIME_NOW: c_long = 1000000000;
1064
041b39d2
XL
1065pub const VINTR: usize = 0;
1066pub const VQUIT: usize = 1;
1067pub const VERASE: usize = 2;
1068pub const VKILL: usize = 3;
1069pub const VEOF: usize = 4;
1070pub const VEOL: usize = 5;
1071pub const VMIN: usize = 4;
1072pub const VTIME: usize = 5;
1073pub const VEOL2: usize = 6;
1074pub const VSWTCH: usize = 7;
1075pub const VSTART: usize = 8;
1076pub const VSTOP: usize = 9;
1077pub const VSUSP: usize = 10;
abe05a73
XL
1078
1079pub const IGNBRK: ::tcflag_t = 0x01;
1080pub const BRKINT: ::tcflag_t = 0x02;
1081pub const IGNPAR: ::tcflag_t = 0x04;
1082pub const PARMRK: ::tcflag_t = 0x08;
1083pub const INPCK: ::tcflag_t = 0x10;
1084pub const ISTRIP: ::tcflag_t = 0x20;
1085pub const INLCR: ::tcflag_t = 0x40;
1086pub const IGNCR: ::tcflag_t = 0x80;
1087pub const ICRNL: ::tcflag_t = 0x100;
1088pub const IUCLC: ::tcflag_t = 0x200;
1089pub const IXON: ::tcflag_t = 0x400;
1090pub const IXANY: ::tcflag_t = 0x800;
1091pub const IXOFF: ::tcflag_t = 0x1000;
1092
e74abb32
XL
1093pub const OPOST: ::tcflag_t = 0x00000001;
1094pub const OLCUC: ::tcflag_t = 0x00000002;
1095pub const ONLCR: ::tcflag_t = 0x00000004;
1096pub const OCRNL: ::tcflag_t = 0x00000008;
1097pub const ONOCR: ::tcflag_t = 0x00000010;
abe05a73 1098pub const ONLRET: ::tcflag_t = 0x00000020;
e74abb32
XL
1099pub const OFILL: ::tcflag_t = 0x00000040;
1100pub const OFDEL: ::tcflag_t = 0x00000080;
1101pub const NLDLY: ::tcflag_t = 0x00000100;
1102pub const NL0: ::tcflag_t = 0x00000000;
1103pub const NL1: ::tcflag_t = 0x00000100;
1104pub const CRDLY: ::tcflag_t = 0x00000600;
1105pub const CR0: ::tcflag_t = 0x00000000;
1106pub const CR1: ::tcflag_t = 0x00000200;
1107pub const CR2: ::tcflag_t = 0x00000400;
1108pub const CR3: ::tcflag_t = 0x00000600;
abe05a73 1109pub const TABDLY: ::tcflag_t = 0x00001800;
e74abb32
XL
1110pub const TAB0: ::tcflag_t = 0x00000000;
1111pub const TAB1: ::tcflag_t = 0x00000800;
1112pub const TAB2: ::tcflag_t = 0x00001000;
1113pub const TAB3: ::tcflag_t = 0x00001800;
1114pub const BSDLY: ::tcflag_t = 0x00002000;
1115pub const BS0: ::tcflag_t = 0x00000000;
1116pub const BS1: ::tcflag_t = 0x00002000;
1117pub const VTDLY: ::tcflag_t = 0x00004000;
1118pub const VT0: ::tcflag_t = 0x00000000;
1119pub const VT1: ::tcflag_t = 0x00004000;
1120pub const FFDLY: ::tcflag_t = 0x00008000;
1121pub const FF0: ::tcflag_t = 0x00000000;
1122pub const FF1: ::tcflag_t = 0x00008000;
1123
1124pub const CSIZE: ::tcflag_t = 0x00000020;
1125pub const CS5: ::tcflag_t = 0x00000000;
1126pub const CS6: ::tcflag_t = 0x00000000;
1127pub const CS7: ::tcflag_t = 0x00000000;
1128pub const CS8: ::tcflag_t = 0x00000020;
1129pub const CSTOPB: ::tcflag_t = 0x00000040;
1130pub const CREAD: ::tcflag_t = 0x00000080;
1131pub const PARENB: ::tcflag_t = 0x00000100;
1132pub const PARODD: ::tcflag_t = 0x00000200;
1133pub const HUPCL: ::tcflag_t = 0x00000400;
1134pub const CLOCAL: ::tcflag_t = 0x00000800;
1135pub const XLOBLK: ::tcflag_t = 0x00001000;
1136pub const CTSFLOW: ::tcflag_t = 0x00002000;
1137pub const RTSFLOW: ::tcflag_t = 0x00004000;
1138pub const CRTSCTS: ::tcflag_t = RTSFLOW | CTSFLOW;
1139
1140pub const ISIG: ::tcflag_t = 0x00000001;
1141pub const ICANON: ::tcflag_t = 0x00000002;
1142pub const XCASE: ::tcflag_t = 0x00000004;
1143pub const ECHO: ::tcflag_t = 0x00000008;
1144pub const ECHOE: ::tcflag_t = 0x00000010;
1145pub const ECHOK: ::tcflag_t = 0x00000020;
1146pub const ECHONL: ::tcflag_t = 0x00000040;
1147pub const NOFLSH: ::tcflag_t = 0x00000080;
1148pub const TOSTOP: ::tcflag_t = 0x00000100;
1149pub const IEXTEN: ::tcflag_t = 0x00000200;
1150pub const ECHOCTL: ::tcflag_t = 0x00000400;
1151pub const ECHOPRT: ::tcflag_t = 0x00000800;
1152pub const ECHOKE: ::tcflag_t = 0x00001000;
1153pub const FLUSHO: ::tcflag_t = 0x00002000;
1154pub const PENDIN: ::tcflag_t = 0x00004000;
041b39d2
XL
1155
1156pub const TCGB_CTS: ::c_int = 0x01;
1157pub const TCGB_DSR: ::c_int = 0x02;
1158pub const TCGB_RI: ::c_int = 0x04;
1159pub const TCGB_DCD: ::c_int = 0x08;
1160pub const TIOCM_CTS: ::c_int = TCGB_CTS;
1161pub const TIOCM_CD: ::c_int = TCGB_DCD;
1162pub const TIOCM_CAR: ::c_int = TIOCM_CD;
1163pub const TIOCM_RI: ::c_int = TCGB_RI;
ea8adc8c 1164pub const TIOCM_DSR: ::c_int = TCGB_DSR;
041b39d2
XL
1165pub const TIOCM_DTR: ::c_int = 0x10;
1166pub const TIOCM_RTS: ::c_int = 0x20;
1167
e74abb32
XL
1168pub const B0: speed_t = 0x00;
1169pub const B50: speed_t = 0x01;
1170pub const B75: speed_t = 0x02;
1171pub const B110: speed_t = 0x03;
1172pub const B134: speed_t = 0x04;
1173pub const B150: speed_t = 0x05;
1174pub const B200: speed_t = 0x06;
1175pub const B300: speed_t = 0x07;
1176pub const B600: speed_t = 0x08;
1177pub const B1200: speed_t = 0x09;
1178pub const B1800: speed_t = 0x0A;
1179pub const B2400: speed_t = 0x0B;
1180pub const B4800: speed_t = 0x0C;
1181pub const B9600: speed_t = 0x0D;
1182pub const B19200: speed_t = 0x0E;
1183pub const B38400: speed_t = 0x0F;
1184pub const B57600: speed_t = 0x10;
abe05a73
XL
1185pub const B115200: speed_t = 0x11;
1186pub const B230400: speed_t = 0x12;
e74abb32 1187pub const B31250: speed_t = 0x13;
abe05a73
XL
1188
1189pub const TCSANOW: ::c_int = 0x01;
1190pub const TCSADRAIN: ::c_int = 0x02;
1191pub const TCSAFLUSH: ::c_int = 0x04;
1192
1193pub const TCOOFF: ::c_int = 0x01;
1194pub const TCOON: ::c_int = 0x02;
1195pub const TCIOFF: ::c_int = 0x04;
1196pub const TCION: ::c_int = 0x08;
1197
1198pub const TCIFLUSH: ::c_int = 0x01;
1199pub const TCOFLUSH: ::c_int = 0x02;
1200pub const TCIOFLUSH: ::c_int = 0x03;
1201
e74abb32
XL
1202pub const TCGETA: ::c_int = 0x8000;
1203pub const TCSETA: ::c_int = TCGETA + 1;
1204pub const TCSETAF: ::c_int = TCGETA + 2;
1205pub const TCSETAW: ::c_int = TCGETA + 3;
416331ca 1206pub const TCWAITEVENT: ::c_int = TCGETA + 4;
e74abb32
XL
1207pub const TCSBRK: ::c_int = TCGETA + 5;
1208pub const TCFLSH: ::c_int = TCGETA + 6;
1209pub const TCXONC: ::c_int = TCGETA + 7;
416331ca 1210pub const TCQUERYCONNECTED: ::c_int = TCGETA + 8;
e74abb32
XL
1211pub const TCGETBITS: ::c_int = TCGETA + 9;
1212pub const TCSETDTR: ::c_int = TCGETA + 10;
1213pub const TCSETRTS: ::c_int = TCGETA + 11;
1214pub const TIOCGWINSZ: ::c_int = TCGETA + 12;
1215pub const TIOCSWINSZ: ::c_int = TCGETA + 13;
1216pub const TCVTIME: ::c_int = TCGETA + 14;
1217pub const TIOCGPGRP: ::c_int = TCGETA + 15;
1218pub const TIOCSPGRP: ::c_int = TCGETA + 16;
1219pub const TIOCSCTTY: ::c_int = TCGETA + 17;
1220pub const TIOCMGET: ::c_int = TCGETA + 18;
1221pub const TIOCMSET: ::c_int = TCGETA + 19;
1222pub const TIOCSBRK: ::c_int = TCGETA + 20;
1223pub const TIOCCBRK: ::c_int = TCGETA + 21;
1224pub const TIOCMBIS: ::c_int = TCGETA + 22;
1225pub const TIOCMBIC: ::c_int = TCGETA + 23;
416331ca 1226
f035d41b
XL
1227pub const PRIO_PROCESS: ::c_int = 0;
1228pub const PRIO_PGRP: ::c_int = 1;
1229pub const PRIO_USER: ::c_int = 2;
1230
476ff2be
SL
1231f! {
1232 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
1233 let fd = fd as usize;
532ac7d7 1234 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
476ff2be
SL
1235 (*set).fds_bits[fd / size] &= !(1 << (fd % size));
1236 return
1237 }
1238
1239 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1240 let fd = fd as usize;
532ac7d7 1241 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
476ff2be
SL
1242 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
1243 }
1244
1245 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
1246 let fd = fd as usize;
532ac7d7 1247 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
476ff2be
SL
1248 (*set).fds_bits[fd / size] |= 1 << (fd % size);
1249 return
1250 }
1251
1252 pub fn FD_ZERO(set: *mut fd_set) -> () {
1253 for slot in (*set).fds_bits.iter_mut() {
1254 *slot = 0;
1255 }
1256 }
1257
1258 pub fn WIFEXITED(status: ::c_int) -> bool {
abe05a73 1259 (status & !0xff) == 0
476ff2be
SL
1260 }
1261
1262 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
ba9703b0 1263 status & 0xff
476ff2be
SL
1264 }
1265
abe05a73
XL
1266 pub fn WIFSIGNALED(status: ::c_int) -> bool {
1267 ((status >> 8) & 0xff) != 0
1268 }
1269
476ff2be
SL
1270 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
1271 (status >> 8) & 0xff
1272 }
abe05a73
XL
1273
1274 pub fn WIFSTOPPED(status: ::c_int) -> bool {
1275 ((status >> 16) & 0xff) != 0
1276 }
1277
1278 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
1279 (status >> 16) & 0xff
1280 }
1281
1282 // actually WIFCORED, but this is used everywhere else
1283 pub fn WCOREDUMP(status: ::c_int) -> bool {
1284 (status & 0x10000) != 0
1285 }
1286
1287 pub fn WIFCONTINUED(status: ::c_int) -> bool {
1288 (status & 0x20000) != 0
1289 }
476ff2be
SL
1290}
1291
e74abb32 1292extern "C" {
416331ca
XL
1293 pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
1294 pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
ba9703b0
XL
1295 pub fn utimensat(
1296 fd: ::c_int,
1297 path: *const ::c_char,
1298 times: *const ::timespec,
1299 flag: ::c_int,
1300 ) -> ::c_int;
1301 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
e74abb32
XL
1302 pub fn strerror_r(
1303 errnum: ::c_int,
1304 buf: *mut c_char,
1305 buflen: ::size_t,
1306 ) -> ::c_int;
416331ca
XL
1307 pub fn _errnop() -> *mut ::c_int;
1308
69743fb6
XL
1309 pub fn abs(i: ::c_int) -> ::c_int;
1310 pub fn atof(s: *const ::c_char) -> ::c_double;
1311 pub fn labs(i: ::c_long) -> ::c_long;
1312 pub fn rand() -> ::c_int;
1313 pub fn srand(seed: ::c_uint);
1314}
1315
abe05a73 1316#[link(name = "bsd")]
e74abb32 1317extern "C" {
532ac7d7 1318 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
e74abb32
XL
1319 pub fn sem_init(
1320 sem: *mut sem_t,
1321 pshared: ::c_int,
1322 value: ::c_uint,
1323 ) -> ::c_int;
532ac7d7 1324
476ff2be 1325 pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
8bb4bdeb 1326 pub fn clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int;
e74abb32
XL
1327 pub fn pthread_create(
1328 thread: *mut ::pthread_t,
1329 attr: *const ::pthread_attr_t,
1330 f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
1331 value: *mut ::c_void,
1332 ) -> ::c_int;
1333 pub fn pthread_attr_getguardsize(
1334 attr: *const ::pthread_attr_t,
1335 guardsize: *mut ::size_t,
1336 ) -> ::c_int;
1337 pub fn pthread_attr_getstack(
1338 attr: *const ::pthread_attr_t,
1339 stackaddr: *mut *mut ::c_void,
1340 stacksize: *mut ::size_t,
1341 ) -> ::c_int;
1342 pub fn pthread_condattr_getclock(
1343 attr: *const pthread_condattr_t,
1344 clock_id: *mut clockid_t,
1345 ) -> ::c_int;
1346 pub fn pthread_condattr_setclock(
1347 attr: *mut pthread_condattr_t,
1348 clock_id: ::clockid_t,
1349 ) -> ::c_int;
476ff2be 1350 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
e74abb32 1351 pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
476ff2be 1352 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
e74abb32
XL
1353 pub fn mprotect(
1354 addr: *const ::c_void,
1355 len: ::size_t,
1356 prot: ::c_int,
1357 ) -> ::c_int;
041b39d2 1358 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
e74abb32
XL
1359 pub fn getnameinfo(
1360 sa: *const ::sockaddr,
1361 salen: ::socklen_t,
1362 host: *mut ::c_char,
1363 hostlen: ::size_t,
1364 serv: *mut ::c_char,
1365 sevlen: ::size_t,
1366 flags: ::c_int,
1367 ) -> ::c_int;
1368 pub fn pthread_mutex_timedlock(
1369 lock: *mut pthread_mutex_t,
1370 abstime: *const ::timespec,
1371 ) -> ::c_int;
1372 pub fn waitid(
1373 idtype: idtype_t,
1374 id: id_t,
1375 infop: *mut ::siginfo_t,
1376 options: ::c_int,
1377 ) -> ::c_int;
1378
1379 pub fn glob(
1380 pattern: *const ::c_char,
1381 flags: ::c_int,
1382 errfunc: ::Option<
1383 extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int,
1384 >,
1385 pglob: *mut ::glob_t,
1386 ) -> ::c_int;
8bb4bdeb 1387 pub fn globfree(pglob: *mut ::glob_t);
e74abb32
XL
1388 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
1389 pub fn posix_madvise(
1390 addr: *mut ::c_void,
1391 len: ::size_t,
1392 advice: ::c_int,
1393 ) -> ::c_int;
1394
1395 pub fn shm_open(
1396 name: *const ::c_char,
1397 oflag: ::c_int,
1398 mode: ::mode_t,
1399 ) -> ::c_int;
8bb4bdeb
XL
1400 pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
1401
1402 pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
1403
1404 pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
e74abb32
XL
1405 pub fn madvise(
1406 addr: *mut ::c_void,
1407 len: ::size_t,
1408 advice: ::c_int,
1409 ) -> ::c_int;
1410
1411 pub fn msync(
1412 addr: *mut ::c_void,
1413 len: ::size_t,
1414 flags: ::c_int,
1415 ) -> ::c_int;
1416
1417 pub fn recvfrom(
1418 socket: ::c_int,
1419 buf: *mut ::c_void,
1420 len: ::size_t,
1421 flags: ::c_int,
1422 addr: *mut ::sockaddr,
1423 addrlen: *mut ::socklen_t,
1424 ) -> ::ssize_t;
8bb4bdeb 1425 pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
ff7c6d11 1426 pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
8bb4bdeb
XL
1427 pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
1428
e74abb32
XL
1429 pub fn bind(
1430 socket: ::c_int,
1431 address: *const ::sockaddr,
1432 address_len: ::socklen_t,
1433 ) -> ::c_int;
1434
1435 pub fn writev(
1436 fd: ::c_int,
1437 iov: *const ::iovec,
1438 iovcnt: ::c_int,
1439 ) -> ::ssize_t;
1440 pub fn readv(
1441 fd: ::c_int,
1442 iov: *const ::iovec,
1443 iovcnt: ::c_int,
1444 ) -> ::ssize_t;
1445
1446 pub fn sendmsg(
1447 fd: ::c_int,
1448 msg: *const ::msghdr,
1449 flags: ::c_int,
1450 ) -> ::ssize_t;
1451 pub fn recvmsg(
1452 fd: ::c_int,
1453 msg: *mut ::msghdr,
1454 flags: ::c_int,
1455 ) -> ::ssize_t;
1456 pub fn execvpe(
1457 file: *const ::c_char,
1458 argv: *const *const ::c_char,
1459 environment: *const *const ::c_char,
1460 ) -> ::c_int;
e74abb32
XL
1461 pub fn getgrgid_r(
1462 gid: ::gid_t,
1463 grp: *mut ::group,
1464 buf: *mut ::c_char,
1465 buflen: ::size_t,
1466 result: *mut *mut ::group,
1467 ) -> ::c_int;
e74abb32 1468 pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
ea8adc8c
XL
1469 pub fn sem_close(sem: *mut sem_t) -> ::c_int;
1470 pub fn getdtablesize() -> ::c_int;
e74abb32
XL
1471 pub fn getgrnam_r(
1472 name: *const ::c_char,
1473 grp: *mut ::group,
1474 buf: *mut ::c_char,
1475 buflen: ::size_t,
1476 result: *mut *mut ::group,
1477 ) -> ::c_int;
e74abb32
XL
1478 pub fn pthread_sigmask(
1479 how: ::c_int,
1480 set: *const sigset_t,
1481 oldset: *mut sigset_t,
1482 ) -> ::c_int;
ea8adc8c
XL
1483 pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
1484 pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
1485 pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
1486 pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
1487 pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
e74abb32
XL
1488 pub fn getpwnam_r(
1489 name: *const ::c_char,
1490 pwd: *mut passwd,
1491 buf: *mut ::c_char,
1492 buflen: ::size_t,
1493 result: *mut *mut passwd,
1494 ) -> ::c_int;
e74abb32
XL
1495 pub fn getpwuid_r(
1496 uid: ::uid_t,
1497 pwd: *mut passwd,
1498 buf: *mut ::c_char,
1499 buflen: ::size_t,
1500 result: *mut *mut passwd,
1501 ) -> ::c_int;
e74abb32
XL
1502 pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
1503 pub fn pthread_atfork(
1504 prepare: ::Option<unsafe extern "C" fn()>,
1505 parent: ::Option<unsafe extern "C" fn()>,
1506 child: ::Option<unsafe extern "C" fn()>,
1507 ) -> ::c_int;
ea8adc8c 1508 pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
e74abb32
XL
1509 pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
1510 pub fn openpty(
1511 amaster: *mut ::c_int,
1512 aslave: *mut ::c_int,
1513 name: *mut ::c_char,
1514 termp: *mut termios,
1515 winp: *mut ::winsize,
1516 ) -> ::c_int;
1517 pub fn forkpty(
1518 amaster: *mut ::c_int,
1519 name: *mut ::c_char,
1520 termp: *mut termios,
1521 winp: *mut ::winsize,
1522 ) -> ::pid_t;
abe05a73 1523 pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
532ac7d7 1524 pub fn uname(buf: *mut ::utsname) -> ::c_int;
476ff2be
SL
1525}
1526
1527cfg_if! {
1528 if #[cfg(target_pointer_width = "64")] {
1529 mod b64;
1530 pub use self::b64::*;
1531 } else {
1532 mod b32;
1533 pub use self::b32::*;
1534 }
1535}