1 //! Interface to VxWorks C library
2 
3 use core::mem::size_of;
4 use core::ptr::null_mut;
5 
6 #[cfg_attr(feature = "extra_traits", derive(Debug))]
7 pub enum DIR {}
8 impl ::Copy for DIR {}
9 impl ::Clone for DIR {
clone(&self) -> DIR10     fn clone(&self) -> DIR {
11         *self
12     }
13 }
14 
15 pub type c_schar = i8;
16 pub type c_uchar = u8;
17 pub type c_short = i16;
18 pub type c_ushort = u16;
19 pub type c_int = i32;
20 pub type c_uint = u32;
21 pub type c_float = f32;
22 pub type c_double = f64;
23 pub type c_longlong = i64;
24 pub type c_ulonglong = u64;
25 pub type intmax_t = i64;
26 pub type uintmax_t = u64;
27 
28 pub type uintptr_t = usize;
29 pub type intptr_t = isize;
30 pub type ptrdiff_t = isize;
31 pub type size_t = ::uintptr_t;
32 pub type ssize_t = ::intptr_t;
33 
34 pub type pid_t = ::c_int;
35 pub type in_addr_t = u32;
36 pub type sighandler_t = ::size_t;
37 pub type cpuset_t = u32;
38 
39 pub type blkcnt_t = ::c_long;
40 pub type blksize_t = ::c_long;
41 pub type ino_t = ::c_ulong;
42 
43 pub type rlim_t = ::c_ulong;
44 pub type suseconds_t = ::c_long;
45 pub type time_t = ::c_long;
46 
47 pub type errno_t = ::c_int;
48 
49 pub type useconds_t = ::c_ulong;
50 
51 pub type socklen_t = ::c_uint;
52 
53 pub type pthread_t = ::c_ulong;
54 
55 pub type clockid_t = ::c_int;
56 
57 //defined for the structs
58 pub type dev_t = ::c_ulong;
59 pub type mode_t = ::c_int;
60 pub type nlink_t = ::c_ulong;
61 pub type uid_t = ::c_ushort;
62 pub type gid_t = ::c_ushort;
63 pub type sigset_t = ::c_ulonglong;
64 pub type key_t = ::c_long;
65 
66 pub type nfds_t = ::c_uint;
67 pub type stat64 = ::stat;
68 
69 pub type pthread_key_t = ::c_ulong;
70 
71 // From b_off_t.h
72 pub type off_t = ::c_longlong;
73 pub type off64_t = off_t;
74 
75 // From b_BOOL.h
76 pub type BOOL = ::c_int;
77 
78 // From vxWind.h ..
79 pub type _Vx_OBJ_HANDLE = ::c_int;
80 pub type _Vx_TASK_ID = ::_Vx_OBJ_HANDLE;
81 pub type _Vx_MSG_Q_ID = ::_Vx_OBJ_HANDLE;
82 pub type _Vx_SEM_ID_KERNEL = ::_Vx_OBJ_HANDLE;
83 pub type _Vx_RTP_ID = ::_Vx_OBJ_HANDLE;
84 pub type _Vx_SD_ID = ::_Vx_OBJ_HANDLE;
85 pub type _Vx_CONDVAR_ID = ::_Vx_OBJ_HANDLE;
86 pub type _Vx_SEM_ID = *mut ::_Vx_semaphore;
87 pub type OBJ_HANDLE = ::_Vx_OBJ_HANDLE;
88 pub type TASK_ID = ::OBJ_HANDLE;
89 pub type MSG_Q_ID = ::OBJ_HANDLE;
90 pub type SEM_ID_KERNEL = ::OBJ_HANDLE;
91 pub type RTP_ID = ::OBJ_HANDLE;
92 pub type SD_ID = ::OBJ_HANDLE;
93 pub type CONDVAR_ID = ::OBJ_HANDLE;
94 pub type STATUS = ::OBJ_HANDLE;
95 
96 // From vxTypes.h
97 pub type _Vx_usr_arg_t = isize;
98 pub type _Vx_exit_code_t = isize;
99 pub type _Vx_ticks_t = ::c_uint;
100 pub type _Vx_ticks64_t = ::c_ulonglong;
101 
102 pub type sa_family_t = ::c_uchar;
103 
104 // mqueue.h
105 pub type mqd_t = ::c_int;
106 
107 #[cfg_attr(feature = "extra_traits", derive(Debug))]
108 pub enum _Vx_semaphore {}
109 impl ::Copy for _Vx_semaphore {}
110 impl ::Clone for _Vx_semaphore {
clone(&self) -> _Vx_semaphore111     fn clone(&self) -> _Vx_semaphore {
112         *self
113     }
114 }
115 
116 impl siginfo_t {
si_addr(&self) -> *mut ::c_void117     pub unsafe fn si_addr(&self) -> *mut ::c_void {
118         self.si_addr
119     }
120 
si_value(&self) -> ::sigval121     pub unsafe fn si_value(&self) -> ::sigval {
122         self.si_value
123     }
124 
si_pid(&self) -> ::pid_t125     pub unsafe fn si_pid(&self) -> ::pid_t {
126         self.si_pid
127     }
128 
si_uid(&self) -> ::uid_t129     pub unsafe fn si_uid(&self) -> ::uid_t {
130         self.si_uid
131     }
132 
si_status(&self) -> ::c_int133     pub unsafe fn si_status(&self) -> ::c_int {
134         self.si_status
135     }
136 }
137 
138 s! {
139     // b_pthread_condattr_t.h
140     pub struct pthread_condattr_t {
141         pub condAttrStatus: ::c_int,
142         pub condAttrPshared: ::c_int,
143         pub condAttrClockId: ::clockid_t,
144     }
145 
146     // b_pthread_cond_t.h
147     pub struct pthread_cond_t{
148         pub condSemId: ::_Vx_SEM_ID,
149         pub condValid: ::c_int,
150         pub condInitted: ::c_int,
151         pub condRefCount: ::c_int,
152         pub condMutex: *mut ::pthread_mutex_t,
153         pub condAttr: ::pthread_condattr_t,
154         pub condSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX]
155     }
156 
157     // b_pthread_rwlockattr_t.h
158     pub struct pthread_rwlockattr_t {
159         pub rwlockAttrStatus: ::c_int,
160         pub rwlockAttrPshared: ::c_int,
161         pub rwlockAttrMaxReaders: ::c_uint,
162         pub rwlockAttrConformOpt: ::c_uint,
163     }
164 
165     // b_pthread_rwlock_t.h
166     pub struct pthread_rwlock_t {
167         pub rwlockSemId: :: _Vx_SEM_ID,
168         pub rwlockReadersRefCount: ::c_uint,
169         pub rwlockValid: ::c_int,
170         pub rwlockInitted: ::c_int,
171         pub rwlockAttr: ::pthread_rwlockattr_t,
172         pub rwlockSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX]
173     }
174 
175     // b_struct_timeval.h
176     pub struct timeval {
177         pub tv_sec: ::time_t,
178         pub tv_usec: ::suseconds_t,
179     }
180 
181     // socket.h
182     pub struct linger {
183         pub l_onoff: ::c_int,
184         pub l_linger: ::c_int,
185     }
186 
187     pub struct sockaddr {
188         pub sa_len    : ::c_uchar,
189         pub sa_family : sa_family_t,
190         pub sa_data   : [::c_char; 14],
191     }
192 
193     pub struct iovec {
194         pub iov_base: *mut ::c_void,
195         pub iov_len: ::size_t,
196     }
197 
198     pub struct msghdr {
199         pub msg_name: *mut c_void,
200         pub msg_namelen: socklen_t,
201         pub msg_iov: *mut iovec,
202         pub msg_iovlen: ::c_int,
203         pub msg_control: *mut c_void,
204         pub msg_controllen: socklen_t,
205         pub msg_flags: ::c_int,
206     }
207 
208     pub struct cmsghdr {
209         pub cmsg_len: socklen_t,
210         pub cmsg_level: ::c_int,
211         pub cmsg_type: ::c_int,
212     }
213 
214     // poll.h
215     pub struct pollfd {
216         pub fd      : ::c_int,
217         pub events  : ::c_short,
218         pub revents : ::c_short,
219     }
220 
221     // resource.h
222     pub struct rlimit {
223                            pub rlim_cur : ::rlim_t,
224                            pub rlim_max : ::rlim_t,
225     }
226 
227     // stat.h
228     pub struct stat {
229                          pub st_dev       : ::dev_t,
230                          pub st_ino       : ::ino_t,
231                          pub st_mode      : ::mode_t,
232                          pub st_nlink     : ::nlink_t,
233                          pub st_uid       : ::uid_t,
234                          pub st_gid       : ::gid_t,
235                          pub st_rdev      : ::dev_t,
236                          pub st_size      : ::off_t,
237                          pub st_atime     : ::time_t,
238                          pub st_mtime     : ::time_t,
239                          pub st_ctime     : ::time_t,
240                          pub st_blksize   : ::blksize_t,
241                          pub st_blocks    : ::blkcnt_t,
242                          pub st_attrib    : ::c_uchar,
243                          pub st_reserved1 : ::c_int,
244                          pub st_reserved2 : ::c_int,
245                          pub st_reserved3 : ::c_int,
246                          pub st_reserved4 : ::c_int,
247     }
248 
249     //b_struct__Timespec.h
250     pub struct _Timespec {
251         pub tv_sec  : ::time_t,
252         pub tv_nsec : ::c_long,
253     }
254 
255     // b_struct__Sched_param.h
256     pub struct sched_param {
257         pub sched_priority: ::c_int, /* scheduling priority */
258         pub sched_ss_low_priority: ::c_int,    /* low scheduling priority */
259         pub sched_ss_repl_period: ::_Timespec, /* replenishment period */
260         pub sched_ss_init_budget: ::_Timespec, /* initial budget */
261         pub sched_ss_max_repl: ::c_int,        /* max pending replenishment */
262 
263     }
264 
265     // b_pthread_attr_t.h
266     pub struct pthread_attr_t {
267         pub threadAttrStatus          : ::c_int,
268         pub threadAttrStacksize       : ::size_t,
269         pub threadAttrStackaddr       : *mut ::c_void,
270         pub threadAttrGuardsize       : ::size_t,
271         pub threadAttrDetachstate     : ::c_int,
272         pub threadAttrContentionscope : ::c_int,
273         pub threadAttrInheritsched    : ::c_int,
274         pub threadAttrSchedpolicy     : ::c_int,
275         pub threadAttrName            : *mut ::c_char,
276         pub threadAttrOptions         : ::c_int,
277         pub threadAttrSchedparam      : ::sched_param,
278     }
279 
280     // signal.h
281 
282     pub struct sigaction {
283         pub sa_u     : ::sa_u_t,
284         pub sa_mask  : ::sigset_t,
285         pub sa_flags : ::c_int,
286     }
287 
288     // b_stack_t.h
289     pub struct stack_t {
290         pub ss_sp    : *mut ::c_void,
291         pub ss_size  : ::size_t,
292         pub ss_flags : ::c_int,
293     }
294 
295     // signal.h
296     pub struct siginfo_t {
297         pub si_signo : ::c_int,
298         pub si_code  : ::c_int,
299         pub si_value : ::sigval,
300         pub si_errno : ::c_int,
301         pub si_status: ::c_int,
302         pub si_addr: *mut ::c_void,
303         pub si_uid: ::uid_t,
304         pub si_pid: ::pid_t,
305     }
306 
307     // pthread.h (krnl)
308     // b_pthread_mutexattr_t.h (usr)
309     pub struct pthread_mutexattr_t {
310         mutexAttrStatus      : ::c_int,
311         mutexAttrPshared     : ::c_int,
312         mutexAttrProtocol    : ::c_int,
313         mutexAttrPrioceiling : ::c_int,
314         mutexAttrType        : ::c_int,
315     }
316 
317     // pthread.h (krnl)
318     // b_pthread_mutex_t.h (usr)
319     pub struct pthread_mutex_t  {
320         pub mutexSemId: ::_Vx_SEM_ID, /*_Vx_SEM_ID ..*/
321         pub mutexValid: ::c_int,
322         pub mutexInitted: ::c_int,
323         pub mutexCondRefCount: ::c_int,
324         pub mutexSavPriority: ::c_int,
325         pub mutexAttr: ::pthread_mutexattr_t,
326         pub mutexSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX],
327     }
328 
329     // b_struct_timespec.h
330     pub struct timespec {
331         pub tv_sec: ::time_t,
332         pub tv_nsec: ::c_long,
333     }
334 
335     // time.h
336     pub struct tm {
337         pub tm_sec: ::c_int,
338         pub tm_min: ::c_int,
339         pub tm_hour: ::c_int,
340         pub tm_mday: ::c_int,
341         pub tm_mon: ::c_int,
342         pub tm_year: ::c_int,
343         pub tm_wday: ::c_int,
344         pub tm_yday: ::c_int,
345         pub tm_isdst: ::c_int,
346     }
347 
348     // in.h
349     pub struct in_addr {
350         pub s_addr: in_addr_t,
351     }
352 
353     // in.h
354     pub struct ip_mreq {
355         pub imr_multiaddr: in_addr,
356         pub imr_interface: in_addr,
357     }
358 
359     // in6.h
360     #[repr(align(4))]
361     pub struct in6_addr {
362         pub s6_addr: [u8; 16],
363     }
364 
365     // in6.h
366     pub struct ipv6_mreq {
367         pub ipv6mr_multiaddr: in6_addr,
368         pub ipv6mr_interface: ::c_uint,
369     }
370 
371     // netdb.h
372     pub struct addrinfo {
373         pub ai_flags    : ::c_int,
374         pub ai_family   : ::c_int,
375         pub ai_socktype : ::c_int,
376         pub ai_protocol : ::c_int,
377         pub ai_addrlen  : ::size_t,
378         pub ai_canonname: *mut ::c_char,
379         pub ai_addr     : *mut ::sockaddr,
380         pub ai_next     : *mut ::addrinfo,
381     }
382 
383     // in.h
384     pub struct sockaddr_in {
385         pub sin_len   : u8,
386         pub sin_family: u8,
387         pub sin_port  : u16,
388         pub sin_addr  : ::in_addr,
389         pub sin_zero  : [::c_char; 8],
390     }
391 
392     // in6.h
393     pub struct sockaddr_in6 {
394         pub sin6_len     : u8,
395         pub sin6_family  : u8,
396         pub sin6_port    : u16,
397         pub sin6_flowinfo: u32,
398         pub sin6_addr    : ::in6_addr,
399         pub sin6_scope_id: u32,
400     }
401 
402     pub struct Dl_info {
403         pub dli_fname: *const ::c_char,
404         pub dli_fbase: *mut ::c_void,
405         pub dli_sname: *const ::c_char,
406         pub dli_saddr: *mut ::c_void,
407     }
408 
409     pub struct mq_attr {
410         pub mq_maxmsg:  ::c_long,
411         pub mq_msgsize: ::c_long,
412         pub mq_flags:   ::c_long,
413         pub mq_curmsgs: ::c_long,
414     }
415 }
416 
417 s_no_extra_traits! {
418     // dirent.h
419     pub struct dirent {
420         pub d_ino  : ::ino_t,
421         pub d_name : [::c_char; _PARM_NAME_MAX as usize + 1],
422     }
423 
424     pub struct sockaddr_un {
425         pub sun_len: u8,
426         pub sun_family: sa_family_t,
427         pub sun_path: [::c_char; 104]
428     }
429 
430     // rtpLibCommon.h
431     pub struct RTP_DESC {
432         pub status    : ::c_int,
433         pub options   : u32,
434         pub entrAddr  : *mut ::c_void,
435         pub initTaskId: ::TASK_ID,
436         pub parentId  : ::RTP_ID,
437         pub pathName  : [::c_char; VX_RTP_NAME_LENGTH as usize + 1],
438         pub taskCnt   : ::c_int,
439         pub textStart : *mut ::c_void,
440         pub textEnd   : *mut ::c_void,
441     }
442     // socket.h
443     pub struct sockaddr_storage {
444         pub ss_len     : ::c_uchar,
445         pub ss_family  : ::sa_family_t,
446         pub __ss_pad1  : [::c_char; _SS_PAD1SIZE],
447         pub __ss_align : i32,
448         pub __ss_pad2  : [::c_char; _SS_PAD2SIZE],
449     }
450 
451     pub union sa_u_t {
452         pub sa_handler : ::Option<unsafe extern "C" fn(::c_int) -> !>,
453         pub sa_sigaction: ::Option<unsafe extern "C" fn(::c_int,
454                                                         *mut ::siginfo_t,
455                                                         *mut ::c_void) -> !>,
456     }
457 
458     pub union sigval {
459         pub sival_int : ::c_int,
460         pub sival_ptr : *mut ::c_void,
461     }
462 }
463 
464 cfg_if! {
465     if #[cfg(feature = "extra_traits")] {
466         impl ::fmt::Debug for dirent {
467             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
468                 f.debug_struct("dirent")
469                     .field("d_ino", &self.d_ino)
470                     .field("d_name", &&self.d_name[..])
471                     .finish()
472             }
473         }
474 
475         impl ::fmt::Debug for sockaddr_un {
476             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
477                 f.debug_struct("sockaddr_un")
478                     .field("sun_len", &self.sun_len)
479                     .field("sun_family", &self.sun_family)
480                     .field("sun_path", &&self.sun_path[..])
481                     .finish()
482             }
483         }
484 
485         impl ::fmt::Debug for RTP_DESC {
486             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
487                 f.debug_struct("RTP_DESC")
488                     .field("status", &self.status)
489                     .field("options", &self.options)
490                     .field("entrAddr", &self.entrAddr)
491                     .field("initTaskId", &self.initTaskId)
492                     .field("parentId", &self.parentId)
493                     .field("pathName", &&self.pathName[..])
494                     .field("taskCnt", &self.taskCnt)
495                     .field("textStart", &self.textStart)
496                     .field("textEnd", &self.textEnd)
497                     .finish()
498             }
499         }
500         impl ::fmt::Debug for sockaddr_storage {
501             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
502                 f.debug_struct("sockaddr_storage")
503                     .field("ss_len", &self.ss_len)
504                     .field("ss_family", &self.ss_family)
505                     .field("__ss_pad1", &&self.__ss_pad1[..])
506                     .field("__ss_align", &self.__ss_align)
507                     .field("__ss_pad2", &&self.__ss_pad2[..])
508                     .finish()
509             }
510         }
511 
512         impl PartialEq for sa_u_t {
513             fn eq(&self, other: &sa_u_t) -> bool {
514                 unsafe {
515                     let h1 = match self.sa_handler {
516                         Some(handler) => handler as usize,
517                         None => 0 as usize,
518                     };
519                     let h2 = match other.sa_handler {
520                         Some(handler) => handler as usize,
521                         None => 0 as usize,
522                     };
523                     h1 == h2
524                 }
525             }
526         }
527         impl Eq for sa_u_t {}
528         impl ::fmt::Debug for sa_u_t {
529             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
530                 unsafe {
531                     let h = match self.sa_handler {
532                         Some(handler) => handler as usize,
533                         None => 0 as usize,
534                     };
535 
536                     f.debug_struct("sa_u_t")
537                         .field("sa_handler", &h)
538                         .finish()
539                 }
540             }
541         }
542         impl ::hash::Hash for sa_u_t {
543             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
544                 unsafe {
545                     let h = match self.sa_handler {
546                         Some(handler) => handler as usize,
547                         None => 0 as usize,
548                     };
549                     h.hash(state)
550                 }
551             }
552         }
553 
554         impl PartialEq for sigval {
555             fn eq(&self, other: &sigval) -> bool {
556                 unsafe { self.sival_ptr as usize == other.sival_ptr as usize }
557             }
558         }
559         impl Eq for sigval {}
560         impl ::fmt::Debug for sigval {
561             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
562                 f.debug_struct("sigval")
563                     .field("sival_ptr", unsafe { &(self.sival_ptr as usize) })
564                     .finish()
565             }
566         }
567         impl ::hash::Hash for sigval {
568             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
569                 unsafe { (self.sival_ptr as usize).hash(state) };
570             }
571         }
572     }
573 }
574 
575 pub const STDIN_FILENO: ::c_int = 0;
576 pub const STDOUT_FILENO: ::c_int = 1;
577 pub const STDERR_FILENO: ::c_int = 2;
578 
579 pub const EXIT_SUCCESS: ::c_int = 0;
580 pub const EXIT_FAILURE: ::c_int = 1;
581 
582 pub const EAI_SERVICE: ::c_int = 9;
583 pub const EAI_SOCKTYPE: ::c_int = 10;
584 pub const EAI_SYSTEM: ::c_int = 11;
585 
586 // FIXME: This is not defined in vxWorks, but we have to define it here
587 // to make the building pass for getrandom and std
588 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
589 
590 //Clock Lib Stuff
591 pub const CLOCK_REALTIME: ::c_int = 0x0;
592 pub const CLOCK_MONOTONIC: ::c_int = 0x1;
593 pub const CLOCK_PROCESS_CPUTIME_ID: ::c_int = 0x2;
594 pub const CLOCK_THREAD_CPUTIME_ID: ::c_int = 0x3;
595 pub const TIMER_ABSTIME: ::c_int = 0x1;
596 pub const TIMER_RELTIME: ::c_int = 0x0;
597 
598 // PTHREAD STUFF
599 pub const PTHREAD_INITIALIZED_OBJ: ::c_int = 0xF70990EF;
600 pub const PTHREAD_DESTROYED_OBJ: ::c_int = -1;
601 pub const PTHREAD_VALID_OBJ: ::c_int = 0xEC542A37;
602 pub const PTHREAD_INVALID_OBJ: ::c_int = -1;
603 pub const PTHREAD_UNUSED_YET_OBJ: ::c_int = -1;
604 
605 pub const PTHREAD_PRIO_NONE: ::c_int = 0;
606 pub const PTHREAD_PRIO_INHERIT: ::c_int = 1;
607 pub const PTHREAD_PRIO_PROTECT: ::c_int = 2;
608 
609 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
610 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
611 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
612 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
613 pub const PTHREAD_STACK_MIN: usize = 4096;
614 pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30;
615 
616 //sched.h
617 pub const SCHED_FIFO: ::c_int = 0x01;
618 pub const SCHED_RR: ::c_int = 0x02;
619 pub const SCHED_OTHER: ::c_int = 0x04;
620 pub const SCHED_SPORADIC: ::c_int = 0x08;
621 pub const PRIO_PROCESS: ::c_uint = 0;
622 pub const SCHED_FIFO_HIGH_PRI: ::c_int = 255;
623 pub const SCHED_FIFO_LOW_PRI: ::c_int = 0;
624 pub const SCHED_RR_HIGH_PRI: ::c_int = 255;
625 pub const SCHED_RR_LOW_PRI: ::c_int = 0;
626 pub const SCHED_SPORADIC_HIGH_PRI: ::c_int = 255;
627 pub const SCHED_SPORADIC_LOW_PRI: ::c_int = 0;
628 
629 // ERRNO STUFF
630 pub const ERROR: ::c_int = -1;
631 pub const OK: ::c_int = 0;
632 pub const EPERM: ::c_int = 1; /* Not owner */
633 pub const ENOENT: ::c_int = 2; /* No such file or directory */
634 pub const ESRCH: ::c_int = 3; /* No such process */
635 pub const EINTR: ::c_int = 4; /* Interrupted system call */
636 pub const EIO: ::c_int = 5; /* I/O error */
637 pub const ENXIO: ::c_int = 6; /* No such device or address */
638 pub const E2BIG: ::c_int = 7; /* Arg list too long */
639 pub const ENOEXEC: ::c_int = 8; /* Exec format error */
640 pub const EBADF: ::c_int = 9; /* Bad file number */
641 pub const ECHILD: ::c_int = 10; /* No children */
642 pub const EAGAIN: ::c_int = 11; /* No more processes */
643 pub const ENOMEM: ::c_int = 12; /* Not enough core */
644 pub const EACCES: ::c_int = 13; /* Permission denied */
645 pub const EFAULT: ::c_int = 14;
646 pub const ENOTEMPTY: ::c_int = 15;
647 pub const EBUSY: ::c_int = 16;
648 pub const EEXIST: ::c_int = 17;
649 pub const EXDEV: ::c_int = 18;
650 pub const ENODEV: ::c_int = 19;
651 pub const ENOTDIR: ::c_int = 20;
652 pub const EISDIR: ::c_int = 21;
653 pub const EINVAL: ::c_int = 22;
654 pub const ENAMETOOLONG: ::c_int = 26;
655 pub const EFBIG: ::c_int = 27;
656 pub const ENOSPC: ::c_int = 28;
657 pub const ESPIPE: ::c_int = 29;
658 pub const EROFS: ::c_int = 30;
659 pub const EMLINK: ::c_int = 31;
660 pub const EPIPE: ::c_int = 32;
661 pub const EDEADLK: ::c_int = 33;
662 pub const ERANGE: ::c_int = 38;
663 pub const EDESTADDRREQ: ::c_int = 40;
664 pub const EPROTOTYPE: ::c_int = 41;
665 pub const ENOPROTOOPT: ::c_int = 42;
666 pub const EPROTONOSUPPORT: ::c_int = 43;
667 pub const ESOCKTNOSUPPORT: ::c_int = 44;
668 pub const EOPNOTSUPP: ::c_int = 45;
669 pub const EPFNOSUPPORT: ::c_int = 46;
670 pub const EAFNOSUPPORT: ::c_int = 47;
671 pub const EADDRINUSE: ::c_int = 48;
672 pub const EADDRNOTAVAIL: ::c_int = 49;
673 pub const ENOTSOCK: ::c_int = 50;
674 pub const ENETUNREACH: ::c_int = 51;
675 pub const ENETRESET: ::c_int = 52;
676 pub const ECONNABORTED: ::c_int = 53;
677 pub const ECONNRESET: ::c_int = 54;
678 pub const ENOBUFS: ::c_int = 55;
679 pub const EISCONN: ::c_int = 56;
680 pub const ENOTCONN: ::c_int = 57;
681 pub const ESHUTDOWN: ::c_int = 58;
682 pub const ETOOMANYREFS: ::c_int = 59;
683 pub const ETIMEDOUT: ::c_int = 60;
684 pub const ECONNREFUSED: ::c_int = 61;
685 pub const ENETDOWN: ::c_int = 62;
686 pub const ETXTBSY: ::c_int = 63;
687 pub const ELOOP: ::c_int = 64;
688 pub const EHOSTUNREACH: ::c_int = 65;
689 pub const EINPROGRESS: ::c_int = 68;
690 pub const EALREADY: ::c_int = 69;
691 pub const EWOULDBLOCK: ::c_int = 70;
692 pub const ENOSYS: ::c_int = 71;
693 pub const EDQUOT: ::c_int = 83;
694 pub const ESTALE: ::c_int = 88;
695 
696 // NFS errnos: Refer to pkgs_v2/storage/fs/nfs/h/nfs/nfsCommon.h
697 const M_nfsStat: ::c_int = 48 << 16;
698 enum nfsstat {
699     NFSERR_REMOTE = 71,
700     NFSERR_WFLUSH = 99,
701     NFSERR_BADHANDLE = 10001,
702     NFSERR_NOT_SYNC = 10002,
703     NFSERR_BAD_COOKIE = 10003,
704     NFSERR_TOOSMALL = 10005,
705     NFSERR_BADTYPE = 10007,
706     NFSERR_JUKEBOX = 10008,
707 }
708 
709 pub const S_nfsLib_NFS_OK: ::c_int = OK;
710 pub const S_nfsLib_NFSERR_PERM: ::c_int = EPERM;
711 pub const S_nfsLib_NFSERR_NOENT: ::c_int = ENOENT;
712 pub const S_nfsLib_NFSERR_IO: ::c_int = EIO;
713 pub const S_nfsLib_NFSERR_NXIO: ::c_int = ENXIO;
714 pub const S_nfsLib_NFSERR_ACCESS: ::c_int = EACCES;
715 pub const S_nfsLib_NFSERR_EXIST: ::c_int = EEXIST;
716 pub const S_nfsLib_NFSERR_ENODEV: ::c_int = ENODEV;
717 pub const S_nfsLib_NFSERR_NOTDIR: ::c_int = ENOTDIR;
718 pub const S_nfsLib_NFSERR_ISDIR: ::c_int = EISDIR;
719 pub const S_nfsLib_NFSERR_INVAL: ::c_int = EINVAL;
720 pub const S_nfsLib_NFSERR_FBIG: ::c_int = EFBIG;
721 pub const S_nfsLib_NFSERR_NOSPC: ::c_int = ENOSPC;
722 pub const S_nfsLib_NFSERR_ROFS: ::c_int = EROFS;
723 pub const S_nfsLib_NFSERR_NAMETOOLONG: ::c_int = ENAMETOOLONG;
724 pub const S_nfsLib_NFSERR_NOTEMPTY: ::c_int = ENOTEMPTY;
725 pub const S_nfsLib_NFSERR_DQUOT: ::c_int = EDQUOT;
726 pub const S_nfsLib_NFSERR_STALE: ::c_int = ESTALE;
727 pub const S_nfsLib_NFSERR_WFLUSH: ::c_int = M_nfsStat | nfsstat::NFSERR_WFLUSH as ::c_int;
728 pub const S_nfsLib_NFSERR_REMOTE: ::c_int = M_nfsStat | nfsstat::NFSERR_REMOTE as ::c_int;
729 pub const S_nfsLib_NFSERR_BADHANDLE: ::c_int = M_nfsStat | nfsstat::NFSERR_BADHANDLE as ::c_int;
730 pub const S_nfsLib_NFSERR_NOT_SYNC: ::c_int = M_nfsStat | nfsstat::NFSERR_NOT_SYNC as ::c_int;
731 pub const S_nfsLib_NFSERR_BAD_COOKIE: ::c_int = M_nfsStat | nfsstat::NFSERR_BAD_COOKIE as ::c_int;
732 pub const S_nfsLib_NFSERR_NOTSUPP: ::c_int = EOPNOTSUPP;
733 pub const S_nfsLib_NFSERR_TOOSMALL: ::c_int = M_nfsStat | nfsstat::NFSERR_TOOSMALL as ::c_int;
734 pub const S_nfsLib_NFSERR_SERVERFAULT: ::c_int = EIO;
735 pub const S_nfsLib_NFSERR_BADTYPE: ::c_int = M_nfsStat | nfsstat::NFSERR_BADTYPE as ::c_int;
736 pub const S_nfsLib_NFSERR_JUKEBOX: ::c_int = M_nfsStat | nfsstat::NFSERR_JUKEBOX as ::c_int;
737 
738 // internal offset values for below constants
739 const taskErrorBase: ::c_int = 0x00030000;
740 const semErrorBase: ::c_int = 0x00160000;
741 const objErrorBase: ::c_int = 0x003d0000;
742 
743 // taskLibCommon.h
744 pub const S_taskLib_NAME_NOT_FOUND: ::c_int = taskErrorBase + 0x0065;
745 pub const S_taskLib_TASK_HOOK_TABLE_FULL: ::c_int = taskErrorBase + 0x0066;
746 pub const S_taskLib_TASK_HOOK_NOT_FOUND: ::c_int = taskErrorBase + 0x0067;
747 pub const S_taskLib_ILLEGAL_PRIORITY: ::c_int = taskErrorBase + 0x0068;
748 
749 // FIXME: could also be useful for TASK_DESC type
750 pub const VX_TASK_NAME_LENGTH: ::c_int = 31;
751 
752 // semLibCommon.h
753 pub const S_semLib_INVALID_STATE: ::c_int = semErrorBase + 0x0065;
754 pub const S_semLib_INVALID_OPTION: ::c_int = semErrorBase + 0x0066;
755 pub const S_semLib_INVALID_QUEUE_TYPE: ::c_int = semErrorBase + 0x0067;
756 pub const S_semLib_INVALID_OPERATION: ::c_int = semErrorBase + 0x0068;
757 
758 // objLibCommon.h
759 pub const S_objLib_OBJ_ID_ERROR: ::c_int = objErrorBase + 0x0001;
760 pub const S_objLib_OBJ_UNAVAILABLE: ::c_int = objErrorBase + 0x0002;
761 pub const S_objLib_OBJ_DELETED: ::c_int = objErrorBase + 0x0003;
762 pub const S_objLib_OBJ_TIMEOUT: ::c_int = objErrorBase + 0x0004;
763 pub const S_objLib_OBJ_NO_METHOD: ::c_int = objErrorBase + 0x0005;
764 
765 // in.h
766 pub const IPPROTO_IP: ::c_int = 0;
767 pub const IPPROTO_IPV6: ::c_int = 41;
768 
769 pub const IP_TTL: ::c_int = 4;
770 pub const IP_MULTICAST_IF: ::c_int = 9;
771 pub const IP_MULTICAST_TTL: ::c_int = 10;
772 pub const IP_MULTICAST_LOOP: ::c_int = 11;
773 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
774 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
775 
776 // in6.h
777 pub const IPV6_V6ONLY: ::c_int = 1;
778 pub const IPV6_UNICAST_HOPS: ::c_int = 4;
779 pub const IPV6_MULTICAST_IF: ::c_int = 9;
780 pub const IPV6_MULTICAST_HOPS: ::c_int = 10;
781 pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
782 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12;
783 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13;
784 
785 // STAT Stuff
786 pub const S_IFMT: ::c_int = 0xf000;
787 pub const S_IFIFO: ::c_int = 0x1000;
788 pub const S_IFCHR: ::c_int = 0x2000;
789 pub const S_IFDIR: ::c_int = 0x4000;
790 pub const S_IFBLK: ::c_int = 0x6000;
791 pub const S_IFREG: ::c_int = 0x8000;
792 pub const S_IFLNK: ::c_int = 0xa000;
793 pub const S_IFSHM: ::c_int = 0xb000;
794 pub const S_IFSOCK: ::c_int = 0xc000;
795 pub const S_ISUID: ::c_int = 0x0800;
796 pub const S_ISGID: ::c_int = 0x0400;
797 pub const S_ISTXT: ::c_int = 0x0200;
798 pub const S_ISVTX: ::c_int = 0o1000;
799 pub const S_IRUSR: ::c_int = 0x0100;
800 pub const S_IWUSR: ::c_int = 0x0080;
801 pub const S_IXUSR: ::c_int = 0x0040;
802 pub const S_IRWXU: ::c_int = 0x01c0;
803 pub const S_IRGRP: ::c_int = 0x0020;
804 pub const S_IWGRP: ::c_int = 0x0010;
805 pub const S_IXGRP: ::c_int = 0x0008;
806 pub const S_IRWXG: ::c_int = 0x0038;
807 pub const S_IROTH: ::c_int = 0x0004;
808 pub const S_IWOTH: ::c_int = 0x0002;
809 pub const S_IXOTH: ::c_int = 0x0001;
810 pub const S_IRWXO: ::c_int = 0x0007;
811 
812 // socket.h
813 pub const SOL_SOCKET: ::c_int = 0xffff;
814 pub const SOMAXCONN: ::c_int = 128;
815 
816 pub const SO_DEBUG: ::c_int = 0x0001;
817 pub const SO_REUSEADDR: ::c_int = 0x0004;
818 pub const SO_KEEPALIVE: ::c_int = 0x0008;
819 pub const SO_DONTROUTE: ::c_int = 0x0010;
820 pub const SO_RCVLOWAT: ::c_int = 0x0012;
821 pub const SO_SNDLOWAT: ::c_int = 0x0013;
822 pub const SO_SNDTIMEO: ::c_int = 0x1005;
823 pub const SO_ACCEPTCONN: ::c_int = 0x001e;
824 pub const SO_BROADCAST: ::c_int = 0x0020;
825 pub const SO_USELOOPBACK: ::c_int = 0x0040;
826 pub const SO_LINGER: ::c_int = 0x0080;
827 pub const SO_REUSEPORT: ::c_int = 0x0200;
828 
829 pub const SO_VLAN: ::c_int = 0x8000;
830 
831 pub const SO_SNDBUF: ::c_int = 0x1001;
832 pub const SO_RCVBUF: ::c_int = 0x1002;
833 pub const SO_RCVTIMEO: ::c_int = 0x1006;
834 pub const SO_ERROR: ::c_int = 0x1007;
835 pub const SO_TYPE: ::c_int = 0x1008;
836 pub const SO_BINDTODEVICE: ::c_int = 0x1010;
837 pub const SO_OOBINLINE: ::c_int = 0x1011;
838 pub const SO_CONNTIMEO: ::c_int = 0x100a;
839 
840 pub const SOCK_STREAM: ::c_int = 1;
841 pub const SOCK_DGRAM: ::c_int = 2;
842 pub const SOCK_RAW: ::c_int = 3;
843 pub const SOCK_RDM: ::c_int = 4;
844 pub const SOCK_SEQPACKET: ::c_int = 5;
845 pub const SOCK_PACKET: ::c_int = 10;
846 
847 pub const _SS_MAXSIZE: usize = 128;
848 pub const _SS_ALIGNSIZE: usize = size_of::<u32>();
849 pub const _SS_PAD1SIZE: usize = _SS_ALIGNSIZE - size_of::<::c_uchar>() - size_of::<::sa_family_t>();
850 pub const _SS_PAD2SIZE: usize = _SS_MAXSIZE
851     - size_of::<::c_uchar>()
852     - size_of::<::sa_family_t>()
853     - _SS_PAD1SIZE
854     - _SS_ALIGNSIZE;
855 
856 pub const MSG_OOB: ::c_int = 0x0001;
857 pub const MSG_PEEK: ::c_int = 0x0002;
858 pub const MSG_DONTROUTE: ::c_int = 0x0004;
859 pub const MSG_EOR: ::c_int = 0x0008;
860 pub const MSG_TRUNC: ::c_int = 0x0010;
861 pub const MSG_CTRUNC: ::c_int = 0x0020;
862 pub const MSG_WAITALL: ::c_int = 0x0040;
863 pub const MSG_DONTWAIT: ::c_int = 0x0080;
864 pub const MSG_EOF: ::c_int = 0x0100;
865 pub const MSG_EXP: ::c_int = 0x0200;
866 pub const MSG_MBUF: ::c_int = 0x0400;
867 pub const MSG_NOTIFICATION: ::c_int = 0x0800;
868 pub const MSG_COMPAT: ::c_int = 0x8000;
869 
870 pub const AF_UNSPEC: ::c_int = 0;
871 pub const AF_LOCAL: ::c_int = 1;
872 pub const AF_UNIX: ::c_int = AF_LOCAL;
873 pub const AF_INET: ::c_int = 2;
874 pub const AF_NETLINK: ::c_int = 16;
875 pub const AF_ROUTE: ::c_int = 17;
876 pub const AF_LINK: ::c_int = 18;
877 pub const AF_PACKET: ::c_int = 19;
878 pub const pseudo_AF_KEY: ::c_int = 27;
879 pub const AF_KEY: ::c_int = pseudo_AF_KEY;
880 pub const AF_INET6: ::c_int = 28;
881 pub const AF_SOCKDEV: ::c_int = 31;
882 pub const AF_TIPC: ::c_int = 33;
883 pub const AF_MIPC: ::c_int = 34;
884 pub const AF_MIPC_SAFE: ::c_int = 35;
885 pub const AF_MAX: ::c_int = 37;
886 
887 pub const SHUT_RD: ::c_int = 0;
888 pub const SHUT_WR: ::c_int = 1;
889 pub const SHUT_RDWR: ::c_int = 2;
890 
891 pub const IPPROTO_TCP: ::c_int = 6;
892 pub const TCP_NODELAY: ::c_int = 1;
893 pub const TCP_MAXSEG: ::c_int = 2;
894 pub const TCP_NOPUSH: ::c_int = 3;
895 pub const TCP_KEEPIDLE: ::c_int = 4;
896 pub const TCP_KEEPINTVL: ::c_int = 5;
897 pub const TCP_KEEPCNT: ::c_int = 6;
898 
899 // ioLib.h
900 pub const FIONREAD: ::c_int = 0x40040001;
901 pub const FIOFLUSH: ::c_int = 2;
902 pub const FIOOPTIONS: ::c_int = 3;
903 pub const FIOBAUDRATE: ::c_int = 4;
904 pub const FIODISKFORMAT: ::c_int = 5;
905 pub const FIODISKINIT: ::c_int = 6;
906 pub const FIOSEEK: ::c_int = 7;
907 pub const FIOWHERE: ::c_int = 8;
908 pub const FIODIRENTRY: ::c_int = 9;
909 pub const FIORENAME: ::c_int = 10;
910 pub const FIOREADYCHANGE: ::c_int = 11;
911 pub const FIODISKCHANGE: ::c_int = 13;
912 pub const FIOCANCEL: ::c_int = 14;
913 pub const FIOSQUEEZE: ::c_int = 15;
914 pub const FIOGETNAME: ::c_int = 18;
915 pub const FIONBIO: ::c_int = 0x90040010;
916 
917 // limits.h
918 pub const PATH_MAX: ::c_int = _PARM_PATH_MAX;
919 pub const _POSIX_PATH_MAX: ::c_int = 256;
920 
921 // Some poll stuff
922 pub const POLLIN: ::c_short = 0x0001;
923 pub const POLLPRI: ::c_short = 0x0002;
924 pub const POLLOUT: ::c_short = 0x0004;
925 pub const POLLRDNORM: ::c_short = 0x0040;
926 pub const POLLWRNORM: ::c_short = POLLOUT;
927 pub const POLLRDBAND: ::c_short = 0x0080;
928 pub const POLLWRBAND: ::c_short = 0x0100;
929 pub const POLLERR: ::c_short = 0x0008;
930 pub const POLLHUP: ::c_short = 0x0010;
931 pub const POLLNVAL: ::c_short = 0x0020;
932 
933 // fnctlcom.h
934 pub const FD_CLOEXEC: ::c_int = 1;
935 pub const F_DUPFD: ::c_int = 0;
936 pub const F_GETFD: ::c_int = 1;
937 pub const F_SETFD: ::c_int = 2;
938 pub const F_GETFL: ::c_int = 3;
939 pub const F_SETFL: ::c_int = 4;
940 pub const F_GETOWN: ::c_int = 5;
941 pub const F_SETOWN: ::c_int = 6;
942 pub const F_GETLK: ::c_int = 7;
943 pub const F_SETLK: ::c_int = 8;
944 pub const F_SETLKW: ::c_int = 9;
945 pub const F_DUPFD_CLOEXEC: ::c_int = 14;
946 
947 // signal.h
948 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
949 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
950 pub const SIG_ERR: sighandler_t = -1 as isize as sighandler_t;
951 
952 pub const SIGHUP: ::c_int = 1;
953 pub const SIGINT: ::c_int = 2;
954 pub const SIGQUIT: ::c_int = 3;
955 pub const SIGILL: ::c_int = 4;
956 pub const SIGTRAP: ::c_int = 5;
957 pub const SIGABRT: ::c_int = 6;
958 pub const SIGEMT: ::c_int = 7;
959 pub const SIGFPE: ::c_int = 8;
960 pub const SIGKILL: ::c_int = 9;
961 pub const SIGBUS: ::c_int = 10;
962 pub const SIGSEGV: ::c_int = 11;
963 pub const SIGFMT: ::c_int = 12;
964 pub const SIGPIPE: ::c_int = 13;
965 pub const SIGALRM: ::c_int = 14;
966 pub const SIGTERM: ::c_int = 15;
967 pub const SIGCNCL: ::c_int = 16;
968 pub const SIGSTOP: ::c_int = 17;
969 pub const SIGTSTP: ::c_int = 18;
970 pub const SIGCONT: ::c_int = 19;
971 pub const SIGCHLD: ::c_int = 20;
972 pub const SIGTTIN: ::c_int = 21;
973 pub const SIGTTOU: ::c_int = 22;
974 
975 pub const SIG_BLOCK: ::c_int = 1;
976 pub const SIG_UNBLOCK: ::c_int = 2;
977 pub const SIG_SETMASK: ::c_int = 3;
978 
979 pub const SI_SYNC: ::c_int = 0;
980 pub const SI_USER: ::c_int = -1;
981 pub const SI_QUEUE: ::c_int = -2;
982 pub const SI_TIMER: ::c_int = -3;
983 pub const SI_ASYNCIO: ::c_int = -4;
984 pub const SI_MESGQ: ::c_int = -5;
985 pub const SI_CHILD: ::c_int = -6;
986 pub const SI_KILL: ::c_int = SI_USER;
987 
988 // vxParams.h definitions
989 pub const _PARM_NAME_MAX: ::c_int = 255;
990 pub const _PARM_PATH_MAX: ::c_int = 1024;
991 
992 // WAIT STUFF
993 pub const WNOHANG: ::c_int = 0x01;
994 pub const WUNTRACED: ::c_int = 0x02;
995 
996 const PTHREAD_MUTEXATTR_INITIALIZER: pthread_mutexattr_t = pthread_mutexattr_t {
997     mutexAttrStatus: PTHREAD_INITIALIZED_OBJ,
998     mutexAttrProtocol: PTHREAD_PRIO_NONE,
999     mutexAttrPrioceiling: 0,
1000     mutexAttrType: PTHREAD_MUTEX_DEFAULT,
1001     mutexAttrPshared: 1,
1002 };
1003 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
1004     mutexSemId: null_mut(),
1005     mutexValid: PTHREAD_VALID_OBJ,
1006     mutexInitted: PTHREAD_UNUSED_YET_OBJ,
1007     mutexCondRefCount: 0,
1008     mutexSavPriority: -1,
1009     mutexAttr: PTHREAD_MUTEXATTR_INITIALIZER,
1010     mutexSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
1011 };
1012 
1013 const PTHREAD_CONDATTR_INITIALIZER: pthread_condattr_t = pthread_condattr_t {
1014     condAttrStatus: 0xf70990ef,
1015     condAttrPshared: 1,
1016     condAttrClockId: CLOCK_REALTIME,
1017 };
1018 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
1019     condSemId: null_mut(),
1020     condValid: PTHREAD_VALID_OBJ,
1021     condInitted: PTHREAD_UNUSED_YET_OBJ,
1022     condRefCount: 0,
1023     condMutex: null_mut(),
1024     condAttr: PTHREAD_CONDATTR_INITIALIZER,
1025     condSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
1026 };
1027 
1028 const PTHREAD_RWLOCKATTR_INITIALIZER: pthread_rwlockattr_t = pthread_rwlockattr_t {
1029     rwlockAttrStatus: PTHREAD_INITIALIZED_OBJ,
1030     rwlockAttrPshared: 1,
1031     rwlockAttrMaxReaders: 0,
1032     rwlockAttrConformOpt: 1,
1033 };
1034 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1035     rwlockSemId: null_mut(),
1036     rwlockReadersRefCount: 0,
1037     rwlockValid: PTHREAD_VALID_OBJ,
1038     rwlockInitted: PTHREAD_UNUSED_YET_OBJ,
1039     rwlockAttr: PTHREAD_RWLOCKATTR_INITIALIZER,
1040     rwlockSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
1041 };
1042 
1043 pub const SEEK_SET: ::c_int = 0;
1044 pub const SEEK_CUR: ::c_int = 1;
1045 pub const SEEK_END: ::c_int = 2;
1046 
1047 // rtpLibCommon.h
1048 pub const VX_RTP_NAME_LENGTH: ::c_int = 255;
1049 pub const RTP_ID_ERROR: ::RTP_ID = -1;
1050 
1051 // h/public/unistd.h
1052 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 21; // Via unistd.h
1053 pub const _SC_PAGESIZE: ::c_int = 39;
1054 pub const O_ACCMODE: ::c_int = 3;
1055 pub const O_CLOEXEC: ::c_int = 0x100000; // fcntlcom
1056 pub const O_EXCL: ::c_int = 0x0800;
1057 pub const O_CREAT: ::c_int = 0x0200;
1058 pub const O_TRUNC: ::c_int = 0x0400;
1059 pub const O_APPEND: ::c_int = 0x0008;
1060 pub const O_RDWR: ::c_int = 0x0002;
1061 pub const O_WRONLY: ::c_int = 0x0001;
1062 pub const O_RDONLY: ::c_int = 0;
1063 pub const O_NONBLOCK: ::c_int = 0x4000;
1064 
1065 // mman.h
1066 pub const PROT_NONE: ::c_int = 0x0000;
1067 pub const PROT_READ: ::c_int = 0x0001;
1068 pub const PROT_WRITE: ::c_int = 0x0002;
1069 pub const PROT_EXEC: ::c_int = 0x0004;
1070 
1071 pub const MAP_SHARED: ::c_int = 0x0001;
1072 pub const MAP_PRIVATE: ::c_int = 0x0002;
1073 pub const MAP_ANON: ::c_int = 0x0004;
1074 pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
1075 pub const MAP_FIXED: ::c_int = 0x0010;
1076 pub const MAP_CONTIG: ::c_int = 0x0020;
1077 
1078 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
1079 
1080 #[cfg_attr(feature = "extra_traits", derive(Debug))]
1081 pub enum FILE {}
1082 impl ::Copy for FILE {}
1083 impl ::Clone for FILE {
clone(&self) -> FILE1084     fn clone(&self) -> FILE {
1085         *self
1086     }
1087 }
1088 #[cfg_attr(feature = "extra_traits", derive(Debug))]
1089 pub enum fpos_t {} // FIXME: fill this out with a struct
1090 impl ::Copy for fpos_t {}
1091 impl ::Clone for fpos_t {
clone(&self) -> fpos_t1092     fn clone(&self) -> fpos_t {
1093         *self
1094     }
1095 }
1096 
1097 f! {
1098     pub {const} fn CMSG_ALIGN(len: usize) -> usize {
1099         len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
1100     }
1101 
1102     pub fn CMSG_NXTHDR(mhdr: *const msghdr,
1103                        cmsg: *const cmsghdr) -> *mut cmsghdr {
1104         let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)
1105             + CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
1106         let max = (*mhdr).msg_control as usize
1107             + (*mhdr).msg_controllen as usize;
1108         if next <= max {
1109             (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize))
1110                 as *mut ::cmsghdr
1111         } else {
1112             0 as *mut ::cmsghdr
1113         }
1114     }
1115 
1116     pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1117         if (*mhdr).msg_controllen as usize > 0  {
1118             (*mhdr).msg_control as *mut cmsghdr
1119         } else {
1120             0 as *mut cmsghdr
1121         }
1122     }
1123 
1124     pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar {
1125         (cmsg as *mut ::c_uchar)
1126             .offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1127     }
1128 
1129     pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1130         (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
1131             as ::c_uint
1132     }
1133 
1134     pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1135         CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
1136     }
1137 }
1138 
1139 extern "C" {
isalnum(c: c_int) -> c_int1140     pub fn isalnum(c: c_int) -> c_int;
isalpha(c: c_int) -> c_int1141     pub fn isalpha(c: c_int) -> c_int;
iscntrl(c: c_int) -> c_int1142     pub fn iscntrl(c: c_int) -> c_int;
isdigit(c: c_int) -> c_int1143     pub fn isdigit(c: c_int) -> c_int;
isgraph(c: c_int) -> c_int1144     pub fn isgraph(c: c_int) -> c_int;
islower(c: c_int) -> c_int1145     pub fn islower(c: c_int) -> c_int;
isprint(c: c_int) -> c_int1146     pub fn isprint(c: c_int) -> c_int;
ispunct(c: c_int) -> c_int1147     pub fn ispunct(c: c_int) -> c_int;
isspace(c: c_int) -> c_int1148     pub fn isspace(c: c_int) -> c_int;
isupper(c: c_int) -> c_int1149     pub fn isupper(c: c_int) -> c_int;
isxdigit(c: c_int) -> c_int1150     pub fn isxdigit(c: c_int) -> c_int;
isblank(c: c_int) -> c_int1151     pub fn isblank(c: c_int) -> c_int;
tolower(c: c_int) -> c_int1152     pub fn tolower(c: c_int) -> c_int;
toupper(c: c_int) -> c_int1153     pub fn toupper(c: c_int) -> c_int;
fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE1154     pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE1155     pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
fflush(file: *mut FILE) -> c_int1156     pub fn fflush(file: *mut FILE) -> c_int;
fclose(file: *mut FILE) -> c_int1157     pub fn fclose(file: *mut FILE) -> c_int;
remove(filename: *const c_char) -> c_int1158     pub fn remove(filename: *const c_char) -> c_int;
rename(oldname: *const c_char, newname: *const c_char) -> c_int1159     pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
tmpfile() -> *mut FILE1160     pub fn tmpfile() -> *mut FILE;
setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int1161     pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
setbuf(stream: *mut FILE, buf: *mut c_char)1162     pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
getchar() -> c_int1163     pub fn getchar() -> c_int;
putchar(c: c_int) -> c_int1164     pub fn putchar(c: c_int) -> c_int;
fgetc(stream: *mut FILE) -> c_int1165     pub fn fgetc(stream: *mut FILE) -> c_int;
fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char1166     pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
fputc(c: c_int, stream: *mut FILE) -> c_int1167     pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
fputs(s: *const c_char, stream: *mut FILE) -> c_int1168     pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
puts(s: *const c_char) -> c_int1169     pub fn puts(s: *const c_char) -> c_int;
ungetc(c: c_int, stream: *mut FILE) -> c_int1170     pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t1171     pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t1172     pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int1173     pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
ftell(stream: *mut FILE) -> c_long1174     pub fn ftell(stream: *mut FILE) -> c_long;
rewind(stream: *mut FILE)1175     pub fn rewind(stream: *mut FILE);
fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int1176     pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int1177     pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
feof(stream: *mut FILE) -> c_int1178     pub fn feof(stream: *mut FILE) -> c_int;
ferror(stream: *mut FILE) -> c_int1179     pub fn ferror(stream: *mut FILE) -> c_int;
perror(s: *const c_char)1180     pub fn perror(s: *const c_char);
atof(s: *const c_char) -> c_double1181     pub fn atof(s: *const c_char) -> c_double;
atoi(s: *const c_char) -> c_int1182     pub fn atoi(s: *const c_char) -> c_int;
atol(s: *const c_char) -> c_long1183     pub fn atol(s: *const c_char) -> c_long;
atoll(s: *const c_char) -> c_longlong1184     pub fn atoll(s: *const c_char) -> c_longlong;
strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double1185     pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float1186     pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;
strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long1187     pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong1188     pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong;
strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong1189     pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong1190     pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong;
calloc(nobj: size_t, size: size_t) -> *mut c_void1191     pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
malloc(size: size_t) -> *mut c_void1192     pub fn malloc(size: size_t) -> *mut c_void;
realloc(p: *mut c_void, size: size_t) -> *mut c_void1193     pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
free(p: *mut c_void)1194     pub fn free(p: *mut c_void);
abort() -> !1195     pub fn abort() -> !;
exit(status: c_int) -> !1196     pub fn exit(status: c_int) -> !;
atexit(cb: extern "C" fn()) -> c_int1197     pub fn atexit(cb: extern "C" fn()) -> c_int;
system(s: *const c_char) -> c_int1198     pub fn system(s: *const c_char) -> c_int;
getenv(s: *const c_char) -> *mut c_char1199     pub fn getenv(s: *const c_char) -> *mut c_char;
1200 
strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char1201     pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char1202     pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char1203     pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char1204     pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
strcmp(cs: *const c_char, ct: *const c_char) -> c_int1205     pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int1206     pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
strcoll(cs: *const c_char, ct: *const c_char) -> c_int1207     pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
strchr(cs: *const c_char, c: c_int) -> *mut c_char1208     pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
strrchr(cs: *const c_char, c: c_int) -> *mut c_char1209     pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
strspn(cs: *const c_char, ct: *const c_char) -> size_t1210     pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
strcspn(cs: *const c_char, ct: *const c_char) -> size_t1211     pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
strdup(cs: *const c_char) -> *mut c_char1212     pub fn strdup(cs: *const c_char) -> *mut c_char;
strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char1213     pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char1214     pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int1215     pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int1216     pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
strlen(cs: *const c_char) -> size_t1217     pub fn strlen(cs: *const c_char) -> size_t;
strerror(n: c_int) -> *mut c_char1218     pub fn strerror(n: c_int) -> *mut c_char;
strtok(s: *mut c_char, t: *const c_char) -> *mut c_char1219     pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t1220     pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
wcslen(buf: *const wchar_t) -> size_t1221     pub fn wcslen(buf: *const wchar_t) -> size_t;
wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t1222     pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t;
1223 
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void1224     pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t1225     pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int1226     pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void1227     pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void1228     pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void1229     pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
1230 }
1231 
1232 extern "C" {
fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int1233     pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
printf(format: *const ::c_char, ...) -> ::c_int1234     pub fn printf(format: *const ::c_char, ...) -> ::c_int;
snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int1235     pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int;
sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int1236     pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int1237     pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
scanf(format: *const ::c_char, ...) -> ::c_int1238     pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int1239     pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
getchar_unlocked() -> ::c_int1240     pub fn getchar_unlocked() -> ::c_int;
putchar_unlocked(c: ::c_int) -> ::c_int1241     pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
stat(path: *const c_char, buf: *mut stat) -> ::c_int1242     pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE1243     pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
fileno(stream: *mut ::FILE) -> ::c_int1244     pub fn fileno(stream: *mut ::FILE) -> ::c_int;
creat(path: *const c_char, mode: mode_t) -> ::c_int1245     pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
rewinddir(dirp: *mut ::DIR)1246     pub fn rewinddir(dirp: *mut ::DIR);
fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int1247     pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int;
access(path: *const c_char, amode: ::c_int) -> ::c_int1248     pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
alarm(seconds: ::c_uint) -> ::c_uint1249     pub fn alarm(seconds: ::c_uint) -> ::c_uint;
fchdir(dirfd: ::c_int) -> ::c_int1250     pub fn fchdir(dirfd: ::c_int) -> ::c_int;
chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int1251     pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
fpathconf(filedes: ::c_int, name: ::c_int) -> c_long1252     pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
getegid() -> gid_t1253     pub fn getegid() -> gid_t;
geteuid() -> uid_t1254     pub fn geteuid() -> uid_t;
getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int1255     pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
getlogin() -> *mut c_char1256     pub fn getlogin() -> *mut c_char;
getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int1257     pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int;
pathconf(path: *const c_char, name: ::c_int) -> c_long1258     pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pause() -> ::c_int1259     pub fn pause() -> ::c_int;
seteuid(uid: uid_t) -> ::c_int1260     pub fn seteuid(uid: uid_t) -> ::c_int;
setegid(gid: gid_t) -> ::c_int1261     pub fn setegid(gid: gid_t) -> ::c_int;
sleep(secs: ::c_uint) -> ::c_uint1262     pub fn sleep(secs: ::c_uint) -> ::c_uint;
ttyname(fd: ::c_int) -> *mut c_char1263     pub fn ttyname(fd: ::c_int) -> *mut c_char;
wait(status: *mut ::c_int) -> pid_t1264     pub fn wait(status: *mut ::c_int) -> pid_t;
umask(mask: mode_t) -> mode_t1265     pub fn umask(mask: mode_t) -> mode_t;
mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int1266     pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
mlockall(flags: ::c_int) -> ::c_int1267     pub fn mlockall(flags: ::c_int) -> ::c_int;
munlockall() -> ::c_int1268     pub fn munlockall() -> ::c_int;
1269 
mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void1270     pub fn mmap(
1271         addr: *mut ::c_void,
1272         len: ::size_t,
1273         prot: ::c_int,
1274         flags: ::c_int,
1275         fd: ::c_int,
1276         offset: off_t,
1277     ) -> *mut ::c_void;
munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int1278     pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
truncate(path: *const c_char, length: off_t) -> ::c_int1279     pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int1280     pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int;
shm_unlink(name: *const ::c_char) -> ::c_int1281     pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
1282 
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1283     pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pthread_exit(value: *mut ::c_void) -> !1284     pub fn pthread_exit(value: *mut ::c_void) -> !;
pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int1285     pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int;
1286 
strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int1287     pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
1288 
sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1289     pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1290 
sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int1291     pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int;
1292 
utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int1293     pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int;
1294 
1295     #[link_name = "_rtld_dlopen"]
dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1296     pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
1297 
1298     #[link_name = "_rtld_dlerror"]
dlerror() -> *mut ::c_char1299     pub fn dlerror() -> *mut ::c_char;
1300 
1301     #[link_name = "_rtld_dlsym"]
dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void1302     pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void;
1303 
1304     #[link_name = "_rtld_dlclose"]
dlclose(handle: *mut ::c_void) -> ::c_int1305     pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
1306 
1307     #[link_name = "_rtld_dladdr"]
dladdr(addr: *mut ::c_void, info: *mut Dl_info) -> ::c_int1308     pub fn dladdr(addr: *mut ::c_void, info: *mut Dl_info) -> ::c_int;
1309 
1310     // time.h
gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1311     pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1312     pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
mktime(tm: *mut tm) -> time_t1313     pub fn mktime(tm: *mut tm) -> time_t;
time(time: *mut time_t) -> time_t1314     pub fn time(time: *mut time_t) -> time_t;
gmtime(time_p: *const time_t) -> *mut tm1315     pub fn gmtime(time_p: *const time_t) -> *mut tm;
localtime(time_p: *const time_t) -> *mut tm1316     pub fn localtime(time_p: *const time_t) -> *mut tm;
timegm(tm: *mut tm) -> time_t1317     pub fn timegm(tm: *mut tm) -> time_t;
difftime(time1: time_t, time0: time_t) -> ::c_double1318     pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1319     pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
usleep(secs: ::useconds_t) -> ::c_int1320     pub fn usleep(secs: ::useconds_t) -> ::c_int;
putenv(string: *mut c_char) -> ::c_int1321     pub fn putenv(string: *mut c_char) -> ::c_int;
setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char1322     pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char;
1323 
sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1324     pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
sigpending(set: *mut sigset_t) -> ::c_int1325     pub fn sigpending(set: *mut sigset_t) -> ::c_int;
1326 
mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1327     pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
1328 
fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int1329     pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int;
ftello(stream: *mut ::FILE) -> ::off_t1330     pub fn ftello(stream: *mut ::FILE) -> ::off_t;
mkstemp(template: *mut ::c_char) -> ::c_int1331     pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
1332 
tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1333     pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
1334 
openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1335     pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
closelog()1336     pub fn closelog();
setlogmask(maskpri: ::c_int) -> ::c_int1337     pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
syslog(priority: ::c_int, message: *const ::c_char, ...)1338     pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t1339     pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
1340 
1341 }
1342 
1343 extern "C" {
1344     // stdlib.h
memalign(block_size: ::size_t, size_arg: ::size_t) -> *mut ::c_void1345     pub fn memalign(block_size: ::size_t, size_arg: ::size_t) -> *mut ::c_void;
1346 
1347     // ioLib.h
getcwd(buf: *mut ::c_char, size: ::size_t) -> *mut ::c_char1348     pub fn getcwd(buf: *mut ::c_char, size: ::size_t) -> *mut ::c_char;
1349 
1350     // ioLib.h
chdir(attr: *const ::c_char) -> ::c_int1351     pub fn chdir(attr: *const ::c_char) -> ::c_int;
1352 
1353     // pthread.h
pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int1354     pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
1355 
1356     // pthread.h
pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int1357     pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
1358 
1359     // pthread.h
pthread_mutexattr_settype(pAttr: *mut ::pthread_mutexattr_t, pType: ::c_int) -> ::c_int1360     pub fn pthread_mutexattr_settype(pAttr: *mut ::pthread_mutexattr_t, pType: ::c_int) -> ::c_int;
1361 
1362     // pthread.h
pthread_mutex_init( mutex: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> ::c_int1363     pub fn pthread_mutex_init(
1364         mutex: *mut pthread_mutex_t,
1365         attr: *const pthread_mutexattr_t,
1366     ) -> ::c_int;
1367 
1368     // pthread.h
pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> ::c_int1369     pub fn pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> ::c_int;
1370 
1371     // pthread.h
pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> ::c_int1372     pub fn pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> ::c_int;
1373 
1374     // pthread.h
pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> ::c_int1375     pub fn pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> ::c_int;
1376 
1377     // pthread.h
pthread_mutex_timedlock(attr: *mut pthread_mutex_t, spec: *const timespec) -> ::c_int1378     pub fn pthread_mutex_timedlock(attr: *mut pthread_mutex_t, spec: *const timespec) -> ::c_int;
1379 
1380     // pthread.h
pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> ::c_int1381     pub fn pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> ::c_int;
1382 
1383     // pthread.h
pthread_attr_setname(pAttr: *mut ::pthread_attr_t, name: *mut ::c_char) -> ::c_int1384     pub fn pthread_attr_setname(pAttr: *mut ::pthread_attr_t, name: *mut ::c_char) -> ::c_int;
1385 
1386     // pthread.h
pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stacksize: ::size_t) -> ::c_int1387     pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stacksize: ::size_t) -> ::c_int;
1388 
1389     // pthread.h
pthread_attr_getstacksize(attr: *const ::pthread_attr_t, size: *mut ::size_t) -> ::c_int1390     pub fn pthread_attr_getstacksize(attr: *const ::pthread_attr_t, size: *mut ::size_t)
1391         -> ::c_int;
1392 
1393     // pthread.h
pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1394     pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
1395 
1396     // pthread.h
pthread_create( pThread: *mut ::pthread_t, pAttr: *const ::pthread_attr_t, start_routine: extern "C" fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int1397     pub fn pthread_create(
1398         pThread: *mut ::pthread_t,
1399         pAttr: *const ::pthread_attr_t,
1400         start_routine: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
1401         value: *mut ::c_void,
1402     ) -> ::c_int;
1403 
1404     //pthread.h
pthread_setschedparam( native: ::pthread_t, policy: ::c_int, param: *const ::sched_param, ) -> ::c_int1405     pub fn pthread_setschedparam(
1406         native: ::pthread_t,
1407         policy: ::c_int,
1408         param: *const ::sched_param,
1409     ) -> ::c_int;
1410 
1411     //pthread.h
pthread_getschedparam( native: ::pthread_t, policy: *mut ::c_int, param: *mut ::sched_param, ) -> ::c_int1412     pub fn pthread_getschedparam(
1413         native: ::pthread_t,
1414         policy: *mut ::c_int,
1415         param: *mut ::sched_param,
1416     ) -> ::c_int;
1417 
1418     //pthread.h
pthread_attr_setinheritsched( attr: *mut ::pthread_attr_t, inheritsched: ::c_int, ) -> ::c_int1419     pub fn pthread_attr_setinheritsched(
1420         attr: *mut ::pthread_attr_t,
1421         inheritsched: ::c_int,
1422     ) -> ::c_int;
1423 
1424     //pthread.h
pthread_attr_setschedpolicy(attr: *mut ::pthread_attr_t, policy: ::c_int) -> ::c_int1425     pub fn pthread_attr_setschedpolicy(attr: *mut ::pthread_attr_t, policy: ::c_int) -> ::c_int;
1426 
1427     // pthread.h
pthread_attr_destroy(thread: *mut ::pthread_attr_t) -> ::c_int1428     pub fn pthread_attr_destroy(thread: *mut ::pthread_attr_t) -> ::c_int;
1429 
1430     // pthread.h
pthread_detach(thread: ::pthread_t) -> ::c_int1431     pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
1432 
1433     // int pthread_atfork (void (*)(void), void (*)(void), void (*)(void));
pthread_atfork( prepare: ::Option<unsafe extern "C" fn()>, parent: ::Option<unsafe extern "C" fn()>, child: ::Option<unsafe extern "C" fn()>, ) -> ::c_int1434     pub fn pthread_atfork(
1435         prepare: ::Option<unsafe extern "C" fn()>,
1436         parent: ::Option<unsafe extern "C" fn()>,
1437         child: ::Option<unsafe extern "C" fn()>,
1438     ) -> ::c_int;
1439 
1440     // stat.h
fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int1441     pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
1442 
1443     // stat.h
lstat(path: *const ::c_char, buf: *mut stat) -> ::c_int1444     pub fn lstat(path: *const ::c_char, buf: *mut stat) -> ::c_int;
1445 
1446     // unistd.h
ftruncate(fd: ::c_int, length: off_t) -> ::c_int1447     pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
1448 
1449     // dirent.h
readdir_r(pDir: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent) -> ::c_int1450     pub fn readdir_r(pDir: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent)
1451         -> ::c_int;
1452 
1453     // dirent.h
readdir(pDir: *mut ::DIR) -> *mut ::dirent1454     pub fn readdir(pDir: *mut ::DIR) -> *mut ::dirent;
1455 
1456     // fcntl.h or
1457     // ioLib.h
open(path: *const ::c_char, oflag: ::c_int, ...) -> ::c_int1458     pub fn open(path: *const ::c_char, oflag: ::c_int, ...) -> ::c_int;
1459 
1460     // poll.h
poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1461     pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
1462 
1463     // pthread.h
pthread_condattr_init(attr: *mut ::pthread_condattr_t) -> ::c_int1464     pub fn pthread_condattr_init(attr: *mut ::pthread_condattr_t) -> ::c_int;
1465 
1466     // pthread.h
pthread_condattr_destroy(attr: *mut ::pthread_condattr_t) -> ::c_int1467     pub fn pthread_condattr_destroy(attr: *mut ::pthread_condattr_t) -> ::c_int;
1468 
1469     // pthread.h
pthread_condattr_getclock( pAttr: *const ::pthread_condattr_t, pClockId: *mut ::clockid_t, ) -> ::c_int1470     pub fn pthread_condattr_getclock(
1471         pAttr: *const ::pthread_condattr_t,
1472         pClockId: *mut ::clockid_t,
1473     ) -> ::c_int;
1474 
1475     // pthread.h
pthread_condattr_setclock( pAttr: *mut ::pthread_condattr_t, clockId: ::clockid_t, ) -> ::c_int1476     pub fn pthread_condattr_setclock(
1477         pAttr: *mut ::pthread_condattr_t,
1478         clockId: ::clockid_t,
1479     ) -> ::c_int;
1480 
1481     // pthread.h
pthread_cond_init( cond: *mut ::pthread_cond_t, attr: *const ::pthread_condattr_t, ) -> ::c_int1482     pub fn pthread_cond_init(
1483         cond: *mut ::pthread_cond_t,
1484         attr: *const ::pthread_condattr_t,
1485     ) -> ::c_int;
1486 
1487     // pthread.h
pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1488     pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
1489 
1490     // pthread.h
pthread_cond_signal(cond: *mut ::pthread_cond_t) -> ::c_int1491     pub fn pthread_cond_signal(cond: *mut ::pthread_cond_t) -> ::c_int;
1492 
1493     // pthread.h
pthread_cond_broadcast(cond: *mut ::pthread_cond_t) -> ::c_int1494     pub fn pthread_cond_broadcast(cond: *mut ::pthread_cond_t) -> ::c_int;
1495 
1496     // pthread.h
pthread_cond_wait(cond: *mut ::pthread_cond_t, mutex: *mut ::pthread_mutex_t) -> ::c_int1497     pub fn pthread_cond_wait(cond: *mut ::pthread_cond_t, mutex: *mut ::pthread_mutex_t)
1498         -> ::c_int;
1499 
1500     // pthread.h
pthread_rwlockattr_init(attr: *mut ::pthread_rwlockattr_t) -> ::c_int1501     pub fn pthread_rwlockattr_init(attr: *mut ::pthread_rwlockattr_t) -> ::c_int;
1502 
1503     // pthread.h
pthread_rwlockattr_destroy(attr: *mut ::pthread_rwlockattr_t) -> ::c_int1504     pub fn pthread_rwlockattr_destroy(attr: *mut ::pthread_rwlockattr_t) -> ::c_int;
1505 
1506     // pthread.h
pthread_rwlockattr_setmaxreaders( attr: *mut ::pthread_rwlockattr_t, attr2: ::c_uint, ) -> ::c_int1507     pub fn pthread_rwlockattr_setmaxreaders(
1508         attr: *mut ::pthread_rwlockattr_t,
1509         attr2: ::c_uint,
1510     ) -> ::c_int;
1511 
1512     // pthread.h
pthread_rwlock_init( attr: *mut ::pthread_rwlock_t, host: *const ::pthread_rwlockattr_t, ) -> ::c_int1513     pub fn pthread_rwlock_init(
1514         attr: *mut ::pthread_rwlock_t,
1515         host: *const ::pthread_rwlockattr_t,
1516     ) -> ::c_int;
1517 
1518     // pthread.h
pthread_rwlock_destroy(attr: *mut ::pthread_rwlock_t) -> ::c_int1519     pub fn pthread_rwlock_destroy(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1520 
1521     // pthread.h
pthread_rwlock_rdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1522     pub fn pthread_rwlock_rdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1523 
1524     // pthread.h
pthread_rwlock_tryrdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1525     pub fn pthread_rwlock_tryrdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1526 
1527     // pthread.h
pthread_rwlock_timedrdlock( attr: *mut ::pthread_rwlock_t, host: *const ::timespec, ) -> ::c_int1528     pub fn pthread_rwlock_timedrdlock(
1529         attr: *mut ::pthread_rwlock_t,
1530         host: *const ::timespec,
1531     ) -> ::c_int;
1532 
1533     // pthread.h
pthread_rwlock_wrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1534     pub fn pthread_rwlock_wrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1535 
1536     // pthread.h
pthread_rwlock_trywrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1537     pub fn pthread_rwlock_trywrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1538 
1539     // pthread.h
pthread_rwlock_timedwrlock( attr: *mut ::pthread_rwlock_t, host: *const ::timespec, ) -> ::c_int1540     pub fn pthread_rwlock_timedwrlock(
1541         attr: *mut ::pthread_rwlock_t,
1542         host: *const ::timespec,
1543     ) -> ::c_int;
1544 
1545     // pthread.h
pthread_rwlock_unlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1546     pub fn pthread_rwlock_unlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1547 
1548     // pthread.h
pthread_key_create( key: *mut ::pthread_key_t, dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, ) -> ::c_int1549     pub fn pthread_key_create(
1550         key: *mut ::pthread_key_t,
1551         dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
1552     ) -> ::c_int;
1553 
1554     // pthread.h
pthread_key_delete(key: ::pthread_key_t) -> ::c_int1555     pub fn pthread_key_delete(key: ::pthread_key_t) -> ::c_int;
1556 
1557     // pthread.h
pthread_setspecific(key: ::pthread_key_t, value: *const ::c_void) -> ::c_int1558     pub fn pthread_setspecific(key: ::pthread_key_t, value: *const ::c_void) -> ::c_int;
1559 
1560     // pthread.h
pthread_getspecific(key: ::pthread_key_t) -> *mut ::c_void1561     pub fn pthread_getspecific(key: ::pthread_key_t) -> *mut ::c_void;
1562 
1563     // pthread.h
pthread_cond_timedwait( cond: *mut ::pthread_cond_t, mutex: *mut ::pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1564     pub fn pthread_cond_timedwait(
1565         cond: *mut ::pthread_cond_t,
1566         mutex: *mut ::pthread_mutex_t,
1567         abstime: *const ::timespec,
1568     ) -> ::c_int;
1569 
1570     // pthread.h
pthread_attr_getname(attr: *mut ::pthread_attr_t, name: *mut *mut ::c_char) -> ::c_int1571     pub fn pthread_attr_getname(attr: *mut ::pthread_attr_t, name: *mut *mut ::c_char) -> ::c_int;
1572 
1573     // pthread.h
pthread_join(thread: ::pthread_t, status: *mut *mut ::c_void) -> ::c_int1574     pub fn pthread_join(thread: ::pthread_t, status: *mut *mut ::c_void) -> ::c_int;
1575 
1576     // pthread.h
pthread_self() -> ::pthread_t1577     pub fn pthread_self() -> ::pthread_t;
1578 
1579     // clockLib.h
clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int1580     pub fn clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1581 
1582     // clockLib.h
clock_settime(clock_id: ::clockid_t, tp: *const ::timespec) -> ::c_int1583     pub fn clock_settime(clock_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
1584 
1585     // clockLib.h
clock_getres(clock_id: ::clockid_t, res: *mut ::timespec) -> ::c_int1586     pub fn clock_getres(clock_id: ::clockid_t, res: *mut ::timespec) -> ::c_int;
1587 
1588     // clockLib.h
clock_nanosleep( clock_id: ::clockid_t, flags: ::c_int, rqtp: *const ::timespec, rmtp: *mut ::timespec, ) -> ::c_int1589     pub fn clock_nanosleep(
1590         clock_id: ::clockid_t,
1591         flags: ::c_int,
1592         rqtp: *const ::timespec,
1593         rmtp: *mut ::timespec,
1594     ) -> ::c_int;
1595 
1596     // timerLib.h
nanosleep(rqtp: *const ::timespec, rmtp: *mut ::timespec) -> ::c_int1597     pub fn nanosleep(rqtp: *const ::timespec, rmtp: *mut ::timespec) -> ::c_int;
1598 
1599     // socket.h
accept(s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::c_int1600     pub fn accept(s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::c_int;
1601 
1602     // socket.h
bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int1603     pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int;
1604 
1605     // socket.h
connect(s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t) -> ::c_int1606     pub fn connect(s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t) -> ::c_int;
1607 
1608     // socket.h
getpeername(s: ::c_int, name: *mut ::sockaddr, namelen: *mut ::socklen_t) -> ::c_int1609     pub fn getpeername(s: ::c_int, name: *mut ::sockaddr, namelen: *mut ::socklen_t) -> ::c_int;
1610 
1611     // socket.h
getsockname( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int1612     pub fn getsockname(
1613         socket: ::c_int,
1614         address: *mut sockaddr,
1615         address_len: *mut socklen_t,
1616     ) -> ::c_int;
1617 
1618     // socket.h
getsockopt( sockfd: ::c_int, level: ::c_int, optname: ::c_int, optval: *mut ::c_void, optlen: *mut ::socklen_t, ) -> ::c_int1619     pub fn getsockopt(
1620         sockfd: ::c_int,
1621         level: ::c_int,
1622         optname: ::c_int,
1623         optval: *mut ::c_void,
1624         optlen: *mut ::socklen_t,
1625     ) -> ::c_int;
1626 
1627     // socket.h
listen(socket: ::c_int, backlog: ::c_int) -> ::c_int1628     pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
1629 
1630     // socket.h
recv(s: ::c_int, buf: *mut ::c_void, bufLen: ::size_t, flags: ::c_int) -> ::ssize_t1631     pub fn recv(s: ::c_int, buf: *mut ::c_void, bufLen: ::size_t, flags: ::c_int) -> ::ssize_t;
1632 
1633     // socket.h
recvfrom( s: ::c_int, buf: *mut ::c_void, bufLen: ::size_t, flags: ::c_int, from: *mut ::sockaddr, pFromLen: *mut ::socklen_t, ) -> ::ssize_t1634     pub fn recvfrom(
1635         s: ::c_int,
1636         buf: *mut ::c_void,
1637         bufLen: ::size_t,
1638         flags: ::c_int,
1639         from: *mut ::sockaddr,
1640         pFromLen: *mut ::socklen_t,
1641     ) -> ::ssize_t;
1642 
recvmsg(socket: ::c_int, mp: *mut ::msghdr, flags: ::c_int) -> ::ssize_t1643     pub fn recvmsg(socket: ::c_int, mp: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
1644 
1645     // socket.h
send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1646     pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
1647 
sendmsg(socket: ::c_int, mp: *const ::msghdr, flags: ::c_int) -> ::ssize_t1648     pub fn sendmsg(socket: ::c_int, mp: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
1649 
1650     // socket.h
sendto( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, addr: *const sockaddr, addrlen: socklen_t, ) -> ::ssize_t1651     pub fn sendto(
1652         socket: ::c_int,
1653         buf: *const ::c_void,
1654         len: ::size_t,
1655         flags: ::c_int,
1656         addr: *const sockaddr,
1657         addrlen: socklen_t,
1658     ) -> ::ssize_t;
1659 
1660     // socket.h
setsockopt( socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t, ) -> ::c_int1661     pub fn setsockopt(
1662         socket: ::c_int,
1663         level: ::c_int,
1664         name: ::c_int,
1665         value: *const ::c_void,
1666         option_len: socklen_t,
1667     ) -> ::c_int;
1668 
1669     // socket.h
shutdown(s: ::c_int, how: ::c_int) -> ::c_int1670     pub fn shutdown(s: ::c_int, how: ::c_int) -> ::c_int;
1671 
1672     // socket.h
socket(domain: ::c_int, _type: ::c_int, protocol: ::c_int) -> ::c_int1673     pub fn socket(domain: ::c_int, _type: ::c_int, protocol: ::c_int) -> ::c_int;
1674 
1675     // icotl.h
ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int1676     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
1677 
1678     // fcntl.h
fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int1679     pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
1680 
1681     // ntp_rfc2553.h for kernel
1682     // netdb.h for user
gai_strerror(errcode: ::c_int) -> *mut ::c_char1683     pub fn gai_strerror(errcode: ::c_int) -> *mut ::c_char;
1684 
1685     // ioLib.h or
1686     // unistd.h
close(fd: ::c_int) -> ::c_int1687     pub fn close(fd: ::c_int) -> ::c_int;
1688 
1689     // ioLib.h or
1690     // unistd.h
read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t1691     pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
1692 
1693     // ioLib.h or
1694     // unistd.h
write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t1695     pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
1696 
1697     // ioLib.h or
1698     // unistd.h
isatty(fd: ::c_int) -> ::c_int1699     pub fn isatty(fd: ::c_int) -> ::c_int;
1700 
1701     // ioLib.h or
1702     // unistd.h
dup(src: ::c_int) -> ::c_int1703     pub fn dup(src: ::c_int) -> ::c_int;
1704 
1705     // ioLib.h or
1706     // unistd.h
dup2(src: ::c_int, dst: ::c_int) -> ::c_int1707     pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
1708 
1709     // ioLib.h or
1710     // unistd.h
pipe(fds: *mut ::c_int) -> ::c_int1711     pub fn pipe(fds: *mut ::c_int) -> ::c_int;
1712 
1713     // ioLib.h or
1714     // unistd.h
unlink(pathname: *const ::c_char) -> ::c_int1715     pub fn unlink(pathname: *const ::c_char) -> ::c_int;
1716 
1717     // unistd.h and
1718     // ioLib.h
lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t1719     pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
1720 
1721     // netdb.h
getaddrinfo( node: *const ::c_char, service: *const ::c_char, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> ::c_int1722     pub fn getaddrinfo(
1723         node: *const ::c_char,
1724         service: *const ::c_char,
1725         hints: *const addrinfo,
1726         res: *mut *mut addrinfo,
1727     ) -> ::c_int;
1728 
1729     // netdb.h
freeaddrinfo(res: *mut addrinfo)1730     pub fn freeaddrinfo(res: *mut addrinfo);
1731 
1732     // signal.h
signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t1733     pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
1734 
1735     // unistd.h
getpid() -> pid_t1736     pub fn getpid() -> pid_t;
1737 
1738     // unistd.h
getppid() -> pid_t1739     pub fn getppid() -> pid_t;
1740 
1741     // wait.h
waitpid(pid: pid_t, status: *mut ::c_int, optons: ::c_int) -> pid_t1742     pub fn waitpid(pid: pid_t, status: *mut ::c_int, optons: ::c_int) -> pid_t;
1743 
1744     // unistd.h
sysconf(attr: ::c_int) -> ::c_long1745     pub fn sysconf(attr: ::c_int) -> ::c_long;
1746 
1747     // stdlib.h
setenv( envVarName: *const ::c_char, envVarValue: *const ::c_char, overwrite: ::c_int, ) -> ::c_int1748     pub fn setenv(
1749         // setenv.c
1750         envVarName: *const ::c_char,
1751         envVarValue: *const ::c_char,
1752         overwrite: ::c_int,
1753     ) -> ::c_int;
1754 
1755     // stdlib.h
unsetenv( envVarName: *const ::c_char, ) -> ::c_int1756     pub fn unsetenv(
1757         // setenv.c
1758         envVarName: *const ::c_char,
1759     ) -> ::c_int;
1760 
1761     // stdlib.h
realpath(fileName: *const ::c_char, resolvedName: *mut ::c_char) -> *mut ::c_char1762     pub fn realpath(fileName: *const ::c_char, resolvedName: *mut ::c_char) -> *mut ::c_char;
1763 
1764     // unistd.h
link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int1765     pub fn link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int;
1766 
1767     // unistd.h
readlink(path: *const ::c_char, buf: *mut ::c_char, bufsize: ::size_t) -> ::ssize_t1768     pub fn readlink(path: *const ::c_char, buf: *mut ::c_char, bufsize: ::size_t) -> ::ssize_t;
1769 
1770     // unistd.h
symlink(path1: *const ::c_char, path2: *const ::c_char) -> ::c_int1771     pub fn symlink(path1: *const ::c_char, path2: *const ::c_char) -> ::c_int;
1772 
1773     // dirent.h
opendir(name: *const ::c_char) -> *mut ::DIR1774     pub fn opendir(name: *const ::c_char) -> *mut ::DIR;
1775 
1776     // unistd.h
rmdir(path: *const ::c_char) -> ::c_int1777     pub fn rmdir(path: *const ::c_char) -> ::c_int;
1778 
1779     // stat.h
mkdir(dirName: *const ::c_char, mode: ::mode_t) -> ::c_int1780     pub fn mkdir(dirName: *const ::c_char, mode: ::mode_t) -> ::c_int;
1781 
1782     // stat.h
chmod(path: *const ::c_char, mode: ::mode_t) -> ::c_int1783     pub fn chmod(path: *const ::c_char, mode: ::mode_t) -> ::c_int;
1784 
1785     // stat.h
fchmod(attr1: ::c_int, attr2: ::mode_t) -> ::c_int1786     pub fn fchmod(attr1: ::c_int, attr2: ::mode_t) -> ::c_int;
1787 
1788     // unistd.h
fsync(fd: ::c_int) -> ::c_int1789     pub fn fsync(fd: ::c_int) -> ::c_int;
1790 
1791     // dirent.h
closedir(ptr: *mut ::DIR) -> ::c_int1792     pub fn closedir(ptr: *mut ::DIR) -> ::c_int;
1793 
1794     //sched.h
sched_get_priority_max(policy: ::c_int) -> ::c_int1795     pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
1796 
1797     //sched.h
sched_get_priority_min(policy: ::c_int) -> ::c_int1798     pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
1799 
1800     //sched.h
sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int1801     pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
1802 
1803     //sched.h
sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int1804     pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
1805 
1806     //sched.h
sched_setscheduler( pid: ::pid_t, policy: ::c_int, param: *const ::sched_param, ) -> ::c_int1807     pub fn sched_setscheduler(
1808         pid: ::pid_t,
1809         policy: ::c_int,
1810         param: *const ::sched_param,
1811     ) -> ::c_int;
1812 
1813     //sched.h
sched_getscheduler(pid: ::pid_t) -> ::c_int1814     pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
1815 
1816     //sched.h
sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int1817     pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
1818 
1819     // sched.h
sched_yield() -> ::c_int1820     pub fn sched_yield() -> ::c_int;
1821 
1822     // errnoLib.h
errnoSet(err: ::c_int) -> ::c_int1823     pub fn errnoSet(err: ::c_int) -> ::c_int;
1824 
1825     // errnoLib.h
errnoGet() -> ::c_int1826     pub fn errnoGet() -> ::c_int;
1827 
1828     // unistd.h
_exit(status: ::c_int) -> !1829     pub fn _exit(status: ::c_int) -> !;
1830 
1831     // unistd.h
setgid(gid: ::gid_t) -> ::c_int1832     pub fn setgid(gid: ::gid_t) -> ::c_int;
1833 
1834     // unistd.h
getgid() -> ::gid_t1835     pub fn getgid() -> ::gid_t;
1836 
1837     // unistd.h
setuid(uid: ::uid_t) -> ::c_int1838     pub fn setuid(uid: ::uid_t) -> ::c_int;
1839 
1840     // unistd.h
getuid() -> ::uid_t1841     pub fn getuid() -> ::uid_t;
1842 
1843     // signal.h
sigemptyset(__set: *mut sigset_t) -> ::c_int1844     pub fn sigemptyset(__set: *mut sigset_t) -> ::c_int;
1845 
1846     // pthread.h for kernel
1847     // signal.h for user
pthread_sigmask( __how: ::c_int, __set: *const sigset_t, __oset: *mut sigset_t, ) -> ::c_int1848     pub fn pthread_sigmask(
1849         __how: ::c_int,
1850         __set: *const sigset_t,
1851         __oset: *mut sigset_t,
1852     ) -> ::c_int;
1853 
1854     // signal.h for user
kill(__pid: pid_t, __signo: ::c_int) -> ::c_int1855     pub fn kill(__pid: pid_t, __signo: ::c_int) -> ::c_int;
1856 
1857     // signal.h for user
sigqueue(__pid: pid_t, __signo: ::c_int, __value: ::sigval) -> ::c_int1858     pub fn sigqueue(__pid: pid_t, __signo: ::c_int, __value: ::sigval) -> ::c_int;
1859 
1860     // signal.h for user
_sigqueue( rtpId: ::RTP_ID, signo: ::c_int, pValue: *const ::sigval, sigCode: ::c_int, ) -> ::c_int1861     pub fn _sigqueue(
1862         rtpId: ::RTP_ID,
1863         signo: ::c_int,
1864         pValue: *const ::sigval,
1865         sigCode: ::c_int,
1866     ) -> ::c_int;
1867 
1868     // signal.h
taskKill(taskId: ::TASK_ID, signo: ::c_int) -> ::c_int1869     pub fn taskKill(taskId: ::TASK_ID, signo: ::c_int) -> ::c_int;
1870 
1871     // signal.h
raise(__signo: ::c_int) -> ::c_int1872     pub fn raise(__signo: ::c_int) -> ::c_int;
1873 
1874     // taskLibCommon.h
taskIdSelf() -> ::TASK_ID1875     pub fn taskIdSelf() -> ::TASK_ID;
taskDelay(ticks: ::_Vx_ticks_t) -> ::c_int1876     pub fn taskDelay(ticks: ::_Vx_ticks_t) -> ::c_int;
1877 
1878     // taskLib.h
taskNameSet(task_id: ::TASK_ID, task_name: *mut ::c_char) -> ::c_int1879     pub fn taskNameSet(task_id: ::TASK_ID, task_name: *mut ::c_char) -> ::c_int;
taskNameGet(task_id: ::TASK_ID, buf_name: *mut ::c_char, bufsize: ::size_t) -> ::c_int1880     pub fn taskNameGet(task_id: ::TASK_ID, buf_name: *mut ::c_char, bufsize: ::size_t) -> ::c_int;
1881 
1882     // rtpLibCommon.h
rtpInfoGet(rtpId: ::RTP_ID, rtpStruct: *mut ::RTP_DESC) -> ::c_int1883     pub fn rtpInfoGet(rtpId: ::RTP_ID, rtpStruct: *mut ::RTP_DESC) -> ::c_int;
rtpSpawn( pubrtpFileName: *const ::c_char, argv: *mut *const ::c_char, envp: *mut *const ::c_char, priority: ::c_int, uStackSize: ::size_t, options: ::c_int, taskOptions: ::c_int, ) -> RTP_ID1884     pub fn rtpSpawn(
1885         pubrtpFileName: *const ::c_char,
1886         argv: *mut *const ::c_char,
1887         envp: *mut *const ::c_char,
1888         priority: ::c_int,
1889         uStackSize: ::size_t,
1890         options: ::c_int,
1891         taskOptions: ::c_int,
1892     ) -> RTP_ID;
1893 
1894     // ioLib.h
_realpath(fileName: *const ::c_char, resolvedName: *mut ::c_char) -> *mut ::c_char1895     pub fn _realpath(fileName: *const ::c_char, resolvedName: *mut ::c_char) -> *mut ::c_char;
1896 
1897     // pathLib.h
_pathIsAbsolute(filepath: *const ::c_char, pNameTail: *mut *const ::c_char) -> BOOL1898     pub fn _pathIsAbsolute(filepath: *const ::c_char, pNameTail: *mut *const ::c_char) -> BOOL;
1899 
writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t1900     pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t1901     pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
1902 
1903     // randomNumGen.h
randBytes(buf: *mut c_uchar, length: c_int) -> c_int1904     pub fn randBytes(buf: *mut c_uchar, length: c_int) -> c_int;
randABytes(buf: *mut c_uchar, length: c_int) -> c_int1905     pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int;
randUBytes(buf: *mut c_uchar, length: c_int) -> c_int1906     pub fn randUBytes(buf: *mut c_uchar, length: c_int) -> c_int;
randSecure() -> c_int1907     pub fn randSecure() -> c_int;
1908 
1909     // mqueue.h
mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t1910     pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
mq_close(mqd: ::mqd_t) -> ::c_int1911     pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
mq_unlink(name: *const ::c_char) -> ::c_int1912     pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
mq_receive( mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msg_prio: *mut ::c_uint, ) -> ::ssize_t1913     pub fn mq_receive(
1914         mqd: ::mqd_t,
1915         msg_ptr: *mut ::c_char,
1916         msg_len: ::size_t,
1917         msg_prio: *mut ::c_uint,
1918     ) -> ::ssize_t;
mq_timedreceive( mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, msg_prio: *mut ::c_uint, abs_timeout: *const ::timespec, ) -> ::ssize_t1919     pub fn mq_timedreceive(
1920         mqd: ::mqd_t,
1921         msg_ptr: *mut ::c_char,
1922         msg_len: ::size_t,
1923         msg_prio: *mut ::c_uint,
1924         abs_timeout: *const ::timespec,
1925     ) -> ::ssize_t;
mq_send( mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msg_prio: ::c_uint, ) -> ::c_int1926     pub fn mq_send(
1927         mqd: ::mqd_t,
1928         msg_ptr: *const ::c_char,
1929         msg_len: ::size_t,
1930         msg_prio: ::c_uint,
1931     ) -> ::c_int;
mq_timedsend( mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msg_prio: ::c_uint, abs_timeout: *const ::timespec, ) -> ::c_int1932     pub fn mq_timedsend(
1933         mqd: ::mqd_t,
1934         msg_ptr: *const ::c_char,
1935         msg_len: ::size_t,
1936         msg_prio: ::c_uint,
1937         abs_timeout: *const ::timespec,
1938     ) -> ::c_int;
mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int1939     pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int1940     pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
1941 
1942     // vxCpuLib.h
vxCpuEnabledGet() -> ::cpuset_t1943     pub fn vxCpuEnabledGet() -> ::cpuset_t; // Get set of running CPU's in the system
vxCpuConfiguredGet() -> ::cpuset_t1944     pub fn vxCpuConfiguredGet() -> ::cpuset_t; // Get set of Configured CPU's in the system
1945 }
1946 
1947 //Dummy functions, these don't really exist in VxWorks.
1948 
1949 // wait.h macros
1950 safe_f! {
1951     pub {const} fn WIFEXITED(status: ::c_int) -> bool {
1952         (status & 0xFF00) == 0
1953     }
1954     pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
1955         (status & 0xFF00) != 0
1956     }
1957     pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
1958         (status & 0xFF0000) != 0
1959     }
1960     pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
1961         status & 0xFF
1962     }
1963     pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
1964         (status >> 8) & 0xFF
1965     }
1966     pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
1967         (status >> 16) & 0xFF
1968     }
1969 }
1970 
pread(_fd: ::c_int, _buf: *mut ::c_void, _count: ::size_t, _offset: off64_t) -> ::ssize_t1971 pub fn pread(_fd: ::c_int, _buf: *mut ::c_void, _count: ::size_t, _offset: off64_t) -> ::ssize_t {
1972     -1
1973 }
1974 
pwrite( _fd: ::c_int, _buf: *const ::c_void, _count: ::size_t, _offset: off64_t, ) -> ::ssize_t1975 pub fn pwrite(
1976     _fd: ::c_int,
1977     _buf: *const ::c_void,
1978     _count: ::size_t,
1979     _offset: off64_t,
1980 ) -> ::ssize_t {
1981     -1
1982 }
posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int1983 pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int {
1984     // check to see if align is a power of 2 and if align is a multiple
1985     //  of sizeof(void *)
1986     if (align & align - 1 != 0) || (align as usize % size_of::<::size_t>() != 0) {
1987         return ::EINVAL;
1988     }
1989 
1990     unsafe {
1991         // posix_memalign should not set errno
1992         let e = ::errnoGet();
1993 
1994         let temp = memalign(align, size);
1995         ::errnoSet(e as ::c_int);
1996 
1997         if temp.is_null() {
1998             ::ENOMEM
1999         } else {
2000             *memptr = temp;
2001             0
2002         }
2003     }
2004 }
2005 
2006 cfg_if! {
2007     if #[cfg(libc_core_cvoid)] {
2008         pub use ::ffi::c_void;
2009     } else {
2010         // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
2011         // enable more optimization opportunities around it recognizing things
2012         // like malloc/free.
2013         #[repr(u8)]
2014         #[allow(missing_copy_implementations)]
2015         #[allow(missing_debug_implementations)]
2016         pub enum c_void {
2017             // Two dummy variants so the #[repr] attribute can be used.
2018             #[doc(hidden)]
2019             __variant1,
2020             #[doc(hidden)]
2021             __variant2,
2022         }
2023     }
2024 }
2025 
2026 cfg_if! {
2027     if #[cfg(target_arch = "aarch64")] {
2028         mod aarch64;
2029         pub use self::aarch64::*;
2030     } else if #[cfg(target_arch = "arm")] {
2031         mod arm;
2032         pub use self::arm::*;
2033     }  else if #[cfg(target_arch = "x86")] {
2034         mod x86;
2035         pub use self::x86::*;
2036     } else if #[cfg(target_arch = "x86_64")] {
2037         mod x86_64;
2038         pub use self::x86_64::*;
2039     } else if #[cfg(target_arch = "powerpc")] {
2040         mod powerpc;
2041         pub use self::powerpc::*;
2042     } else if #[cfg(target_arch = "powerpc64")] {
2043         mod powerpc64;
2044         pub use self::powerpc64::*;
2045     } else if #[cfg(target_arch = "riscv32")] {
2046         mod riscv32;
2047         pub use self::riscv32::*;
2048     } else if #[cfg(target_arch = "riscv64")] {
2049         mod riscv64;
2050         pub use self::riscv64::*;
2051     } else {
2052         // Unknown target_arch
2053     }
2054 }
2055