1 //! Interface to VxWorks C library
2
3 use core::mem::size_of;
4 use core::ptr::null_mut;
5
6 use crate::prelude::*;
7
8 #[cfg_attr(feature = "extra_traits", derive(Debug))]
9 pub enum DIR {}
10 impl Copy for DIR {}
11 impl Clone for DIR {
clone(&self) -> DIR12 fn clone(&self) -> DIR {
13 *self
14 }
15 }
16
17 pub type intmax_t = i64;
18 pub type uintmax_t = u64;
19
20 pub type uintptr_t = usize;
21 pub type intptr_t = isize;
22 pub type ptrdiff_t = isize;
23 pub type size_t = crate::uintptr_t;
24 pub type ssize_t = intptr_t;
25
26 pub type pid_t = c_int;
27 pub type in_addr_t = u32;
28 pub type sighandler_t = size_t;
29 pub type cpuset_t = u32;
30
31 pub type blkcnt_t = c_long;
32 pub type blksize_t = c_long;
33 pub type ino_t = c_ulong;
34
35 pub type rlim_t = c_ulong;
36 pub type suseconds_t = c_long;
37 pub type time_t = c_longlong;
38
39 pub type errno_t = c_int;
40
41 pub type useconds_t = c_ulong;
42
43 pub type socklen_t = c_uint;
44
45 pub type pthread_t = c_ulong;
46
47 pub type clockid_t = c_int;
48
49 //defined for the structs
50 pub type dev_t = c_ulong;
51 pub type mode_t = c_int;
52 pub type nlink_t = c_ulong;
53 pub type uid_t = c_ushort;
54 pub type gid_t = c_ushort;
55 pub type sigset_t = c_ulonglong;
56 pub type key_t = c_long;
57
58 pub type nfds_t = c_uint;
59 pub type stat64 = crate::stat;
60
61 pub type pthread_key_t = c_ulong;
62
63 // From b_off_t.h
64 pub type off_t = c_longlong;
65 pub type off64_t = off_t;
66
67 // From b_BOOL.h
68 pub type BOOL = c_int;
69
70 // From vxWind.h ..
71 pub type _Vx_OBJ_HANDLE = c_int;
72 pub type _Vx_TASK_ID = crate::_Vx_OBJ_HANDLE;
73 pub type _Vx_MSG_Q_ID = crate::_Vx_OBJ_HANDLE;
74 pub type _Vx_SEM_ID_KERNEL = crate::_Vx_OBJ_HANDLE;
75 pub type _Vx_RTP_ID = crate::_Vx_OBJ_HANDLE;
76 pub type _Vx_SD_ID = crate::_Vx_OBJ_HANDLE;
77 pub type _Vx_CONDVAR_ID = crate::_Vx_OBJ_HANDLE;
78 pub type _Vx_SEM_ID = *mut crate::_Vx_semaphore;
79 pub type OBJ_HANDLE = crate::_Vx_OBJ_HANDLE;
80 pub type TASK_ID = crate::OBJ_HANDLE;
81 pub type MSG_Q_ID = crate::OBJ_HANDLE;
82 pub type SEM_ID_KERNEL = crate::OBJ_HANDLE;
83 pub type RTP_ID = crate::OBJ_HANDLE;
84 pub type SD_ID = crate::OBJ_HANDLE;
85 pub type CONDVAR_ID = crate::OBJ_HANDLE;
86 pub type STATUS = crate::OBJ_HANDLE;
87
88 // From vxTypes.h
89 pub type _Vx_usr_arg_t = isize;
90 pub type _Vx_exit_code_t = isize;
91 pub type _Vx_ticks_t = c_uint;
92 pub type _Vx_ticks64_t = c_ulonglong;
93
94 pub type sa_family_t = c_uchar;
95
96 // mqueue.h
97 pub type mqd_t = c_int;
98
99 #[cfg_attr(feature = "extra_traits", derive(Debug))]
100 pub enum _Vx_semaphore {}
101 impl Copy for _Vx_semaphore {}
102 impl Clone for _Vx_semaphore {
clone(&self) -> _Vx_semaphore103 fn clone(&self) -> _Vx_semaphore {
104 *self
105 }
106 }
107
108 impl siginfo_t {
si_addr(&self) -> *mut c_void109 pub unsafe fn si_addr(&self) -> *mut c_void {
110 self.si_addr
111 }
112
si_value(&self) -> crate::sigval113 pub unsafe fn si_value(&self) -> crate::sigval {
114 self.si_value
115 }
116
si_pid(&self) -> crate::pid_t117 pub unsafe fn si_pid(&self) -> crate::pid_t {
118 self.si_pid
119 }
120
si_uid(&self) -> crate::uid_t121 pub unsafe fn si_uid(&self) -> crate::uid_t {
122 self.si_uid
123 }
124
si_status(&self) -> c_int125 pub unsafe fn si_status(&self) -> c_int {
126 self.si_status
127 }
128 }
129
130 s! {
131 // b_pthread_condattr_t.h
132 pub struct pthread_condattr_t {
133 pub condAttrStatus: c_int,
134 pub condAttrPshared: c_int,
135 pub condAttrClockId: crate::clockid_t,
136 }
137
138 // b_pthread_cond_t.h
139 pub struct pthread_cond_t {
140 pub condSemId: crate::_Vx_SEM_ID,
141 pub condValid: c_int,
142 pub condInitted: c_int,
143 pub condRefCount: c_int,
144 pub condMutex: *mut crate::pthread_mutex_t,
145 pub condAttr: crate::pthread_condattr_t,
146 pub condSemName: [c_char; _PTHREAD_SHARED_SEM_NAME_MAX],
147 }
148
149 // b_pthread_rwlockattr_t.h
150 pub struct pthread_rwlockattr_t {
151 pub rwlockAttrStatus: c_int,
152 pub rwlockAttrPshared: c_int,
153 pub rwlockAttrMaxReaders: c_uint,
154 pub rwlockAttrConformOpt: c_uint,
155 }
156
157 // b_pthread_rwlock_t.h
158 pub struct pthread_rwlock_t {
159 pub rwlockSemId: crate::_Vx_SEM_ID,
160 pub rwlockReadersRefCount: c_uint,
161 pub rwlockValid: c_int,
162 pub rwlockInitted: c_int,
163 pub rwlockAttr: crate::pthread_rwlockattr_t,
164 pub rwlockSemName: [c_char; _PTHREAD_SHARED_SEM_NAME_MAX],
165 }
166
167 // b_struct_timeval.h
168 pub struct timeval {
169 pub tv_sec: crate::time_t,
170 pub tv_usec: crate::suseconds_t,
171 }
172
173 // socket.h
174 pub struct linger {
175 pub l_onoff: c_int,
176 pub l_linger: c_int,
177 }
178
179 pub struct sockaddr {
180 pub sa_len: c_uchar,
181 pub sa_family: sa_family_t,
182 pub sa_data: [c_char; 14],
183 }
184
185 pub struct iovec {
186 pub iov_base: *mut c_void,
187 pub iov_len: size_t,
188 }
189
190 pub struct msghdr {
191 pub msg_name: *mut c_void,
192 pub msg_namelen: socklen_t,
193 pub msg_iov: *mut iovec,
194 pub msg_iovlen: c_int,
195 pub msg_control: *mut c_void,
196 pub msg_controllen: socklen_t,
197 pub msg_flags: c_int,
198 }
199
200 pub struct cmsghdr {
201 pub cmsg_len: socklen_t,
202 pub cmsg_level: c_int,
203 pub cmsg_type: c_int,
204 }
205
206 // poll.h
207 pub struct pollfd {
208 pub fd: c_int,
209 pub events: c_short,
210 pub revents: c_short,
211 }
212
213 // resource.h
214 pub struct rlimit {
215 pub rlim_cur: crate::rlim_t,
216 pub rlim_max: crate::rlim_t,
217 }
218
219 // stat.h
220 pub struct stat {
221 pub st_dev: crate::dev_t,
222 pub st_ino: crate::ino_t,
223 pub st_mode: mode_t,
224 pub st_nlink: crate::nlink_t,
225 pub st_uid: crate::uid_t,
226 pub st_gid: crate::gid_t,
227 pub st_rdev: crate::dev_t,
228 pub st_size: off_t,
229 pub st_atime: crate::time_t,
230 pub st_mtime: crate::time_t,
231 pub st_ctime: crate::time_t,
232 pub st_blksize: crate::blksize_t,
233 pub st_blocks: crate::blkcnt_t,
234 pub st_attrib: c_uchar,
235 pub st_reserved1: c_int,
236 pub st_reserved2: c_int,
237 pub st_reserved3: c_int,
238 pub st_reserved4: c_int,
239 }
240
241 //b_struct__Timespec.h
242 pub struct _Timespec {
243 pub tv_sec: crate::time_t,
244 pub tv_nsec: c_long,
245 }
246
247 // b_struct__Sched_param.h
248 pub struct sched_param {
249 pub sched_priority: c_int, /* scheduling priority */
250 pub sched_ss_low_priority: c_int, /* low scheduling priority */
251 pub sched_ss_repl_period: crate::_Timespec, /* replenishment period */
252 pub sched_ss_init_budget: crate::_Timespec, /* initial budget */
253 pub sched_ss_max_repl: c_int, /* max pending replenishment */
254 }
255
256 // b_pthread_attr_t.h
257 pub struct pthread_attr_t {
258 pub threadAttrStatus: c_int,
259 pub threadAttrStacksize: size_t,
260 pub threadAttrStackaddr: *mut c_void,
261 pub threadAttrGuardsize: size_t,
262 pub threadAttrDetachstate: c_int,
263 pub threadAttrContentionscope: c_int,
264 pub threadAttrInheritsched: c_int,
265 pub threadAttrSchedpolicy: c_int,
266 pub threadAttrName: *mut c_char,
267 pub threadAttrOptions: c_int,
268 pub threadAttrSchedparam: crate::sched_param,
269 }
270
271 // signal.h
272
273 pub struct sigaction {
274 pub sa_u: crate::sa_u_t,
275 pub sa_mask: crate::sigset_t,
276 pub sa_flags: c_int,
277 }
278
279 // b_stack_t.h
280 pub struct stack_t {
281 pub ss_sp: *mut c_void,
282 pub ss_size: size_t,
283 pub ss_flags: c_int,
284 }
285
286 // signal.h
287 pub struct siginfo_t {
288 pub si_signo: c_int,
289 pub si_code: c_int,
290 pub si_value: crate::sigval,
291 pub si_errno: c_int,
292 pub si_status: c_int,
293 pub si_addr: *mut c_void,
294 pub si_uid: crate::uid_t,
295 pub si_pid: crate::pid_t,
296 }
297
298 // pthread.h (krnl)
299 // b_pthread_mutexattr_t.h (usr)
300 pub struct pthread_mutexattr_t {
301 mutexAttrStatus: c_int,
302 mutexAttrPshared: c_int,
303 mutexAttrProtocol: c_int,
304 mutexAttrPrioceiling: c_int,
305 mutexAttrType: c_int,
306 }
307
308 // pthread.h (krnl)
309 // b_pthread_mutex_t.h (usr)
310 pub struct pthread_mutex_t {
311 pub mutexSemId: crate::_Vx_SEM_ID, /*_Vx_SEM_ID ..*/
312 pub mutexValid: c_int,
313 pub mutexInitted: c_int,
314 pub mutexCondRefCount: c_int,
315 pub mutexSavPriority: c_int,
316 pub mutexAttr: crate::pthread_mutexattr_t,
317 pub mutexSemName: [c_char; _PTHREAD_SHARED_SEM_NAME_MAX],
318 }
319
320 // b_struct_timespec.h
321 pub struct timespec {
322 pub tv_sec: crate::time_t,
323 pub tv_nsec: c_long,
324 }
325
326 // time.h
327 pub struct tm {
328 pub tm_sec: c_int,
329 pub tm_min: c_int,
330 pub tm_hour: c_int,
331 pub tm_mday: c_int,
332 pub tm_mon: c_int,
333 pub tm_year: c_int,
334 pub tm_wday: c_int,
335 pub tm_yday: c_int,
336 pub tm_isdst: c_int,
337 }
338
339 // in.h
340 pub struct in_addr {
341 pub s_addr: in_addr_t,
342 }
343
344 // in.h
345 pub struct ip_mreq {
346 pub imr_multiaddr: in_addr,
347 pub imr_interface: in_addr,
348 }
349
350 // in6.h
351 #[repr(align(4))]
352 pub struct in6_addr {
353 pub s6_addr: [u8; 16],
354 }
355
356 // in6.h
357 pub struct ipv6_mreq {
358 pub ipv6mr_multiaddr: in6_addr,
359 pub ipv6mr_interface: c_uint,
360 }
361
362 // netdb.h
363 pub struct addrinfo {
364 pub ai_flags: c_int,
365 pub ai_family: c_int,
366 pub ai_socktype: c_int,
367 pub ai_protocol: c_int,
368 pub ai_addrlen: size_t,
369 pub ai_canonname: *mut c_char,
370 pub ai_addr: *mut crate::sockaddr,
371 pub ai_next: *mut crate::addrinfo,
372 }
373
374 // in.h
375 pub struct sockaddr_in {
376 pub sin_len: u8,
377 pub sin_family: u8,
378 pub sin_port: u16,
379 pub sin_addr: crate::in_addr,
380 pub sin_zero: [c_char; 8],
381 }
382
383 // in6.h
384 pub struct sockaddr_in6 {
385 pub sin6_len: u8,
386 pub sin6_family: u8,
387 pub sin6_port: u16,
388 pub sin6_flowinfo: u32,
389 pub sin6_addr: crate::in6_addr,
390 pub sin6_scope_id: u32,
391 }
392
393 pub struct Dl_info {
394 pub dli_fname: *const c_char,
395 pub dli_fbase: *mut c_void,
396 pub dli_sname: *const c_char,
397 pub dli_saddr: *mut c_void,
398 }
399
400 pub struct mq_attr {
401 pub mq_maxmsg: c_long,
402 pub mq_msgsize: c_long,
403 pub mq_flags: c_long,
404 pub mq_curmsgs: c_long,
405 }
406 }
407
408 s_no_extra_traits! {
409 // dirent.h
410 pub struct dirent {
411 pub d_ino: crate::ino_t,
412 pub d_name: [c_char; _PARM_NAME_MAX as usize + 1],
413 pub d_type: c_uchar,
414 }
415
416 pub struct sockaddr_un {
417 pub sun_len: u8,
418 pub sun_family: sa_family_t,
419 pub sun_path: [c_char; 104],
420 }
421
422 // rtpLibCommon.h
423 pub struct RTP_DESC {
424 pub status: c_int,
425 pub options: u32,
426 pub entrAddr: *mut c_void,
427 pub initTaskId: crate::TASK_ID,
428 pub parentId: crate::RTP_ID,
429 pub pathName: [c_char; VX_RTP_NAME_LENGTH as usize + 1],
430 pub taskCnt: c_int,
431 pub textStart: *mut c_void,
432 pub textEnd: *mut c_void,
433 }
434 // socket.h
435 pub struct sockaddr_storage {
436 pub ss_len: c_uchar,
437 pub ss_family: crate::sa_family_t,
438 pub __ss_pad1: [c_char; _SS_PAD1SIZE],
439 pub __ss_align: i32,
440 pub __ss_pad2: [c_char; _SS_PAD2SIZE],
441 }
442
443 pub union sa_u_t {
444 pub sa_handler: Option<unsafe extern "C" fn(c_int) -> !>,
445 pub sa_sigaction:
446 Option<unsafe extern "C" fn(c_int, *mut crate::siginfo_t, *mut c_void) -> !>,
447 }
448
449 pub union sigval {
450 pub sival_int: c_int,
451 pub sival_ptr: *mut c_void,
452 }
453 }
454
455 cfg_if! {
456 if #[cfg(feature = "extra_traits")] {
457 impl PartialEq for sa_u_t {
458 fn eq(&self, other: &sa_u_t) -> bool {
459 unsafe {
460 let h1 = match self.sa_handler {
461 Some(handler) => handler as usize,
462 None => 0 as usize,
463 };
464 let h2 = match other.sa_handler {
465 Some(handler) => handler as usize,
466 None => 0 as usize,
467 };
468 h1 == h2
469 }
470 }
471 }
472 impl Eq for sa_u_t {}
473 impl hash::Hash for sa_u_t {
474 fn hash<H: hash::Hasher>(&self, state: &mut H) {
475 unsafe {
476 let h = match self.sa_handler {
477 Some(handler) => handler as usize,
478 None => 0 as usize,
479 };
480 h.hash(state)
481 }
482 }
483 }
484
485 impl PartialEq for sigval {
486 fn eq(&self, other: &sigval) -> bool {
487 unsafe { self.sival_ptr as usize == other.sival_ptr as usize }
488 }
489 }
490 impl Eq for sigval {}
491 impl hash::Hash for sigval {
492 fn hash<H: hash::Hasher>(&self, state: &mut H) {
493 unsafe { (self.sival_ptr as usize).hash(state) };
494 }
495 }
496 }
497 }
498
499 pub const STDIN_FILENO: c_int = 0;
500 pub const STDOUT_FILENO: c_int = 1;
501 pub const STDERR_FILENO: c_int = 2;
502
503 pub const EXIT_SUCCESS: c_int = 0;
504 pub const EXIT_FAILURE: c_int = 1;
505
506 pub const EAI_SERVICE: c_int = 9;
507 pub const EAI_SOCKTYPE: c_int = 10;
508 pub const EAI_SYSTEM: c_int = 11;
509
510 // FIXME(vxworks): This is not defined in vxWorks, but we have to define it here
511 // to make the building pass for getrandom and std
512 pub const RTLD_DEFAULT: *mut c_void = 0i64 as *mut c_void;
513
514 //Clock Lib Stuff
515 pub const CLOCK_REALTIME: c_int = 0x0;
516 pub const CLOCK_MONOTONIC: c_int = 0x1;
517 pub const CLOCK_PROCESS_CPUTIME_ID: c_int = 0x2;
518 pub const CLOCK_THREAD_CPUTIME_ID: c_int = 0x3;
519 pub const TIMER_ABSTIME: c_int = 0x1;
520 pub const TIMER_RELTIME: c_int = 0x0;
521
522 // PTHREAD STUFF
523 pub const PTHREAD_INITIALIZED_OBJ: c_int = 0xF70990EF;
524 pub const PTHREAD_DESTROYED_OBJ: c_int = -1;
525 pub const PTHREAD_VALID_OBJ: c_int = 0xEC542A37;
526 pub const PTHREAD_INVALID_OBJ: c_int = -1;
527 pub const PTHREAD_UNUSED_YET_OBJ: c_int = -1;
528
529 pub const PTHREAD_PRIO_NONE: c_int = 0;
530 pub const PTHREAD_PRIO_INHERIT: c_int = 1;
531 pub const PTHREAD_PRIO_PROTECT: c_int = 2;
532
533 pub const PTHREAD_MUTEX_NORMAL: c_int = 0;
534 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
535 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;
536 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL;
537 pub const PTHREAD_STACK_MIN: usize = 4096;
538 pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30;
539
540 //sched.h
541 pub const SCHED_FIFO: c_int = 0x01;
542 pub const SCHED_RR: c_int = 0x02;
543 pub const SCHED_OTHER: c_int = 0x04;
544 pub const SCHED_SPORADIC: c_int = 0x08;
545 pub const PRIO_PROCESS: c_uint = 0;
546 pub const SCHED_FIFO_HIGH_PRI: c_int = 255;
547 pub const SCHED_FIFO_LOW_PRI: c_int = 0;
548 pub const SCHED_RR_HIGH_PRI: c_int = 255;
549 pub const SCHED_RR_LOW_PRI: c_int = 0;
550 pub const SCHED_SPORADIC_HIGH_PRI: c_int = 255;
551 pub const SCHED_SPORADIC_LOW_PRI: c_int = 0;
552
553 // ERRNO STUFF
554 pub const ERROR: c_int = -1;
555 pub const OK: c_int = 0;
556 pub const EPERM: c_int = 1; /* Not owner */
557 pub const ENOENT: c_int = 2; /* No such file or directory */
558 pub const ESRCH: c_int = 3; /* No such process */
559 pub const EINTR: c_int = 4; /* Interrupted system call */
560 pub const EIO: c_int = 5; /* I/O error */
561 pub const ENXIO: c_int = 6; /* No such device or address */
562 pub const E2BIG: c_int = 7; /* Arg list too long */
563 pub const ENOEXEC: c_int = 8; /* Exec format error */
564 pub const EBADF: c_int = 9; /* Bad file number */
565 pub const ECHILD: c_int = 10; /* No children */
566 pub const EAGAIN: c_int = 11; /* No more processes */
567 pub const ENOMEM: c_int = 12; /* Not enough core */
568 pub const EACCES: c_int = 13; /* Permission denied */
569 pub const EFAULT: c_int = 14;
570 pub const ENOTEMPTY: c_int = 15;
571 pub const EBUSY: c_int = 16;
572 pub const EEXIST: c_int = 17;
573 pub const EXDEV: c_int = 18;
574 pub const ENODEV: c_int = 19;
575 pub const ENOTDIR: c_int = 20;
576 pub const EISDIR: c_int = 21;
577 pub const EINVAL: c_int = 22;
578 pub const ENFILE: c_int = 23;
579 pub const EMFILE: c_int = 24;
580 pub const ENOTTY: c_int = 25;
581 pub const ENAMETOOLONG: c_int = 26;
582 pub const EFBIG: c_int = 27;
583 pub const ENOSPC: c_int = 28;
584 pub const ESPIPE: c_int = 29;
585 pub const EROFS: c_int = 30;
586 pub const EMLINK: c_int = 31;
587 pub const EPIPE: c_int = 32;
588 pub const EDEADLK: c_int = 33;
589 pub const ENOLCK: c_int = 34;
590 pub const ENOTSUP: c_int = 35;
591 pub const EMSGSIZE: c_int = 36;
592 pub const EDOM: c_int = 37;
593 pub const ERANGE: c_int = 38;
594 pub const EDOOM: c_int = 39;
595 pub const EDESTADDRREQ: c_int = 40;
596 pub const EPROTOTYPE: c_int = 41;
597 pub const ENOPROTOOPT: c_int = 42;
598 pub const EPROTONOSUPPORT: c_int = 43;
599 pub const ESOCKTNOSUPPORT: c_int = 44;
600 pub const EOPNOTSUPP: c_int = 45;
601 pub const EPFNOSUPPORT: c_int = 46;
602 pub const EAFNOSUPPORT: c_int = 47;
603 pub const EADDRINUSE: c_int = 48;
604 pub const EADDRNOTAVAIL: c_int = 49;
605 pub const ENOTSOCK: c_int = 50;
606 pub const ENETUNREACH: c_int = 51;
607 pub const ENETRESET: c_int = 52;
608 pub const ECONNABORTED: c_int = 53;
609 pub const ECONNRESET: c_int = 54;
610 pub const ENOBUFS: c_int = 55;
611 pub const EISCONN: c_int = 56;
612 pub const ENOTCONN: c_int = 57;
613 pub const ESHUTDOWN: c_int = 58;
614 pub const ETOOMANYREFS: c_int = 59;
615 pub const ETIMEDOUT: c_int = 60;
616 pub const ECONNREFUSED: c_int = 61;
617 pub const ENETDOWN: c_int = 62;
618 pub const ETXTBSY: c_int = 63;
619 pub const ELOOP: c_int = 64;
620 pub const EHOSTUNREACH: c_int = 65;
621 pub const ENOTBLK: c_int = 66;
622 pub const EHOSTDOWN: c_int = 67;
623 pub const EINPROGRESS: c_int = 68;
624 pub const EALREADY: c_int = 69;
625 pub const EWOULDBLOCK: c_int = 70;
626 pub const ENOSYS: c_int = 71;
627 pub const ECANCELED: c_int = 72;
628 pub const ENOSR: c_int = 74;
629 pub const ENOSTR: c_int = 75;
630 pub const EPROTO: c_int = 76;
631 pub const EBADMSG: c_int = 77;
632 pub const ENODATA: c_int = 78;
633 pub const ETIME: c_int = 79;
634 pub const ENOMSG: c_int = 80;
635 pub const EFPOS: c_int = 81;
636 pub const EILSEQ: c_int = 82;
637 pub const EDQUOT: c_int = 83;
638 pub const EIDRM: c_int = 84;
639 pub const EOVERFLOW: c_int = 85;
640 pub const EMULTIHOP: c_int = 86;
641 pub const ENOLINK: c_int = 87;
642 pub const ESTALE: c_int = 88;
643 pub const EOWNERDEAD: c_int = 89;
644 pub const ENOTRECOVERABLE: c_int = 90;
645
646 // NFS errnos: Refer to pkgs_v2/storage/fs/nfs/h/nfs/nfsCommon.h
647 const M_nfsStat: c_int = 48 << 16;
648 enum nfsstat {
649 NFSERR_REMOTE = 71,
650 NFSERR_WFLUSH = 99,
651 NFSERR_BADHANDLE = 10001,
652 NFSERR_NOT_SYNC = 10002,
653 NFSERR_BAD_COOKIE = 10003,
654 NFSERR_TOOSMALL = 10005,
655 NFSERR_BADTYPE = 10007,
656 NFSERR_JUKEBOX = 10008,
657 }
658
659 pub const S_nfsLib_NFS_OK: c_int = OK;
660 pub const S_nfsLib_NFSERR_PERM: c_int = EPERM;
661 pub const S_nfsLib_NFSERR_NOENT: c_int = ENOENT;
662 pub const S_nfsLib_NFSERR_IO: c_int = EIO;
663 pub const S_nfsLib_NFSERR_NXIO: c_int = ENXIO;
664 pub const S_nfsLib_NFSERR_ACCESS: c_int = EACCES;
665 pub const S_nfsLib_NFSERR_EXIST: c_int = EEXIST;
666 pub const S_nfsLib_NFSERR_ENODEV: c_int = ENODEV;
667 pub const S_nfsLib_NFSERR_NOTDIR: c_int = ENOTDIR;
668 pub const S_nfsLib_NFSERR_ISDIR: c_int = EISDIR;
669 pub const S_nfsLib_NFSERR_INVAL: c_int = EINVAL;
670 pub const S_nfsLib_NFSERR_FBIG: c_int = EFBIG;
671 pub const S_nfsLib_NFSERR_NOSPC: c_int = ENOSPC;
672 pub const S_nfsLib_NFSERR_ROFS: c_int = EROFS;
673 pub const S_nfsLib_NFSERR_NAMETOOLONG: c_int = ENAMETOOLONG;
674 pub const S_nfsLib_NFSERR_NOTEMPTY: c_int = ENOTEMPTY;
675 pub const S_nfsLib_NFSERR_DQUOT: c_int = EDQUOT;
676 pub const S_nfsLib_NFSERR_STALE: c_int = ESTALE;
677 pub const S_nfsLib_NFSERR_WFLUSH: c_int = M_nfsStat | nfsstat::NFSERR_WFLUSH as c_int;
678 pub const S_nfsLib_NFSERR_REMOTE: c_int = M_nfsStat | nfsstat::NFSERR_REMOTE as c_int;
679 pub const S_nfsLib_NFSERR_BADHANDLE: c_int = M_nfsStat | nfsstat::NFSERR_BADHANDLE as c_int;
680 pub const S_nfsLib_NFSERR_NOT_SYNC: c_int = M_nfsStat | nfsstat::NFSERR_NOT_SYNC as c_int;
681 pub const S_nfsLib_NFSERR_BAD_COOKIE: c_int = M_nfsStat | nfsstat::NFSERR_BAD_COOKIE as c_int;
682 pub const S_nfsLib_NFSERR_NOTSUPP: c_int = EOPNOTSUPP;
683 pub const S_nfsLib_NFSERR_TOOSMALL: c_int = M_nfsStat | nfsstat::NFSERR_TOOSMALL as c_int;
684 pub const S_nfsLib_NFSERR_SERVERFAULT: c_int = EIO;
685 pub const S_nfsLib_NFSERR_BADTYPE: c_int = M_nfsStat | nfsstat::NFSERR_BADTYPE as c_int;
686 pub const S_nfsLib_NFSERR_JUKEBOX: c_int = M_nfsStat | nfsstat::NFSERR_JUKEBOX as c_int;
687
688 // internal offset values for below constants
689 const taskErrorBase: c_int = 0x00030000;
690 const semErrorBase: c_int = 0x00160000;
691 const objErrorBase: c_int = 0x003d0000;
692
693 // taskLibCommon.h
694 pub const S_taskLib_NAME_NOT_FOUND: c_int = taskErrorBase + 0x0065;
695 pub const S_taskLib_TASK_HOOK_TABLE_FULL: c_int = taskErrorBase + 0x0066;
696 pub const S_taskLib_TASK_HOOK_NOT_FOUND: c_int = taskErrorBase + 0x0067;
697 pub const S_taskLib_ILLEGAL_PRIORITY: c_int = taskErrorBase + 0x0068;
698
699 // FIXME(vxworks): could also be useful for TASK_DESC type
700 pub const VX_TASK_NAME_LENGTH: c_int = 31;
701 pub const VX_TASK_RENAME_LENGTH: c_int = 16;
702
703 // semLibCommon.h
704 pub const S_semLib_INVALID_STATE: c_int = semErrorBase + 0x0065;
705 pub const S_semLib_INVALID_OPTION: c_int = semErrorBase + 0x0066;
706 pub const S_semLib_INVALID_QUEUE_TYPE: c_int = semErrorBase + 0x0067;
707 pub const S_semLib_INVALID_OPERATION: c_int = semErrorBase + 0x0068;
708
709 // objLibCommon.h
710 pub const S_objLib_OBJ_ID_ERROR: c_int = objErrorBase + 0x0001;
711 pub const S_objLib_OBJ_UNAVAILABLE: c_int = objErrorBase + 0x0002;
712 pub const S_objLib_OBJ_DELETED: c_int = objErrorBase + 0x0003;
713 pub const S_objLib_OBJ_TIMEOUT: c_int = objErrorBase + 0x0004;
714 pub const S_objLib_OBJ_NO_METHOD: c_int = objErrorBase + 0x0005;
715
716 // in.h
717 pub const IPPROTO_IP: c_int = 0;
718 pub const IPPROTO_IPV6: c_int = 41;
719
720 pub const IP_TTL: c_int = 4;
721 pub const IP_MULTICAST_IF: c_int = 9;
722 pub const IP_MULTICAST_TTL: c_int = 10;
723 pub const IP_MULTICAST_LOOP: c_int = 11;
724 pub const IP_ADD_MEMBERSHIP: c_int = 12;
725 pub const IP_DROP_MEMBERSHIP: c_int = 13;
726
727 // in6.h
728 pub const IPV6_V6ONLY: c_int = 1;
729 pub const IPV6_UNICAST_HOPS: c_int = 4;
730 pub const IPV6_MULTICAST_IF: c_int = 9;
731 pub const IPV6_MULTICAST_HOPS: c_int = 10;
732 pub const IPV6_MULTICAST_LOOP: c_int = 11;
733 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
734 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
735
736 // STAT Stuff
737 pub const S_IFMT: c_int = 0o17_0000;
738 pub const S_IFIFO: c_int = 0o1_0000;
739 pub const S_IFCHR: c_int = 0o2_0000;
740 pub const S_IFDIR: c_int = 0o4_0000;
741 pub const S_IFBLK: c_int = 0o6_0000;
742 pub const S_IFREG: c_int = 0o10_0000;
743 pub const S_IFLNK: c_int = 0o12_0000;
744 pub const S_IFSHM: c_int = 0o13_0000;
745 pub const S_IFSOCK: c_int = 0o14_0000;
746 pub const S_ISUID: c_int = 0o4000;
747 pub const S_ISGID: c_int = 0o2000;
748 pub const S_ISTXT: c_int = 0o1000;
749 pub const S_ISVTX: c_int = 0o1000;
750 pub const S_IRUSR: c_int = 0o0400;
751 pub const S_IWUSR: c_int = 0o0200;
752 pub const S_IXUSR: c_int = 0o0100;
753 pub const S_IRWXU: c_int = 0o0700;
754 pub const S_IRGRP: c_int = 0o0040;
755 pub const S_IWGRP: c_int = 0o0020;
756 pub const S_IXGRP: c_int = 0o0010;
757 pub const S_IRWXG: c_int = 0o0070;
758 pub const S_IROTH: c_int = 0o0004;
759 pub const S_IWOTH: c_int = 0o0002;
760 pub const S_IXOTH: c_int = 0o0001;
761 pub const S_IRWXO: c_int = 0o0007;
762
763 pub const UTIME_OMIT: c_long = 0x3ffffffe;
764 pub const UTIME_NOW: c_long = 0x3fffffff;
765
766 // socket.h
767 pub const SOL_SOCKET: c_int = 0xffff;
768 pub const SOMAXCONN: c_int = 128;
769
770 pub const SO_DEBUG: c_int = 0x0001;
771 pub const SO_REUSEADDR: c_int = 0x0004;
772 pub const SO_KEEPALIVE: c_int = 0x0008;
773 pub const SO_DONTROUTE: c_int = 0x0010;
774 pub const SO_RCVLOWAT: c_int = 0x0012;
775 pub const SO_SNDLOWAT: c_int = 0x0013;
776 pub const SO_SNDTIMEO: c_int = 0x1005;
777 pub const SO_ACCEPTCONN: c_int = 0x001e;
778 pub const SO_BROADCAST: c_int = 0x0020;
779 pub const SO_USELOOPBACK: c_int = 0x0040;
780 pub const SO_LINGER: c_int = 0x0080;
781 pub const SO_REUSEPORT: c_int = 0x0200;
782
783 pub const SO_VLAN: c_int = 0x8000;
784
785 pub const SO_SNDBUF: c_int = 0x1001;
786 pub const SO_RCVBUF: c_int = 0x1002;
787 pub const SO_RCVTIMEO: c_int = 0x1006;
788 pub const SO_ERROR: c_int = 0x1007;
789 pub const SO_TYPE: c_int = 0x1008;
790 pub const SO_BINDTODEVICE: c_int = 0x1010;
791 pub const SO_OOBINLINE: c_int = 0x1011;
792 pub const SO_CONNTIMEO: c_int = 0x100a;
793
794 pub const SOCK_STREAM: c_int = 1;
795 pub const SOCK_DGRAM: c_int = 2;
796 pub const SOCK_RAW: c_int = 3;
797 pub const SOCK_RDM: c_int = 4;
798 pub const SOCK_SEQPACKET: c_int = 5;
799 pub const SOCK_PACKET: c_int = 10;
800
801 pub const _SS_MAXSIZE: usize = 128;
802 pub const _SS_ALIGNSIZE: usize = size_of::<u32>();
803 pub const _SS_PAD1SIZE: usize =
804 _SS_ALIGNSIZE - size_of::<c_uchar>() - size_of::<crate::sa_family_t>();
805 pub const _SS_PAD2SIZE: usize = _SS_MAXSIZE
806 - size_of::<c_uchar>()
807 - size_of::<crate::sa_family_t>()
808 - _SS_PAD1SIZE
809 - _SS_ALIGNSIZE;
810
811 pub const MSG_OOB: c_int = 0x0001;
812 pub const MSG_PEEK: c_int = 0x0002;
813 pub const MSG_DONTROUTE: c_int = 0x0004;
814 pub const MSG_EOR: c_int = 0x0008;
815 pub const MSG_TRUNC: c_int = 0x0010;
816 pub const MSG_CTRUNC: c_int = 0x0020;
817 pub const MSG_WAITALL: c_int = 0x0040;
818 pub const MSG_DONTWAIT: c_int = 0x0080;
819 pub const MSG_EOF: c_int = 0x0100;
820 pub const MSG_EXP: c_int = 0x0200;
821 pub const MSG_MBUF: c_int = 0x0400;
822 pub const MSG_NOTIFICATION: c_int = 0x0800;
823 pub const MSG_COMPAT: c_int = 0x8000;
824
825 pub const AF_UNSPEC: c_int = 0;
826 pub const AF_LOCAL: c_int = 1;
827 pub const AF_UNIX: c_int = AF_LOCAL;
828 pub const AF_INET: c_int = 2;
829 pub const AF_NETLINK: c_int = 16;
830 pub const AF_ROUTE: c_int = 17;
831 pub const AF_LINK: c_int = 18;
832 pub const AF_PACKET: c_int = 19;
833 pub const pseudo_AF_KEY: c_int = 27;
834 pub const AF_KEY: c_int = pseudo_AF_KEY;
835 pub const AF_INET6: c_int = 28;
836 pub const AF_SOCKDEV: c_int = 31;
837 pub const AF_TIPC: c_int = 33;
838 pub const AF_MIPC: c_int = 34;
839 pub const AF_MIPC_SAFE: c_int = 35;
840 pub const AF_MAX: c_int = 37;
841
842 pub const SHUT_RD: c_int = 0;
843 pub const SHUT_WR: c_int = 1;
844 pub const SHUT_RDWR: c_int = 2;
845
846 pub const IPPROTO_TCP: c_int = 6;
847 pub const TCP_NODELAY: c_int = 1;
848 pub const TCP_MAXSEG: c_int = 2;
849 pub const TCP_NOPUSH: c_int = 3;
850 pub const TCP_KEEPIDLE: c_int = 4;
851 pub const TCP_KEEPINTVL: c_int = 5;
852 pub const TCP_KEEPCNT: c_int = 6;
853
854 // ioLib.h
855 pub const FIONREAD: c_int = 0x40040001;
856 pub const FIOFLUSH: c_int = 2;
857 pub const FIOOPTIONS: c_int = 3;
858 pub const FIOBAUDRATE: c_int = 4;
859 pub const FIODISKFORMAT: c_int = 5;
860 pub const FIODISKINIT: c_int = 6;
861 pub const FIOSEEK: c_int = 7;
862 pub const FIOWHERE: c_int = 8;
863 pub const FIODIRENTRY: c_int = 9;
864 pub const FIORENAME: c_int = 10;
865 pub const FIOREADYCHANGE: c_int = 11;
866 pub const FIODISKCHANGE: c_int = 13;
867 pub const FIOCANCEL: c_int = 14;
868 pub const FIOSQUEEZE: c_int = 15;
869 pub const FIOGETNAME: c_int = 18;
870 pub const FIONBIO: c_int = 0x90040010;
871
872 // limits.h
873 pub const PATH_MAX: c_int = _PARM_PATH_MAX;
874 pub const _POSIX_PATH_MAX: c_int = 256;
875
876 // Some poll stuff
877 pub const POLLIN: c_short = 0x0001;
878 pub const POLLPRI: c_short = 0x0002;
879 pub const POLLOUT: c_short = 0x0004;
880 pub const POLLRDNORM: c_short = 0x0040;
881 pub const POLLWRNORM: c_short = POLLOUT;
882 pub const POLLRDBAND: c_short = 0x0080;
883 pub const POLLWRBAND: c_short = 0x0100;
884 pub const POLLERR: c_short = 0x0008;
885 pub const POLLHUP: c_short = 0x0010;
886 pub const POLLNVAL: c_short = 0x0020;
887
888 // fnctlcom.h
889 pub const FD_CLOEXEC: c_int = 1;
890 pub const F_DUPFD: c_int = 0;
891 pub const F_GETFD: c_int = 1;
892 pub const F_SETFD: c_int = 2;
893 pub const F_GETFL: c_int = 3;
894 pub const F_SETFL: c_int = 4;
895 pub const F_GETOWN: c_int = 5;
896 pub const F_SETOWN: c_int = 6;
897 pub const F_GETLK: c_int = 7;
898 pub const F_SETLK: c_int = 8;
899 pub const F_SETLKW: c_int = 9;
900 pub const F_DUPFD_CLOEXEC: c_int = 14;
901
902 // signal.h
903 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
904 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
905 pub const SIG_ERR: sighandler_t = -1 as isize as sighandler_t;
906
907 pub const SIGHUP: c_int = 1;
908 pub const SIGINT: c_int = 2;
909 pub const SIGQUIT: c_int = 3;
910 pub const SIGILL: c_int = 4;
911 pub const SIGTRAP: c_int = 5;
912 pub const SIGABRT: c_int = 6;
913 pub const SIGEMT: c_int = 7;
914 pub const SIGFPE: c_int = 8;
915 pub const SIGKILL: c_int = 9;
916 pub const SIGBUS: c_int = 10;
917 pub const SIGSEGV: c_int = 11;
918 pub const SIGFMT: c_int = 12;
919 pub const SIGPIPE: c_int = 13;
920 pub const SIGALRM: c_int = 14;
921 pub const SIGTERM: c_int = 15;
922 pub const SIGCNCL: c_int = 16;
923 pub const SIGSTOP: c_int = 17;
924 pub const SIGTSTP: c_int = 18;
925 pub const SIGCONT: c_int = 19;
926 pub const SIGCHLD: c_int = 20;
927 pub const SIGTTIN: c_int = 21;
928 pub const SIGTTOU: c_int = 22;
929 pub const SIGUSR1: c_int = 30;
930 pub const SIGUSR2: c_int = 31;
931 pub const SIGPOLL: c_int = 32;
932 pub const SIGPROF: c_int = 33;
933 pub const SIGSYS: c_int = 34;
934 pub const SIGURG: c_int = 35;
935 pub const SIGVTALRM: c_int = 36;
936 pub const SIGXCPU: c_int = 37;
937 pub const SIGXFSZ: c_int = 38;
938 pub const SIGRTMIN: c_int = 48;
939
940 pub const SIGIO: c_int = SIGRTMIN;
941 pub const SIGWINCH: c_int = SIGRTMIN + 5;
942 pub const SIGLOST: c_int = SIGRTMIN + 6;
943
944 pub const SIG_BLOCK: c_int = 1;
945 pub const SIG_UNBLOCK: c_int = 2;
946 pub const SIG_SETMASK: c_int = 3;
947
948 pub const SA_NOCLDSTOP: c_int = 0x0001;
949 pub const SA_SIGINFO: c_int = 0x0002;
950 pub const SA_ONSTACK: c_int = 0x0004;
951 pub const SA_INTERRUPT: c_int = 0x0008;
952 pub const SA_RESETHAND: c_int = 0x0010;
953 pub const SA_RESTART: c_int = 0x0020;
954 pub const SA_NODEFER: c_int = 0x0040;
955 pub const SA_NOCLDWAIT: c_int = 0x0080;
956
957 pub const SI_SYNC: c_int = 0;
958 pub const SI_USER: c_int = -1;
959 pub const SI_QUEUE: c_int = -2;
960 pub const SI_TIMER: c_int = -3;
961 pub const SI_ASYNCIO: c_int = -4;
962 pub const SI_MESGQ: c_int = -5;
963 pub const SI_CHILD: c_int = -6;
964 pub const SI_KILL: c_int = SI_USER;
965
966 // vxParams.h definitions
967 pub const _PARM_NAME_MAX: c_int = 255;
968 pub const _PARM_PATH_MAX: c_int = 1024;
969
970 // WAIT STUFF
971 pub const WNOHANG: c_int = 0x01;
972 pub const WUNTRACED: c_int = 0x02;
973
974 const PTHREAD_MUTEXATTR_INITIALIZER: pthread_mutexattr_t = pthread_mutexattr_t {
975 mutexAttrStatus: PTHREAD_INITIALIZED_OBJ,
976 mutexAttrProtocol: PTHREAD_PRIO_NONE,
977 mutexAttrPrioceiling: 0,
978 mutexAttrType: PTHREAD_MUTEX_DEFAULT,
979 mutexAttrPshared: 1,
980 };
981 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
982 mutexSemId: null_mut(),
983 mutexValid: PTHREAD_VALID_OBJ,
984 mutexInitted: PTHREAD_UNUSED_YET_OBJ,
985 mutexCondRefCount: 0,
986 mutexSavPriority: -1,
987 mutexAttr: PTHREAD_MUTEXATTR_INITIALIZER,
988 mutexSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
989 };
990
991 const PTHREAD_CONDATTR_INITIALIZER: pthread_condattr_t = pthread_condattr_t {
992 condAttrStatus: 0xf70990ef,
993 condAttrPshared: 1,
994 condAttrClockId: CLOCK_REALTIME,
995 };
996 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
997 condSemId: null_mut(),
998 condValid: PTHREAD_VALID_OBJ,
999 condInitted: PTHREAD_UNUSED_YET_OBJ,
1000 condRefCount: 0,
1001 condMutex: null_mut(),
1002 condAttr: PTHREAD_CONDATTR_INITIALIZER,
1003 condSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
1004 };
1005
1006 const PTHREAD_RWLOCKATTR_INITIALIZER: pthread_rwlockattr_t = pthread_rwlockattr_t {
1007 rwlockAttrStatus: PTHREAD_INITIALIZED_OBJ,
1008 rwlockAttrPshared: 1,
1009 rwlockAttrMaxReaders: 0,
1010 rwlockAttrConformOpt: 1,
1011 };
1012 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1013 rwlockSemId: null_mut(),
1014 rwlockReadersRefCount: 0,
1015 rwlockValid: PTHREAD_VALID_OBJ,
1016 rwlockInitted: PTHREAD_UNUSED_YET_OBJ,
1017 rwlockAttr: PTHREAD_RWLOCKATTR_INITIALIZER,
1018 rwlockSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
1019 };
1020
1021 pub const SEEK_SET: c_int = 0;
1022 pub const SEEK_CUR: c_int = 1;
1023 pub const SEEK_END: c_int = 2;
1024
1025 // rtpLibCommon.h
1026 pub const VX_RTP_NAME_LENGTH: c_int = 255;
1027 pub const RTP_ID_ERROR: crate::RTP_ID = -1;
1028
1029 // h/public/unistd.h
1030 pub const _SC_GETPW_R_SIZE_MAX: c_int = 21; // Via unistd.h
1031 pub const _SC_PAGESIZE: c_int = 39;
1032 pub const O_ACCMODE: c_int = 3;
1033 pub const O_CLOEXEC: c_int = 0x100000; // fcntlcom
1034 pub const O_EXCL: c_int = 0x0800;
1035 pub const O_CREAT: c_int = 0x0200;
1036 pub const O_TRUNC: c_int = 0x0400;
1037 pub const O_APPEND: c_int = 0x0008;
1038 pub const O_RDWR: c_int = 0x0002;
1039 pub const O_WRONLY: c_int = 0x0001;
1040 pub const O_RDONLY: c_int = 0;
1041 pub const O_NONBLOCK: c_int = 0x4000;
1042
1043 // mman.h
1044 pub const PROT_NONE: c_int = 0x0000;
1045 pub const PROT_READ: c_int = 0x0001;
1046 pub const PROT_WRITE: c_int = 0x0002;
1047 pub const PROT_EXEC: c_int = 0x0004;
1048
1049 pub const MAP_SHARED: c_int = 0x0001;
1050 pub const MAP_PRIVATE: c_int = 0x0002;
1051 pub const MAP_ANON: c_int = 0x0004;
1052 pub const MAP_ANONYMOUS: c_int = MAP_ANON;
1053 pub const MAP_FIXED: c_int = 0x0010;
1054 pub const MAP_CONTIG: c_int = 0x0020;
1055
1056 pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
1057
1058 #[cfg_attr(feature = "extra_traits", derive(Debug))]
1059 pub enum FILE {}
1060 impl Copy for FILE {}
1061 impl Clone for FILE {
clone(&self) -> FILE1062 fn clone(&self) -> FILE {
1063 *self
1064 }
1065 }
1066 #[cfg_attr(feature = "extra_traits", derive(Debug))]
1067 pub enum fpos_t {} // FIXME(vxworks): fill this out with a struct
1068 impl Copy for fpos_t {}
1069 impl Clone for fpos_t {
clone(&self) -> fpos_t1070 fn clone(&self) -> fpos_t {
1071 *self
1072 }
1073 }
1074
1075 f! {
1076 pub {const} fn CMSG_ALIGN(len: usize) -> usize {
1077 len + mem::size_of::<usize>() - 1 & !(mem::size_of::<usize>() - 1)
1078 }
1079
1080 pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
1081 let next = cmsg as usize
1082 + CMSG_ALIGN((*cmsg).cmsg_len as usize)
1083 + CMSG_ALIGN(mem::size_of::<cmsghdr>());
1084 let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
1085 if next <= max {
1086 (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
1087 } else {
1088 core::ptr::null_mut::<cmsghdr>()
1089 }
1090 }
1091
1092 pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1093 if (*mhdr).msg_controllen as usize > 0 {
1094 (*mhdr).msg_control as *mut cmsghdr
1095 } else {
1096 core::ptr::null_mut::<cmsghdr>()
1097 }
1098 }
1099
1100 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
1101 (cmsg as *mut c_uchar).offset(CMSG_ALIGN(mem::size_of::<cmsghdr>()) as isize)
1102 }
1103
1104 pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
1105 (CMSG_ALIGN(length as usize) + CMSG_ALIGN(mem::size_of::<cmsghdr>())) as c_uint
1106 }
1107
1108 pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
1109 CMSG_ALIGN(mem::size_of::<cmsghdr>()) as c_uint + length
1110 }
1111 }
1112
1113 extern "C" {
isalnum(c: c_int) -> c_int1114 pub fn isalnum(c: c_int) -> c_int;
isalpha(c: c_int) -> c_int1115 pub fn isalpha(c: c_int) -> c_int;
iscntrl(c: c_int) -> c_int1116 pub fn iscntrl(c: c_int) -> c_int;
isdigit(c: c_int) -> c_int1117 pub fn isdigit(c: c_int) -> c_int;
isgraph(c: c_int) -> c_int1118 pub fn isgraph(c: c_int) -> c_int;
islower(c: c_int) -> c_int1119 pub fn islower(c: c_int) -> c_int;
isprint(c: c_int) -> c_int1120 pub fn isprint(c: c_int) -> c_int;
ispunct(c: c_int) -> c_int1121 pub fn ispunct(c: c_int) -> c_int;
isspace(c: c_int) -> c_int1122 pub fn isspace(c: c_int) -> c_int;
isupper(c: c_int) -> c_int1123 pub fn isupper(c: c_int) -> c_int;
isxdigit(c: c_int) -> c_int1124 pub fn isxdigit(c: c_int) -> c_int;
isblank(c: c_int) -> c_int1125 pub fn isblank(c: c_int) -> c_int;
tolower(c: c_int) -> c_int1126 pub fn tolower(c: c_int) -> c_int;
toupper(c: c_int) -> c_int1127 pub fn toupper(c: c_int) -> c_int;
fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE1128 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 FILE1129 pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
fflush(file: *mut FILE) -> c_int1130 pub fn fflush(file: *mut FILE) -> c_int;
fclose(file: *mut FILE) -> c_int1131 pub fn fclose(file: *mut FILE) -> c_int;
remove(filename: *const c_char) -> c_int1132 pub fn remove(filename: *const c_char) -> c_int;
rename(oldname: *const c_char, newname: *const c_char) -> c_int1133 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
tmpfile() -> *mut FILE1134 pub fn tmpfile() -> *mut FILE;
setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int1135 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)1136 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
getchar() -> c_int1137 pub fn getchar() -> c_int;
putchar(c: c_int) -> c_int1138 pub fn putchar(c: c_int) -> c_int;
fgetc(stream: *mut FILE) -> c_int1139 pub fn fgetc(stream: *mut FILE) -> c_int;
fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char1140 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
fputc(c: c_int, stream: *mut FILE) -> c_int1141 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
fputs(s: *const c_char, stream: *mut FILE) -> c_int1142 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
puts(s: *const c_char) -> c_int1143 pub fn puts(s: *const c_char) -> c_int;
ungetc(c: c_int, stream: *mut FILE) -> c_int1144 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_t1145 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_t1146 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_int1147 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
ftell(stream: *mut FILE) -> c_long1148 pub fn ftell(stream: *mut FILE) -> c_long;
rewind(stream: *mut FILE)1149 pub fn rewind(stream: *mut FILE);
fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int1150 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int1151 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
feof(stream: *mut FILE) -> c_int1152 pub fn feof(stream: *mut FILE) -> c_int;
ferror(stream: *mut FILE) -> c_int1153 pub fn ferror(stream: *mut FILE) -> c_int;
perror(s: *const c_char)1154 pub fn perror(s: *const c_char);
atof(s: *const c_char) -> c_double1155 pub fn atof(s: *const c_char) -> c_double;
atoi(s: *const c_char) -> c_int1156 pub fn atoi(s: *const c_char) -> c_int;
atol(s: *const c_char) -> c_long1157 pub fn atol(s: *const c_char) -> c_long;
atoll(s: *const c_char) -> c_longlong1158 pub fn atoll(s: *const c_char) -> c_longlong;
strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double1159 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_float1160 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_long1161 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_longlong1162 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_ulong1163 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_ulonglong1164 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_void1165 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
malloc(size: size_t) -> *mut c_void1166 pub fn malloc(size: size_t) -> *mut c_void;
realloc(p: *mut c_void, size: size_t) -> *mut c_void1167 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
free(p: *mut c_void)1168 pub fn free(p: *mut c_void);
abort() -> !1169 pub fn abort() -> !;
exit(status: c_int) -> !1170 pub fn exit(status: c_int) -> !;
atexit(cb: extern "C" fn()) -> c_int1171 pub fn atexit(cb: extern "C" fn()) -> c_int;
system(s: *const c_char) -> c_int1172 pub fn system(s: *const c_char) -> c_int;
getenv(s: *const c_char) -> *mut c_char1173 pub fn getenv(s: *const c_char) -> *mut c_char;
1174
strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char1175 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_char1176 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_char1177 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_char1178 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_int1179 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_int1180 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_int1181 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
strchr(cs: *const c_char, c: c_int) -> *mut c_char1182 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
strrchr(cs: *const c_char, c: c_int) -> *mut c_char1183 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
strspn(cs: *const c_char, ct: *const c_char) -> size_t1184 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
strcspn(cs: *const c_char, ct: *const c_char) -> size_t1185 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
strdup(cs: *const c_char) -> *mut c_char1186 pub fn strdup(cs: *const c_char) -> *mut c_char;
strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char1187 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_char1188 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int1189 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_int1190 pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
strlen(cs: *const c_char) -> size_t1191 pub fn strlen(cs: *const c_char) -> size_t;
strerror(n: c_int) -> *mut c_char1192 pub fn strerror(n: c_int) -> *mut c_char;
strtok(s: *mut c_char, t: *const c_char) -> *mut c_char1193 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_t1194 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
wcslen(buf: *const wchar_t) -> size_t1195 pub fn wcslen(buf: *const wchar_t) -> size_t;
wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> size_t1196 pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> size_t;
1197
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void1198 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_t1199 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_int1200 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_void1201 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_void1202 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_void1203 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
1204 }
1205
1206 extern "C" {
fprintf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int1207 pub fn fprintf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
printf(format: *const c_char, ...) -> c_int1208 pub fn printf(format: *const c_char, ...) -> c_int;
snprintf(s: *mut c_char, n: size_t, format: *const c_char, ...) -> c_int1209 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_int1210 pub fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int;
fscanf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int1211 pub fn fscanf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
scanf(format: *const c_char, ...) -> c_int1212 pub fn scanf(format: *const c_char, ...) -> c_int;
sscanf(s: *const c_char, format: *const c_char, ...) -> c_int1213 pub fn sscanf(s: *const c_char, format: *const c_char, ...) -> c_int;
getchar_unlocked() -> c_int1214 pub fn getchar_unlocked() -> c_int;
putchar_unlocked(c: c_int) -> c_int1215 pub fn putchar_unlocked(c: c_int) -> c_int;
stat(path: *const c_char, buf: *mut stat) -> c_int1216 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
fdopen(fd: c_int, mode: *const c_char) -> *mut crate::FILE1217 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut crate::FILE;
fileno(stream: *mut crate::FILE) -> c_int1218 pub fn fileno(stream: *mut crate::FILE) -> c_int;
creat(path: *const c_char, mode: mode_t) -> c_int1219 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
rewinddir(dirp: *mut crate::DIR)1220 pub fn rewinddir(dirp: *mut crate::DIR);
fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int1221 pub fn fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int;
access(path: *const c_char, amode: c_int) -> c_int1222 pub fn access(path: *const c_char, amode: c_int) -> c_int;
alarm(seconds: c_uint) -> c_uint1223 pub fn alarm(seconds: c_uint) -> c_uint;
fchdir(dirfd: c_int) -> c_int1224 pub fn fchdir(dirfd: c_int) -> c_int;
chown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int1225 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int;
fpathconf(filedes: c_int, name: c_int) -> c_long1226 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
getegid() -> gid_t1227 pub fn getegid() -> gid_t;
geteuid() -> uid_t1228 pub fn geteuid() -> uid_t;
getgroups(ngroups_max: c_int, groups: *mut gid_t) -> c_int1229 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t) -> c_int;
getlogin() -> *mut c_char1230 pub fn getlogin() -> *mut c_char;
getopt(argc: c_int, argv: *const *mut c_char, optstr: *const c_char) -> c_int1231 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_long1232 pub fn pathconf(path: *const c_char, name: c_int) -> c_long;
pause() -> c_int1233 pub fn pause() -> c_int;
seteuid(uid: uid_t) -> c_int1234 pub fn seteuid(uid: uid_t) -> c_int;
setegid(gid: gid_t) -> c_int1235 pub fn setegid(gid: gid_t) -> c_int;
sleep(secs: c_uint) -> c_uint1236 pub fn sleep(secs: c_uint) -> c_uint;
ttyname(fd: c_int) -> *mut c_char1237 pub fn ttyname(fd: c_int) -> *mut c_char;
wait(status: *mut c_int) -> pid_t1238 pub fn wait(status: *mut c_int) -> pid_t;
umask(mask: mode_t) -> mode_t1239 pub fn umask(mask: mode_t) -> mode_t;
mlock(addr: *const c_void, len: size_t) -> c_int1240 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
mlockall(flags: c_int) -> c_int1241 pub fn mlockall(flags: c_int) -> c_int;
munlock(addr: *const c_void, len: size_t) -> c_int1242 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
munlockall() -> c_int1243 pub fn munlockall() -> c_int;
1244
mmap( addr: *mut c_void, len: size_t, prot: c_int, flags: c_int, fd: c_int, offset: off_t, ) -> *mut c_void1245 pub fn mmap(
1246 addr: *mut c_void,
1247 len: size_t,
1248 prot: c_int,
1249 flags: c_int,
1250 fd: c_int,
1251 offset: off_t,
1252 ) -> *mut c_void;
munmap(addr: *mut c_void, len: size_t) -> c_int1253 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
1254
mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int1255 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int1256 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int;
1257
truncate(path: *const c_char, length: off_t) -> c_int1258 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_int1259 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
shm_unlink(name: *const c_char) -> c_int1260 pub fn shm_unlink(name: *const c_char) -> c_int;
1261
gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int1262 pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
pthread_exit(value: *mut c_void) -> !1263 pub fn pthread_exit(value: *mut c_void) -> !;
pthread_attr_setdetachstate(attr: *mut crate::pthread_attr_t, state: c_int) -> c_int1264 pub fn pthread_attr_setdetachstate(attr: *mut crate::pthread_attr_t, state: c_int) -> c_int;
1265
strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int1266 pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
1267
sigaddset(set: *mut sigset_t, signum: c_int) -> c_int1268 pub fn sigaddset(set: *mut sigset_t, signum: c_int) -> c_int;
1269
sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction) -> c_int1270 pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction) -> c_int;
1271
utimes(filename: *const c_char, times: *const crate::timeval) -> c_int1272 pub fn utimes(filename: *const c_char, times: *const crate::timeval) -> c_int;
1273
futimens(fd: c_int, times: *const crate::timespec) -> c_int1274 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
1275
1276 #[link_name = "_rtld_dlopen"]
dlopen(filename: *const c_char, flag: c_int) -> *mut c_void1277 pub fn dlopen(filename: *const c_char, flag: c_int) -> *mut c_void;
1278
1279 #[link_name = "_rtld_dlerror"]
dlerror() -> *mut c_char1280 pub fn dlerror() -> *mut c_char;
1281
1282 #[link_name = "_rtld_dlsym"]
dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void1283 pub fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void;
1284
1285 #[link_name = "_rtld_dlclose"]
dlclose(handle: *mut c_void) -> c_int1286 pub fn dlclose(handle: *mut c_void) -> c_int;
1287
1288 #[link_name = "_rtld_dladdr"]
dladdr(addr: *mut c_void, info: *mut Dl_info) -> c_int1289 pub fn dladdr(addr: *mut c_void, info: *mut Dl_info) -> c_int;
1290
1291 // time.h
gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1292 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 tm1293 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
mktime(tm: *mut tm) -> time_t1294 pub fn mktime(tm: *mut tm) -> time_t;
time(time: *mut time_t) -> time_t1295 pub fn time(time: *mut time_t) -> time_t;
gmtime(time_p: *const time_t) -> *mut tm1296 pub fn gmtime(time_p: *const time_t) -> *mut tm;
localtime(time_p: *const time_t) -> *mut tm1297 pub fn localtime(time_p: *const time_t) -> *mut tm;
timegm(tm: *mut tm) -> time_t1298 pub fn timegm(tm: *mut tm) -> time_t;
difftime(time1: time_t, time0: time_t) -> c_double1299 pub fn difftime(time1: time_t, time0: time_t) -> c_double;
gethostname(name: *mut c_char, len: size_t) -> c_int1300 pub fn gethostname(name: *mut c_char, len: size_t) -> c_int;
usleep(secs: crate::useconds_t) -> c_int1301 pub fn usleep(secs: crate::useconds_t) -> c_int;
putenv(string: *mut c_char) -> c_int1302 pub fn putenv(string: *mut c_char) -> c_int;
setlocale(category: c_int, locale: *const c_char) -> *mut c_char1303 pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char;
1304
sigprocmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int1305 pub fn sigprocmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int;
sigpending(set: *mut sigset_t) -> c_int1306 pub fn sigpending(set: *mut sigset_t) -> c_int;
1307
mkfifo(path: *const c_char, mode: mode_t) -> c_int1308 pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
1309
fseeko(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int1310 pub fn fseeko(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int;
ftello(stream: *mut crate::FILE) -> off_t1311 pub fn ftello(stream: *mut crate::FILE) -> off_t;
mkstemp(template: *mut c_char) -> c_int1312 pub fn mkstemp(template: *mut c_char) -> c_int;
1313
tmpnam(ptr: *mut c_char) -> *mut c_char1314 pub fn tmpnam(ptr: *mut c_char) -> *mut c_char;
1315
openlog(ident: *const c_char, logopt: c_int, facility: c_int)1316 pub fn openlog(ident: *const c_char, logopt: c_int, facility: c_int);
closelog()1317 pub fn closelog();
setlogmask(maskpri: c_int) -> c_int1318 pub fn setlogmask(maskpri: c_int) -> c_int;
syslog(priority: c_int, message: *const c_char, ...)1319 pub fn syslog(priority: c_int, message: *const c_char, ...);
getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t1320 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
1321
1322 }
1323
1324 extern "C" {
1325 // stdlib.h
memalign(block_size: size_t, size_arg: size_t) -> *mut c_void1326 pub fn memalign(block_size: size_t, size_arg: size_t) -> *mut c_void;
1327
1328 // ioLib.h
getcwd(buf: *mut c_char, size: size_t) -> *mut c_char1329 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
1330
1331 // ioLib.h
chdir(attr: *const c_char) -> c_int1332 pub fn chdir(attr: *const c_char) -> c_int;
1333
1334 // pthread.h
pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int1335 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int;
1336
1337 // pthread.h
pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int1338 pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int;
1339
1340 // pthread.h
pthread_mutexattr_settype(pAttr: *mut crate::pthread_mutexattr_t, pType: c_int) -> c_int1341 pub fn pthread_mutexattr_settype(pAttr: *mut crate::pthread_mutexattr_t, pType: c_int)
1342 -> c_int;
1343
1344 // pthread.h
pthread_mutex_init( mutex: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> c_int1345 pub fn pthread_mutex_init(
1346 mutex: *mut pthread_mutex_t,
1347 attr: *const pthread_mutexattr_t,
1348 ) -> c_int;
1349
1350 // pthread.h
pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> c_int1351 pub fn pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> c_int;
1352
1353 // pthread.h
pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> c_int1354 pub fn pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> c_int;
1355
1356 // pthread.h
pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> c_int1357 pub fn pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> c_int;
1358
1359 // pthread.h
pthread_mutex_timedlock(attr: *mut pthread_mutex_t, spec: *const timespec) -> c_int1360 pub fn pthread_mutex_timedlock(attr: *mut pthread_mutex_t, spec: *const timespec) -> c_int;
1361
1362 // pthread.h
pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> c_int1363 pub fn pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> c_int;
1364
1365 // pthread.h
pthread_attr_setname(pAttr: *mut crate::pthread_attr_t, name: *mut c_char) -> c_int1366 pub fn pthread_attr_setname(pAttr: *mut crate::pthread_attr_t, name: *mut c_char) -> c_int;
1367
1368 // pthread.h
pthread_attr_setstacksize(attr: *mut crate::pthread_attr_t, stacksize: size_t) -> c_int1369 pub fn pthread_attr_setstacksize(attr: *mut crate::pthread_attr_t, stacksize: size_t) -> c_int;
1370
1371 // pthread.h
pthread_attr_getstacksize( attr: *const crate::pthread_attr_t, size: *mut size_t, ) -> c_int1372 pub fn pthread_attr_getstacksize(
1373 attr: *const crate::pthread_attr_t,
1374 size: *mut size_t,
1375 ) -> c_int;
1376
1377 // pthread.h
pthread_attr_init(attr: *mut crate::pthread_attr_t) -> c_int1378 pub fn pthread_attr_init(attr: *mut crate::pthread_attr_t) -> c_int;
1379
1380 // pthread.h
pthread_create( pThread: *mut crate::pthread_t, pAttr: *const crate::pthread_attr_t, start_routine: extern "C" fn(*mut c_void) -> *mut c_void, value: *mut c_void, ) -> c_int1381 pub fn pthread_create(
1382 pThread: *mut crate::pthread_t,
1383 pAttr: *const crate::pthread_attr_t,
1384 start_routine: extern "C" fn(*mut c_void) -> *mut c_void,
1385 value: *mut c_void,
1386 ) -> c_int;
1387
1388 //pthread.h
pthread_setschedparam( native: crate::pthread_t, policy: c_int, param: *const crate::sched_param, ) -> c_int1389 pub fn pthread_setschedparam(
1390 native: crate::pthread_t,
1391 policy: c_int,
1392 param: *const crate::sched_param,
1393 ) -> c_int;
1394
1395 //pthread.h
pthread_getschedparam( native: crate::pthread_t, policy: *mut c_int, param: *mut crate::sched_param, ) -> c_int1396 pub fn pthread_getschedparam(
1397 native: crate::pthread_t,
1398 policy: *mut c_int,
1399 param: *mut crate::sched_param,
1400 ) -> c_int;
1401
1402 //pthread.h
pthread_attr_setinheritsched( attr: *mut crate::pthread_attr_t, inheritsched: c_int, ) -> c_int1403 pub fn pthread_attr_setinheritsched(
1404 attr: *mut crate::pthread_attr_t,
1405 inheritsched: c_int,
1406 ) -> c_int;
1407
1408 //pthread.h
pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int1409 pub fn pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int;
1410
1411 // pthread.h
pthread_attr_destroy(thread: *mut crate::pthread_attr_t) -> c_int1412 pub fn pthread_attr_destroy(thread: *mut crate::pthread_attr_t) -> c_int;
1413
1414 // pthread.h
pthread_detach(thread: crate::pthread_t) -> c_int1415 pub fn pthread_detach(thread: crate::pthread_t) -> c_int;
1416
1417 // 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_int1418 pub fn pthread_atfork(
1419 prepare: Option<unsafe extern "C" fn()>,
1420 parent: Option<unsafe extern "C" fn()>,
1421 child: Option<unsafe extern "C" fn()>,
1422 ) -> c_int;
1423
1424 // stat.h
fstat(fildes: c_int, buf: *mut stat) -> c_int1425 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
1426
1427 // stat.h
lstat(path: *const c_char, buf: *mut stat) -> c_int1428 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
1429
1430 // unistd.h
ftruncate(fd: c_int, length: off_t) -> c_int1431 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
1432
1433 // dirent.h
readdir_r( pDir: *mut crate::DIR, entry: *mut crate::dirent, result: *mut *mut crate::dirent, ) -> c_int1434 pub fn readdir_r(
1435 pDir: *mut crate::DIR,
1436 entry: *mut crate::dirent,
1437 result: *mut *mut crate::dirent,
1438 ) -> c_int;
1439
1440 // dirent.h
readdir(pDir: *mut crate::DIR) -> *mut crate::dirent1441 pub fn readdir(pDir: *mut crate::DIR) -> *mut crate::dirent;
1442
1443 // fcntl.h or
1444 // ioLib.h
open(path: *const c_char, oflag: c_int, ...) -> c_int1445 pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
1446
1447 // poll.h
poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int1448 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int;
1449
1450 // pthread.h
pthread_condattr_init(attr: *mut crate::pthread_condattr_t) -> c_int1451 pub fn pthread_condattr_init(attr: *mut crate::pthread_condattr_t) -> c_int;
1452
1453 // pthread.h
pthread_condattr_destroy(attr: *mut crate::pthread_condattr_t) -> c_int1454 pub fn pthread_condattr_destroy(attr: *mut crate::pthread_condattr_t) -> c_int;
1455
1456 // pthread.h
pthread_condattr_getclock( pAttr: *const crate::pthread_condattr_t, pClockId: *mut crate::clockid_t, ) -> c_int1457 pub fn pthread_condattr_getclock(
1458 pAttr: *const crate::pthread_condattr_t,
1459 pClockId: *mut crate::clockid_t,
1460 ) -> c_int;
1461
1462 // pthread.h
pthread_condattr_setclock( pAttr: *mut crate::pthread_condattr_t, clockId: crate::clockid_t, ) -> c_int1463 pub fn pthread_condattr_setclock(
1464 pAttr: *mut crate::pthread_condattr_t,
1465 clockId: crate::clockid_t,
1466 ) -> c_int;
1467
1468 // pthread.h
pthread_cond_init( cond: *mut crate::pthread_cond_t, attr: *const crate::pthread_condattr_t, ) -> c_int1469 pub fn pthread_cond_init(
1470 cond: *mut crate::pthread_cond_t,
1471 attr: *const crate::pthread_condattr_t,
1472 ) -> c_int;
1473
1474 // pthread.h
pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int1475 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int;
1476
1477 // pthread.h
pthread_cond_signal(cond: *mut crate::pthread_cond_t) -> c_int1478 pub fn pthread_cond_signal(cond: *mut crate::pthread_cond_t) -> c_int;
1479
1480 // pthread.h
pthread_cond_broadcast(cond: *mut crate::pthread_cond_t) -> c_int1481 pub fn pthread_cond_broadcast(cond: *mut crate::pthread_cond_t) -> c_int;
1482
1483 // pthread.h
pthread_cond_wait( cond: *mut crate::pthread_cond_t, mutex: *mut crate::pthread_mutex_t, ) -> c_int1484 pub fn pthread_cond_wait(
1485 cond: *mut crate::pthread_cond_t,
1486 mutex: *mut crate::pthread_mutex_t,
1487 ) -> c_int;
1488
1489 // pthread.h
pthread_rwlockattr_init(attr: *mut crate::pthread_rwlockattr_t) -> c_int1490 pub fn pthread_rwlockattr_init(attr: *mut crate::pthread_rwlockattr_t) -> c_int;
1491
1492 // pthread.h
pthread_rwlockattr_destroy(attr: *mut crate::pthread_rwlockattr_t) -> c_int1493 pub fn pthread_rwlockattr_destroy(attr: *mut crate::pthread_rwlockattr_t) -> c_int;
1494
1495 // pthread.h
pthread_rwlockattr_setmaxreaders( attr: *mut crate::pthread_rwlockattr_t, attr2: c_uint, ) -> c_int1496 pub fn pthread_rwlockattr_setmaxreaders(
1497 attr: *mut crate::pthread_rwlockattr_t,
1498 attr2: c_uint,
1499 ) -> c_int;
1500
1501 // pthread.h
pthread_rwlock_init( attr: *mut crate::pthread_rwlock_t, host: *const crate::pthread_rwlockattr_t, ) -> c_int1502 pub fn pthread_rwlock_init(
1503 attr: *mut crate::pthread_rwlock_t,
1504 host: *const crate::pthread_rwlockattr_t,
1505 ) -> c_int;
1506
1507 // pthread.h
pthread_rwlock_destroy(attr: *mut crate::pthread_rwlock_t) -> c_int1508 pub fn pthread_rwlock_destroy(attr: *mut crate::pthread_rwlock_t) -> c_int;
1509
1510 // pthread.h
pthread_rwlock_rdlock(attr: *mut crate::pthread_rwlock_t) -> c_int1511 pub fn pthread_rwlock_rdlock(attr: *mut crate::pthread_rwlock_t) -> c_int;
1512
1513 // pthread.h
pthread_rwlock_tryrdlock(attr: *mut crate::pthread_rwlock_t) -> c_int1514 pub fn pthread_rwlock_tryrdlock(attr: *mut crate::pthread_rwlock_t) -> c_int;
1515
1516 // pthread.h
pthread_rwlock_timedrdlock( attr: *mut crate::pthread_rwlock_t, host: *const crate::timespec, ) -> c_int1517 pub fn pthread_rwlock_timedrdlock(
1518 attr: *mut crate::pthread_rwlock_t,
1519 host: *const crate::timespec,
1520 ) -> c_int;
1521
1522 // pthread.h
pthread_rwlock_wrlock(attr: *mut crate::pthread_rwlock_t) -> c_int1523 pub fn pthread_rwlock_wrlock(attr: *mut crate::pthread_rwlock_t) -> c_int;
1524
1525 // pthread.h
pthread_rwlock_trywrlock(attr: *mut crate::pthread_rwlock_t) -> c_int1526 pub fn pthread_rwlock_trywrlock(attr: *mut crate::pthread_rwlock_t) -> c_int;
1527
1528 // pthread.h
pthread_rwlock_timedwrlock( attr: *mut crate::pthread_rwlock_t, host: *const crate::timespec, ) -> c_int1529 pub fn pthread_rwlock_timedwrlock(
1530 attr: *mut crate::pthread_rwlock_t,
1531 host: *const crate::timespec,
1532 ) -> c_int;
1533
1534 // pthread.h
pthread_rwlock_unlock(attr: *mut crate::pthread_rwlock_t) -> c_int1535 pub fn pthread_rwlock_unlock(attr: *mut crate::pthread_rwlock_t) -> c_int;
1536
1537 // pthread.h
pthread_key_create( key: *mut crate::pthread_key_t, dtor: Option<unsafe extern "C" fn(*mut c_void)>, ) -> c_int1538 pub fn pthread_key_create(
1539 key: *mut crate::pthread_key_t,
1540 dtor: Option<unsafe extern "C" fn(*mut c_void)>,
1541 ) -> c_int;
1542
1543 // pthread.h
pthread_key_delete(key: crate::pthread_key_t) -> c_int1544 pub fn pthread_key_delete(key: crate::pthread_key_t) -> c_int;
1545
1546 // pthread.h
pthread_setspecific(key: crate::pthread_key_t, value: *const c_void) -> c_int1547 pub fn pthread_setspecific(key: crate::pthread_key_t, value: *const c_void) -> c_int;
1548
1549 // pthread.h
pthread_getspecific(key: crate::pthread_key_t) -> *mut c_void1550 pub fn pthread_getspecific(key: crate::pthread_key_t) -> *mut c_void;
1551
1552 // pthread.h
pthread_cond_timedwait( cond: *mut crate::pthread_cond_t, mutex: *mut crate::pthread_mutex_t, abstime: *const crate::timespec, ) -> c_int1553 pub fn pthread_cond_timedwait(
1554 cond: *mut crate::pthread_cond_t,
1555 mutex: *mut crate::pthread_mutex_t,
1556 abstime: *const crate::timespec,
1557 ) -> c_int;
1558
1559 // pthread.h
pthread_attr_getname(attr: *mut crate::pthread_attr_t, name: *mut *mut c_char) -> c_int1560 pub fn pthread_attr_getname(attr: *mut crate::pthread_attr_t, name: *mut *mut c_char) -> c_int;
1561
1562 // pthread.h
pthread_join(thread: crate::pthread_t, status: *mut *mut c_void) -> c_int1563 pub fn pthread_join(thread: crate::pthread_t, status: *mut *mut c_void) -> c_int;
1564
1565 // pthread.h
pthread_self() -> crate::pthread_t1566 pub fn pthread_self() -> crate::pthread_t;
1567
1568 // clockLib.h
clock_gettime(clock_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int1569 pub fn clock_gettime(clock_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1570
1571 // clockLib.h
clock_settime(clock_id: crate::clockid_t, tp: *const crate::timespec) -> c_int1572 pub fn clock_settime(clock_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
1573
1574 // clockLib.h
clock_getres(clock_id: crate::clockid_t, res: *mut crate::timespec) -> c_int1575 pub fn clock_getres(clock_id: crate::clockid_t, res: *mut crate::timespec) -> c_int;
1576
1577 // clockLib.h
clock_nanosleep( clock_id: crate::clockid_t, flags: c_int, rqtp: *const crate::timespec, rmtp: *mut crate::timespec, ) -> c_int1578 pub fn clock_nanosleep(
1579 clock_id: crate::clockid_t,
1580 flags: c_int,
1581 rqtp: *const crate::timespec,
1582 rmtp: *mut crate::timespec,
1583 ) -> c_int;
1584
1585 // timerLib.h
nanosleep(rqtp: *const crate::timespec, rmtp: *mut crate::timespec) -> c_int1586 pub fn nanosleep(rqtp: *const crate::timespec, rmtp: *mut crate::timespec) -> c_int;
1587
1588 // socket.h
accept(s: c_int, addr: *mut crate::sockaddr, addrlen: *mut crate::socklen_t) -> c_int1589 pub fn accept(s: c_int, addr: *mut crate::sockaddr, addrlen: *mut crate::socklen_t) -> c_int;
1590
1591 // socket.h
bind(fd: c_int, addr: *const sockaddr, len: socklen_t) -> c_int1592 pub fn bind(fd: c_int, addr: *const sockaddr, len: socklen_t) -> c_int;
1593
1594 // socket.h
connect(s: c_int, name: *const crate::sockaddr, namelen: crate::socklen_t) -> c_int1595 pub fn connect(s: c_int, name: *const crate::sockaddr, namelen: crate::socklen_t) -> c_int;
1596
1597 // socket.h
getpeername( s: c_int, name: *mut crate::sockaddr, namelen: *mut crate::socklen_t, ) -> c_int1598 pub fn getpeername(
1599 s: c_int,
1600 name: *mut crate::sockaddr,
1601 namelen: *mut crate::socklen_t,
1602 ) -> c_int;
1603
1604 // socket.h
getsockname(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> c_int1605 pub fn getsockname(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t)
1606 -> c_int;
1607
1608 // socket.h
getsockopt( sockfd: c_int, level: c_int, optname: c_int, optval: *mut c_void, optlen: *mut crate::socklen_t, ) -> c_int1609 pub fn getsockopt(
1610 sockfd: c_int,
1611 level: c_int,
1612 optname: c_int,
1613 optval: *mut c_void,
1614 optlen: *mut crate::socklen_t,
1615 ) -> c_int;
1616
1617 // socket.h
listen(socket: c_int, backlog: c_int) -> c_int1618 pub fn listen(socket: c_int, backlog: c_int) -> c_int;
1619
1620 // socket.h
recv(s: c_int, buf: *mut c_void, bufLen: size_t, flags: c_int) -> ssize_t1621 pub fn recv(s: c_int, buf: *mut c_void, bufLen: size_t, flags: c_int) -> ssize_t;
1622
1623 // socket.h
recvfrom( s: c_int, buf: *mut c_void, bufLen: size_t, flags: c_int, from: *mut crate::sockaddr, pFromLen: *mut crate::socklen_t, ) -> ssize_t1624 pub fn recvfrom(
1625 s: c_int,
1626 buf: *mut c_void,
1627 bufLen: size_t,
1628 flags: c_int,
1629 from: *mut crate::sockaddr,
1630 pFromLen: *mut crate::socklen_t,
1631 ) -> ssize_t;
1632
recvmsg(socket: c_int, mp: *mut crate::msghdr, flags: c_int) -> ssize_t1633 pub fn recvmsg(socket: c_int, mp: *mut crate::msghdr, flags: c_int) -> ssize_t;
1634
1635 // socket.h
send(socket: c_int, buf: *const c_void, len: size_t, flags: c_int) -> ssize_t1636 pub fn send(socket: c_int, buf: *const c_void, len: size_t, flags: c_int) -> ssize_t;
1637
sendmsg(socket: c_int, mp: *const crate::msghdr, flags: c_int) -> ssize_t1638 pub fn sendmsg(socket: c_int, mp: *const crate::msghdr, flags: c_int) -> ssize_t;
1639
1640 // socket.h
sendto( socket: c_int, buf: *const c_void, len: size_t, flags: c_int, addr: *const sockaddr, addrlen: socklen_t, ) -> ssize_t1641 pub fn sendto(
1642 socket: c_int,
1643 buf: *const c_void,
1644 len: size_t,
1645 flags: c_int,
1646 addr: *const sockaddr,
1647 addrlen: socklen_t,
1648 ) -> ssize_t;
1649
1650 // socket.h
setsockopt( socket: c_int, level: c_int, name: c_int, value: *const c_void, option_len: socklen_t, ) -> c_int1651 pub fn setsockopt(
1652 socket: c_int,
1653 level: c_int,
1654 name: c_int,
1655 value: *const c_void,
1656 option_len: socklen_t,
1657 ) -> c_int;
1658
1659 // socket.h
shutdown(s: c_int, how: c_int) -> c_int1660 pub fn shutdown(s: c_int, how: c_int) -> c_int;
1661
1662 // socket.h
socket(domain: c_int, _type: c_int, protocol: c_int) -> c_int1663 pub fn socket(domain: c_int, _type: c_int, protocol: c_int) -> c_int;
1664
1665 // icotl.h
ioctl(fd: c_int, request: c_int, ...) -> c_int1666 pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int;
1667
1668 // fcntl.h
fcntl(fd: c_int, cmd: c_int, ...) -> c_int1669 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
1670
1671 // ntp_rfc2553.h for kernel
1672 // netdb.h for user
gai_strerror(errcode: c_int) -> *mut c_char1673 pub fn gai_strerror(errcode: c_int) -> *mut c_char;
1674
1675 // ioLib.h or
1676 // unistd.h
close(fd: c_int) -> c_int1677 pub fn close(fd: c_int) -> c_int;
1678
1679 // ioLib.h or
1680 // unistd.h
read(fd: c_int, buf: *mut c_void, count: size_t) -> ssize_t1681 pub fn read(fd: c_int, buf: *mut c_void, count: size_t) -> ssize_t;
1682
1683 // ioLib.h or
1684 // unistd.h
write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t1685 pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t;
1686
1687 // ioLib.h or
1688 // unistd.h
isatty(fd: c_int) -> c_int1689 pub fn isatty(fd: c_int) -> c_int;
1690
1691 // ioLib.h or
1692 // unistd.h
dup(src: c_int) -> c_int1693 pub fn dup(src: c_int) -> c_int;
1694
1695 // ioLib.h or
1696 // unistd.h
dup2(src: c_int, dst: c_int) -> c_int1697 pub fn dup2(src: c_int, dst: c_int) -> c_int;
1698
1699 // ioLib.h or
1700 // unistd.h
pipe(fds: *mut c_int) -> c_int1701 pub fn pipe(fds: *mut c_int) -> c_int;
1702
1703 // ioLib.h or
1704 // unistd.h
unlink(pathname: *const c_char) -> c_int1705 pub fn unlink(pathname: *const c_char) -> c_int;
1706
1707 // unistd.h and
1708 // ioLib.h
lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t1709 pub fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
1710
1711 // netdb.h
getaddrinfo( node: *const c_char, service: *const c_char, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> c_int1712 pub fn getaddrinfo(
1713 node: *const c_char,
1714 service: *const c_char,
1715 hints: *const addrinfo,
1716 res: *mut *mut addrinfo,
1717 ) -> c_int;
1718
1719 // netdb.h
freeaddrinfo(res: *mut addrinfo)1720 pub fn freeaddrinfo(res: *mut addrinfo);
1721
1722 // signal.h
signal(signum: c_int, handler: sighandler_t) -> sighandler_t1723 pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t;
1724
1725 // unistd.h
getpid() -> pid_t1726 pub fn getpid() -> pid_t;
1727
1728 // unistd.h
getppid() -> pid_t1729 pub fn getppid() -> pid_t;
1730
1731 // wait.h
waitpid(pid: pid_t, status: *mut c_int, options: c_int) -> pid_t1732 pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) -> pid_t;
1733
1734 // unistd.h
sysconf(attr: c_int) -> c_long1735 pub fn sysconf(attr: c_int) -> c_long;
1736
1737 // stdlib.h
setenv( envVarName: *const c_char, envVarValue: *const c_char, overwrite: c_int, ) -> c_int1738 pub fn setenv(
1739 // setenv.c
1740 envVarName: *const c_char,
1741 envVarValue: *const c_char,
1742 overwrite: c_int,
1743 ) -> c_int;
1744
1745 // stdlib.h
unsetenv( envVarName: *const c_char, ) -> c_int1746 pub fn unsetenv(
1747 // setenv.c
1748 envVarName: *const c_char,
1749 ) -> c_int;
1750
1751 // stdlib.h
realpath(fileName: *const c_char, resolvedName: *mut c_char) -> *mut c_char1752 pub fn realpath(fileName: *const c_char, resolvedName: *mut c_char) -> *mut c_char;
1753
1754 // unistd.h
link(src: *const c_char, dst: *const c_char) -> c_int1755 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
1756
1757 // unistd.h
readlink(path: *const c_char, buf: *mut c_char, bufsize: size_t) -> ssize_t1758 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsize: size_t) -> ssize_t;
1759
1760 // unistd.h
symlink(path1: *const c_char, path2: *const c_char) -> c_int1761 pub fn symlink(path1: *const c_char, path2: *const c_char) -> c_int;
1762
1763 // dirent.h
opendir(name: *const c_char) -> *mut crate::DIR1764 pub fn opendir(name: *const c_char) -> *mut crate::DIR;
1765
1766 // unistd.h
rmdir(path: *const c_char) -> c_int1767 pub fn rmdir(path: *const c_char) -> c_int;
1768
1769 // stat.h
mkdir(dirName: *const c_char, mode: mode_t) -> c_int1770 pub fn mkdir(dirName: *const c_char, mode: mode_t) -> c_int;
1771
1772 // stat.h
chmod(path: *const c_char, mode: mode_t) -> c_int1773 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
1774
1775 // stat.h
fchmod(attr1: c_int, attr2: mode_t) -> c_int1776 pub fn fchmod(attr1: c_int, attr2: mode_t) -> c_int;
1777
1778 // unistd.h
fsync(fd: c_int) -> c_int1779 pub fn fsync(fd: c_int) -> c_int;
1780
1781 // dirent.h
closedir(ptr: *mut crate::DIR) -> c_int1782 pub fn closedir(ptr: *mut crate::DIR) -> c_int;
1783
1784 //sched.h
sched_get_priority_max(policy: c_int) -> c_int1785 pub fn sched_get_priority_max(policy: c_int) -> c_int;
1786
1787 //sched.h
sched_get_priority_min(policy: c_int) -> c_int1788 pub fn sched_get_priority_min(policy: c_int) -> c_int;
1789
1790 //sched.h
sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int1791 pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int;
1792
1793 //sched.h
sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int1794 pub fn sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int;
1795
1796 //sched.h
sched_setscheduler( pid: crate::pid_t, policy: c_int, param: *const crate::sched_param, ) -> c_int1797 pub fn sched_setscheduler(
1798 pid: crate::pid_t,
1799 policy: c_int,
1800 param: *const crate::sched_param,
1801 ) -> c_int;
1802
1803 //sched.h
sched_getscheduler(pid: crate::pid_t) -> c_int1804 pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
1805
1806 //sched.h
sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int1807 pub fn sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int;
1808
1809 // sched.h
sched_yield() -> c_int1810 pub fn sched_yield() -> c_int;
1811
1812 // errnoLib.h
errnoSet(err: c_int) -> c_int1813 pub fn errnoSet(err: c_int) -> c_int;
1814
1815 // errnoLib.h
errnoGet() -> c_int1816 pub fn errnoGet() -> c_int;
1817
1818 // unistd.h
_exit(status: c_int) -> !1819 pub fn _exit(status: c_int) -> !;
1820
1821 // unistd.h
setgid(gid: crate::gid_t) -> c_int1822 pub fn setgid(gid: crate::gid_t) -> c_int;
1823
1824 // unistd.h
getgid() -> crate::gid_t1825 pub fn getgid() -> crate::gid_t;
1826
1827 // unistd.h
setuid(uid: crate::uid_t) -> c_int1828 pub fn setuid(uid: crate::uid_t) -> c_int;
1829
1830 // unistd.h
getuid() -> crate::uid_t1831 pub fn getuid() -> crate::uid_t;
1832
1833 // signal.h
sigemptyset(__set: *mut sigset_t) -> c_int1834 pub fn sigemptyset(__set: *mut sigset_t) -> c_int;
1835
1836 // pthread.h for kernel
1837 // signal.h for user
pthread_sigmask(__how: c_int, __set: *const sigset_t, __oset: *mut sigset_t) -> c_int1838 pub fn pthread_sigmask(__how: c_int, __set: *const sigset_t, __oset: *mut sigset_t) -> c_int;
1839
1840 // signal.h for user
kill(__pid: pid_t, __signo: c_int) -> c_int1841 pub fn kill(__pid: pid_t, __signo: c_int) -> c_int;
1842
1843 // signal.h for user
sigqueue(__pid: pid_t, __signo: c_int, __value: crate::sigval) -> c_int1844 pub fn sigqueue(__pid: pid_t, __signo: c_int, __value: crate::sigval) -> c_int;
1845
1846 // signal.h for user
_sigqueue( rtpId: crate::RTP_ID, signo: c_int, pValue: *const crate::sigval, sigCode: c_int, ) -> c_int1847 pub fn _sigqueue(
1848 rtpId: crate::RTP_ID,
1849 signo: c_int,
1850 pValue: *const crate::sigval,
1851 sigCode: c_int,
1852 ) -> c_int;
1853
1854 // signal.h
taskKill(taskId: crate::TASK_ID, signo: c_int) -> c_int1855 pub fn taskKill(taskId: crate::TASK_ID, signo: c_int) -> c_int;
1856
1857 // signal.h
raise(__signo: c_int) -> c_int1858 pub fn raise(__signo: c_int) -> c_int;
1859
1860 // taskLibCommon.h
taskIdSelf() -> crate::TASK_ID1861 pub fn taskIdSelf() -> crate::TASK_ID;
taskDelay(ticks: crate::_Vx_ticks_t) -> c_int1862 pub fn taskDelay(ticks: crate::_Vx_ticks_t) -> c_int;
1863
1864 // taskLib.h
taskNameSet(task_id: crate::TASK_ID, task_name: *mut c_char) -> c_int1865 pub fn taskNameSet(task_id: crate::TASK_ID, task_name: *mut c_char) -> c_int;
taskNameGet(task_id: crate::TASK_ID, buf_name: *mut c_char, bufsize: size_t) -> c_int1866 pub fn taskNameGet(task_id: crate::TASK_ID, buf_name: *mut c_char, bufsize: size_t) -> c_int;
1867
1868 // rtpLibCommon.h
rtpInfoGet(rtpId: crate::RTP_ID, rtpStruct: *mut crate::RTP_DESC) -> c_int1869 pub fn rtpInfoGet(rtpId: crate::RTP_ID, rtpStruct: *mut crate::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_ID1870 pub fn rtpSpawn(
1871 pubrtpFileName: *const c_char,
1872 argv: *mut *const c_char,
1873 envp: *mut *const c_char,
1874 priority: c_int,
1875 uStackSize: size_t,
1876 options: c_int,
1877 taskOptions: c_int,
1878 ) -> RTP_ID;
1879
1880 // ioLib.h
_realpath(fileName: *const c_char, resolvedName: *mut c_char) -> *mut c_char1881 pub fn _realpath(fileName: *const c_char, resolvedName: *mut c_char) -> *mut c_char;
1882
1883 // pathLib.h
_pathIsAbsolute(filepath: *const c_char, pNameTail: *mut *const c_char) -> BOOL1884 pub fn _pathIsAbsolute(filepath: *const c_char, pNameTail: *mut *const c_char) -> BOOL;
1885
writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t1886 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t1887 pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
1888
1889 // randomNumGen.h
randBytes(buf: *mut c_uchar, length: c_int) -> c_int1890 pub fn randBytes(buf: *mut c_uchar, length: c_int) -> c_int;
randABytes(buf: *mut c_uchar, length: c_int) -> c_int1891 pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int;
randUBytes(buf: *mut c_uchar, length: c_int) -> c_int1892 pub fn randUBytes(buf: *mut c_uchar, length: c_int) -> c_int;
randSecure() -> c_int1893 pub fn randSecure() -> c_int;
1894
1895 // mqueue.h
mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t1896 pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t;
mq_close(mqd: crate::mqd_t) -> c_int1897 pub fn mq_close(mqd: crate::mqd_t) -> c_int;
mq_unlink(name: *const c_char) -> c_int1898 pub fn mq_unlink(name: *const c_char) -> c_int;
mq_receive( mqd: crate::mqd_t, msg_ptr: *mut c_char, msg_len: size_t, msg_prio: *mut c_uint, ) -> ssize_t1899 pub fn mq_receive(
1900 mqd: crate::mqd_t,
1901 msg_ptr: *mut c_char,
1902 msg_len: size_t,
1903 msg_prio: *mut c_uint,
1904 ) -> ssize_t;
mq_timedreceive( mqd: crate::mqd_t, msg_ptr: *mut c_char, msg_len: size_t, msg_prio: *mut c_uint, abs_timeout: *const crate::timespec, ) -> ssize_t1905 pub fn mq_timedreceive(
1906 mqd: crate::mqd_t,
1907 msg_ptr: *mut c_char,
1908 msg_len: size_t,
1909 msg_prio: *mut c_uint,
1910 abs_timeout: *const crate::timespec,
1911 ) -> ssize_t;
mq_send( mqd: crate::mqd_t, msg_ptr: *const c_char, msg_len: size_t, msg_prio: c_uint, ) -> c_int1912 pub fn mq_send(
1913 mqd: crate::mqd_t,
1914 msg_ptr: *const c_char,
1915 msg_len: size_t,
1916 msg_prio: c_uint,
1917 ) -> c_int;
mq_timedsend( mqd: crate::mqd_t, msg_ptr: *const c_char, msg_len: size_t, msg_prio: c_uint, abs_timeout: *const crate::timespec, ) -> c_int1918 pub fn mq_timedsend(
1919 mqd: crate::mqd_t,
1920 msg_ptr: *const c_char,
1921 msg_len: size_t,
1922 msg_prio: c_uint,
1923 abs_timeout: *const crate::timespec,
1924 ) -> c_int;
mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int1925 pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int;
mq_setattr( mqd: crate::mqd_t, newattr: *const crate::mq_attr, oldattr: *mut crate::mq_attr, ) -> c_int1926 pub fn mq_setattr(
1927 mqd: crate::mqd_t,
1928 newattr: *const crate::mq_attr,
1929 oldattr: *mut crate::mq_attr,
1930 ) -> c_int;
1931
1932 // vxCpuLib.h
vxCpuEnabledGet() -> crate::cpuset_t1933 pub fn vxCpuEnabledGet() -> crate::cpuset_t; // Get set of running CPU's in the system
vxCpuConfiguredGet() -> crate::cpuset_t1934 pub fn vxCpuConfiguredGet() -> crate::cpuset_t; // Get set of Configured CPU's in the system
1935 }
1936
1937 //Dummy functions, these don't really exist in VxWorks.
1938
1939 // wait.h macros
1940 safe_f! {
1941 pub {const} fn WIFEXITED(status: c_int) -> bool {
1942 (status & 0xFF00) == 0
1943 }
1944 pub {const} fn WIFSIGNALED(status: c_int) -> bool {
1945 (status & 0xFF00) != 0
1946 }
1947 pub {const} fn WIFSTOPPED(status: c_int) -> bool {
1948 (status & 0xFF0000) != 0
1949 }
1950 pub {const} fn WEXITSTATUS(status: c_int) -> c_int {
1951 status & 0xFF
1952 }
1953 pub {const} fn WTERMSIG(status: c_int) -> c_int {
1954 (status >> 8) & 0xFF
1955 }
1956 pub {const} fn WSTOPSIG(status: c_int) -> c_int {
1957 (status >> 16) & 0xFF
1958 }
1959 }
1960
pread(_fd: c_int, _buf: *mut c_void, _count: size_t, _offset: off64_t) -> ssize_t1961 pub fn pread(_fd: c_int, _buf: *mut c_void, _count: size_t, _offset: off64_t) -> ssize_t {
1962 -1
1963 }
1964
pwrite(_fd: c_int, _buf: *const c_void, _count: size_t, _offset: off64_t) -> ssize_t1965 pub fn pwrite(_fd: c_int, _buf: *const c_void, _count: size_t, _offset: off64_t) -> ssize_t {
1966 -1
1967 }
posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int1968 pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int {
1969 // check to see if align is a power of 2 and if align is a multiple
1970 // of sizeof(void *)
1971 if (align & align - 1 != 0) || (align as usize % size_of::<size_t>() != 0) {
1972 return crate::EINVAL;
1973 }
1974
1975 unsafe {
1976 // posix_memalign should not set errno
1977 let e = crate::errnoGet();
1978
1979 let temp = memalign(align, size);
1980 crate::errnoSet(e as c_int);
1981
1982 if temp.is_null() {
1983 crate::ENOMEM
1984 } else {
1985 *memptr = temp;
1986 0
1987 }
1988 }
1989 }
1990
1991 cfg_if! {
1992 if #[cfg(target_arch = "aarch64")] {
1993 mod aarch64;
1994 pub use self::aarch64::*;
1995 } else if #[cfg(target_arch = "arm")] {
1996 mod arm;
1997 pub use self::arm::*;
1998 } else if #[cfg(target_arch = "x86")] {
1999 mod x86;
2000 pub use self::x86::*;
2001 } else if #[cfg(target_arch = "x86_64")] {
2002 mod x86_64;
2003 pub use self::x86_64::*;
2004 } else if #[cfg(target_arch = "powerpc")] {
2005 mod powerpc;
2006 pub use self::powerpc::*;
2007 } else if #[cfg(target_arch = "powerpc64")] {
2008 mod powerpc64;
2009 pub use self::powerpc64::*;
2010 } else if #[cfg(target_arch = "riscv32")] {
2011 mod riscv32;
2012 pub use self::riscv32::*;
2013 } else if #[cfg(target_arch = "riscv64")] {
2014 mod riscv64;
2015 pub use self::riscv64::*;
2016 } else {
2017 // Unknown target_arch
2018 }
2019 }
2020