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
95 // From vxTypes.h
96 pub type _Vx_usr_arg_t = isize;
97 pub type _Vx_exit_code_t = isize;
98 pub type _Vx_ticks_t = ::c_uint;
99 pub type _Vx_ticks64_t = ::c_ulonglong;
100
101 pub type sa_family_t = ::c_uchar;
102
103 #[cfg_attr(feature = "extra_traits", derive(Debug))]
104 pub enum _Vx_semaphore {}
105 impl ::Copy for _Vx_semaphore {}
106 impl ::Clone for _Vx_semaphore {
clone(&self) -> _Vx_semaphore107 fn clone(&self) -> _Vx_semaphore {
108 *self
109 }
110 }
111
112 s! {
113 // b_pthread_condattr_t.h
114 pub struct pthread_condattr_t {
115 pub condAttrStatus: ::c_int,
116 pub condAttrPshared: ::c_int,
117 pub condAttrClockId: ::clockid_t,
118 }
119
120 // b_pthread_cond_t.h
121 pub struct pthread_cond_t{
122 pub condSemId: ::_Vx_SEM_ID,
123 pub condValid: ::c_int,
124 pub condInitted: ::c_int,
125 pub condRefCount: ::c_int,
126 pub condMutex: *mut ::pthread_mutex_t,
127 pub condAttr: ::pthread_condattr_t,
128 pub condSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX]
129 }
130
131 // b_pthread_rwlockattr_t.h
132 pub struct pthread_rwlockattr_t {
133 pub rwlockAttrStatus: ::c_int,
134 pub rwlockAttrPshared: ::c_int,
135 pub rwlockAttrMaxReaders: ::c_uint,
136 pub rwlockAttrConformOpt: ::c_uint,
137 }
138
139 // b_pthread_rwlock_t.h
140 pub struct pthread_rwlock_t {
141 pub rwlockSemId: :: _Vx_SEM_ID,
142 pub rwlockReadersRefCount: ::c_uint,
143 pub rwlockValid: ::c_int,
144 pub rwlockInitted: ::c_int,
145 pub rwlockAttr: ::pthread_rwlockattr_t,
146 pub rwlockSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX]
147 }
148
149 // b_struct_timeval.h
150 pub struct timeval {
151 pub tv_sec: ::time_t,
152 pub tv_usec: ::suseconds_t,
153 }
154
155 // socket.h
156 pub struct linger {
157 pub l_onoff: ::c_int,
158 pub l_linger: ::c_int,
159 }
160
161 pub struct sockaddr {
162 pub sa_len : ::c_uchar,
163 pub sa_family : sa_family_t,
164 pub sa_data : [::c_char; 14],
165 }
166
167 pub struct iovec {
168 pub iov_base: *mut ::c_void,
169 pub iov_len: ::size_t,
170 }
171
172 pub struct msghdr {
173 pub msg_name: *mut c_void,
174 pub msg_namelen: socklen_t,
175 pub msg_iov: *mut iovec,
176 pub msg_iovlen: ::c_int,
177 pub msg_control: *mut c_void,
178 pub msg_controllen: socklen_t,
179 pub msg_flags: ::c_int,
180 }
181
182 pub struct cmsghdr {
183 pub cmsg_len: socklen_t,
184 pub cmsg_level: ::c_int,
185 pub cmsg_type: ::c_int,
186 }
187
188 // poll.h
189 pub struct pollfd {
190 pub fd : ::c_int,
191 pub events : ::c_short,
192 pub revents : ::c_short,
193 }
194
195 // resource.h
196 pub struct rlimit {
197 pub rlim_cur : ::rlim_t,
198 pub rlim_max : ::rlim_t,
199 }
200
201 // stat.h
202 pub struct stat {
203 pub st_dev : ::dev_t,
204 pub st_ino : ::ino_t,
205 pub st_mode : ::mode_t,
206 pub st_nlink : ::nlink_t,
207 pub st_uid : ::uid_t,
208 pub st_gid : ::gid_t,
209 pub st_rdev : ::dev_t,
210 pub st_size : ::off_t,
211 pub st_atime : ::time_t,
212 pub st_mtime : ::time_t,
213 pub st_ctime : ::time_t,
214 pub st_blksize : ::blksize_t,
215 pub st_blocks : ::blkcnt_t,
216 pub st_attrib : ::c_uchar,
217 pub st_reserved1 : ::c_int,
218 pub st_reserved2 : ::c_int,
219 pub st_reserved3 : ::c_int,
220 pub st_reserved4 : ::c_int,
221 }
222
223 //b_struct__Timespec.h
224 pub struct _Timespec {
225 pub tv_sec : ::time_t,
226 pub tv_nsec : ::c_long,
227 }
228
229 // b_struct__Sched_param.h
230 pub struct _Sched_param {
231 pub sched_priority: ::c_int, /* scheduling priority */
232 pub sched_ss_low_priority: ::c_int, /* low scheduling priority */
233 pub sched_ss_repl_period: ::_Timespec, /* replenishment period */
234 pub sched_ss_init_budget: ::_Timespec, /* initial budget */
235 pub sched_ss_max_repl: ::c_int, /* max pending replenishment */
236
237 }
238
239 // b_pthread_attr_t.h
240 pub struct pthread_attr_t {
241 pub threadAttrStatus : ::c_int,
242 pub threadAttrStacksize : ::size_t,
243 pub threadAttrStackaddr : *mut ::c_void,
244 pub threadAttrGuardsize : ::size_t,
245 pub threadAttrDetachstate : ::c_int,
246 pub threadAttrContentionscope : ::c_int,
247 pub threadAttrInheritsched : ::c_int,
248 pub threadAttrSchedpolicy : ::c_int,
249 pub threadAttrName : *mut ::c_char,
250 pub threadAttrOptions : ::c_int,
251 pub threadAttrSchedparam : ::_Sched_param,
252 }
253
254 // signal.h
255
256 pub struct sigaction {
257 pub sa_u : ::sa_u_t,
258 pub sa_mask : ::sigset_t,
259 pub sa_flags : ::c_int,
260 }
261
262 // b_stack_t.h
263 pub struct stack_t {
264 pub ss_sp : *mut ::c_void,
265 pub ss_size : ::size_t,
266 pub ss_flags : ::c_int,
267 }
268
269 // signal.h
270 pub struct siginfo_t {
271 pub si_signo : ::c_int,
272 pub si_code : ::c_int,
273 pub si_value : ::sigval,
274 pub si_errno : ::c_int,
275 pub si_status: ::c_int,
276 pub si_addr: *mut ::c_void,
277 pub si_uid: ::uid_t,
278 pub si_pid: ::pid_t,
279 }
280
281 // pthread.h (krnl)
282 // b_pthread_mutexattr_t.h (usr)
283 pub struct pthread_mutexattr_t {
284 mutexAttrStatus : ::c_int,
285 mutexAttrPshared : ::c_int,
286 mutexAttrProtocol : ::c_int,
287 mutexAttrPrioceiling : ::c_int,
288 mutexAttrType : ::c_int,
289 }
290
291 // pthread.h (krnl)
292 // b_pthread_mutex_t.h (usr)
293 pub struct pthread_mutex_t {
294 pub mutexSemId: ::_Vx_SEM_ID, /*_Vx_SEM_ID ..*/
295 pub mutexValid: ::c_int,
296 pub mutexInitted: ::c_int,
297 pub mutexCondRefCount: ::c_int,
298 pub mutexSavPriority: ::c_int,
299 pub mutexAttr: ::pthread_mutexattr_t,
300 pub mutexSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX],
301 }
302
303 // b_struct_timespec.h
304 pub struct timespec {
305 pub tv_sec: ::time_t,
306 pub tv_nsec: ::c_long,
307 }
308
309 // time.h
310 pub struct tm {
311 pub tm_sec: ::c_int,
312 pub tm_min: ::c_int,
313 pub tm_hour: ::c_int,
314 pub tm_mday: ::c_int,
315 pub tm_mon: ::c_int,
316 pub tm_year: ::c_int,
317 pub tm_wday: ::c_int,
318 pub tm_yday: ::c_int,
319 pub tm_isdst: ::c_int,
320 }
321
322 // in.h
323 pub struct in_addr {
324 pub s_addr: in_addr_t,
325 }
326
327 // in.h
328 pub struct ip_mreq {
329 pub imr_multiaddr: in_addr,
330 pub imr_interface: in_addr,
331 }
332
333 // in6.h
334 #[repr(align(4))]
335 pub struct in6_addr {
336 pub s6_addr: [u8; 16],
337 }
338
339 // in6.h
340 pub struct ipv6_mreq {
341 pub ipv6mr_multiaddr: in6_addr,
342 pub ipv6mr_interface: ::c_uint,
343 }
344
345 // netdb.h
346 pub struct addrinfo {
347 pub ai_flags : ::c_int,
348 pub ai_family : ::c_int,
349 pub ai_socktype : ::c_int,
350 pub ai_protocol : ::c_int,
351 pub ai_addrlen : ::size_t,
352 pub ai_canonname: *mut ::c_char,
353 pub ai_addr : *mut ::sockaddr,
354 pub ai_next : *mut ::addrinfo,
355 }
356
357 // in.h
358 pub struct sockaddr_in {
359 pub sin_len : u8,
360 pub sin_family: u8,
361 pub sin_port : u16,
362 pub sin_addr : ::in_addr,
363 pub sin_zero : [::c_char; 8],
364 }
365
366 // in6.h
367 pub struct sockaddr_in6 {
368 pub sin6_len : u8,
369 pub sin6_family : u8,
370 pub sin6_port : u16,
371 pub sin6_flowinfo: u32,
372 pub sin6_addr : ::in6_addr,
373 pub sin6_scope_id: u32,
374 }
375
376 pub struct Dl_info {
377 pub dli_fname: *const ::c_char,
378 pub dli_fbase: *mut ::c_void,
379 pub dli_sname: *const ::c_char,
380 pub dli_saddr: *mut ::c_void,
381 }
382 }
383
384 s_no_extra_traits! {
385 // dirent.h
386 pub struct dirent {
387 pub d_ino : ::ino_t,
388 pub d_name : [::c_char; _PARM_NAME_MAX as usize + 1],
389 }
390
391 pub struct sockaddr_un {
392 pub sun_len: u8,
393 pub sun_family: sa_family_t,
394 pub sun_path: [::c_char; 104]
395 }
396
397 // rtpLibCommon.h
398 pub struct RTP_DESC {
399 pub status : ::c_int,
400 pub options : u32,
401 pub entrAddr : *mut ::c_void,
402 pub initTaskId: ::TASK_ID,
403 pub parentId : ::RTP_ID,
404 pub pathName : [::c_char; VX_RTP_NAME_LENGTH as usize + 1],
405 pub taskCnt : ::c_int,
406 pub textStart : *mut ::c_void,
407 pub textEnd : *mut ::c_void,
408 }
409 // socket.h
410 pub struct sockaddr_storage {
411 pub ss_len : ::c_uchar,
412 pub ss_family : ::sa_family_t,
413 pub __ss_pad1 : [::c_char; _SS_PAD1SIZE],
414 pub __ss_align : i32,
415 pub __ss_pad2 : [::c_char; _SS_PAD2SIZE],
416 }
417
418 pub union sa_u_t {
419 pub sa_handler : ::Option<unsafe extern "C" fn(::c_int) -> !>,
420 pub sa_sigaction: ::Option<unsafe extern "C" fn(::c_int,
421 *mut ::siginfo_t,
422 *mut ::c_void) -> !>,
423 }
424
425 pub union sigval {
426 pub sival_int : ::c_int,
427 pub sival_ptr : *mut ::c_void,
428 }
429 }
430
431 cfg_if! {
432 if #[cfg(feature = "extra_traits")] {
433 impl ::fmt::Debug for dirent {
434 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
435 f.debug_struct("dirent")
436 .field("d_ino", &self.d_ino)
437 .field("d_name", &&self.d_name[..])
438 .finish()
439 }
440 }
441
442 impl ::fmt::Debug for sockaddr_un {
443 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
444 f.debug_struct("sockaddr_un")
445 .field("sun_len", &self.sun_len)
446 .field("sun_family", &self.sun_family)
447 .field("sun_path", &&self.sun_path[..])
448 .finish()
449 }
450 }
451
452 impl ::fmt::Debug for RTP_DESC {
453 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
454 f.debug_struct("RTP_DESC")
455 .field("status", &self.status)
456 .field("options", &self.options)
457 .field("entrAddr", &self.entrAddr)
458 .field("initTaskId", &self.initTaskId)
459 .field("parentId", &self.parentId)
460 .field("pathName", &&self.pathName[..])
461 .field("taskCnt", &self.taskCnt)
462 .field("textStart", &self.textStart)
463 .field("textEnd", &self.textEnd)
464 .finish()
465 }
466 }
467 impl ::fmt::Debug for sockaddr_storage {
468 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
469 f.debug_struct("sockaddr_storage")
470 .field("ss_len", &self.ss_len)
471 .field("ss_family", &self.ss_family)
472 .field("__ss_pad1", &&self.__ss_pad1[..])
473 .field("__ss_align", &self.__ss_align)
474 .field("__ss_pad2", &&self.__ss_pad2[..])
475 .finish()
476 }
477 }
478
479 impl PartialEq for sa_u_t {
480 fn eq(&self, other: &sa_u_t) -> bool {
481 unsafe {
482 let h1 = match self.sa_handler {
483 Some(handler) => handler as usize,
484 None => 0 as usize,
485 };
486 let h2 = match other.sa_handler {
487 Some(handler) => handler as usize,
488 None => 0 as usize,
489 };
490 h1 == h2
491 }
492 }
493 }
494 impl Eq for sa_u_t {}
495 impl ::fmt::Debug for sa_u_t {
496 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
497 unsafe {
498 let h = match self.sa_handler {
499 Some(handler) => handler as usize,
500 None => 0 as usize,
501 };
502
503 f.debug_struct("sa_u_t")
504 .field("sa_handler", &h)
505 .finish()
506 }
507 }
508 }
509 impl ::hash::Hash for sa_u_t {
510 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
511 unsafe {
512 let h = match self.sa_handler {
513 Some(handler) => handler as usize,
514 None => 0 as usize,
515 };
516 h.hash(state)
517 }
518 }
519 }
520
521 impl PartialEq for sigval {
522 fn eq(&self, other: &sigval) -> bool {
523 unsafe { self.sival_ptr as usize == other.sival_ptr as usize }
524 }
525 }
526 impl Eq for sigval {}
527 impl ::fmt::Debug for sigval {
528 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
529 f.debug_struct("sigval")
530 .field("sival_ptr", unsafe { &(self.sival_ptr as usize) })
531 .finish()
532 }
533 }
534 impl ::hash::Hash for sigval {
535 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
536 unsafe { (self.sival_ptr as usize).hash(state) };
537 }
538 }
539 }
540 }
541
542 pub const STDIN_FILENO: ::c_int = 0;
543 pub const STDOUT_FILENO: ::c_int = 1;
544 pub const STDERR_FILENO: ::c_int = 2;
545
546 pub const EXIT_SUCCESS: ::c_int = 0;
547 pub const EXIT_FAILURE: ::c_int = 1;
548
549 pub const EAI_SERVICE: ::c_int = 9;
550 pub const EAI_SOCKTYPE: ::c_int = 10;
551 pub const EAI_SYSTEM: ::c_int = 11;
552
553 // This is not defined in vxWorks, but we have to define it here
554 // to make the building pass for getrandom and libstd, FIXME
555 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
556
557 //Clock Lib Stuff
558 pub const CLOCK_REALTIME: ::c_int = 0x0;
559 pub const CLOCK_MONOTONIC: ::c_int = 0x1;
560 pub const CLOCK_PROCESS_CPUTIME_ID: ::c_int = 0x2;
561 pub const CLOCK_THREAD_CPUTIME_ID: ::c_int = 0x3;
562 pub const TIMER_ABSTIME: ::c_int = 0x1;
563 pub const TIMER_RELTIME: ::c_int = 0x0;
564
565 // PTHREAD STUFF
566 pub const PTHREAD_INITIALIZED_OBJ: ::c_int = 0xF70990EF;
567 pub const PTHREAD_DESTROYED_OBJ: ::c_int = -1;
568 pub const PTHREAD_VALID_OBJ: ::c_int = 0xEC542A37;
569 pub const PTHREAD_INVALID_OBJ: ::c_int = -1;
570 pub const PTHREAD_UNUSED_YET_OBJ: ::c_int = -1;
571
572 pub const PTHREAD_PRIO_NONE: ::c_int = 0;
573 pub const PTHREAD_PRIO_INHERIT: ::c_int = 1;
574 pub const PTHREAD_PRIO_PROTECT: ::c_int = 2;
575
576 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
577 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
578 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
579 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
580 pub const PTHREAD_STACK_MIN: usize = 4096;
581 pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30;
582
583 // ERRNO STUFF
584 pub const OK: ::c_int = 0;
585 pub const EPERM: ::c_int = 1; /* Not owner */
586 pub const ENOENT: ::c_int = 2; /* No such file or directory */
587 pub const ESRCH: ::c_int = 3; /* No such process */
588 pub const EINTR: ::c_int = 4; /* Interrupted system call */
589 pub const EIO: ::c_int = 5; /* I/O error */
590 pub const ENXIO: ::c_int = 6; /* No such device or address */
591 pub const E2BIG: ::c_int = 7; /* Arg list too long */
592 pub const ENOEXEC: ::c_int = 8; /* Exec format error */
593 pub const EBADF: ::c_int = 9; /* Bad file number */
594 pub const ECHILD: ::c_int = 10; /* No children */
595 pub const EAGAIN: ::c_int = 11; /* No more processes */
596 pub const ENOMEM: ::c_int = 12; /* Not enough core */
597 pub const EACCES: ::c_int = 13; /* Permission denied */
598 pub const EFAULT: ::c_int = 14;
599 pub const ENOTEMPTY: ::c_int = 15;
600 pub const EBUSY: ::c_int = 16;
601 pub const EEXIST: ::c_int = 17;
602 pub const ENODEV: ::c_int = 19;
603 pub const ENOTDIR: ::c_int = 20;
604 pub const EISDIR: ::c_int = 21;
605 pub const EINVAL: ::c_int = 22;
606 pub const ENAMETOOLONG: ::c_int = 26;
607 pub const EFBIG: ::c_int = 27;
608 pub const ENOSPC: ::c_int = 28;
609 pub const EROFS: ::c_int = 30;
610 pub const EPIPE: ::c_int = 32;
611 pub const EDEADLK: ::c_int = 33;
612 pub const ERANGE: ::c_int = 38;
613 pub const EDESTADDRREQ: ::c_int = 40;
614 pub const EPROTOTYPE: ::c_int = 41;
615 pub const ENOPROTOOPT: ::c_int = 42;
616 pub const EPROTONOSUPPORT: ::c_int = 43;
617 pub const ESOCKTNOSUPPORT: ::c_int = 44;
618 pub const EOPNOTSUPP: ::c_int = 45;
619 pub const EPFNOSUPPORT: ::c_int = 46;
620 pub const EAFNOSUPPORT: ::c_int = 47;
621 pub const EADDRINUSE: ::c_int = 48;
622 pub const EADDRNOTAVAIL: ::c_int = 49;
623 pub const ENOTSOCK: ::c_int = 50;
624 pub const ENETUNREACH: ::c_int = 51;
625 pub const ENETRESET: ::c_int = 52;
626 pub const ECONNABORTED: ::c_int = 53;
627 pub const ECONNRESET: ::c_int = 54;
628 pub const ENOBUFS: ::c_int = 55;
629 pub const EISCONN: ::c_int = 56;
630 pub const ENOTCONN: ::c_int = 57;
631 pub const ESHUTDOWN: ::c_int = 58;
632 pub const ETOOMANYREFS: ::c_int = 59;
633 pub const ETIMEDOUT: ::c_int = 60;
634 pub const ECONNREFUSED: ::c_int = 61;
635 pub const EINPROGRESS: ::c_int = 68;
636 pub const EALREADY: ::c_int = 69;
637 pub const EWOULDBLOCK: ::c_int = 70;
638 pub const ENOSYS: ::c_int = 71;
639 pub const EDQUOT: ::c_int = 83;
640 pub const ESTALE: ::c_int = 88;
641
642 // NFS errnos: Refer to pkgs_v2/storage/fs/nfs/h/nfs/nfsCommon.h
643 const M_nfsStat: ::c_int = 48 << 16;
644 enum nfsstat {
645 NFSERR_REMOTE = 71,
646 NFSERR_WFLUSH = 99,
647 NFSERR_BADHANDLE = 10001,
648 NFSERR_NOT_SYNC = 10002,
649 NFSERR_BAD_COOKIE = 10003,
650 NFSERR_TOOSMALL = 10005,
651 NFSERR_BADTYPE = 10007,
652 NFSERR_JUKEBOX = 10008,
653 }
654
655 pub const S_nfsLib_NFS_OK: ::c_int = OK;
656 pub const S_nfsLib_NFSERR_PERM: ::c_int = EPERM;
657 pub const S_nfsLib_NFSERR_NOENT: ::c_int = ENOENT;
658 pub const S_nfsLib_NFSERR_IO: ::c_int = EIO;
659 pub const S_nfsLib_NFSERR_NXIO: ::c_int = ENXIO;
660 pub const S_nfsLib_NFSERR_ACCESS: ::c_int = EACCES;
661 pub const S_nfsLib_NFSERR_EXIST: ::c_int = EEXIST;
662 pub const S_nfsLib_NFSERR_ENODEV: ::c_int = ENODEV;
663 pub const S_nfsLib_NFSERR_NOTDIR: ::c_int = ENOTDIR;
664 pub const S_nfsLib_NFSERR_ISDIR: ::c_int = EISDIR;
665 pub const S_nfsLib_NFSERR_INVAL: ::c_int = EINVAL;
666 pub const S_nfsLib_NFSERR_FBIG: ::c_int = EFBIG;
667 pub const S_nfsLib_NFSERR_NOSPC: ::c_int = ENOSPC;
668 pub const S_nfsLib_NFSERR_ROFS: ::c_int = EROFS;
669 pub const S_nfsLib_NFSERR_NAMETOOLONG: ::c_int = ENAMETOOLONG;
670 pub const S_nfsLib_NFSERR_NOTEMPTY: ::c_int = ENOTEMPTY;
671 pub const S_nfsLib_NFSERR_DQUOT: ::c_int = EDQUOT;
672 pub const S_nfsLib_NFSERR_STALE: ::c_int = ESTALE;
673 pub const S_nfsLib_NFSERR_WFLUSH: ::c_int =
674 M_nfsStat | nfsstat::NFSERR_WFLUSH as ::c_int;
675 pub const S_nfsLib_NFSERR_REMOTE: ::c_int =
676 M_nfsStat | nfsstat::NFSERR_REMOTE as ::c_int;
677 pub const S_nfsLib_NFSERR_BADHANDLE: ::c_int =
678 M_nfsStat | nfsstat::NFSERR_BADHANDLE as ::c_int;
679 pub const S_nfsLib_NFSERR_NOT_SYNC: ::c_int =
680 M_nfsStat | nfsstat::NFSERR_NOT_SYNC as ::c_int;
681 pub const S_nfsLib_NFSERR_BAD_COOKIE: ::c_int =
682 M_nfsStat | nfsstat::NFSERR_BAD_COOKIE as ::c_int;
683 pub const S_nfsLib_NFSERR_NOTSUPP: ::c_int = EOPNOTSUPP;
684 pub const S_nfsLib_NFSERR_TOOSMALL: ::c_int =
685 M_nfsStat | nfsstat::NFSERR_TOOSMALL as ::c_int;
686 pub const S_nfsLib_NFSERR_SERVERFAULT: ::c_int = EIO;
687 pub const S_nfsLib_NFSERR_BADTYPE: ::c_int =
688 M_nfsStat | nfsstat::NFSERR_BADTYPE as ::c_int;
689 pub const S_nfsLib_NFSERR_JUKEBOX: ::c_int =
690 M_nfsStat | nfsstat::NFSERR_JUKEBOX as ::c_int;
691
692 // in.h
693 pub const IPPROTO_IP: ::c_int = 0;
694 pub const IPPROTO_IPV6: ::c_int = 41;
695
696 pub const IP_TTL: ::c_int = 4;
697 pub const IP_MULTICAST_IF: ::c_int = 9;
698 pub const IP_MULTICAST_TTL: ::c_int = 10;
699 pub const IP_MULTICAST_LOOP: ::c_int = 11;
700 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
701 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
702
703 // in6.h
704 pub const IPV6_V6ONLY: ::c_int = 1;
705 pub const IPV6_UNICAST_HOPS: ::c_int = 4;
706 pub const IPV6_MULTICAST_IF: ::c_int = 9;
707 pub const IPV6_MULTICAST_HOPS: ::c_int = 10;
708 pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
709 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12;
710 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13;
711
712 // STAT Stuff
713 pub const S_IFMT: ::c_int = 0xf000;
714 pub const S_IFIFO: ::c_int = 0x1000;
715 pub const S_IFCHR: ::c_int = 0x2000;
716 pub const S_IFDIR: ::c_int = 0x4000;
717 pub const S_IFBLK: ::c_int = 0x6000;
718 pub const S_IFREG: ::c_int = 0x8000;
719 pub const S_IFLNK: ::c_int = 0xa000;
720 pub const S_IFSHM: ::c_int = 0xb000;
721 pub const S_IFSOCK: ::c_int = 0xc000;
722 pub const S_ISUID: ::c_int = 0x0800;
723 pub const S_ISGID: ::c_int = 0x0400;
724 pub const S_ISTXT: ::c_int = 0x0200;
725 pub const S_IRUSR: ::c_int = 0x0100;
726 pub const S_IWUSR: ::c_int = 0x0080;
727 pub const S_IXUSR: ::c_int = 0x0040;
728 pub const S_IRWXU: ::c_int = 0x01c0;
729 pub const S_IRGRP: ::c_int = 0x0020;
730 pub const S_IWGRP: ::c_int = 0x0010;
731 pub const S_IXGRP: ::c_int = 0x0008;
732 pub const S_IRWXG: ::c_int = 0x0038;
733 pub const S_IROTH: ::c_int = 0x0004;
734 pub const S_IWOTH: ::c_int = 0x0002;
735 pub const S_IXOTH: ::c_int = 0x0001;
736 pub const S_IRWXO: ::c_int = 0x0007;
737
738 // socket.h
739 pub const SOL_SOCKET: ::c_int = 0xffff;
740
741 pub const SO_DEBUG: ::c_int = 0x0001;
742 pub const SO_REUSEADDR: ::c_int = 0x0004;
743 pub const SO_KEEPALIVE: ::c_int = 0x0008;
744 pub const SO_DONTROUTE: ::c_int = 0x0010;
745 pub const SO_RCVLOWAT: ::c_int = 0x0012;
746 pub const SO_SNDLOWAT: ::c_int = 0x0013;
747 pub const SO_SNDTIMEO: ::c_int = 0x1005;
748 pub const SO_ACCEPTCONN: ::c_int = 0x001e;
749 pub const SO_BROADCAST: ::c_int = 0x0020;
750 pub const SO_USELOOPBACK: ::c_int = 0x0040;
751 pub const SO_LINGER: ::c_int = 0x0080;
752 pub const SO_REUSEPORT: ::c_int = 0x0200;
753
754 pub const SO_VLAN: ::c_int = 0x8000;
755
756 pub const SO_SNDBUF: ::c_int = 0x1001;
757 pub const SO_RCVBUF: ::c_int = 0x1002;
758 pub const SO_RCVTIMEO: ::c_int = 0x1006;
759 pub const SO_ERROR: ::c_int = 0x1007;
760 pub const SO_TYPE: ::c_int = 0x1008;
761 pub const SO_BINDTODEVICE: ::c_int = 0x1010;
762 pub const SO_OOBINLINE: ::c_int = 0x1011;
763 pub const SO_CONNTIMEO: ::c_int = 0x100a;
764
765 pub const SOCK_STREAM: ::c_int = 1;
766 pub const SOCK_DGRAM: ::c_int = 2;
767 pub const SOCK_RAW: ::c_int = 3;
768 pub const SOCK_RDM: ::c_int = 4;
769 pub const SOCK_SEQPACKET: ::c_int = 5;
770 pub const SOCK_PACKET: ::c_int = 10;
771
772 pub const _SS_MAXSIZE: usize = 128;
773 pub const _SS_ALIGNSIZE: usize = size_of::<u32>();
774 pub const _SS_PAD1SIZE: usize =
775 (_SS_ALIGNSIZE - size_of::<::c_uchar>() - size_of::<::sa_family_t>());
776 pub const _SS_PAD2SIZE: usize = (_SS_MAXSIZE
777 - size_of::<::c_uchar>()
778 - size_of::<::sa_family_t>()
779 - _SS_PAD1SIZE
780 - _SS_ALIGNSIZE);
781
782 pub const MSG_OOB: ::c_int = 0x0001;
783 pub const MSG_PEEK: ::c_int = 0x0002;
784 pub const MSG_DONTROUTE: ::c_int = 0x0004;
785 pub const MSG_EOR: ::c_int = 0x0008;
786 pub const MSG_TRUNC: ::c_int = 0x0010;
787 pub const MSG_CTRUNC: ::c_int = 0x0020;
788 pub const MSG_WAITALL: ::c_int = 0x0040;
789 pub const MSG_DONTWAIT: ::c_int = 0x0080;
790 pub const MSG_EOF: ::c_int = 0x0100;
791 pub const MSG_EXP: ::c_int = 0x0200;
792 pub const MSG_MBUF: ::c_int = 0x0400;
793 pub const MSG_NOTIFICATION: ::c_int = 0x0800;
794 pub const MSG_COMPAT: ::c_int = 0x8000;
795
796 pub const AF_UNSPEC: ::c_int = 0;
797 pub const AF_LOCAL: ::c_int = 1;
798 pub const AF_UNIX: ::c_int = AF_LOCAL;
799 pub const AF_INET: ::c_int = 2;
800 pub const AF_NETLINK: ::c_int = 16;
801 pub const AF_ROUTE: ::c_int = 17;
802 pub const AF_LINK: ::c_int = 18;
803 pub const AF_PACKET: ::c_int = 19;
804 pub const pseudo_AF_KEY: ::c_int = 27;
805 pub const AF_KEY: ::c_int = pseudo_AF_KEY;
806 pub const AF_INET6: ::c_int = 28;
807 pub const AF_SOCKDEV: ::c_int = 31;
808 pub const AF_TIPC: ::c_int = 33;
809 pub const AF_MIPC: ::c_int = 34;
810 pub const AF_MIPC_SAFE: ::c_int = 35;
811 pub const AF_MAX: ::c_int = 37;
812
813 pub const SHUT_RD: ::c_int = 0;
814 pub const SHUT_WR: ::c_int = 1;
815 pub const SHUT_RDWR: ::c_int = 2;
816
817 pub const IPPROTO_TCP: ::c_int = 6;
818 pub const TCP_NODELAY: ::c_int = 1;
819 pub const TCP_MAXSEG: ::c_int = 2;
820 pub const TCP_NOPUSH: ::c_int = 3;
821 pub const TCP_KEEPIDLE: ::c_int = 4;
822 pub const TCP_KEEPINTVL: ::c_int = 5;
823 pub const TCP_KEEPCNT: ::c_int = 6;
824
825 // ioLib.h
826 pub const FIONREAD: ::c_int = 0x40040001;
827 pub const FIOFLUSH: ::c_int = 2;
828 pub const FIOOPTIONS: ::c_int = 3;
829 pub const FIOBAUDRATE: ::c_int = 4;
830 pub const FIODISKFORMAT: ::c_int = 5;
831 pub const FIODISKINIT: ::c_int = 6;
832 pub const FIOSEEK: ::c_int = 7;
833 pub const FIOWHERE: ::c_int = 8;
834 pub const FIODIRENTRY: ::c_int = 9;
835 pub const FIORENAME: ::c_int = 10;
836 pub const FIOREADYCHANGE: ::c_int = 11;
837 pub const FIODISKCHANGE: ::c_int = 13;
838 pub const FIOCANCEL: ::c_int = 14;
839 pub const FIOSQUEEZE: ::c_int = 15;
840 pub const FIOGETNAME: ::c_int = 18;
841 pub const FIONBIO: ::c_int = 0x90040010;
842
843 // limits.h
844 pub const PATH_MAX: ::c_int = _PARM_PATH_MAX;
845 pub const _POSIX_PATH_MAX: ::c_int = 256;
846
847 // Some poll stuff
848 pub const POLLIN: ::c_short = 0x0001;
849 pub const POLLPRI: ::c_short = 0x0002;
850 pub const POLLOUT: ::c_short = 0x0004;
851 pub const POLLRDNORM: ::c_short = 0x0040;
852 pub const POLLWRNORM: ::c_short = POLLOUT;
853 pub const POLLRDBAND: ::c_short = 0x0080;
854 pub const POLLWRBAND: ::c_short = 0x0100;
855 pub const POLLERR: ::c_short = 0x0008;
856 pub const POLLHUP: ::c_short = 0x0010;
857 pub const POLLNVAL: ::c_short = 0x0020;
858
859 // fnctlcom.h
860 pub const FD_CLOEXEC: ::c_int = 1;
861 pub const F_DUPFD: ::c_int = 0;
862 pub const F_GETFD: ::c_int = 1;
863 pub const F_SETFD: ::c_int = 2;
864 pub const F_GETFL: ::c_int = 3;
865 pub const F_SETFL: ::c_int = 4;
866 pub const F_GETOWN: ::c_int = 5;
867 pub const F_SETOWN: ::c_int = 6;
868 pub const F_GETLK: ::c_int = 7;
869 pub const F_SETLK: ::c_int = 8;
870 pub const F_SETLKW: ::c_int = 9;
871 pub const F_DUPFD_CLOEXEC: ::c_int = 14;
872
873 // signal.h
874 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
875 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
876 pub const SIG_ERR: sighandler_t = -1 as isize as sighandler_t;
877
878 pub const SIGHUP: ::c_int = 1;
879 pub const SIGINT: ::c_int = 2;
880 pub const SIGQUIT: ::c_int = 3;
881 pub const SIGILL: ::c_int = 4;
882 pub const SIGTRAP: ::c_int = 5;
883 pub const SIGABRT: ::c_int = 6;
884 pub const SIGEMT: ::c_int = 7;
885 pub const SIGFPE: ::c_int = 8;
886 pub const SIGKILL: ::c_int = 9;
887 pub const SIGBUS: ::c_int = 10;
888 pub const SIGSEGV: ::c_int = 11;
889 pub const SIGFMT: ::c_int = 12;
890 pub const SIGPIPE: ::c_int = 13;
891 pub const SIGALRM: ::c_int = 14;
892 pub const SIGTERM: ::c_int = 15;
893 pub const SIGCNCL: ::c_int = 16;
894 pub const SIGSTOP: ::c_int = 17;
895 pub const SIGTSTP: ::c_int = 18;
896 pub const SIGCONT: ::c_int = 19;
897 pub const SIGCHLD: ::c_int = 20;
898 pub const SIGTTIN: ::c_int = 21;
899 pub const SIGTTOU: ::c_int = 22;
900
901 pub const SIG_BLOCK: ::c_int = 1;
902 pub const SIG_UNBLOCK: ::c_int = 2;
903 pub const SIG_SETMASK: ::c_int = 3;
904
905 pub const SI_SYNC: ::c_int = 0;
906 pub const SI_USER: ::c_int = -1;
907 pub const SI_QUEUE: ::c_int = -2;
908 pub const SI_TIMER: ::c_int = -3;
909 pub const SI_ASYNCIO: ::c_int = -4;
910 pub const SI_MESGQ: ::c_int = -5;
911 pub const SI_CHILD: ::c_int = -6;
912 pub const SI_KILL: ::c_int = SI_USER;
913
914 // vxParams.h definitions
915 pub const _PARM_NAME_MAX: ::c_int = 255;
916 pub const _PARM_PATH_MAX: ::c_int = 1024;
917
918 // WAIT STUFF
919 pub const WNOHANG: ::c_int = 0x01;
920 pub const WUNTRACED: ::c_int = 0x02;
921
922 const PTHREAD_MUTEXATTR_INITIALIZER: pthread_mutexattr_t =
923 pthread_mutexattr_t {
924 mutexAttrStatus: PTHREAD_INITIALIZED_OBJ,
925 mutexAttrProtocol: PTHREAD_PRIO_NONE,
926 mutexAttrPrioceiling: 0,
927 mutexAttrType: PTHREAD_MUTEX_DEFAULT,
928 mutexAttrPshared: 1,
929 };
930 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
931 mutexSemId: null_mut(),
932 mutexValid: PTHREAD_VALID_OBJ,
933 mutexInitted: PTHREAD_UNUSED_YET_OBJ,
934 mutexCondRefCount: 0,
935 mutexSavPriority: -1,
936 mutexAttr: PTHREAD_MUTEXATTR_INITIALIZER,
937 mutexSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
938 };
939
940 const PTHREAD_CONDATTR_INITIALIZER: pthread_condattr_t = pthread_condattr_t {
941 condAttrStatus: 0xf70990ef,
942 condAttrPshared: 1,
943 condAttrClockId: CLOCK_REALTIME,
944 };
945 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
946 condSemId: null_mut(),
947 condValid: PTHREAD_VALID_OBJ,
948 condInitted: PTHREAD_UNUSED_YET_OBJ,
949 condRefCount: 0,
950 condMutex: null_mut(),
951 condAttr: PTHREAD_CONDATTR_INITIALIZER,
952 condSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
953 };
954
955 const PTHREAD_RWLOCKATTR_INITIALIZER: pthread_rwlockattr_t =
956 pthread_rwlockattr_t {
957 rwlockAttrStatus: PTHREAD_INITIALIZED_OBJ,
958 rwlockAttrPshared: 1,
959 rwlockAttrMaxReaders: 0,
960 rwlockAttrConformOpt: 1,
961 };
962 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
963 rwlockSemId: null_mut(),
964 rwlockReadersRefCount: 0,
965 rwlockValid: PTHREAD_VALID_OBJ,
966 rwlockInitted: PTHREAD_UNUSED_YET_OBJ,
967 rwlockAttr: PTHREAD_RWLOCKATTR_INITIALIZER,
968 rwlockSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
969 };
970
971 pub const SEEK_SET: ::c_int = 0;
972 pub const SEEK_CUR: ::c_int = 1;
973 pub const SEEK_END: ::c_int = 2;
974
975 // rtpLibCommon.h
976 pub const VX_RTP_NAME_LENGTH: ::c_int = 255;
977 pub const RTP_ID_ERROR: ::RTP_ID = -1;
978
979 // h/public/unistd.h
980 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 21; // Via unistd.h
981 pub const _SC_PAGESIZE: ::c_int = 39;
982 pub const O_ACCMODE: ::c_int = 3;
983 pub const O_CLOEXEC: ::c_int = 0x100000; // fcntlcom
984 pub const O_EXCL: ::c_int = 0x0800;
985 pub const O_CREAT: ::c_int = 0x0200;
986 pub const O_TRUNC: ::c_int = 0x0400;
987 pub const O_APPEND: ::c_int = 0x0008;
988 pub const O_RDWR: ::c_int = 0x0002;
989 pub const O_WRONLY: ::c_int = 0x0001;
990 pub const O_RDONLY: ::c_int = 0;
991 pub const O_NONBLOCK: ::c_int = 0x4000;
992
993 #[cfg_attr(feature = "extra_traits", derive(Debug))]
994 pub enum FILE {}
995 impl ::Copy for FILE {}
996 impl ::Clone for FILE {
clone(&self) -> FILE997 fn clone(&self) -> FILE {
998 *self
999 }
1000 }
1001 #[cfg_attr(feature = "extra_traits", derive(Debug))]
1002 pub enum fpos_t {} // TODO: fill this out with a struct
1003 impl ::Copy for fpos_t {}
1004 impl ::Clone for fpos_t {
clone(&self) -> fpos_t1005 fn clone(&self) -> fpos_t {
1006 *self
1007 }
1008 }
1009
1010 f! {
1011 pub fn CMSG_ALIGN(len: usize) -> usize {
1012 len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
1013 }
1014
1015 pub fn CMSG_NXTHDR(mhdr: *const msghdr,
1016 cmsg: *const cmsghdr) -> *mut cmsghdr {
1017 let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)
1018 + CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
1019 let max = (*mhdr).msg_control as usize
1020 + (*mhdr).msg_controllen as usize;
1021 if next <= max {
1022 (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize))
1023 as *mut ::cmsghdr
1024 } else {
1025 0 as *mut ::cmsghdr
1026 }
1027 }
1028
1029 pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1030 if (*mhdr).msg_controllen as usize > 0 {
1031 (*mhdr).msg_control as *mut cmsghdr
1032 } else {
1033 0 as *mut cmsghdr
1034 }
1035 }
1036
1037 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar {
1038 (cmsg as *mut ::c_uchar)
1039 .offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
1040 }
1041
1042 pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
1043 (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
1044 as ::c_uint
1045 }
1046
1047 pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
1048 CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
1049 }
1050 }
1051
1052 extern "C" {
isalnum(c: c_int) -> c_int1053 pub fn isalnum(c: c_int) -> c_int;
isalpha(c: c_int) -> c_int1054 pub fn isalpha(c: c_int) -> c_int;
iscntrl(c: c_int) -> c_int1055 pub fn iscntrl(c: c_int) -> c_int;
isdigit(c: c_int) -> c_int1056 pub fn isdigit(c: c_int) -> c_int;
isgraph(c: c_int) -> c_int1057 pub fn isgraph(c: c_int) -> c_int;
islower(c: c_int) -> c_int1058 pub fn islower(c: c_int) -> c_int;
isprint(c: c_int) -> c_int1059 pub fn isprint(c: c_int) -> c_int;
ispunct(c: c_int) -> c_int1060 pub fn ispunct(c: c_int) -> c_int;
isspace(c: c_int) -> c_int1061 pub fn isspace(c: c_int) -> c_int;
isupper(c: c_int) -> c_int1062 pub fn isupper(c: c_int) -> c_int;
isxdigit(c: c_int) -> c_int1063 pub fn isxdigit(c: c_int) -> c_int;
isblank(c: c_int) -> c_int1064 pub fn isblank(c: c_int) -> c_int;
tolower(c: c_int) -> c_int1065 pub fn tolower(c: c_int) -> c_int;
toupper(c: c_int) -> c_int1066 pub fn toupper(c: c_int) -> c_int;
fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE1067 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 FILE1068 pub fn freopen(
1069 filename: *const c_char,
1070 mode: *const c_char,
1071 file: *mut FILE,
1072 ) -> *mut FILE;
fflush(file: *mut FILE) -> c_int1073 pub fn fflush(file: *mut FILE) -> c_int;
fclose(file: *mut FILE) -> c_int1074 pub fn fclose(file: *mut FILE) -> c_int;
remove(filename: *const c_char) -> c_int1075 pub fn remove(filename: *const c_char) -> c_int;
rename(oldname: *const c_char, newname: *const c_char) -> c_int1076 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
tmpfile() -> *mut FILE1077 pub fn tmpfile() -> *mut FILE;
setvbuf( stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t, ) -> c_int1078 pub fn setvbuf(
1079 stream: *mut FILE,
1080 buffer: *mut c_char,
1081 mode: c_int,
1082 size: size_t,
1083 ) -> c_int;
setbuf(stream: *mut FILE, buf: *mut c_char)1084 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
getchar() -> c_int1085 pub fn getchar() -> c_int;
putchar(c: c_int) -> c_int1086 pub fn putchar(c: c_int) -> c_int;
fgetc(stream: *mut FILE) -> c_int1087 pub fn fgetc(stream: *mut FILE) -> c_int;
fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char1088 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
1089 -> *mut c_char;
fputc(c: c_int, stream: *mut FILE) -> c_int1090 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
fputs(s: *const c_char, stream: *mut FILE) -> c_int1091 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
puts(s: *const c_char) -> c_int1092 pub fn puts(s: *const c_char) -> c_int;
ungetc(c: c_int, stream: *mut FILE) -> c_int1093 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_t1094 pub fn fread(
1095 ptr: *mut c_void,
1096 size: size_t,
1097 nobj: size_t,
1098 stream: *mut FILE,
1099 ) -> size_t;
fwrite( ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE, ) -> size_t1100 pub fn fwrite(
1101 ptr: *const c_void,
1102 size: size_t,
1103 nobj: size_t,
1104 stream: *mut FILE,
1105 ) -> size_t;
fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int1106 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
ftell(stream: *mut FILE) -> c_long1107 pub fn ftell(stream: *mut FILE) -> c_long;
rewind(stream: *mut FILE)1108 pub fn rewind(stream: *mut FILE);
fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int1109 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int1110 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
feof(stream: *mut FILE) -> c_int1111 pub fn feof(stream: *mut FILE) -> c_int;
ferror(stream: *mut FILE) -> c_int1112 pub fn ferror(stream: *mut FILE) -> c_int;
perror(s: *const c_char)1113 pub fn perror(s: *const c_char);
atoi(s: *const c_char) -> c_int1114 pub fn atoi(s: *const c_char) -> c_int;
strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double1115 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
strtol( s: *const c_char, endp: *mut *mut c_char, base: c_int, ) -> c_long1116 pub fn strtol(
1117 s: *const c_char,
1118 endp: *mut *mut c_char,
1119 base: c_int,
1120 ) -> c_long;
strtoul( s: *const c_char, endp: *mut *mut c_char, base: c_int, ) -> c_ulong1121 pub fn strtoul(
1122 s: *const c_char,
1123 endp: *mut *mut c_char,
1124 base: c_int,
1125 ) -> c_ulong;
calloc(nobj: size_t, size: size_t) -> *mut c_void1126 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
malloc(size: size_t) -> *mut c_void1127 pub fn malloc(size: size_t) -> *mut c_void;
realloc(p: *mut c_void, size: size_t) -> *mut c_void1128 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
free(p: *mut c_void)1129 pub fn free(p: *mut c_void);
abort() -> !1130 pub fn abort() -> !;
exit(status: c_int) -> !1131 pub fn exit(status: c_int) -> !;
atexit(cb: extern "C" fn()) -> c_int1132 pub fn atexit(cb: extern "C" fn()) -> c_int;
system(s: *const c_char) -> c_int1133 pub fn system(s: *const c_char) -> c_int;
getenv(s: *const c_char) -> *mut c_char1134 pub fn getenv(s: *const c_char) -> *mut c_char;
1135
strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char1136 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_char1137 pub fn strncpy(
1138 dst: *mut c_char,
1139 src: *const c_char,
1140 n: size_t,
1141 ) -> *mut c_char;
strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char1142 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_char1143 pub fn strncat(
1144 s: *mut c_char,
1145 ct: *const c_char,
1146 n: size_t,
1147 ) -> *mut c_char;
strcmp(cs: *const c_char, ct: *const c_char) -> c_int1148 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_int1149 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_int1150 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
strchr(cs: *const c_char, c: c_int) -> *mut c_char1151 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
strrchr(cs: *const c_char, c: c_int) -> *mut c_char1152 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
strspn(cs: *const c_char, ct: *const c_char) -> size_t1153 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
strcspn(cs: *const c_char, ct: *const c_char) -> size_t1154 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
strdup(cs: *const c_char) -> *mut c_char1155 pub fn strdup(cs: *const c_char) -> *mut c_char;
strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char1156 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_char1157 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int1158 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_int1159 pub fn strncasecmp(
1160 s1: *const c_char,
1161 s2: *const c_char,
1162 n: size_t,
1163 ) -> c_int;
strlen(cs: *const c_char) -> size_t1164 pub fn strlen(cs: *const c_char) -> size_t;
strerror(n: c_int) -> *mut c_char1165 pub fn strerror(n: c_int) -> *mut c_char;
strtok(s: *mut c_char, t: *const c_char) -> *mut c_char1166 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_t1167 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
wcslen(buf: *const wchar_t) -> size_t1168 pub fn wcslen(buf: *const wchar_t) -> size_t;
wcstombs( dest: *mut c_char, src: *const wchar_t, n: size_t, ) -> ::size_t1169 pub fn wcstombs(
1170 dest: *mut c_char,
1171 src: *const wchar_t,
1172 n: size_t,
1173 ) -> ::size_t;
1174
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void1175 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int1176 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_void1177 pub fn memcpy(
1178 dest: *mut c_void,
1179 src: *const c_void,
1180 n: size_t,
1181 ) -> *mut c_void;
memmove( dest: *mut c_void, src: *const c_void, n: size_t, ) -> *mut c_void1182 pub fn memmove(
1183 dest: *mut c_void,
1184 src: *const c_void,
1185 n: size_t,
1186 ) -> *mut c_void;
memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void1187 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
1188 }
1189
1190 extern "C" {
fprintf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int1191 pub fn fprintf(
1192 stream: *mut ::FILE,
1193 format: *const ::c_char,
1194 ...
1195 ) -> ::c_int;
printf(format: *const ::c_char, ...) -> ::c_int1196 pub fn printf(format: *const ::c_char, ...) -> ::c_int;
snprintf( s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ... ) -> ::c_int1197 pub fn snprintf(
1198 s: *mut ::c_char,
1199 n: ::size_t,
1200 format: *const ::c_char,
1201 ...
1202 ) -> ::c_int;
sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int1203 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
fscanf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int1204 pub fn fscanf(
1205 stream: *mut ::FILE,
1206 format: *const ::c_char,
1207 ...
1208 ) -> ::c_int;
scanf(format: *const ::c_char, ...) -> ::c_int1209 pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int1210 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
1211 -> ::c_int;
getchar_unlocked() -> ::c_int1212 pub fn getchar_unlocked() -> ::c_int;
putchar_unlocked(c: ::c_int) -> ::c_int1213 pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
stat(path: *const c_char, buf: *mut stat) -> ::c_int1214 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE1215 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
fileno(stream: *mut ::FILE) -> ::c_int1216 pub fn fileno(stream: *mut ::FILE) -> ::c_int;
creat(path: *const c_char, mode: mode_t) -> ::c_int1217 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
rewinddir(dirp: *mut ::DIR)1218 pub fn rewinddir(dirp: *mut ::DIR);
fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int1219 pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int;
access(path: *const c_char, amode: ::c_int) -> ::c_int1220 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
alarm(seconds: ::c_uint) -> ::c_uint1221 pub fn alarm(seconds: ::c_uint) -> ::c_uint;
fchdir(dirfd: ::c_int) -> ::c_int1222 pub fn fchdir(dirfd: ::c_int) -> ::c_int;
chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int1223 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
fpathconf(filedes: ::c_int, name: ::c_int) -> c_long1224 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
getegid() -> gid_t1225 pub fn getegid() -> gid_t;
geteuid() -> uid_t1226 pub fn geteuid() -> uid_t;
getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int1227 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
getlogin() -> *mut c_char1228 pub fn getlogin() -> *mut c_char;
getopt( argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char, ) -> ::c_int1229 pub fn getopt(
1230 argc: ::c_int,
1231 argv: *const *mut c_char,
1232 optstr: *const c_char,
1233 ) -> ::c_int;
pathconf(path: *const c_char, name: ::c_int) -> c_long1234 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pause() -> ::c_int1235 pub fn pause() -> ::c_int;
seteuid(uid: uid_t) -> ::c_int1236 pub fn seteuid(uid: uid_t) -> ::c_int;
setegid(gid: gid_t) -> ::c_int1237 pub fn setegid(gid: gid_t) -> ::c_int;
sleep(secs: ::c_uint) -> ::c_uint1238 pub fn sleep(secs: ::c_uint) -> ::c_uint;
ttyname(fd: ::c_int) -> *mut c_char1239 pub fn ttyname(fd: ::c_int) -> *mut c_char;
wait(status: *mut ::c_int) -> pid_t1240 pub fn wait(status: *mut ::c_int) -> pid_t;
umask(mask: mode_t) -> mode_t1241 pub fn umask(mask: mode_t) -> mode_t;
mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int1242 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
mlockall(flags: ::c_int) -> ::c_int1243 pub fn mlockall(flags: ::c_int) -> ::c_int;
munlockall() -> ::c_int1244 pub fn munlockall() -> ::c_int;
1245
mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void1246 pub fn mmap(
1247 addr: *mut ::c_void,
1248 len: ::size_t,
1249 prot: ::c_int,
1250 flags: ::c_int,
1251 fd: ::c_int,
1252 offset: off_t,
1253 ) -> *mut ::c_void;
munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int1254 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
truncate(path: *const c_char, length: off_t) -> ::c_int1255 pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
1256
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1257 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pthread_exit(value: *mut ::c_void) -> !1258 pub fn pthread_exit(value: *mut ::c_void) -> !;
pthread_attr_setdetachstate( attr: *mut ::pthread_attr_t, state: ::c_int, ) -> ::c_int1259 pub fn pthread_attr_setdetachstate(
1260 attr: *mut ::pthread_attr_t,
1261 state: ::c_int,
1262 ) -> ::c_int;
1263
strerror_r( errnum: ::c_int, buf: *mut c_char, buflen: ::size_t, ) -> ::c_int1264 pub fn strerror_r(
1265 errnum: ::c_int,
1266 buf: *mut c_char,
1267 buflen: ::size_t,
1268 ) -> ::c_int;
1269
sigaction( signum: ::c_int, act: *const sigaction, oldact: *mut sigaction, ) -> ::c_int1270 pub fn sigaction(
1271 signum: ::c_int,
1272 act: *const sigaction,
1273 oldact: *mut sigaction,
1274 ) -> ::c_int;
1275
utimes( filename: *const ::c_char, times: *const ::timeval, ) -> ::c_int1276 pub fn utimes(
1277 filename: *const ::c_char,
1278 times: *const ::timeval,
1279 ) -> ::c_int;
1280
1281 #[link_name = "_rtld_dlopen"]
dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1282 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
1283
1284 #[link_name = "_rtld_dlerror"]
dlerror() -> *mut ::c_char1285 pub fn dlerror() -> *mut ::c_char;
1286
1287 #[link_name = "_rtld_dlsym"]
dlsym( handle: *mut ::c_void, symbol: *const ::c_char, ) -> *mut ::c_void1288 pub fn dlsym(
1289 handle: *mut ::c_void,
1290 symbol: *const ::c_char,
1291 ) -> *mut ::c_void;
1292
1293 #[link_name = "_rtld_dlclose"]
dlclose(handle: *mut ::c_void) -> ::c_int1294 pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
1295
1296 #[link_name = "_rtld_dladdr"]
dladdr(addr: *mut ::c_void, info: *mut Dl_info) -> ::c_int1297 pub fn dladdr(addr: *mut ::c_void, info: *mut Dl_info) -> ::c_int;
1298
1299 // time.h
gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1300 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 tm1301 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
mktime(tm: *mut tm) -> time_t1302 pub fn mktime(tm: *mut tm) -> time_t;
time(time: *mut time_t) -> time_t1303 pub fn time(time: *mut time_t) -> time_t;
gmtime(time_p: *const time_t) -> *mut tm1304 pub fn gmtime(time_p: *const time_t) -> *mut tm;
localtime(time_p: *const time_t) -> *mut tm1305 pub fn localtime(time_p: *const time_t) -> *mut tm;
timegm(tm: *mut tm) -> time_t1306 pub fn timegm(tm: *mut tm) -> time_t;
difftime(time1: time_t, time0: time_t) -> ::c_double1307 pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1308 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
usleep(secs: ::useconds_t) -> ::c_int1309 pub fn usleep(secs: ::useconds_t) -> ::c_int;
putenv(string: *mut c_char) -> ::c_int1310 pub fn putenv(string: *mut c_char) -> ::c_int;
setlocale( category: ::c_int, locale: *const ::c_char, ) -> *mut ::c_char1311 pub fn setlocale(
1312 category: ::c_int,
1313 locale: *const ::c_char,
1314 ) -> *mut ::c_char;
1315
sigprocmask( how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t, ) -> ::c_int1316 pub fn sigprocmask(
1317 how: ::c_int,
1318 set: *const sigset_t,
1319 oldset: *mut sigset_t,
1320 ) -> ::c_int;
sigpending(set: *mut sigset_t) -> ::c_int1321 pub fn sigpending(set: *mut sigset_t) -> ::c_int;
1322
mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1323 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
1324
fseeko( stream: *mut ::FILE, offset: ::off_t, whence: ::c_int, ) -> ::c_int1325 pub fn fseeko(
1326 stream: *mut ::FILE,
1327 offset: ::off_t,
1328 whence: ::c_int,
1329 ) -> ::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(
1340 lineptr: *mut *mut c_char,
1341 n: *mut size_t,
1342 stream: *mut FILE,
1343 ) -> ssize_t;
1344
1345 }
1346
1347 extern "C" {
1348 // stdlib.h
memalign(block_size: ::size_t, size_arg: ::size_t) -> *mut ::c_void1349 pub fn memalign(block_size: ::size_t, size_arg: ::size_t)
1350 -> *mut ::c_void;
1351
1352 // ioLib.h
getcwd(buf: *mut ::c_char, size: ::size_t) -> *mut ::c_char1353 pub fn getcwd(buf: *mut ::c_char, size: ::size_t) -> *mut ::c_char;
1354
1355 // ioLib.h
chdir(attr: *const ::c_char) -> ::c_int1356 pub fn chdir(attr: *const ::c_char) -> ::c_int;
1357
1358 // pthread.h
pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int1359 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
1360
1361 // pthread.h
pthread_mutexattr_destroy( attr: *mut pthread_mutexattr_t, ) -> ::c_int1362 pub fn pthread_mutexattr_destroy(
1363 attr: *mut pthread_mutexattr_t,
1364 ) -> ::c_int;
1365
1366 // pthread.h
pthread_mutexattr_settype( pAttr: *mut ::pthread_mutexattr_t, pType: ::c_int, ) -> ::c_int1367 pub fn pthread_mutexattr_settype(
1368 pAttr: *mut ::pthread_mutexattr_t,
1369 pType: ::c_int,
1370 ) -> ::c_int;
1371
1372 // pthread.h
pthread_mutex_init( mutex: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> ::c_int1373 pub fn pthread_mutex_init(
1374 mutex: *mut pthread_mutex_t,
1375 attr: *const pthread_mutexattr_t,
1376 ) -> ::c_int;
1377
1378 // pthread.h
pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> ::c_int1379 pub fn pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> ::c_int;
1380
1381 // pthread.h
pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> ::c_int1382 pub fn pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> ::c_int;
1383
1384 // pthread.h
pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> ::c_int1385 pub fn pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> ::c_int;
1386
1387 // pthread.h
pthread_mutex_timedlock( attr: *mut pthread_mutex_t, spec: *const timespec, ) -> ::c_int1388 pub fn pthread_mutex_timedlock(
1389 attr: *mut pthread_mutex_t,
1390 spec: *const timespec,
1391 ) -> ::c_int;
1392
1393 // pthread.h
pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> ::c_int1394 pub fn pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> ::c_int;
1395
1396 // pthread.h
pthread_attr_setname( pAttr: *mut ::pthread_attr_t, name: *mut ::c_char, ) -> ::c_int1397 pub fn pthread_attr_setname(
1398 pAttr: *mut ::pthread_attr_t,
1399 name: *mut ::c_char,
1400 ) -> ::c_int;
1401
1402 // pthread.h
pthread_attr_setstacksize( attr: *mut ::pthread_attr_t, stacksize: ::size_t, ) -> ::c_int1403 pub fn pthread_attr_setstacksize(
1404 attr: *mut ::pthread_attr_t,
1405 stacksize: ::size_t,
1406 ) -> ::c_int;
1407
1408 // pthread.h
pthread_attr_getstacksize( attr: *const ::pthread_attr_t, size: *mut ::size_t, ) -> ::c_int1409 pub fn pthread_attr_getstacksize(
1410 attr: *const ::pthread_attr_t,
1411 size: *mut ::size_t,
1412 ) -> ::c_int;
1413
1414 // pthread.h
pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1415 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
1416
1417 // 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_int1418 pub fn pthread_create(
1419 pThread: *mut ::pthread_t,
1420 pAttr: *const ::pthread_attr_t,
1421 start_routine: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
1422 value: *mut ::c_void,
1423 ) -> ::c_int;
1424
1425 // pthread.h
pthread_attr_destroy(thread: *mut ::pthread_attr_t) -> ::c_int1426 pub fn pthread_attr_destroy(thread: *mut ::pthread_attr_t) -> ::c_int;
1427
1428 // pthread.h
pthread_detach(thread: ::pthread_t) -> ::c_int1429 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
1430
1431 // 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_int1432 pub fn pthread_atfork(
1433 prepare: ::Option<unsafe extern "C" fn()>,
1434 parent: ::Option<unsafe extern "C" fn()>,
1435 child: ::Option<unsafe extern "C" fn()>,
1436 ) -> ::c_int;
1437 // stat.h
fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int1438 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
1439
1440 // stat.h
lstat(path: *const ::c_char, buf: *mut stat) -> ::c_int1441 pub fn lstat(path: *const ::c_char, buf: *mut stat) -> ::c_int;
1442
1443 // unistd.h
ftruncate(fd: ::c_int, length: off_t) -> ::c_int1444 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
1445
1446 // dirent.h
readdir_r( pDir: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent, ) -> ::c_int1447 pub fn readdir_r(
1448 pDir: *mut ::DIR,
1449 entry: *mut ::dirent,
1450 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(
1468 attr: *mut ::pthread_condattr_t,
1469 ) -> ::c_int;
1470
1471 // pthread.h
pthread_condattr_getclock( pAttr: *const ::pthread_condattr_t, pClockId: *mut ::clockid_t, ) -> ::c_int1472 pub fn pthread_condattr_getclock(
1473 pAttr: *const ::pthread_condattr_t,
1474 pClockId: *mut ::clockid_t,
1475 ) -> ::c_int;
1476
1477 // pthread.h
pthread_condattr_setclock( pAttr: *mut ::pthread_condattr_t, clockId: ::clockid_t, ) -> ::c_int1478 pub fn pthread_condattr_setclock(
1479 pAttr: *mut ::pthread_condattr_t,
1480 clockId: ::clockid_t,
1481 ) -> ::c_int;
1482
1483 // pthread.h
pthread_cond_init( cond: *mut ::pthread_cond_t, attr: *const ::pthread_condattr_t, ) -> ::c_int1484 pub fn pthread_cond_init(
1485 cond: *mut ::pthread_cond_t,
1486 attr: *const ::pthread_condattr_t,
1487 ) -> ::c_int;
1488
1489 // pthread.h
pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1490 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
1491
1492 // pthread.h
pthread_cond_signal(cond: *mut ::pthread_cond_t) -> ::c_int1493 pub fn pthread_cond_signal(cond: *mut ::pthread_cond_t) -> ::c_int;
1494
1495 // pthread.h
pthread_cond_broadcast(cond: *mut ::pthread_cond_t) -> ::c_int1496 pub fn pthread_cond_broadcast(cond: *mut ::pthread_cond_t) -> ::c_int;
1497
1498 // pthread.h
pthread_cond_wait( cond: *mut ::pthread_cond_t, mutex: *mut ::pthread_mutex_t, ) -> ::c_int1499 pub fn pthread_cond_wait(
1500 cond: *mut ::pthread_cond_t,
1501 mutex: *mut ::pthread_mutex_t,
1502 ) -> ::c_int;
1503
1504 // pthread.h
pthread_rwlockattr_init( attr: *mut ::pthread_rwlockattr_t, ) -> ::c_int1505 pub fn pthread_rwlockattr_init(
1506 attr: *mut ::pthread_rwlockattr_t,
1507 ) -> ::c_int;
1508
1509 // pthread.h
pthread_rwlockattr_destroy( attr: *mut ::pthread_rwlockattr_t, ) -> ::c_int1510 pub fn pthread_rwlockattr_destroy(
1511 attr: *mut ::pthread_rwlockattr_t,
1512 ) -> ::c_int;
1513
1514 // pthread.h
pthread_rwlockattr_setmaxreaders( attr: *mut ::pthread_rwlockattr_t, attr2: ::c_uint, ) -> ::c_int1515 pub fn pthread_rwlockattr_setmaxreaders(
1516 attr: *mut ::pthread_rwlockattr_t,
1517 attr2: ::c_uint,
1518 ) -> ::c_int;
1519
1520 // pthread.h
pthread_rwlock_init( attr: *mut ::pthread_rwlock_t, host: *const ::pthread_rwlockattr_t, ) -> ::c_int1521 pub fn pthread_rwlock_init(
1522 attr: *mut ::pthread_rwlock_t,
1523 host: *const ::pthread_rwlockattr_t,
1524 ) -> ::c_int;
1525
1526 // pthread.h
pthread_rwlock_destroy(attr: *mut ::pthread_rwlock_t) -> ::c_int1527 pub fn pthread_rwlock_destroy(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1528
1529 // pthread.h
pthread_rwlock_rdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1530 pub fn pthread_rwlock_rdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1531
1532 // pthread.h
pthread_rwlock_tryrdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1533 pub fn pthread_rwlock_tryrdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1534
1535 // pthread.h
pthread_rwlock_timedrdlock( attr: *mut ::pthread_rwlock_t, host: *const ::timespec, ) -> ::c_int1536 pub fn pthread_rwlock_timedrdlock(
1537 attr: *mut ::pthread_rwlock_t,
1538 host: *const ::timespec,
1539 ) -> ::c_int;
1540
1541 // pthread.h
pthread_rwlock_wrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1542 pub fn pthread_rwlock_wrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1543
1544 // pthread.h
pthread_rwlock_trywrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1545 pub fn pthread_rwlock_trywrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1546
1547 // pthread.h
pthread_rwlock_timedwrlock( attr: *mut ::pthread_rwlock_t, host: *const ::timespec, ) -> ::c_int1548 pub fn pthread_rwlock_timedwrlock(
1549 attr: *mut ::pthread_rwlock_t,
1550 host: *const ::timespec,
1551 ) -> ::c_int;
1552
1553 // pthread.h
pthread_rwlock_unlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1554 pub fn pthread_rwlock_unlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1555
1556 // pthread.h
pthread_key_create( key: *mut ::pthread_key_t, dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, ) -> ::c_int1557 pub fn pthread_key_create(
1558 key: *mut ::pthread_key_t,
1559 dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
1560 ) -> ::c_int;
1561
1562 // pthread.h
pthread_key_delete(key: ::pthread_key_t) -> ::c_int1563 pub fn pthread_key_delete(key: ::pthread_key_t) -> ::c_int;
1564
1565 // pthread.h
pthread_setspecific( key: ::pthread_key_t, value: *const ::c_void, ) -> ::c_int1566 pub fn pthread_setspecific(
1567 key: ::pthread_key_t,
1568 value: *const ::c_void,
1569 ) -> ::c_int;
1570
1571 // pthread.h
pthread_getspecific(key: ::pthread_key_t) -> *mut ::c_void1572 pub fn pthread_getspecific(key: ::pthread_key_t) -> *mut ::c_void;
1573
1574 // pthread.h
pthread_cond_timedwait( cond: *mut ::pthread_cond_t, mutex: *mut ::pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1575 pub fn pthread_cond_timedwait(
1576 cond: *mut ::pthread_cond_t,
1577 mutex: *mut ::pthread_mutex_t,
1578 abstime: *const ::timespec,
1579 ) -> ::c_int;
1580
1581 // pthread.h
pthread_attr_getname( attr: *mut ::pthread_attr_t, name: *mut *mut ::c_char, ) -> ::c_int1582 pub fn pthread_attr_getname(
1583 attr: *mut ::pthread_attr_t,
1584 name: *mut *mut ::c_char,
1585 ) -> ::c_int;
1586
1587 // pthread.h
pthread_join( thread: ::pthread_t, status: *mut *mut ::c_void, ) -> ::c_int1588 pub fn pthread_join(
1589 thread: ::pthread_t,
1590 status: *mut *mut ::c_void,
1591 ) -> ::c_int;
1592
1593 // pthread.h
pthread_self() -> ::pthread_t1594 pub fn pthread_self() -> ::pthread_t;
1595
1596 // clockLib.h
clock_gettime( clock_id: ::clockid_t, tp: *mut ::timespec, ) -> ::c_int1597 pub fn clock_gettime(
1598 clock_id: ::clockid_t,
1599 tp: *mut ::timespec,
1600 ) -> ::c_int;
1601
1602 // clockLib.h
clock_settime( clock_id: ::clockid_t, tp: *const ::timespec, ) -> ::c_int1603 pub fn clock_settime(
1604 clock_id: ::clockid_t,
1605 tp: *const ::timespec,
1606 ) -> ::c_int;
1607
1608 // clockLib.h
clock_getres( clock_id: ::clockid_t, res: *mut ::timespec, ) -> ::c_int1609 pub fn clock_getres(
1610 clock_id: ::clockid_t,
1611 res: *mut ::timespec,
1612 ) -> ::c_int;
1613
1614 // clockLib.h
clock_nanosleep( clock_id: ::clockid_t, flags: ::c_int, rqtp: *const ::timespec, rmtp: *mut ::timespec, ) -> ::c_int1615 pub fn clock_nanosleep(
1616 clock_id: ::clockid_t,
1617 flags: ::c_int,
1618 rqtp: *const ::timespec,
1619 rmtp: *mut ::timespec,
1620 ) -> ::c_int;
1621
1622 // timerLib.h
nanosleep( rqtp: *const ::timespec, rmtp: *mut ::timespec, ) -> ::c_int1623 pub fn nanosleep(
1624 rqtp: *const ::timespec,
1625 rmtp: *mut ::timespec,
1626 ) -> ::c_int;
1627
1628 // socket.h
accept( s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, ) -> ::c_int1629 pub fn accept(
1630 s: ::c_int,
1631 addr: *mut ::sockaddr,
1632 addrlen: *mut ::socklen_t,
1633 ) -> ::c_int;
1634
1635 // socket.h
bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int1636 pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t)
1637 -> ::c_int;
1638
1639 // socket.h
connect( s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t, ) -> ::c_int1640 pub fn connect(
1641 s: ::c_int,
1642 name: *const ::sockaddr,
1643 namelen: ::socklen_t,
1644 ) -> ::c_int;
1645
1646 // socket.h
getpeername( s: ::c_int, name: *mut ::sockaddr, namelen: *mut ::socklen_t, ) -> ::c_int1647 pub fn getpeername(
1648 s: ::c_int,
1649 name: *mut ::sockaddr,
1650 namelen: *mut ::socklen_t,
1651 ) -> ::c_int;
1652
1653 // socket.h
getsockname( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int1654 pub fn getsockname(
1655 socket: ::c_int,
1656 address: *mut sockaddr,
1657 address_len: *mut socklen_t,
1658 ) -> ::c_int;
1659
1660 // socket.h
getsockopt( sockfd: ::c_int, level: ::c_int, optname: ::c_int, optval: *mut ::c_void, optlen: *mut ::socklen_t, ) -> ::c_int1661 pub fn getsockopt(
1662 sockfd: ::c_int,
1663 level: ::c_int,
1664 optname: ::c_int,
1665 optval: *mut ::c_void,
1666 optlen: *mut ::socklen_t,
1667 ) -> ::c_int;
1668
1669 // socket.h
listen(socket: ::c_int, backlog: ::c_int) -> ::c_int1670 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
1671
1672 // socket.h
recv( s: ::c_int, buf: *mut ::c_void, bufLen: ::size_t, flags: ::c_int, ) -> ::ssize_t1673 pub fn recv(
1674 s: ::c_int,
1675 buf: *mut ::c_void,
1676 bufLen: ::size_t,
1677 flags: ::c_int,
1678 ) -> ::ssize_t;
1679
1680 // socket.h
recvfrom( s: ::c_int, buf: *mut ::c_void, bufLen: ::size_t, flags: ::c_int, from: *mut ::sockaddr, pFromLen: *mut ::socklen_t, ) -> ::ssize_t1681 pub fn recvfrom(
1682 s: ::c_int,
1683 buf: *mut ::c_void,
1684 bufLen: ::size_t,
1685 flags: ::c_int,
1686 from: *mut ::sockaddr,
1687 pFromLen: *mut ::socklen_t,
1688 ) -> ::ssize_t;
1689
recvmsg( socket: ::c_int, mp: *mut ::msghdr, flags: ::c_int, ) -> ::ssize_t1690 pub fn recvmsg(
1691 socket: ::c_int,
1692 mp: *mut ::msghdr,
1693 flags: ::c_int,
1694 ) -> ::ssize_t;
1695
1696 // socket.h
send( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, ) -> ::ssize_t1697 pub fn send(
1698 socket: ::c_int,
1699 buf: *const ::c_void,
1700 len: ::size_t,
1701 flags: ::c_int,
1702 ) -> ::ssize_t;
1703
sendmsg( socket: ::c_int, mp: *const ::msghdr, flags: ::c_int, ) -> ::ssize_t1704 pub fn sendmsg(
1705 socket: ::c_int,
1706 mp: *const ::msghdr,
1707 flags: ::c_int,
1708 ) -> ::ssize_t;
1709
1710 // socket.h
sendto( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, addr: *const sockaddr, addrlen: socklen_t, ) -> ::ssize_t1711 pub fn sendto(
1712 socket: ::c_int,
1713 buf: *const ::c_void,
1714 len: ::size_t,
1715 flags: ::c_int,
1716 addr: *const sockaddr,
1717 addrlen: socklen_t,
1718 ) -> ::ssize_t;
1719
1720 // socket.h
setsockopt( socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t, ) -> ::c_int1721 pub fn setsockopt(
1722 socket: ::c_int,
1723 level: ::c_int,
1724 name: ::c_int,
1725 value: *const ::c_void,
1726 option_len: socklen_t,
1727 ) -> ::c_int;
1728
1729 // socket.h
shutdown(s: ::c_int, how: ::c_int) -> ::c_int1730 pub fn shutdown(s: ::c_int, how: ::c_int) -> ::c_int;
1731
1732 // socket.h
socket( domain: ::c_int, _type: ::c_int, protocol: ::c_int, ) -> ::c_int1733 pub fn socket(
1734 domain: ::c_int,
1735 _type: ::c_int,
1736 protocol: ::c_int,
1737 ) -> ::c_int;
1738
1739 // icotl.h
ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int1740 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
1741
1742 // fcntl.h
fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int1743 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
1744
1745 // ntp_rfc2553.h for kernel
1746 // netdb.h for user
gai_strerror(errcode: ::c_int) -> *mut ::c_char1747 pub fn gai_strerror(errcode: ::c_int) -> *mut ::c_char;
1748
1749 // ioLib.h or
1750 // unistd.h
close(fd: ::c_int) -> ::c_int1751 pub fn close(fd: ::c_int) -> ::c_int;
1752
1753 // ioLib.h or
1754 // unistd.h
read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t1755 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
1756 -> ::ssize_t;
1757
1758 // ioLib.h or
1759 // unistd.h
write( fd: ::c_int, buf: *const ::c_void, count: ::size_t, ) -> ::ssize_t1760 pub fn write(
1761 fd: ::c_int,
1762 buf: *const ::c_void,
1763 count: ::size_t,
1764 ) -> ::ssize_t;
1765
1766 // ioLib.h or
1767 // unistd.h
isatty(fd: ::c_int) -> ::c_int1768 pub fn isatty(fd: ::c_int) -> ::c_int;
1769
1770 // ioLib.h or
1771 // unistd.h
dup(src: ::c_int) -> ::c_int1772 pub fn dup(src: ::c_int) -> ::c_int;
1773
1774 // ioLib.h or
1775 // unistd.h
dup2(src: ::c_int, dst: ::c_int) -> ::c_int1776 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
1777
1778 // ioLib.h or
1779 // unistd.h
pipe(fds: *mut ::c_int) -> ::c_int1780 pub fn pipe(fds: *mut ::c_int) -> ::c_int;
1781
1782 // ioLib.h or
1783 // unistd.h
unlink(pathname: *const ::c_char) -> ::c_int1784 pub fn unlink(pathname: *const ::c_char) -> ::c_int;
1785
1786 // unistd.h and
1787 // ioLib.h
lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t1788 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
1789
1790 // netdb.h
getaddrinfo( node: *const ::c_char, service: *const ::c_char, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> ::c_int1791 pub fn getaddrinfo(
1792 node: *const ::c_char,
1793 service: *const ::c_char,
1794 hints: *const addrinfo,
1795 res: *mut *mut addrinfo,
1796 ) -> ::c_int;
1797
1798 // netdb.h
freeaddrinfo(res: *mut addrinfo)1799 pub fn freeaddrinfo(res: *mut addrinfo);
1800
1801 // signal.h
signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t1802 pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
1803
1804 // unistd.h
getpid() -> pid_t1805 pub fn getpid() -> pid_t;
1806
1807 // unistd.h
getppid() -> pid_t1808 pub fn getppid() -> pid_t;
1809
1810 // wait.h
waitpid(pid: pid_t, status: *mut ::c_int, optons: ::c_int) -> pid_t1811 pub fn waitpid(pid: pid_t, status: *mut ::c_int, optons: ::c_int)
1812 -> pid_t;
1813
1814 // unistd.h
sysconf(attr: ::c_int) -> ::c_long1815 pub fn sysconf(attr: ::c_int) -> ::c_long;
1816
1817 // stdlib.h
setenv( envVarName: *const ::c_char, envVarValue: *const ::c_char, overwrite: ::c_int, ) -> ::c_int1818 pub fn setenv(
1819 // setenv.c
1820 envVarName: *const ::c_char,
1821 envVarValue: *const ::c_char,
1822 overwrite: ::c_int,
1823 ) -> ::c_int;
1824
1825 // stdlib.h
unsetenv( envVarName: *const ::c_char, ) -> ::c_int1826 pub fn unsetenv(
1827 // setenv.c
1828 envVarName: *const ::c_char,
1829 ) -> ::c_int;
1830
1831 // stdlib.h
realpath( fileName: *const ::c_char, resolvedName: *mut ::c_char, ) -> *mut ::c_char1832 pub fn realpath(
1833 fileName: *const ::c_char,
1834 resolvedName: *mut ::c_char,
1835 ) -> *mut ::c_char;
1836
1837 // unistd.h
link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int1838 pub fn link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int;
1839
1840 // unistd.h
readlink( path: *const ::c_char, buf: *mut ::c_char, bufsize: ::size_t, ) -> ::ssize_t1841 pub fn readlink(
1842 path: *const ::c_char,
1843 buf: *mut ::c_char,
1844 bufsize: ::size_t,
1845 ) -> ::ssize_t;
1846
1847 // unistd.h
symlink(path1: *const ::c_char, path2: *const ::c_char) -> ::c_int1848 pub fn symlink(path1: *const ::c_char, path2: *const ::c_char) -> ::c_int;
1849
1850 // dirent.h
opendir(name: *const ::c_char) -> *mut ::DIR1851 pub fn opendir(name: *const ::c_char) -> *mut ::DIR;
1852
1853 // unistd.h
rmdir(path: *const ::c_char) -> ::c_int1854 pub fn rmdir(path: *const ::c_char) -> ::c_int;
1855
1856 // stat.h
mkdir(dirName: *const ::c_char, mode: ::mode_t) -> ::c_int1857 pub fn mkdir(dirName: *const ::c_char, mode: ::mode_t) -> ::c_int;
1858
1859 // stat.h
chmod(path: *const ::c_char, mode: ::mode_t) -> ::c_int1860 pub fn chmod(path: *const ::c_char, mode: ::mode_t) -> ::c_int;
1861
1862 // stat.h
fchmod(attr1: ::c_int, attr2: ::mode_t) -> ::c_int1863 pub fn fchmod(attr1: ::c_int, attr2: ::mode_t) -> ::c_int;
1864
1865 // unistd.h
fsync(fd: ::c_int) -> ::c_int1866 pub fn fsync(fd: ::c_int) -> ::c_int;
1867
1868 // dirent.h
closedir(ptr: *mut ::DIR) -> ::c_int1869 pub fn closedir(ptr: *mut ::DIR) -> ::c_int;
1870
1871 // sched.h
sched_yield() -> ::c_int1872 pub fn sched_yield() -> ::c_int;
1873
1874 // errnoLib.h
errnoSet(err: ::c_int) -> ::c_int1875 pub fn errnoSet(err: ::c_int) -> ::c_int;
1876
1877 // errnoLib.h
errnoGet() -> ::c_int1878 pub fn errnoGet() -> ::c_int;
1879
1880 // unistd.h
_exit(status: ::c_int) -> !1881 pub fn _exit(status: ::c_int) -> !;
1882
1883 // unistd.h
setgid(gid: ::gid_t) -> ::c_int1884 pub fn setgid(gid: ::gid_t) -> ::c_int;
1885
1886 // unistd.h
getgid() -> ::gid_t1887 pub fn getgid() -> ::gid_t;
1888
1889 // unistd.h
setuid(uid: ::uid_t) -> ::c_int1890 pub fn setuid(uid: ::uid_t) -> ::c_int;
1891
1892 // unistd.h
getuid() -> ::uid_t1893 pub fn getuid() -> ::uid_t;
1894
1895 // signal.h
sigemptyset(__set: *mut sigset_t) -> ::c_int1896 pub fn sigemptyset(__set: *mut sigset_t) -> ::c_int;
1897
1898 // pthread.h for kernel
1899 // signal.h for user
pthread_sigmask( __how: ::c_int, __set: *const sigset_t, __oset: *mut sigset_t, ) -> ::c_int1900 pub fn pthread_sigmask(
1901 __how: ::c_int,
1902 __set: *const sigset_t,
1903 __oset: *mut sigset_t,
1904 ) -> ::c_int;
1905
1906 // signal.h for user
kill(__pid: pid_t, __signo: ::c_int) -> ::c_int1907 pub fn kill(__pid: pid_t, __signo: ::c_int) -> ::c_int;
1908
1909 // signal.h for user
sigqueue( __pid: pid_t, __signo: ::c_int, __value: ::sigval, ) -> ::c_int1910 pub fn sigqueue(
1911 __pid: pid_t,
1912 __signo: ::c_int,
1913 __value: ::sigval,
1914 ) -> ::c_int;
1915
1916 // signal.h for user
_sigqueue( rtpId: ::RTP_ID, signo: ::c_int, pValue: *const ::sigval, sigCode: ::c_int, ) -> ::c_int1917 pub fn _sigqueue(
1918 rtpId: ::RTP_ID,
1919 signo: ::c_int,
1920 pValue: *const ::sigval,
1921 sigCode: ::c_int,
1922 ) -> ::c_int;
1923
1924 // signal.h
taskKill(taskId: ::TASK_ID, signo: ::c_int) -> ::c_int1925 pub fn taskKill(taskId: ::TASK_ID, signo: ::c_int) -> ::c_int;
1926
1927 // signal.h
raise(__signo: ::c_int) -> ::c_int1928 pub fn raise(__signo: ::c_int) -> ::c_int;
1929
1930 // taskLibCommon.h
taskIdSelf() -> ::TASK_ID1931 pub fn taskIdSelf() -> ::TASK_ID;
taskDelay(ticks: ::_Vx_ticks_t) -> ::c_int1932 pub fn taskDelay(ticks: ::_Vx_ticks_t) -> ::c_int;
1933
1934 // rtpLibCommon.h
rtpInfoGet(rtpId: ::RTP_ID, rtpStruct: *mut ::RTP_DESC) -> ::c_int1935 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_ID1936 pub fn rtpSpawn(
1937 pubrtpFileName: *const ::c_char,
1938 argv: *mut *const ::c_char,
1939 envp: *mut *const ::c_char,
1940 priority: ::c_int,
1941 uStackSize: ::size_t,
1942 options: ::c_int,
1943 taskOptions: ::c_int,
1944 ) -> RTP_ID;
1945
1946 // ioLib.h
_realpath( fileName: *const ::c_char, resolvedName: *mut ::c_char, ) -> *mut ::c_char1947 pub fn _realpath(
1948 fileName: *const ::c_char,
1949 resolvedName: *mut ::c_char,
1950 ) -> *mut ::c_char;
1951
1952 // pathLib.h
_pathIsAbsolute( filepath: *const ::c_char, pNameTail: *mut *const ::c_char, ) -> BOOL1953 pub fn _pathIsAbsolute(
1954 filepath: *const ::c_char,
1955 pNameTail: *mut *const ::c_char,
1956 ) -> BOOL;
1957
writev( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, ) -> ::ssize_t1958 pub fn writev(
1959 fd: ::c_int,
1960 iov: *const ::iovec,
1961 iovcnt: ::c_int,
1962 ) -> ::ssize_t;
readv( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, ) -> ::ssize_t1963 pub fn readv(
1964 fd: ::c_int,
1965 iov: *const ::iovec,
1966 iovcnt: ::c_int,
1967 ) -> ::ssize_t;
1968
1969 // randomNumGen.h
randBytes(buf: *mut c_uchar, length: c_int) -> c_int1970 pub fn randBytes(buf: *mut c_uchar, length: c_int) -> c_int;
randABytes(buf: *mut c_uchar, length: c_int) -> c_int1971 pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int;
randUBytes(buf: *mut c_uchar, length: c_int) -> c_int1972 pub fn randUBytes(buf: *mut c_uchar, length: c_int) -> c_int;
randSecure() -> c_int1973 pub fn randSecure() -> c_int;
1974 }
1975
1976 //Dummy functions, these don't really exist in VxWorks.
1977
1978 // wait.h macros
WIFEXITED(status: ::c_int) -> bool1979 pub fn WIFEXITED(status: ::c_int) -> bool {
1980 (status & 0xFF00) == 0
1981 }
WIFSIGNALED(status: ::c_int) -> bool1982 pub fn WIFSIGNALED(status: ::c_int) -> bool {
1983 (status & 0xFF00) != 0
1984 }
WIFSTOPPED(status: ::c_int) -> bool1985 pub fn WIFSTOPPED(status: ::c_int) -> bool {
1986 (status & 0xFF0000) != 0
1987 }
WEXITSTATUS(status: ::c_int) -> ::c_int1988 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
1989 status & 0xFF
1990 }
WTERMSIG(status: ::c_int) -> ::c_int1991 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
1992 (status >> 8) & 0xFF
1993 }
WSTOPSIG(status: ::c_int) -> ::c_int1994 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
1995 (status >> 16) & 0xFF
1996 }
1997
pread( _fd: ::c_int, _buf: *mut ::c_void, _count: ::size_t, _offset: off64_t, ) -> ::ssize_t1998 pub fn pread(
1999 _fd: ::c_int,
2000 _buf: *mut ::c_void,
2001 _count: ::size_t,
2002 _offset: off64_t,
2003 ) -> ::ssize_t {
2004 -1
2005 }
2006
pwrite( _fd: ::c_int, _buf: *const ::c_void, _count: ::size_t, _offset: off64_t, ) -> ::ssize_t2007 pub fn pwrite(
2008 _fd: ::c_int,
2009 _buf: *const ::c_void,
2010 _count: ::size_t,
2011 _offset: off64_t,
2012 ) -> ::ssize_t {
2013 -1
2014 }
posix_memalign( memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t, ) -> ::c_int2015 pub fn posix_memalign(
2016 memptr: *mut *mut ::c_void,
2017 align: ::size_t,
2018 size: ::size_t,
2019 ) -> ::c_int {
2020 // check to see if align is a power of 2 and if align is a multiple
2021 // of sizeof(void *)
2022 if (align & align - 1 != 0)
2023 || (align as usize % size_of::<::size_t>() != 0)
2024 {
2025 return ::EINVAL;
2026 }
2027
2028 unsafe {
2029 // posix_memalign should not set errno
2030 let e = ::errnoGet();
2031
2032 let temp = memalign(align, size);
2033 ::errnoSet(e as ::c_int);
2034
2035 if temp.is_null() {
2036 ::ENOMEM
2037 } else {
2038 *memptr = temp;
2039 0
2040 }
2041 }
2042 }
2043
2044 cfg_if! {
2045 if #[cfg(libc_core_cvoid)] {
2046 pub use ::ffi::c_void;
2047 } else {
2048 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
2049 // enable more optimization opportunities around it recognizing things
2050 // like malloc/free.
2051 #[repr(u8)]
2052 #[allow(missing_copy_implementations)]
2053 #[allow(missing_debug_implementations)]
2054 pub enum c_void {
2055 // Two dummy variants so the #[repr] attribute can be used.
2056 #[doc(hidden)]
2057 __variant1,
2058 #[doc(hidden)]
2059 __variant2,
2060 }
2061 }
2062 }
2063
2064 cfg_if! {
2065 if #[cfg(target_arch = "aarch64")] {
2066 mod aarch64;
2067 pub use self::aarch64::*;
2068 } else if #[cfg(any(target_arch = "arm"))] {
2069 mod arm;
2070 pub use self::arm::*;
2071 } else if #[cfg(any(target_arch = "x86"))] {
2072 mod x86;
2073 pub use self::x86::*;
2074 } else if #[cfg(any(target_arch = "x86_64"))] {
2075 mod x86_64;
2076 pub use self::x86_64::*;
2077 } else if #[cfg(any(target_arch = "powerpc"))] {
2078 mod powerpc;
2079 pub use self::powerpc::*;
2080 } else if #[cfg(any(target_arch = "powerpc64"))] {
2081 mod powerpc64;
2082 pub use self::powerpc64::*;
2083 } else {
2084 // Unknown target_arch
2085 }
2086 }
2087