1 //! Hacking together the definitions for VxWorks Bindings
2 use core::mem::size_of;
3 use core::ptr::null_mut;
4
5 #[cfg_attr(feature = "extra_traits", derive(Debug))]
6 pub enum DIR {}
7 impl ::Copy for DIR {}
8 impl ::Clone for DIR {
clone(&self) -> DIR9 fn clone(&self) -> DIR {
10 *self
11 }
12 }
13
14 pub type c_schar = i8;
15 pub type c_uchar = u8;
16 pub type c_short = i16;
17 pub type c_ushort = u16;
18 pub type c_int = i32;
19 pub type c_uint = u32;
20 pub type c_float = f32;
21 pub type c_double = f64;
22 pub type c_longlong = i64;
23 pub type c_ulonglong = u64;
24 pub type intmax_t = i64;
25 pub type uintmax_t = u64;
26
27 pub type size_t = usize;
28 pub type ptrdiff_t = isize;
29 pub type intptr_t = isize;
30 pub type uintptr_t = usize;
31 pub type ssize_t = isize;
32
33 pub type pid_t = i32;
34 pub type in_addr_t = u32;
35 pub type in_port_t = u16;
36 pub type sighandler_t = ::size_t;
37 pub type cc_t = ::c_uchar;
38
39 pub type blkcnt_t = ::c_long;
40 pub type blksize_t = ::c_long;
41 pub type ino_t = ::c_ulong;
42 pub type ino32_t = u32;
43 pub type off_t = ::c_longlong;
44
45 pub type rlim_t = ::c_ulonglong;
46 pub type suseconds_t = ::c_long;
47 pub type time_t = ::c_long;
48 pub type wchar_t = ::c_int;
49 pub type errno_t = ::c_int;
50
51 pub type useconds_t = ::c_ulong;
52
53 pub type socklen_t = ::c_int;
54
55 pub type pthread_t = ::c_ulong;
56
57 pub type clockid_t = ::c_int;
58
59 //defined for the structs
60 pub type dev_t = ::c_ulong;
61 pub type mode_t = ::c_int;
62 pub type nlink_t = ::c_ulong;
63 pub type uid_t = ::c_ushort;
64 pub type gid_t = ::c_ushort;
65 pub type sigset_t = ::c_ulonglong;
66 pub type key_t = ::c_long;
67 pub type shmatt_t = ::c_ulong;
68
69 pub type mqd_t = ::c_int;
70
71 pub type nfds_t = ::c_uint;
72 pub type nl_item = ::c_int;
73 pub type stat64 = ::stat;
74
75 pub type pthread_key_t = ::c_ulong;
76
77 // From b_off_t.h
78 pub type off64_t = ::c_longlong;
79 pub type off_t64 = ::c_longlong;
80
81 // From b_BOOL.h
82 pub type BOOL = ::c_int; // excuse me what
83
84 //Straight from vxWind.h ..
85 pub type _Vx_OBJ_HANDLE = ::c_int;
86 pub type _Vx_TASK_ID = ::_Vx_OBJ_HANDLE;
87 pub type _Vx_MSG_Q_ID = ::_Vx_OBJ_HANDLE;
88 pub type _Vx_SEM_ID_KERNEL = ::_Vx_OBJ_HANDLE;
89 pub type _Vx_RTP_ID = ::_Vx_OBJ_HANDLE;
90 pub type _Vx_SD_ID = ::_Vx_OBJ_HANDLE;
91 pub type _Vx_CONDVAR_ID = ::_Vx_OBJ_HANDLE;
92 pub type _Vx_SEM_ID = *mut ::_Vx_semaphore;
93 pub type OBJ_HANDLE = ::_Vx_OBJ_HANDLE;
94 pub type TASK_ID = ::OBJ_HANDLE;
95 pub type MSG_Q_ID = ::OBJ_HANDLE;
96 pub type SEM_ID_KERNEL = ::OBJ_HANDLE;
97 pub type RTP_ID = ::OBJ_HANDLE;
98 pub type SD_ID = ::OBJ_HANDLE;
99 pub type CONDVAR_ID = ::OBJ_HANDLE;
100
101 // From vxTypes.h
102 pub type _Vx_usr_arg_t = ::ssize_t; // c_int for LP32
103 pub type _Vx_exit_code_t = ::ssize_t; // c_int for LP32
104 pub type _Vx_ticks_t = ::c_uint;
105 pub type _Vx_ticks64_t = ::c_ulonglong;
106
107 // From vxTypesBase.h
108 pub type va_list = *mut ::c_char;
109
110 pub type sa_family_t = ::c_uchar;
111
112 // structs that only exist in userspace
113 s! {
114 // b_struct_vx_eventsResourceCb.h
115 pub struct _Vx_EVENTS_RSRC {
116 pub registered : ::c_uint,
117 pub taskId : ::c_int,
118 pub options : ::c_uchar,
119 pub pad : [::c_uchar; 3],
120 }
121
122 // b_struct_vx_semaphore.h
123 pub struct _Vx_semaphore {
124 pub magic : ::c_uint,
125 pub semType: ::c_uint,
126 pub options: ::c_uint,
127 pub recurse: ::c_uint,
128 pub owned_k: ::c_uint, // owned_k is volatile
129 pub semId_k: ::_Vx_SEM_ID_KERNEL,
130 pub state : ::c_uint, //state is union of _Vx_UINT and _Vx_UINT
131 pub events : ::_Vx_EVENTS_RSRC,
132 }
133
134 // b_pthread_condattr_t.h
135 pub struct pthread_condattr_t {
136 pub condAttrStatus: ::c_int,
137 pub condAttrPshared: ::c_int,
138 pub _CondAttrClockId: ::clockid_t,
139 }
140
141 // b_pthread_cond_t.h
142 pub struct pthread_cond_t{
143 pub condSemId: ::_Vx_SEM_ID,
144 pub condValid: ::c_int,
145 pub condInitted: ::c_int,
146 pub condRefCount: ::c_int,
147 pub condMutex: *mut ::pthread_mutex_t,
148 pub condAttr: ::pthread_condattr_t,
149 pub condSemName: [::c_char; PTHREAD_SHARED_SEM_NAME_MAX]
150 }
151
152 // b_pthread_rwlockattr_t.h
153 pub struct pthread_rwlockattr_t {
154 pub rwlockAttrStatus: ::c_int,
155 pub rwlockAttrMaxReaders: ::c_uint,
156 }
157
158 // b_pthread_rwlock_t.h
159 pub struct pthread_rwlock_t {
160 pub rwlockSemId: :: _Vx_SEM_ID,
161 pub rwlockReadersRefCount: ::c_int,
162 pub rwlockValid: ::c_int,
163 pub rwlockInitted: ::c_int,
164 pub rwlockAttr: ::pthread_rwlockattr_t,
165 pub rwlockName: [::c_char; PTHREAD_SHARED_SEM_NAME_MAX]
166 }
167
168 // b_struct_timeval.h
169 pub struct timeval {
170 pub tv_sec: ::time_t,
171 pub tv_usec: ::suseconds_t,
172 }
173
174 // socket.h
175 pub struct sockaddr {
176 pub sa_len : ::c_uchar,
177 pub sa_family : sa_family_t,
178 pub sa_data : [::c_char; 14],
179 }
180
181 // socket.h
182 pub struct sockaddr_storage {
183 pub ss_len : ::c_uchar,
184 pub ss_family : ::sa_family_t,
185 pub __ss_pad1 : [::c_char; _SS_PAD1SIZE],
186 pub __ss_align : i32,
187 // pub __ss_pad2 : [::c_char; _SS_PAD2SIZE],
188 pub __ss_pad2 : [::c_char; 32],
189 pub __ss_pad3 : [::c_char; 32],
190 pub __ss_pad4 : [::c_char; 32],
191 pub __ss_pad5 : [::c_char; 32],
192 }
193 pub struct iovec {
194 pub iov_base: *mut ::c_void,
195 pub iov_len: ::size_t,
196 }
197
198 // poll.h
199 pub struct pollfd {
200 pub fd : ::c_int,
201 pub events : ::c_short,
202 pub revents : ::c_short,
203 }
204
205 // dirent.h
206 pub struct dirent {
207 pub d_ino : ::ino_t,
208 // pub d_name : [::c_char; (_PARM_NAME_MAX + 1)],
209 pub d_name : [::c_char; 32],
210 pub d_name1 : [::c_char; 32],
211 pub d_name2 : [::c_char; 32],
212 pub d_name3 : [::c_char; 32],
213 pub d_name4 : [::c_char; 32],
214 pub d_name5 : [::c_char; 32],
215 pub d_name6 : [::c_char; 32],
216 pub d_name7 : [::c_char; 32],
217 }
218
219 pub struct dirent64 {
220 pub d_ino : ::ino_t,
221 pub d_off : ::off64_t,
222 pub d_reclen : u16,
223 pub d_type : u8,
224 // pub d_name : [::c_char; 256],
225 pub d_name : [::c_char; 32],
226 pub d_name1 : [::c_char; 32],
227 pub d_name2 : [::c_char; 32],
228 pub d_name3 : [::c_char; 32],
229 pub d_name4 : [::c_char; 32],
230 pub d_name5 : [::c_char; 32],
231 pub d_name6 : [::c_char; 32],
232 pub d_name7 : [::c_char; 32],
233 } // Doesn't seem like it exists anymore
234
235 // resource.h
236 pub struct rlimit { /* Is this really needed? Questionable ... */
237 pub rlim_cur : ::size_t,
238 pub rlim_max : ::size_t,
239 }
240
241 // stat.h
242 pub struct stat {
243 pub st_dev : ::dev_t,
244 pub st_ino : ::ino_t,
245 pub st_mode : ::mode_t,
246 pub st_nlink : ::nlink_t,
247 pub st_uid : ::uid_t,
248 pub st_gid : ::gid_t,
249 pub st_rdev : ::dev_t,
250 pub st_size : ::off64_t,
251 pub st_atime : ::time_t,
252 pub st_mtime : ::time_t,
253 pub st_ctime : ::time_t,
254 pub st_blksize : ::blksize_t,
255 pub st_blocks : ::blkcnt_t,
256 pub st_attrib : ::c_uchar,
257 pub st_reserved1 : ::c_int,
258 pub st_reserved2 : ::c_int,
259 pub st_reserved3 : ::c_int,
260 pub st_reserved4 : ::c_int,
261 }
262
263 //b_struct__Timespec.h
264 pub struct _Timespec {
265 pub tv_sec : ::time_t,
266 pub tv_nsec : ::c_long,
267 }
268
269 // b_struct__Sched_param.h
270 pub struct _Sched_param {
271 pub sched_priority: ::c_int, /* scheduling priority */
272 pub sched_ss_low_priority: ::c_int, /* low scheduling priority */
273 pub sched_ss_repl_period: ::_Timespec, /* replenishment period */
274 pub sched_ss_init_budget: ::_Timespec, /* initial budget */
275 pub sched_ss_max_repl: ::c_int, /* max pending replenishment */
276
277 }
278
279 // b_pthread_attr_t.h
280 pub struct pthread_attr_t {
281 pub threadAttrStatus : ::c_int,
282 pub threadAttrStacksize : ::size_t,
283 pub threadAttrStackaddr : *mut ::c_void,
284 pub threadAttrGuardsize : ::size_t,
285 pub threadAttrDetachstate : ::c_int,
286 pub threadAttrContentionscope : ::c_int,
287 pub threadAttrInheritsched : ::c_int,
288 pub threadAttrSchedpolicy : ::c_int,
289 pub threadAttrName : *mut ::c_char,
290 pub threadAttrOptions : ::c_int,
291 pub threadAttrSchedparam : ::_Sched_param,
292 }
293
294 // signal.h
295 pub struct sigaction { // pulled from kernel side,
296 pub sa_u : ::size_t,
297 // This is a union of two function pointers.
298 // Under the assumption that function pointers are the same
299 // size as other pointers, we can replace the union with size_t
300 pub sa_mask : ::sigset_t,
301 pub sa_flags : ::c_int,
302 }
303
304 // b_stack_t.h
305 pub struct stack_t {
306 pub ss_sp : *mut ::c_void,
307 pub ss_size : ::size_t,
308 pub ss_flags : ::c_int,
309 }
310
311 // signal.h
312 pub struct siginfo_t {
313 pub si_signo : ::c_int,
314 pub si_code : ::c_int,
315 // This field is a union of int and void * in vxworks
316 // The size has been set to the larger of the two
317 pub si_value : ::size_t,
318 }
319
320 pub struct ipc_perm {
321 pub __key : key_t,
322 pub uid : uid_t,
323 pub gid : gid_t,
324 pub cuid : uid_t,
325 pub cgid : gid_t,
326 pub mode : ::c_ushort,
327 pub __seq : ::c_ushort,
328 }
329
330 pub struct shmid_ds {
331 pub shm_perm : ipc_perm,
332 pub shm_segsz : ::c_int,
333 }
334
335 // pthread.h (krnl)
336 // b_pthread_mutexattr_t.h (usr)
337 pub struct pthread_mutexattr_t {
338 mutexAttrStatus : ::c_int,
339 mutexAttrPshared : ::c_int,
340 mutexAttrProtocol : ::c_int,
341 mutexAttrPrioceiling : ::c_int,
342 mutexAttrType : ::c_int,
343 }
344
345 // pthread.h (krnl)
346 // b_pthread_mutex_t.h (usr)
347 pub struct pthread_mutex_t {
348 pub mutexSemId: ::_Vx_SEM_ID, /*_Vx_SEM_ID ..*/
349 pub mutexValid: ::c_int,
350 pub mutexInitted: ::c_int,
351 pub mutexCondRefCount: ::c_int,
352 pub mutexSavPriority: ::c_int,
353 pub mutexAttr: ::pthread_mutexattr_t,
354 pub mutexSemName: [::c_char; PTHREAD_SHARED_SEM_NAME_MAX],
355 }
356
357 // b_struct_timespec.h
358 pub struct timespec {
359 pub tv_sec: ::time_t,
360 pub tv_nsec: ::c_long,
361 }
362
363 // in.h
364 pub struct in_addr {
365 pub s_addr: in_addr_t,
366 }
367
368 // in.h
369 pub struct ip_mreq {
370 pub imr_multiaddr: in_addr,
371 pub imr_interface: in_addr,
372 }
373
374 // in6.h
375 pub struct in6_addr {
376 pub s6_addr: [u8; 16],
377 }
378
379 // in6.h
380 pub struct ipv6_mreq {
381 pub ipv6mr_multiaddr: in6_addr,
382 pub ipv6mr_interface: ::c_uint,
383 }
384
385 // netdb.h
386 pub struct addrinfo {
387 pub ai_flags : ::c_int,
388 pub ai_family : ::c_int,
389 pub ai_socktype : ::c_int,
390 pub ai_protocol : ::c_int,
391 pub ai_addrlen : ::size_t,
392 pub ai_canonname: *mut ::c_char,
393 pub ai_addr : *mut ::sockaddr,
394 pub ai_next : *mut ::addrinfo,
395 }
396
397 // in.h
398 pub struct sockaddr_in {
399 pub sin_len : u8,
400 pub sin_family: u8,
401 pub sin_port : u16,
402 pub sin_addr : ::in_addr,
403 pub sin_zero : [::c_char; 8],
404 }
405
406 // in6.h
407 // There is a different implementation in ipv6.h in
408 // krnl directory, but this seems to only happen
409 // when the VSB is built for ipv6 only.
410 pub struct sockaddr_in6 {
411 pub sin6_len : u8,
412 pub sin6_family : u8,
413 pub sin6_port : u16,
414 pub sin6_flowinfo: u32,
415 pub sin6_addr : ::in6_addr,
416 pub sin6_scope_id: u32,
417 }
418
419 pub struct sockaddr_un {
420 pub sun_family: sa_family_t,
421 //pub sun_path: [::c_char; 108]
422 pub sun_path: [::c_char; 32],
423 pub sun_path1: [::c_char; 32],
424 pub sun_path2: [::c_char; 32],
425 pub sun_path3: [::c_char; 12],
426 }
427
428 pub struct passwd {
429 pub pw_name: *mut ::c_char,
430 pub pw_uid: ::uid_t,
431 pub pw_gid: ::gid_t,
432 pub pw_dir: *mut ::c_char,
433 pub pw_shell: *mut ::c_char,
434 }
435
436 // rtpLibCommon.h
437 pub struct RTP_DESC {
438 pub status : ::c_int,
439 pub options : u32,
440 pub entrAddr : *mut ::c_void,
441 pub initTaskId: ::TASK_ID,
442 pub parentId : ::RTP_ID,
443 //pub pathName : [::c_char; (VX_RTP_NAME_LENGTH + 1)],
444 pub pathName : [::c_char; 32],
445 pub pathName1 : [::c_char; 32],
446 pub pathName2 : [::c_char; 32],
447 pub pathName3 : [::c_char; 32],
448 pub pathName4 : [::c_char; 32],
449 pub pathName5 : [::c_char; 32],
450 pub pathName6 : [::c_char; 32],
451 pub pathName7 : [::c_char; 32],
452 pub taskCnt : u32,
453 pub textStart : *mut ::c_void,
454 pub textEnd : *mut ::c_void,
455 }
456
457 pub struct Dl_info {
458 pub dli_fname: *const ::c_char,
459 pub dli_fbase: *mut ::c_void,
460 pub dli_sname: *const ::c_char,
461 pub dli_saddr: *mut ::c_void,
462 }
463 }
464
465 pub const STDIN_FILENO: ::c_int = 0;
466 pub const STDOUT_FILENO: ::c_int = 1;
467 pub const STDERR_FILENO: ::c_int = 2;
468
469 pub const EXIT_SUCCESS: ::c_int = 0;
470 pub const EXIT_FAILURE: ::c_int = 1;
471
472 pub const EAI_SERVICE: ::c_int = 9;
473 pub const EAI_SOCKTYPE: ::c_int = 10;
474 pub const EAI_SYSTEM: ::c_int = 11;
475
476 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
477
478 //Clock Lib Stuff
479 pub const CLOCK_REALTIME: ::c_int = 0x0;
480 pub const CLOCK_MONOTONIC: ::c_int = 0x1;
481 pub const CLOCK_PROCESS_CPUTIME_ID: ::c_int = 0x2;
482 pub const CLOCK_THREAD_CPUTIME_ID: ::c_int = 0x3;
483 pub const TIMER_ABSTIME: ::c_int = 0x1;
484 pub const TIME_RELTIME: ::c_int = 0xFFFFFFFE;
485
486 // PTHREAD STUFF
487 pub const PTHREAD_INITIALIZED_OBJ: ::c_int = 0xF70990EF;
488 pub const PTHREAD_DESTROYED_OBJ: ::c_int = -1;
489 pub const PTHREAD_VALID_OBJ: ::c_int = 0xEC542A37;
490 pub const PTHREAD_INVALID_OBJ: ::c_int = -1;
491 pub const PTHREAD_UNUSED_YET_OBJ: ::c_int = -1;
492
493 pub const PTHREAD_PRIO_NONE: ::c_int = 0;
494 pub const PTHREAD_PRIO_INHERIT: ::c_int = 1;
495 pub const PTHREAD_PRIO_PROTECT: ::c_int = 2;
496
497 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
498 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
499 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
500 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
501 pub const PTHREAD_STACK_MIN: usize = 4096;
502 pub const PTHREAD_SHARED_SEM_NAME_MAX: usize = 30;
503
504 pub const EFAULT: ::c_int = 14;
505 pub const EBUSY: ::c_int = 16;
506 pub const EEXIST: ::c_int = 17;
507 pub const ENODEV: ::c_int = 19;
508 pub const EINVAL: ::c_int = 22;
509 pub const EPIPE: ::c_int = 32;
510 pub const ERANGE: ::c_int = 34;
511
512 // ERRNO STUFF
513 pub const EPERM: ::c_int = 1; /* Not owner */
514 pub const ENOENT: ::c_int = 2; /* No such file or directory */
515 pub const ESRCH: ::c_int = 3; /* No such process */
516 pub const EINTR: ::c_int = 4; /* Interrupted system call */
517 pub const EIOA: ::c_int = 5; /* I/O error */
518 pub const ENXIO: ::c_int = 6; /* No such device or address */
519 pub const E2BIG: ::c_int = 7; /* Arg list too long */
520 pub const ENOEXEC: ::c_int = 8; /* Exec format error */
521 pub const EBADF: ::c_int = 9; /* Bad file number */
522 pub const CHILD: ::c_int = 10; /* No children */
523 pub const EAGAIN: ::c_int = 11; /* No more processes */
524 pub const ENOMEM: ::c_int = 12; /* Not enough core */
525 pub const EACCES: ::c_int = 13; /* Permission denied */
526 pub const EDEADLK: ::c_int = 33;
527 pub const EINPROGRESS: ::c_int = 68;
528 pub const EALREADY: ::c_int = 69;
529 pub const EWOULDBLOCK: ::c_int = 70;
530 pub const ENOSYS: ::c_int = 71;
531 pub const EDESTADDRREQ: ::c_int = 40;
532 pub const EPROTOTYPE: ::c_int = 41;
533 pub const ENOPROTOOPT: ::c_int = 42;
534 pub const EPROTONOSUPPORT: ::c_int = 43;
535 pub const ESOCKTNOSUPPORT: ::c_int = 44;
536 pub const EOPNOTSUPP: ::c_int = 45;
537 pub const EPFNOSUPPORT: ::c_int = 46;
538 pub const EAFNOSUPPORT: ::c_int = 47;
539 pub const EADDRINUSE: ::c_int = 48;
540 pub const EADDRNOTAVAIL: ::c_int = 49;
541 pub const ENOTSOCK: ::c_int = 50;
542 pub const ENETUNREACH: ::c_int = 51;
543 pub const ENETRESET: ::c_int = 52;
544 pub const ECONNABORTED: ::c_int = 53;
545 pub const ECONNRESET: ::c_int = 54;
546 pub const ENOBUFS: ::c_int = 55;
547 pub const EISCONN: ::c_int = 56;
548 pub const ENOTCONN: ::c_int = 57;
549 pub const ESHUTDOWN: ::c_int = 58;
550 pub const ETOOMANYREFS: ::c_int = 59;
551 pub const ETIMEDOUT: ::c_int = 60;
552 pub const ECONNREFUSED: ::c_int = 61;
553
554 // NFS errnos: Refer to pkgs_v2/storage/fs/nfs/h/nfs/nfsCommon.h
555 const M_nfsStat: ::c_int = 48 << 16;
556 enum nfsstat {
557 NFS_OK = 0,
558 NFSERR_PERM = 1,
559 NFSERR_NOENT = 2,
560 NFSERR_IO = 5,
561 NFSERR_NXIO = 6,
562 NFSERR_ACCESS = 13,
563 NFSERR_EXIST = 17,
564 NFSERR_XDEV = 18,
565 NFSERR_NODEV = 19,
566 NFSERR_NOTDIR = 20,
567 NFSERR_ISDIR = 21,
568 NFSERR_INVAL = 22,
569 NFSERR_FBIG = 27,
570 NFSERR_NOSPC = 28,
571 NFSERR_ROFS = 30,
572 NFSERR_MLINK = 31,
573 NFSERR_NAMETOOLONG = 63,
574 NFSERR_NOTEMPTY = 66,
575 NFSERR_DQUOT = 69,
576 NFSERR_STALE = 70,
577 NFSERR_REMOTE = 71,
578 NFSERR_WFLUSH = 99,
579 NFSERR_BADHANDLE = 10001,
580 NFSERR_NOT_SYNC = 10002,
581 NFSERR_BAD_COOKIE = 10003,
582 NFSERR_NOTSUPP = 10004,
583 NFSERR_TOOSMALL = 10005,
584 NFSERR_SERVERFAULT = 10006,
585 NFSERR_BADTYPE = 10007,
586 NFSERR_JUKEBOX = 10008,
587 }
588
589 pub const S_nfsLib_NFS_OK: ::c_int = M_nfsStat | nfsstat::NFS_OK as ::c_int;
590 pub const S_nfsLib_NFSERR_PERM: ::c_int =
591 M_nfsStat | nfsstat::NFSERR_PERM as ::c_int;
592 pub const S_nfsLib_NFSERR_NOENT: ::c_int =
593 M_nfsStat | nfsstat::NFSERR_NOENT as ::c_int;
594 pub const S_nfsLib_NFSERR_IO: ::c_int =
595 M_nfsStat | nfsstat::NFSERR_IO as ::c_int;
596 pub const S_nfsLib_NFSERR_NXIO: ::c_int =
597 M_nfsStat | nfsstat::NFSERR_NXIO as ::c_int;
598 pub const S_nfsLib_NFSERR_ACCESS: ::c_int =
599 M_nfsStat | nfsstat::NFSERR_ACCESS as ::c_int;
600 pub const S_nfsLib_NFSERR_EXIST: ::c_int =
601 M_nfsStat | nfsstat::NFSERR_EXIST as ::c_int;
602 pub const S_nfsLib_NFSERR_XDEV: ::c_int =
603 M_nfsStat | nfsstat::NFSERR_XDEV as ::c_int;
604 pub const S_nfsLib_NFSERR_NODEV: ::c_int =
605 M_nfsStat | nfsstat::NFSERR_NODEV as ::c_int;
606 pub const S_nfsLib_NFSERR_NOTDIR: ::c_int =
607 M_nfsStat | nfsstat::NFSERR_NOTDIR as ::c_int;
608 pub const S_nfsLib_NFSERR_ISDIR: ::c_int =
609 M_nfsStat | nfsstat::NFSERR_ISDIR as ::c_int;
610 pub const S_nfsLib_NFSERR_INVAL: ::c_int =
611 M_nfsStat | nfsstat::NFSERR_INVAL as ::c_int;
612 pub const S_nfsLib_NFSERR_FBIG: ::c_int =
613 M_nfsStat | nfsstat::NFSERR_FBIG as ::c_int;
614 pub const S_nfsLib_NFSERR_NOSPC: ::c_int =
615 M_nfsStat | nfsstat::NFSERR_NOSPC as ::c_int;
616 pub const S_nfsLib_NFSERR_ROFS: ::c_int =
617 M_nfsStat | nfsstat::NFSERR_ROFS as ::c_int;
618 pub const S_nfsLib_NFSERR_MLINK: ::c_int =
619 M_nfsStat | nfsstat::NFSERR_MLINK as ::c_int;
620 pub const S_nfsLib_NFSERR_NAMETOOLONG: ::c_int =
621 M_nfsStat | nfsstat::NFSERR_NAMETOOLONG as ::c_int;
622 pub const S_nfsLib_NFSERR_NOTEMPTY: ::c_int =
623 M_nfsStat | nfsstat::NFSERR_NOTEMPTY as ::c_int;
624 pub const S_nfsLib_NFSERR_DQUOT: ::c_int =
625 M_nfsStat | nfsstat::NFSERR_DQUOT as ::c_int;
626 pub const S_nfsLib_NFSERR_STALE: ::c_int =
627 M_nfsStat | nfsstat::NFSERR_STALE as ::c_int;
628 pub const S_nfsLib_NFSERR_WFLUSH: ::c_int =
629 M_nfsStat | nfsstat::NFSERR_WFLUSH as ::c_int;
630 pub const S_nfsLib_NFSERR_REMOTE: ::c_int =
631 M_nfsStat | nfsstat::NFSERR_REMOTE as ::c_int;
632 pub const S_nfsLib_NFSERR_BADHANDLE: ::c_int =
633 M_nfsStat | nfsstat::NFSERR_BADHANDLE as ::c_int;
634 pub const S_nfsLib_NFSERR_NOT_SYNC: ::c_int =
635 M_nfsStat | nfsstat::NFSERR_NOT_SYNC as ::c_int;
636 pub const S_nfsLib_NFSERR_BAD_COOKIE: ::c_int =
637 M_nfsStat | nfsstat::NFSERR_BAD_COOKIE as ::c_int;
638 pub const S_nfsLib_NFSERR_NOTSUPP: ::c_int =
639 M_nfsStat | nfsstat::NFSERR_NOTSUPP as ::c_int;
640 pub const S_nfsLib_NFSERR_TOOSMALL: ::c_int =
641 M_nfsStat | nfsstat::NFSERR_TOOSMALL as ::c_int;
642 pub const S_nfsLib_NFSERR_SERVERFAULT: ::c_int =
643 M_nfsStat | nfsstat::NFSERR_SERVERFAULT as ::c_int;
644 pub const S_nfsLib_NFSERR_BADTYPE: ::c_int =
645 M_nfsStat | nfsstat::NFSERR_BADTYPE as ::c_int;
646 pub const S_nfsLib_NFSERR_JUKEBOX: ::c_int =
647 M_nfsStat | nfsstat::NFSERR_JUKEBOX as ::c_int;
648
649 // IP Stuff? These are allll guesswork
650 pub const IPPROTO_IP: ::c_int = 0;
651 pub const IP_TTL: ::c_int = 4; // not sure if this is right
652 pub const IP_ADD_MEMBERSHIP: ::c_int = 11;
653 pub const IP_DROP_MEMBERSHIP: ::c_int = 12;
654 pub const IPV6_V6ONLY: ::c_int = 26;
655 pub const IP_MULTICAST_TTL: ::c_int = 33;
656 pub const IP_MULTICAST_LOOP: ::c_int = 34;
657 pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
658 pub const IPPROTO_IPV6: ::c_int = 41; // or this one, for that matter
659
660 // STAT Stuff
661 pub const S_IFMT: ::c_int = 0xf000;
662 pub const S_IFIFO: ::c_int = 0x1000;
663 pub const S_IFCHR: ::c_int = 0x2000;
664 pub const S_IFDIR: ::c_int = 0x4000;
665 pub const S_IFBLK: ::c_int = 0x6000;
666 pub const S_IFREG: ::c_int = 0x8000;
667 pub const S_IFLNK: ::c_int = 0xa000;
668 pub const S_IFSHM: ::c_int = 0xb000;
669 pub const S_IFDEVMEM: ::c_int = 0xd000;
670 pub const S_IFSOCK: ::c_int = 0xc000;
671 pub const S_ISUID: ::c_int = 0x0800;
672 pub const S_ISGID: ::c_int = 0x0400;
673 pub const S_ISTXT: ::c_int = 0x0200;
674 pub const S_IRUSR: ::c_int = 0x0100;
675 pub const S_IWUSR: ::c_int = 0x0080;
676 pub const S_IXUSR: ::c_int = 0x0040;
677 pub const S_IRWXU: ::c_int = 0x01c0;
678 pub const S_IRGRP: ::c_int = 0x0020;
679 pub const S_IWGRP: ::c_int = 0x0010;
680 pub const S_IXGRP: ::c_int = 0x0008;
681 pub const S_IRWXG: ::c_int = 0x0038;
682 pub const S_IROTH: ::c_int = 0x0004;
683 pub const S_IWOTH: ::c_int = 0x0002;
684 pub const S_IXOTH: ::c_int = 0x0001;
685 pub const S_IRWXO: ::c_int = 0x0007;
686
687 pub const SOL_SOCKET: ::c_int = 0xffff;
688 pub const SO_BROADCAST: ::c_int = 0x001e;
689 pub const SO_SNDTIMEO: ::c_int = 0x1005;
690 pub const SO_RCVTIMEO: ::c_int = 0x1006;
691 pub const SOCK_STREAM: ::c_int = 1;
692 pub const SOCK_DGRAM: ::c_int = 2;
693 pub const SOCK_RAW: ::c_int = 3;
694 pub const SOCK_RDM: ::c_int = 4;
695 pub const SOCK_SEQPACKET: ::c_int = 5;
696 pub const SOCK_PACKET: ::c_int = 10;
697 pub const SO_DEBUG: ::c_int = 0x0001;
698 pub const SO_REUSEADDR: ::c_int = 0x0004;
699 pub const SO_KEEPALIVE: ::c_int = 0x0008;
700 pub const SO_DONTROUTE: ::c_int = 0x0010;
701 pub const SO_RCVLOWAT: ::c_int = 0x0012;
702
703 pub const _SS_MAXSIZE: usize = 128;
704 pub const _SS_ALIGNSIZE: usize = size_of::<u32>();
705 pub const _SS_PAD1SIZE: usize =
706 (_SS_ALIGNSIZE - size_of::<::c_uchar>() - size_of::<::sa_family_t>());
707 pub const _SS_PAD2SIZE: usize = (_SS_MAXSIZE
708 - size_of::<::c_uchar>()
709 - size_of::<::sa_family_t>()
710 - _SS_PAD1SIZE
711 - _SS_ALIGNSIZE);
712
713 pub const MSG_OOB: ::c_int = 0x0001;
714 pub const MSG_PEEK: ::c_int = 0x0002;
715 pub const MSG_DONTROUTE: ::c_int = 0x0004;
716 pub const MSG_EOR: ::c_int = 0x0008;
717 pub const MSG_TRUNC: ::c_int = 0x0010;
718 pub const MSG_CTRUNC: ::c_int = 0x0020;
719 pub const MSG_WAITALL: ::c_int = 0x0040;
720 pub const MSG_DONTWAIT: ::c_int = 0x0080;
721 pub const MSG_EOF: ::c_int = 0x0100;
722 pub const MSG_EXP: ::c_int = 0x0200;
723 pub const MSG_MBUF: ::c_int = 0x0400;
724 pub const MSG_NOTIFICATION: ::c_int = 0x0800;
725 pub const MSG_COMPAT: ::c_int = 0x8000;
726
727 pub const AF_UNSPEC: ::c_int = 0;
728 pub const AF_LOCAL: ::c_int = 1;
729 pub const AF_UNIX: ::c_int = AF_LOCAL;
730 pub const AF_INET: ::c_int = 2;
731 pub const AF_NETLINK: ::c_int = 16;
732 pub const AF_ROUTE: ::c_int = 17;
733 pub const AF_LINK: ::c_int = 18;
734 pub const AF_PACKET: ::c_int = 19;
735 pub const pseudo_AF_KEY: ::c_int = 27;
736 pub const AF_KEY: ::c_int = pseudo_AF_KEY;
737 pub const AF_INET6: ::c_int = 28;
738 pub const AF_SOCKDEV: ::c_int = 31;
739 pub const AF_TIPC: ::c_int = 33;
740 pub const AF_MIPC: ::c_int = 34;
741 pub const AF_MIPC_SAFE: ::c_int = 35;
742 pub const AF_MAX: ::c_int = 36;
743
744 pub const SHUT_RD: ::c_int = 0;
745 pub const SHUT_WR: ::c_int = 1;
746 pub const SHUT_RDWR: ::c_int = 2;
747
748 pub const IPPROTO_TCP: ::c_int = 6;
749 pub const TCP_NODELAY: ::c_int = 1;
750 pub const TCP_MAXSEG: ::c_int = 2;
751 pub const TCP_NOPUSH: ::c_int = 3;
752 pub const TCP_KEEPIDLE: ::c_int = 4;
753 pub const TCP_KEEPINTVL: ::c_int = 5;
754 pub const TCP_KEEPCNT: ::c_int = 6;
755 pub const SO_ERROR: ::c_int = 4;
756
757 // IO Lib Definitions:
758
759 pub const FIONREAD: ::c_int = 1;
760 pub const FIOFLUSH: ::c_int = 2;
761 pub const FIOOPTIONS: ::c_int = 3;
762 pub const FIOBAUDRATE: ::c_int = 4;
763 pub const FIODISKFORMAT: ::c_int = 5;
764 pub const FIODISKINIT: ::c_int = 6;
765 pub const FIOSEEK: ::c_int = 7;
766 pub const FIOWHERE: ::c_int = 8;
767 pub const FIODIRENTRY: ::c_int = 9;
768 pub const FIORENAME: ::c_int = 10;
769 pub const FIOREADYCHANGE: ::c_int = 11;
770 pub const FIOWRITE: ::c_int = 12;
771 pub const FIODISKCHANGE: ::c_int = 13;
772 pub const FIOCANCEL: ::c_int = 14;
773 pub const FIOSQUEEZE: ::c_int = 15;
774 pub const FIONBIO: ::c_int = -1878786032; // it goes on ...
775 pub const _POSIX_PATH_MAX: ::c_int = 256;
776
777 // Some poll stuff
778 pub const POLLIN: ::c_short = 0x0001;
779 pub const POLLPRI: ::c_short = 0x0002;
780 pub const POLLOUT: ::c_short = 0x0004;
781 pub const POLLRDNORM: ::c_short = 0x0040;
782 pub const POLLWRNORM: ::c_short = POLLOUT;
783 pub const POLLRDBAND: ::c_short = 0x0080;
784 pub const POLLWRBAND: ::c_short = 0x0100;
785 pub const POLLER: ::c_short = 0x0008;
786 pub const POLLHUP: ::c_short = 0x0010;
787 pub const POLLNVAL: ::c_short = 0x0020;
788
789 //Some Fcntlcom Stuff (look at fcntlcom.h to find definitions)
790 pub const FD_CLOEXEC: ::c_int = 1;
791 pub const F_DUPFD: ::c_int = 0;
792 pub const F_GETFD: ::c_int = 1;
793 pub const F_SETFD: ::c_int = 2;
794 pub const F_GETFL: ::c_int = 3;
795 pub const F_SETFL: ::c_int = 4;
796 pub const F_GETOWN: ::c_int = 5;
797 pub const F_SETOWN: ::c_int = 6;
798 pub const F_GETLK: ::c_int = 7;
799 pub const F_SETLK: ::c_int = 8;
800 pub const F_SETLKW: ::c_int = 9;
801 pub const F_DUPFD_CLOEXEC: ::c_int = 14;
802
803 //Some Dirent.h stuff
804 pub const DT_UNKNOWN: ::c_uchar = 0x0;
805 pub const DT_FIFO: ::c_uchar = 0x1;
806 pub const DT_CHR: ::c_uchar = 0x2;
807 pub const DT_DIR: ::c_uchar = 0x4;
808 pub const DT_BLK: ::c_uchar = 0x6;
809 pub const DT_REG: ::c_uchar = 0x8;
810 pub const DT_LNK: ::c_uchar = 0xA;
811 pub const DT_SOCK: ::c_uchar = 0xC;
812 pub const DT_WHT: ::c_uchar = 0xE;
813
814 // Other Random Stuff
815 pub const VXSIM_EWOULDBLOCK: ::c_int = 70;
816 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
817 pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
818
819 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
820 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
821 pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
822
823 pub const SIGHUP: ::c_int = 1;
824 pub const SIGINT: ::c_int = 2;
825 pub const SIGQUIT: ::c_int = 3;
826 pub const SIGILL: ::c_int = 4;
827 pub const SIGTRAP: ::c_int = 5;
828 pub const SIGABRT: ::c_int = 6;
829 pub const SIGEMT: ::c_int = 7;
830 pub const SIGFPE: ::c_int = 8;
831 pub const SIGKILL: ::c_int = 9;
832 pub const SIGBUS: ::c_int = 10;
833 pub const SIGSEGV: ::c_int = 11;
834 pub const SIGFMT: ::c_int = 12;
835 pub const SIGPIPE: ::c_int = 13;
836 pub const SIGALRM: ::c_int = 14;
837 pub const SIGTERM: ::c_int = 15;
838 pub const SIGCNCL: ::c_int = 16;
839 pub const SIGSTOP: ::c_int = 17;
840 pub const SIGTSTP: ::c_int = 18;
841 pub const SIGCONT: ::c_int = 19;
842 pub const SIGCHLD: ::c_int = 20;
843 pub const SIGTTIN: ::c_int = 21;
844 pub const SIGTTOU: ::c_int = 22;
845
846 pub const SIG_BLOCK: ::c_int = 1;
847 pub const SIG_UNBLOCK: ::c_int = 2;
848 pub const SIG_SETMASK: ::c_int = 3;
849
850 pub const SI_SYNC: ::c_int = 0;
851 pub const SI_USER: ::c_int = -1;
852 pub const SI_QUEUE: ::c_int = -2;
853 pub const SI_TIMER: ::c_int = -3;
854 pub const SI_ASYNCIO: ::c_int = -4;
855 pub const SI_MESGQ: ::c_int = -5;
856 pub const SI_CHILD: ::c_int = -6;
857 pub const SI_KILL: ::c_int = SI_USER;
858
859 // vxParams.h definitions
860 pub const _PARM_NAME_MAX: usize = 255;
861 pub const _PARM_PATH_MAX: usize = 1024;
862
863 // WAIT STUFF
864 pub const WNOHANG: ::c_int = 0x01;
865 pub const WUNTRACED: ::c_int = 0x02;
866
867 const PTHREAD_MUTEXATTR_INITIALIZER: pthread_mutexattr_t =
868 pthread_mutexattr_t {
869 mutexAttrStatus: PTHREAD_INITIALIZED_OBJ,
870 mutexAttrProtocol: PTHREAD_PRIO_NONE,
871 mutexAttrPrioceiling: 0,
872 mutexAttrType: PTHREAD_MUTEX_DEFAULT,
873 mutexAttrPshared: 1,
874 };
875 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
876 mutexSemId: null_mut(),
877 mutexValid: PTHREAD_VALID_OBJ,
878 mutexInitted: PTHREAD_UNUSED_YET_OBJ,
879 mutexCondRefCount: 0,
880 mutexSavPriority: 0,
881 mutexAttr: PTHREAD_MUTEXATTR_INITIALIZER,
882 mutexSemName: [0; PTHREAD_SHARED_SEM_NAME_MAX],
883 };
884
885 const PTHREAD_CONDATTR_INITIALIZER: pthread_condattr_t = pthread_condattr_t {
886 condAttrStatus: 0,
887 condAttrPshared: 0,
888 _CondAttrClockId: CLOCK_REALTIME,
889 };
890 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
891 condSemId: null_mut(),
892 condValid: PTHREAD_VALID_OBJ,
893 condInitted: PTHREAD_UNUSED_YET_OBJ,
894 condRefCount: 0,
895 condMutex: null_mut(),
896 condAttr: PTHREAD_CONDATTR_INITIALIZER,
897 condSemName: [0; PTHREAD_SHARED_SEM_NAME_MAX],
898 };
899
900 const PTHREAD_RWLOCKATTR_INITIALIZER: pthread_rwlockattr_t =
901 pthread_rwlockattr_t {
902 rwlockAttrStatus: PTHREAD_INITIALIZED_OBJ,
903 rwlockAttrMaxReaders: 0,
904 };
905 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
906 rwlockSemId: null_mut(),
907 rwlockReadersRefCount: 0,
908 rwlockValid: PTHREAD_VALID_OBJ,
909 rwlockInitted: PTHREAD_UNUSED_YET_OBJ,
910 rwlockAttr: PTHREAD_RWLOCKATTR_INITIALIZER,
911 rwlockName: [0; PTHREAD_SHARED_SEM_NAME_MAX],
912 };
913
914 pub const SEEK_SET: ::c_int = 0;
915 pub const SEEK_CUR: ::c_int = 1;
916 pub const SEEK_END: ::c_int = 2;
917
918 // rtpLibCommon.h
919 pub const VX_RTP_NAME_LENGTH: usize = 255;
920
921 //Some unsupported stuff
922 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = -1; // Via unistd.h
923 pub const _SC_PAGESIZE: ::c_int = 64;
924 pub const O_ACCMODE: ::c_int = 3;
925 pub const O_CLOEXEC: ::c_int = 0x100000; // fcntlcom
926 pub const O_EXCL: ::c_int = 0x0800;
927 pub const O_CREAT: ::c_int = 0x0200;
928 pub const O_TRUNC: ::c_int = 0x0400;
929 pub const O_APPEND: ::c_int = 0x0008;
930 pub const O_RDWR: ::c_int = 2;
931 pub const O_WRONLY: ::c_int = 1;
932 pub const O_RDONLY: ::c_int = 0;
933 pub const O_NONBLOCK: ::c_int = 0x4;
934
935 #[cfg_attr(feature = "extra_traits", derive(Debug))]
936 pub enum FILE {}
937 impl ::Copy for FILE {}
938 impl ::Clone for FILE {
clone(&self) -> FILE939 fn clone(&self) -> FILE {
940 *self
941 }
942 }
943 #[cfg_attr(feature = "extra_traits", derive(Debug))]
944 pub enum fpos_t {} // TODO: fill this out with a struct
945 impl ::Copy for fpos_t {}
946 impl ::Clone for fpos_t {
clone(&self) -> fpos_t947 fn clone(&self) -> fpos_t {
948 *self
949 }
950 }
951
952 extern {
isalnum(c: c_int) -> c_int953 pub fn isalnum(c: c_int) -> c_int;
isalpha(c: c_int) -> c_int954 pub fn isalpha(c: c_int) -> c_int;
iscntrl(c: c_int) -> c_int955 pub fn iscntrl(c: c_int) -> c_int;
isdigit(c: c_int) -> c_int956 pub fn isdigit(c: c_int) -> c_int;
isgraph(c: c_int) -> c_int957 pub fn isgraph(c: c_int) -> c_int;
islower(c: c_int) -> c_int958 pub fn islower(c: c_int) -> c_int;
isprint(c: c_int) -> c_int959 pub fn isprint(c: c_int) -> c_int;
ispunct(c: c_int) -> c_int960 pub fn ispunct(c: c_int) -> c_int;
isspace(c: c_int) -> c_int961 pub fn isspace(c: c_int) -> c_int;
isupper(c: c_int) -> c_int962 pub fn isupper(c: c_int) -> c_int;
isxdigit(c: c_int) -> c_int963 pub fn isxdigit(c: c_int) -> c_int;
tolower(c: c_int) -> c_int964 pub fn tolower(c: c_int) -> c_int;
toupper(c: c_int) -> c_int965 pub fn toupper(c: c_int) -> c_int;
966 #[cfg_attr(
967 all(target_os = "macos", target_arch = "x86"),
968 link_name = "fopen$UNIX2003"
969 )]
fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE970 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
971 #[cfg_attr(
972 all(target_os = "macos", target_arch = "x86"),
973 link_name = "freopen$UNIX2003"
974 )]
freopen( filename: *const c_char, mode: *const c_char, file: *mut FILE, ) -> *mut FILE975 pub fn freopen(
976 filename: *const c_char,
977 mode: *const c_char,
978 file: *mut FILE,
979 ) -> *mut FILE;
fflush(file: *mut FILE) -> c_int980 pub fn fflush(file: *mut FILE) -> c_int;
fclose(file: *mut FILE) -> c_int981 pub fn fclose(file: *mut FILE) -> c_int;
remove(filename: *const c_char) -> c_int982 pub fn remove(filename: *const c_char) -> c_int;
rename(oldname: *const c_char, newname: *const c_char) -> c_int983 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
tmpfile() -> *mut FILE984 pub fn tmpfile() -> *mut FILE;
setvbuf( stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t, ) -> c_int985 pub fn setvbuf(
986 stream: *mut FILE,
987 buffer: *mut c_char,
988 mode: c_int,
989 size: size_t,
990 ) -> c_int;
setbuf(stream: *mut FILE, buf: *mut c_char)991 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
getchar() -> c_int992 pub fn getchar() -> c_int;
putchar(c: c_int) -> c_int993 pub fn putchar(c: c_int) -> c_int;
fgetc(stream: *mut FILE) -> c_int994 pub fn fgetc(stream: *mut FILE) -> c_int;
fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char995 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
996 -> *mut c_char;
fputc(c: c_int, stream: *mut FILE) -> c_int997 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
998 #[cfg_attr(
999 all(target_os = "macos", target_arch = "x86"),
1000 link_name = "fputs$UNIX2003"
1001 )]
fputs(s: *const c_char, stream: *mut FILE) -> c_int1002 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
puts(s: *const c_char) -> c_int1003 pub fn puts(s: *const c_char) -> c_int;
ungetc(c: c_int, stream: *mut FILE) -> c_int1004 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_t1005 pub fn fread(
1006 ptr: *mut c_void,
1007 size: size_t,
1008 nobj: size_t,
1009 stream: *mut FILE,
1010 ) -> size_t;
1011 #[cfg_attr(
1012 all(target_os = "macos", target_arch = "x86"),
1013 link_name = "fwrite$UNIX2003"
1014 )]
fwrite( ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE, ) -> size_t1015 pub fn fwrite(
1016 ptr: *const c_void,
1017 size: size_t,
1018 nobj: size_t,
1019 stream: *mut FILE,
1020 ) -> size_t;
fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int1021 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
ftell(stream: *mut FILE) -> c_long1022 pub fn ftell(stream: *mut FILE) -> c_long;
rewind(stream: *mut FILE)1023 pub fn rewind(stream: *mut FILE);
1024 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int1025 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
1026 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int1027 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
feof(stream: *mut FILE) -> c_int1028 pub fn feof(stream: *mut FILE) -> c_int;
ferror(stream: *mut FILE) -> c_int1029 pub fn ferror(stream: *mut FILE) -> c_int;
perror(s: *const c_char)1030 pub fn perror(s: *const c_char);
atoi(s: *const c_char) -> c_int1031 pub fn atoi(s: *const c_char) -> c_int;
1032 #[cfg_attr(
1033 all(target_os = "macos", target_arch = "x86"),
1034 link_name = "strtod$UNIX2003"
1035 )]
strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double1036 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_long1037 pub fn strtol(
1038 s: *const c_char,
1039 endp: *mut *mut c_char,
1040 base: c_int,
1041 ) -> c_long;
strtoul( s: *const c_char, endp: *mut *mut c_char, base: c_int, ) -> c_ulong1042 pub fn strtoul(
1043 s: *const c_char,
1044 endp: *mut *mut c_char,
1045 base: c_int,
1046 ) -> c_ulong;
calloc(nobj: size_t, size: size_t) -> *mut c_void1047 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
malloc(size: size_t) -> *mut c_void1048 pub fn malloc(size: size_t) -> *mut c_void;
realloc(p: *mut c_void, size: size_t) -> *mut c_void1049 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
free(p: *mut c_void)1050 pub fn free(p: *mut c_void);
abort() -> !1051 pub fn abort() -> !;
exit(status: c_int) -> !1052 pub fn exit(status: c_int) -> !;
1053 // pub fn _exit(status: c_int) -> !;
atexit(cb: extern fn()) -> c_int1054 pub fn atexit(cb: extern fn()) -> c_int;
1055 #[cfg_attr(
1056 all(target_os = "macos", target_arch = "x86"),
1057 link_name = "system$UNIX2003"
1058 )]
system(s: *const c_char) -> c_int1059 pub fn system(s: *const c_char) -> c_int;
getenv(s: *const c_char) -> *mut c_char1060 pub fn getenv(s: *const c_char) -> *mut c_char;
1061
strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char1062 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_char1063 pub fn strncpy(
1064 dst: *mut c_char,
1065 src: *const c_char,
1066 n: size_t,
1067 ) -> *mut c_char;
strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char1068 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_char1069 pub fn strncat(
1070 s: *mut c_char,
1071 ct: *const c_char,
1072 n: size_t,
1073 ) -> *mut c_char;
strcmp(cs: *const c_char, ct: *const c_char) -> c_int1074 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_int1075 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_int1076 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
strchr(cs: *const c_char, c: c_int) -> *mut c_char1077 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
strrchr(cs: *const c_char, c: c_int) -> *mut c_char1078 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
strspn(cs: *const c_char, ct: *const c_char) -> size_t1079 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
strcspn(cs: *const c_char, ct: *const c_char) -> size_t1080 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
strdup(cs: *const c_char) -> *mut c_char1081 pub fn strdup(cs: *const c_char) -> *mut c_char;
strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char1082 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_char1083 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int1084 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_int1085 pub fn strncasecmp(
1086 s1: *const c_char,
1087 s2: *const c_char,
1088 n: size_t,
1089 ) -> c_int;
strlen(cs: *const c_char) -> size_t1090 pub fn strlen(cs: *const c_char) -> size_t;
strnlen(cs: *const c_char, maxlen: size_t) -> size_t1091 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
1092 #[cfg_attr(
1093 all(target_os = "macos", target_arch = "x86"),
1094 link_name = "strerror$UNIX2003"
1095 )]
strerror(n: c_int) -> *mut c_char1096 pub fn strerror(n: c_int) -> *mut c_char;
strtok(s: *mut c_char, t: *const c_char) -> *mut c_char1097 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_t1098 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
wcslen(buf: *const wchar_t) -> size_t1099 pub fn wcslen(buf: *const wchar_t) -> size_t;
wcstombs( dest: *mut c_char, src: *const wchar_t, n: size_t, ) -> ::size_t1100 pub fn wcstombs(
1101 dest: *mut c_char,
1102 src: *const wchar_t,
1103 n: size_t,
1104 ) -> ::size_t;
1105
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void1106 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_int1107 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_void1108 pub fn memcpy(
1109 dest: *mut c_void,
1110 src: *const c_void,
1111 n: size_t,
1112 ) -> *mut c_void;
memmove( dest: *mut c_void, src: *const c_void, n: size_t, ) -> *mut c_void1113 pub fn memmove(
1114 dest: *mut c_void,
1115 src: *const c_void,
1116 n: size_t,
1117 ) -> *mut c_void;
memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void1118 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
1119 }
1120
1121 extern {
1122 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
getpwnam(name: *const ::c_char) -> *mut passwd1123 pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
1124 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
getpwuid(uid: ::uid_t) -> *mut passwd1125 pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
1126
fprintf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int1127 pub fn fprintf(
1128 stream: *mut ::FILE,
1129 format: *const ::c_char,
1130 ...
1131 ) -> ::c_int;
printf(format: *const ::c_char, ...) -> ::c_int1132 pub fn printf(format: *const ::c_char, ...) -> ::c_int;
snprintf( s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ... ) -> ::c_int1133 pub fn snprintf(
1134 s: *mut ::c_char,
1135 n: ::size_t,
1136 format: *const ::c_char,
1137 ...
1138 ) -> ::c_int;
sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int1139 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
fscanf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int1140 pub fn fscanf(
1141 stream: *mut ::FILE,
1142 format: *const ::c_char,
1143 ...
1144 ) -> ::c_int;
scanf(format: *const ::c_char, ...) -> ::c_int1145 pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int1146 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
1147 -> ::c_int;
getchar_unlocked() -> ::c_int1148 pub fn getchar_unlocked() -> ::c_int;
putchar_unlocked(c: ::c_int) -> ::c_int1149 pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
1150
stat(path: *const c_char, buf: *mut stat) -> ::c_int1151 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
1152
pclose(stream: *mut ::FILE) -> ::c_int1153 pub fn pclose(stream: *mut ::FILE) -> ::c_int;
1154 #[cfg_attr(
1155 all(target_os = "macos", target_arch = "x86"),
1156 link_name = "fdopen$UNIX2003"
1157 )]
fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE1158 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
fileno(stream: *mut ::FILE) -> ::c_int1159 pub fn fileno(stream: *mut ::FILE) -> ::c_int;
1160
1161 #[cfg_attr(
1162 all(target_os = "macos", target_arch = "x86"),
1163 link_name = "open$UNIX2003"
1164 )]
1165 #[cfg_attr(
1166 all(target_os = "macos", target_arch = "x86"),
1167 link_name = "creat$UNIX2003"
1168 )]
creat(path: *const c_char, mode: mode_t) -> ::c_int1169 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
1170
fdopendir(fd: ::c_int) -> *mut ::DIR1171 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
1172
rewinddir(dirp: *mut ::DIR)1173 pub fn rewinddir(dirp: *mut ::DIR);
1174
openat( dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ... ) -> ::c_int1175 pub fn openat(
1176 dirfd: ::c_int,
1177 pathname: *const ::c_char,
1178 flags: ::c_int,
1179 ...
1180 ) -> ::c_int;
fchmodat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int, ) -> ::c_int1181 pub fn fchmodat(
1182 dirfd: ::c_int,
1183 pathname: *const ::c_char,
1184 mode: ::mode_t,
1185 flags: ::c_int,
1186 ) -> ::c_int;
fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int1187 pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int;
fchownat( dirfd: ::c_int, pathname: *const ::c_char, owner: ::uid_t, group: ::gid_t, flags: ::c_int, ) -> ::c_int1188 pub fn fchownat(
1189 dirfd: ::c_int,
1190 pathname: *const ::c_char,
1191 owner: ::uid_t,
1192 group: ::gid_t,
1193 flags: ::c_int,
1194 ) -> ::c_int;
1195 #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
1196 #[cfg_attr(target_os = "freebsd", link_name = "fstatat@FBSD_1.1")]
fstatat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int, ) -> ::c_int1197 pub fn fstatat(
1198 dirfd: ::c_int,
1199 pathname: *const ::c_char,
1200 buf: *mut stat,
1201 flags: ::c_int,
1202 ) -> ::c_int;
linkat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int, ) -> ::c_int1203 pub fn linkat(
1204 olddirfd: ::c_int,
1205 oldpath: *const ::c_char,
1206 newdirfd: ::c_int,
1207 newpath: *const ::c_char,
1208 flags: ::c_int,
1209 ) -> ::c_int;
mkdirat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, ) -> ::c_int1210 pub fn mkdirat(
1211 dirfd: ::c_int,
1212 pathname: *const ::c_char,
1213 mode: ::mode_t,
1214 ) -> ::c_int;
readlinkat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut ::c_char, bufsiz: ::size_t, ) -> ::ssize_t1215 pub fn readlinkat(
1216 dirfd: ::c_int,
1217 pathname: *const ::c_char,
1218 buf: *mut ::c_char,
1219 bufsiz: ::size_t,
1220 ) -> ::ssize_t;
renameat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, ) -> ::c_int1221 pub fn renameat(
1222 olddirfd: ::c_int,
1223 oldpath: *const ::c_char,
1224 newdirfd: ::c_int,
1225 newpath: *const ::c_char,
1226 ) -> ::c_int;
symlinkat( target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char, ) -> ::c_int1227 pub fn symlinkat(
1228 target: *const ::c_char,
1229 newdirfd: ::c_int,
1230 linkpath: *const ::c_char,
1231 ) -> ::c_int;
1232
access(path: *const c_char, amode: ::c_int) -> ::c_int1233 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
alarm(seconds: ::c_uint) -> ::c_uint1234 pub fn alarm(seconds: ::c_uint) -> ::c_uint;
fchdir(dirfd: ::c_int) -> ::c_int1235 pub fn fchdir(dirfd: ::c_int) -> ::c_int;
chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int1236 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
1237 #[cfg_attr(
1238 all(target_os = "macos", target_arch = "x86"),
1239 link_name = "lchown$UNIX2003"
1240 )]
lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int1241 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int1242 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
execle( path: *const ::c_char, arg0: *const ::c_char, ... ) -> ::c_int1243 pub fn execle(
1244 path: *const ::c_char,
1245 arg0: *const ::c_char,
1246 ...
1247 ) -> ::c_int;
execlp( file: *const ::c_char, arg0: *const ::c_char, ... ) -> ::c_int1248 pub fn execlp(
1249 file: *const ::c_char,
1250 arg0: *const ::c_char,
1251 ...
1252 ) -> ::c_int;
execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int1253 pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
execve( prog: *const c_char, argv: *const *const c_char, envp: *const *const c_char, ) -> ::c_int1254 pub fn execve(
1255 prog: *const c_char,
1256 argv: *const *const c_char,
1257 envp: *const *const c_char,
1258 ) -> ::c_int;
1259 /*
1260 pub fn execvp(c: *const c_char,
1261 argv: *const *const c_char) -> ::c_int;
1262 */
1263 // pub fn fork() -> pid_t;
fpathconf(filedes: ::c_int, name: ::c_int) -> c_long1264 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
getegid() -> gid_t1265 pub fn getegid() -> gid_t;
geteuid() -> uid_t1266 pub fn geteuid() -> uid_t;
getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int1267 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
getlogin() -> *mut c_char1268 pub fn getlogin() -> *mut c_char;
getopt( argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char, ) -> ::c_int1269 pub fn getopt(
1270 argc: ::c_int,
1271 argv: *const *mut c_char,
1272 optstr: *const c_char,
1273 ) -> ::c_int;
pathconf(path: *const c_char, name: ::c_int) -> c_long1274 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pause() -> ::c_int1275 pub fn pause() -> ::c_int;
seteuid(uid: uid_t) -> ::c_int1276 pub fn seteuid(uid: uid_t) -> ::c_int;
setegid(gid: gid_t) -> ::c_int1277 pub fn setegid(gid: gid_t) -> ::c_int;
setpgid(pid: pid_t, pgid: pid_t) -> ::c_int1278 pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
setsid() -> pid_t1279 pub fn setsid() -> pid_t;
sleep(secs: ::c_uint) -> ::c_uint1280 pub fn sleep(secs: ::c_uint) -> ::c_uint;
tcgetpgrp(fd: ::c_int) -> pid_t1281 pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int1282 pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
ttyname(fd: ::c_int) -> *mut c_char1283 pub fn ttyname(fd: ::c_int) -> *mut c_char;
wait(status: *mut ::c_int) -> pid_t1284 pub fn wait(status: *mut ::c_int) -> pid_t;
1285 /*
1286 pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
1287 offset: off_t) -> ::ssize_t;
1288 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1289 link_name = "pwrite$UNIX2003")]
1290 pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
1291 offset: off_t) -> ::ssize_t;
1292 */
umask(mask: mode_t) -> mode_t1293 pub fn umask(mask: mode_t) -> mode_t;
1294
1295 // #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
1296 // pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
1297
1298 /*
1299 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1300 link_name = "kill$UNIX2003")]
1301 pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
1302 */
1303 #[cfg_attr(
1304 all(target_os = "macos", target_arch = "x86"),
1305 link_name = "killpg$UNIX2003"
1306 )]
killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int1307 pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int;
1308
mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int1309 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int1310 pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
mlockall(flags: ::c_int) -> ::c_int1311 pub fn mlockall(flags: ::c_int) -> ::c_int;
munlockall() -> ::c_int1312 pub fn munlockall() -> ::c_int;
1313
1314 #[cfg_attr(
1315 all(target_os = "macos", target_arch = "x86"),
1316 link_name = "mmap$UNIX2003"
1317 )]
mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void1318 pub fn mmap(
1319 addr: *mut ::c_void,
1320 len: ::size_t,
1321 prot: ::c_int,
1322 flags: ::c_int,
1323 fd: ::c_int,
1324 offset: off_t,
1325 ) -> *mut ::c_void;
1326 #[cfg_attr(
1327 all(target_os = "macos", target_arch = "x86"),
1328 link_name = "munmap$UNIX2003"
1329 )]
munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int1330 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
1331
if_nametoindex(ifname: *const c_char) -> ::c_uint1332 pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
if_indextoname( ifindex: ::c_uint, ifname: *mut ::c_char, ) -> *mut ::c_char1333 pub fn if_indextoname(
1334 ifindex: ::c_uint,
1335 ifname: *mut ::c_char,
1336 ) -> *mut ::c_char;
1337
truncate(path: *const c_char, length: off_t) -> ::c_int1338 pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
1339
1340 #[cfg_attr(
1341 all(target_os = "macos", target_arch = "x86"),
1342 link_name = "getrlimit$UNIX2003"
1343 )]
getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int1344 pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int;
1345 #[cfg_attr(
1346 all(target_os = "macos", target_arch = "x86"),
1347 link_name = "setrlimit$UNIX2003"
1348 )]
setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int1349 pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int;
1350 // #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
1351 // pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
1352
1353 /*
1354 #[cfg_attr(any(target_os = "macos", target_os = "ios"),
1355 link_name = "realpath$DARWIN_EXTSN")]
1356 pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char)
1357 -> *mut ::c_char;
1358 */
flock(fd: ::c_int, operation: ::c_int) -> ::c_int1359 pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1360
1361 #[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")]
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int1362 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pthread_exit(value: *mut ::c_void)1363 pub fn pthread_exit(value: *mut ::c_void);
pthread_attr_setdetachstate( attr: *mut ::pthread_attr_t, state: ::c_int, ) -> ::c_int1364 pub fn pthread_attr_setdetachstate(
1365 attr: *mut ::pthread_attr_t,
1366 state: ::c_int,
1367 ) -> ::c_int;
1368
strerror_r( errnum: ::c_int, buf: *mut c_char, buflen: ::size_t, ) -> ::c_int1369 pub fn strerror_r(
1370 errnum: ::c_int,
1371 buf: *mut c_char,
1372 buflen: ::size_t,
1373 ) -> ::c_int;
1374
sigaction( signum: ::c_int, act: *const sigaction, oldact: *mut sigaction, ) -> ::c_int1375 pub fn sigaction(
1376 signum: ::c_int,
1377 act: *const sigaction,
1378 oldact: *mut sigaction,
1379 ) -> ::c_int;
1380
1381 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
utimes( filename: *const ::c_char, times: *const ::timeval, ) -> ::c_int1382 pub fn utimes(
1383 filename: *const ::c_char,
1384 times: *const ::timeval,
1385 ) -> ::c_int;
dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1386 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
dlerror() -> *mut ::c_char1387 pub fn dlerror() -> *mut ::c_char;
dlsym( handle: *mut ::c_void, symbol: *const ::c_char, ) -> *mut ::c_void1388 pub fn dlsym(
1389 handle: *mut ::c_void,
1390 symbol: *const ::c_char,
1391 ) -> *mut ::c_void;
dlclose(handle: *mut ::c_void) -> ::c_int1392 pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
res_init() -> ::c_int1393 pub fn res_init() -> ::c_int;
1394 /*
1395 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
1396 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1397 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
1398 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1399 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1400 link_name = "mktime$UNIX2003")]
1401 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
1402 pub fn mktime(tm: *mut tm) -> time_t;
1403 #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
1404 pub fn time(time: *mut time_t) -> time_t;
1405 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
1406 pub fn gmtime(time_p: *const time_t) -> *mut tm;
1407 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
1408 pub fn localtime(time_p: *const time_t) -> *mut tm;
1409 */
1410 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
difftime(time1: time_t, time0: time_t) -> ::c_double1411 pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
1412
1413 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
1414 #[cfg_attr(target_os = "freebsd", link_name = "mknod@FBSD_1.0")]
mknod( pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t, ) -> ::c_int1415 pub fn mknod(
1416 pathname: *const ::c_char,
1417 mode: ::mode_t,
1418 dev: ::dev_t,
1419 ) -> ::c_int;
gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1420 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
1421 // pub fn getservbyname(name: *const ::c_char,
1422 // proto: *const ::c_char) -> *mut servent;
1423 // pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
1424 // pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
chroot(name: *const ::c_char) -> ::c_int1425 pub fn chroot(name: *const ::c_char) -> ::c_int;
1426 #[cfg_attr(
1427 all(target_os = "macos", target_arch = "x86"),
1428 link_name = "usleep$UNIX2003"
1429 )]
usleep(secs: ::c_uint) -> ::c_int1430 pub fn usleep(secs: ::c_uint) -> ::c_int;
1431 #[cfg_attr(
1432 all(target_os = "macos", target_arch = "x86"),
1433 link_name = "putenv$UNIX2003"
1434 )]
putenv(string: *mut c_char) -> ::c_int1435 pub fn putenv(string: *mut c_char) -> ::c_int;
1436 #[cfg_attr(target_os = "netbsd", link_name = "__select50")]
1437 // pub fn select(nfds: ::c_int,
1438 // readfs: *mut fd_set,
1439 // writefds: *mut fd_set,
1440 // errorfds: *mut fd_set,
1441 // timeout: *mut timeval) -> ::c_int;
1442 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
setlocale( category: ::c_int, locale: *const ::c_char, ) -> *mut ::c_char1443 pub fn setlocale(
1444 category: ::c_int,
1445 locale: *const ::c_char,
1446 ) -> *mut ::c_char;
1447 // pub fn localeconv() -> *mut lconv;
1448
sigprocmask( how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t, ) -> ::c_int1449 pub fn sigprocmask(
1450 how: ::c_int,
1451 set: *const sigset_t,
1452 oldset: *mut sigset_t,
1453 ) -> ::c_int;
1454 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
sigpending(set: *mut sigset_t) -> ::c_int1455 pub fn sigpending(set: *mut sigset_t) -> ::c_int;
1456
getsid(pid: pid_t) -> pid_t1457 pub fn getsid(pid: pid_t) -> pid_t;
1458
mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1459 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
1460
fseeko( stream: *mut ::FILE, offset: ::off_t, whence: ::c_int, ) -> ::c_int1461 pub fn fseeko(
1462 stream: *mut ::FILE,
1463 offset: ::off_t,
1464 whence: ::c_int,
1465 ) -> ::c_int;
ftello(stream: *mut ::FILE) -> ::off_t1466 pub fn ftello(stream: *mut ::FILE) -> ::off_t;
1467 #[cfg_attr(
1468 all(target_os = "macos", target_arch = "x86"),
1469 link_name = "tcdrain$UNIX2003"
1470 )]
tcdrain(fd: ::c_int) -> ::c_int1471 pub fn tcdrain(fd: ::c_int) -> ::c_int;
tcflow(fd: ::c_int, action: ::c_int) -> ::c_int1472 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
tcflush(fd: ::c_int, action: ::c_int) -> ::c_int1473 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
tcgetsid(fd: ::c_int) -> ::pid_t1474 pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int1475 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
mkstemp(template: *mut ::c_char) -> ::c_int1476 pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
mkdtemp(template: *mut ::c_char) -> *mut ::c_char1477 pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
1478
tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1479 pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
1480
openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1481 pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
closelog()1482 pub fn closelog();
setlogmask(maskpri: ::c_int) -> ::c_int1483 pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
1484 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
syslog(priority: ::c_int, message: *const ::c_char, ...)1485 pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
1486 #[cfg_attr(
1487 all(target_os = "macos", target_arch = "x86"),
1488 link_name = "nice$UNIX2003"
1489 )]
nice(incr: ::c_int) -> ::c_int1490 pub fn nice(incr: ::c_int) -> ::c_int;
1491
grantpt(fd: ::c_int) -> ::c_int1492 pub fn grantpt(fd: ::c_int) -> ::c_int;
posix_openpt(flags: ::c_int) -> ::c_int1493 pub fn posix_openpt(flags: ::c_int) -> ::c_int;
ptsname(fd: ::c_int) -> *mut ::c_char1494 pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
unlockpt(fd: ::c_int) -> ::c_int1495 pub fn unlockpt(fd: ::c_int) -> ::c_int;
1496
strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char1497 pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
getline( lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE, ) -> ssize_t1498 pub fn getline(
1499 lineptr: *mut *mut c_char,
1500 n: *mut size_t,
1501 stream: *mut FILE,
1502 ) -> ssize_t;
1503
_rtld_dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int1504 pub fn _rtld_dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
1505 }
1506
1507 extern {
1508 // this is gonna be a big one
1509
1510 // stdlib.h
1511 // This function may not be defined for armv7
memalign(block_size: ::size_t, size_arg: ::size_t) -> *mut ::c_void1512 pub fn memalign(block_size: ::size_t, size_arg: ::size_t)
1513 -> *mut ::c_void;
1514
1515 // ioLib.h
getcwd(buf: *mut ::c_char, size: ::size_t) -> *mut ::c_char1516 pub fn getcwd(buf: *mut ::c_char, size: ::size_t) -> *mut ::c_char;
1517
1518 // ioLib.h
chdir(attr: *const ::c_char) -> ::c_int1519 pub fn chdir(attr: *const ::c_char) -> ::c_int;
1520
1521 // pthread.h
pthread_mutexattr_init( attr: *mut pthread_mutexattr_t, ) -> ::c_int1522 pub fn pthread_mutexattr_init(
1523 /* PTHREAD STUFF */
1524 attr: *mut pthread_mutexattr_t,
1525 ) -> ::c_int;
1526
1527 // pthread.h
pthread_mutexattr_destroy( attr: *mut pthread_mutexattr_t, ) -> ::c_int1528 pub fn pthread_mutexattr_destroy(
1529 attr: *mut pthread_mutexattr_t,
1530 ) -> ::c_int;
1531
1532 // pthread.h
pthread_mutexattr_settype( pAttr: *mut ::pthread_mutexattr_t, pType: ::c_int, ) -> ::c_int1533 pub fn pthread_mutexattr_settype(
1534 pAttr: *mut ::pthread_mutexattr_t,
1535 pType: ::c_int,
1536 ) -> ::c_int;
1537
1538 // pthread.h
pthread_mutex_init( mutex: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> ::c_int1539 pub fn pthread_mutex_init(
1540 mutex: *mut pthread_mutex_t,
1541 attr: *const pthread_mutexattr_t,
1542 ) -> ::c_int;
1543
1544 // pthread.h
pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> ::c_int1545 pub fn pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> ::c_int;
1546
1547 // pthread.h
pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> ::c_int1548 pub fn pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> ::c_int;
1549
1550 // pthread.h
pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> ::c_int1551 pub fn pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> ::c_int;
1552
1553 // pthread.h
pthread_mutex_timedlock( attr: *mut pthread_mutex_t, spec: *const timespec, ) -> ::c_int1554 pub fn pthread_mutex_timedlock(
1555 attr: *mut pthread_mutex_t,
1556 spec: *const timespec,
1557 ) -> ::c_int;
1558
1559 // pthread.h
pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> ::c_int1560 pub fn pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> ::c_int;
1561
1562 // pthread.h
pthread_attr_setname( pAttr: *mut ::pthread_attr_t, name: *mut ::c_char, ) -> ::c_int1563 pub fn pthread_attr_setname(
1564 pAttr: *mut ::pthread_attr_t,
1565 name: *mut ::c_char,
1566 ) -> ::c_int;
1567
1568 // pthread.h
pthread_attr_setstacksize( attr: *mut ::pthread_attr_t, stacksize: ::size_t, ) -> ::c_int1569 pub fn pthread_attr_setstacksize(
1570 attr: *mut ::pthread_attr_t,
1571 stacksize: ::size_t,
1572 ) -> ::c_int;
1573
1574 // pthread.h
pthread_attr_getstacksize( attr: *const ::pthread_attr_t, size: *mut ::size_t, ) -> ::c_int1575 pub fn pthread_attr_getstacksize(
1576 attr: *const ::pthread_attr_t,
1577 size: *mut ::size_t,
1578 ) -> ::c_int;
1579
1580 // pthread.h
pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1581 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
1582
1583 // pthread.h
pthread_create( pThread: *mut ::pthread_t, pAttr: *const ::pthread_attr_t, start_routine: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int1584 pub fn pthread_create(
1585 pThread: *mut ::pthread_t,
1586 pAttr: *const ::pthread_attr_t,
1587 start_routine: extern fn(*mut ::c_void) -> *mut ::c_void,
1588 value: *mut ::c_void,
1589 ) -> ::c_int;
1590
1591 // pthread.h
pthread_attr_destroy(thread: *mut ::pthread_attr_t) -> ::c_int1592 pub fn pthread_attr_destroy(thread: *mut ::pthread_attr_t) -> ::c_int;
1593
1594 // pthread.h
pthread_detach(thread: ::pthread_t) -> ::c_int1595 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
1596
1597 // int pthread_atfork (void (*)(void), void (*)(void), void (*)(void));
pthread_atfork( prepare: ::Option<unsafe extern fn()>, parent: ::Option<unsafe extern fn()>, child: ::Option<unsafe extern fn()>, ) -> ::c_int1598 pub fn pthread_atfork(
1599 prepare: ::Option<unsafe extern fn()>,
1600 parent: ::Option<unsafe extern fn()>,
1601 child: ::Option<unsafe extern fn()>,
1602 ) -> ::c_int;
1603 // stat.h
fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int1604 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
1605
1606 // stat.h
lstat(path: *const ::c_char, buf: *mut stat) -> ::c_int1607 pub fn lstat(path: *const ::c_char, buf: *mut stat) -> ::c_int;
1608
1609 // unistd.h
ftruncate(fd: ::c_int, length: off_t) -> ::c_int1610 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
1611
1612 // dirent.h
readdir_r( pDir: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent, ) -> ::c_int1613 pub fn readdir_r(
1614 pDir: *mut ::DIR,
1615 entry: *mut ::dirent,
1616 result: *mut *mut ::dirent,
1617 ) -> ::c_int;
1618
1619 // dirent.h
readdir(pDir: *mut ::DIR) -> *mut ::dirent1620 pub fn readdir(pDir: *mut ::DIR) -> *mut ::dirent;
1621
1622 // fcntl.h or
1623 // ioLib.h
open( path: *const ::c_char, oflag: ::c_int, ... ) -> ::c_int1624 pub fn open(
1625 // this might be hacked
1626 path: *const ::c_char,
1627 oflag: ::c_int,
1628 ...
1629 ) -> ::c_int;
1630
1631 // poll.h
poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1632 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
1633
1634 // pthread.h
pthread_condattr_init(attr: *mut ::pthread_condattr_t) -> ::c_int1635 pub fn pthread_condattr_init(attr: *mut ::pthread_condattr_t) -> ::c_int;
1636
1637 // pthread.h
pthread_condattr_destroy( attr: *mut ::pthread_condattr_t, ) -> ::c_int1638 pub fn pthread_condattr_destroy(
1639 attr: *mut ::pthread_condattr_t,
1640 ) -> ::c_int;
1641
1642 // pthread.h
pthread_condattr_getclock( pAttr: *const ::pthread_condattr_t, pClockId: *mut ::clockid_t, ) -> ::c_int1643 pub fn pthread_condattr_getclock(
1644 pAttr: *const ::pthread_condattr_t,
1645 pClockId: *mut ::clockid_t,
1646 ) -> ::c_int;
1647
1648 // pthread.h
pthread_condattr_setclock( pAttr: *mut ::pthread_condattr_t, clockId: ::clockid_t, ) -> ::c_int1649 pub fn pthread_condattr_setclock(
1650 pAttr: *mut ::pthread_condattr_t,
1651 clockId: ::clockid_t,
1652 ) -> ::c_int;
1653
1654 // pthread.h
pthread_cond_init( cond: *mut ::pthread_cond_t, attr: *const ::pthread_condattr_t, ) -> ::c_int1655 pub fn pthread_cond_init(
1656 cond: *mut ::pthread_cond_t,
1657 attr: *const ::pthread_condattr_t,
1658 ) -> ::c_int;
1659
1660 // pthread.h
pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1661 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
1662
1663 // pthread.h
pthread_cond_signal(cond: *mut ::pthread_cond_t) -> ::c_int1664 pub fn pthread_cond_signal(cond: *mut ::pthread_cond_t) -> ::c_int;
1665
1666 // pthread.h
pthread_cond_broadcast(cond: *mut ::pthread_cond_t) -> ::c_int1667 pub fn pthread_cond_broadcast(cond: *mut ::pthread_cond_t) -> ::c_int;
1668
1669 // pthread.h
pthread_cond_wait( cond: *mut ::pthread_cond_t, mutex: *mut ::pthread_mutex_t, ) -> ::c_int1670 pub fn pthread_cond_wait(
1671 cond: *mut ::pthread_cond_t,
1672 mutex: *mut ::pthread_mutex_t,
1673 ) -> ::c_int;
1674
1675 // pthread.h
pthread_rwlockattr_init( attr: *mut ::pthread_rwlockattr_t, ) -> ::c_int1676 pub fn pthread_rwlockattr_init(
1677 attr: *mut ::pthread_rwlockattr_t,
1678 ) -> ::c_int;
1679
1680 // pthread.h
pthread_rwlockattr_destroy( attr: *mut ::pthread_rwlockattr_t, ) -> ::c_int1681 pub fn pthread_rwlockattr_destroy(
1682 attr: *mut ::pthread_rwlockattr_t,
1683 ) -> ::c_int;
1684
1685 // pthread.h
pthread_rwlockattr_setmaxreaders( attr: *mut ::pthread_rwlockattr_t, attr2: ::c_uint, ) -> ::c_int1686 pub fn pthread_rwlockattr_setmaxreaders(
1687 attr: *mut ::pthread_rwlockattr_t,
1688 attr2: ::c_uint,
1689 ) -> ::c_int;
1690
1691 // pthread.h
pthread_rwlock_init( attr: *mut ::pthread_rwlock_t, host: *const ::pthread_rwlockattr_t, ) -> ::c_int1692 pub fn pthread_rwlock_init(
1693 attr: *mut ::pthread_rwlock_t,
1694 host: *const ::pthread_rwlockattr_t,
1695 ) -> ::c_int;
1696
1697 // pthread.h
pthread_rwlock_destroy(attr: *mut ::pthread_rwlock_t) -> ::c_int1698 pub fn pthread_rwlock_destroy(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1699
1700 // pthread.h
pthread_rwlock_rdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1701 pub fn pthread_rwlock_rdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1702
1703 // pthread.h
pthread_rwlock_tryrdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1704 pub fn pthread_rwlock_tryrdlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1705
1706 // pthread.h
pthread_rwlock_timedrdlock( attr: *mut ::pthread_rwlock_t, host: *const ::timespec, ) -> ::c_int1707 pub fn pthread_rwlock_timedrdlock(
1708 attr: *mut ::pthread_rwlock_t,
1709 host: *const ::timespec,
1710 ) -> ::c_int;
1711
1712 // pthread.h
pthread_rwlock_wrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1713 pub fn pthread_rwlock_wrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1714
1715 // pthread.h
pthread_rwlock_trywrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1716 pub fn pthread_rwlock_trywrlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1717
1718 // pthread.h
pthread_rwlock_timedwrlock( attr: *mut ::pthread_rwlock_t, host: *const ::timespec, ) -> ::c_int1719 pub fn pthread_rwlock_timedwrlock(
1720 attr: *mut ::pthread_rwlock_t,
1721 host: *const ::timespec,
1722 ) -> ::c_int;
1723
1724 // pthread.h
pthread_rwlock_unlock(attr: *mut ::pthread_rwlock_t) -> ::c_int1725 pub fn pthread_rwlock_unlock(attr: *mut ::pthread_rwlock_t) -> ::c_int;
1726
1727 // pthread.h
pthread_key_create( key: *mut ::pthread_key_t, dtor: ::Option<unsafe extern fn(*mut ::c_void)>, ) -> ::c_int1728 pub fn pthread_key_create(
1729 key: *mut ::pthread_key_t,
1730 dtor: ::Option<unsafe extern fn(*mut ::c_void)>,
1731 ) -> ::c_int;
1732
1733 // pthread.h
pthread_key_delete(key: ::pthread_key_t) -> ::c_int1734 pub fn pthread_key_delete(key: ::pthread_key_t) -> ::c_int;
1735
1736 // pthread.h
pthread_setspecific( key: ::pthread_key_t, value: *const ::c_void, ) -> ::c_int1737 pub fn pthread_setspecific(
1738 key: ::pthread_key_t,
1739 value: *const ::c_void,
1740 ) -> ::c_int;
1741
1742 // pthread.h
pthread_getspecific(key: ::pthread_key_t) -> *mut ::c_void1743 pub fn pthread_getspecific(key: ::pthread_key_t) -> *mut ::c_void;
1744
1745 // pthread.h
pthread_cond_timedwait( cond: *mut ::pthread_cond_t, mutex: *mut ::pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1746 pub fn pthread_cond_timedwait(
1747 cond: *mut ::pthread_cond_t,
1748 mutex: *mut ::pthread_mutex_t,
1749 abstime: *const ::timespec,
1750 ) -> ::c_int;
1751
1752 // pthread.h
pthread_attr_getname( attr: *mut ::pthread_attr_t, name: *mut *mut ::c_char, ) -> ::c_int1753 pub fn pthread_attr_getname(
1754 attr: *mut ::pthread_attr_t,
1755 name: *mut *mut ::c_char,
1756 ) -> ::c_int;
1757
1758 // pthread.h
pthread_join( thread: ::pthread_t, status: *mut *mut ::c_void, ) -> ::c_int1759 pub fn pthread_join(
1760 thread: ::pthread_t,
1761 status: *mut *mut ::c_void,
1762 ) -> ::c_int;
1763
1764 // pthread.h
pthread_self() -> ::pthread_t1765 pub fn pthread_self() -> ::pthread_t;
1766
1767 // clockLib.h
clock_gettime( clock_id: ::clockid_t, tp: *mut ::timespec, ) -> ::c_int1768 pub fn clock_gettime(
1769 clock_id: ::clockid_t,
1770 tp: *mut ::timespec,
1771 ) -> ::c_int;
1772
1773 // clockLib.h
clock_settime( clock_id: ::clockid_t, tp: *const ::timespec, ) -> ::c_int1774 pub fn clock_settime(
1775 clock_id: ::clockid_t,
1776 tp: *const ::timespec,
1777 ) -> ::c_int;
1778
1779 // clockLib.h
clock_getres( clock_id: ::clockid_t, res: *mut ::timespec, ) -> ::c_int1780 pub fn clock_getres(
1781 clock_id: ::clockid_t,
1782 res: *mut ::timespec,
1783 ) -> ::c_int;
1784
1785 // clockLib.h
clock_nanosleep( clock_id: ::clockid_t, flags: ::c_int, rqtp: *const ::timespec, rmtp: *mut ::timespec, ) -> ::c_int1786 pub fn clock_nanosleep(
1787 clock_id: ::clockid_t,
1788 flags: ::c_int,
1789 rqtp: *const ::timespec,
1790 rmtp: *mut ::timespec,
1791 ) -> ::c_int;
1792
1793 // timerLib.h
nanosleep( rqtp: *const ::timespec, rmtp: *mut ::timespec, ) -> ::c_int1794 pub fn nanosleep(
1795 rqtp: *const ::timespec,
1796 rmtp: *mut ::timespec,
1797 ) -> ::c_int;
1798
1799 // socket.h
accept( s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, ) -> ::c_int1800 pub fn accept(
1801 s: ::c_int,
1802 addr: *mut ::sockaddr,
1803 addrlen: *mut ::socklen_t,
1804 ) -> ::c_int;
1805
1806 // socket.h
bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int1807 pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t)
1808 -> ::c_int;
1809
1810 // socket.h
connect( s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t, ) -> ::c_int1811 pub fn connect(
1812 s: ::c_int,
1813 name: *const ::sockaddr,
1814 namelen: ::socklen_t,
1815 ) -> ::c_int;
1816
1817 // socket.h
getpeername( s: ::c_int, name: *mut ::sockaddr, namelen: *mut ::socklen_t, ) -> ::c_int1818 pub fn getpeername(
1819 s: ::c_int,
1820 name: *mut ::sockaddr,
1821 namelen: *mut ::socklen_t,
1822 ) -> ::c_int;
1823
1824 // socket.h
getsockname( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int1825 pub fn getsockname(
1826 socket: ::c_int,
1827 address: *mut sockaddr,
1828 address_len: *mut socklen_t,
1829 ) -> ::c_int;
1830
1831 // socket.h
getsockopt( sockfd: ::c_int, level: ::c_int, optname: ::c_int, optval: *mut ::c_void, optlen: *mut ::socklen_t, ) -> ::c_int1832 pub fn getsockopt(
1833 sockfd: ::c_int,
1834 level: ::c_int,
1835 optname: ::c_int,
1836 optval: *mut ::c_void,
1837 optlen: *mut ::socklen_t,
1838 ) -> ::c_int;
1839
1840 // socket.h
listen(socket: ::c_int, backlog: ::c_int) -> ::c_int1841 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
1842
1843 // socket.h
recv( s: ::c_int, buf: *mut ::c_void, bufLen: ::size_t, flags: ::c_int, ) -> ::ssize_t1844 pub fn recv(
1845 s: ::c_int,
1846 buf: *mut ::c_void,
1847 bufLen: ::size_t,
1848 flags: ::c_int,
1849 ) -> ::ssize_t;
1850
1851 // socket.h
recvfrom( s: ::c_int, buf: *mut ::c_void, bufLen: ::size_t, flags: ::c_int, from: *mut ::sockaddr, pFromLen: *mut ::socklen_t, ) -> ::ssize_t1852 pub fn recvfrom(
1853 s: ::c_int,
1854 buf: *mut ::c_void,
1855 bufLen: ::size_t,
1856 flags: ::c_int,
1857 from: *mut ::sockaddr,
1858 pFromLen: *mut ::socklen_t,
1859 ) -> ::ssize_t;
1860
1861 // socket.h
send( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, ) -> ::ssize_t1862 pub fn send(
1863 socket: ::c_int,
1864 buf: *const ::c_void,
1865 len: ::size_t,
1866 flags: ::c_int,
1867 ) -> ::ssize_t;
1868
1869 // socket.h
sendto( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, addr: *const sockaddr, addrlen: socklen_t, ) -> ::ssize_t1870 pub fn sendto(
1871 socket: ::c_int,
1872 buf: *const ::c_void,
1873 len: ::size_t,
1874 flags: ::c_int,
1875 addr: *const sockaddr,
1876 addrlen: socklen_t,
1877 ) -> ::ssize_t;
1878
1879 // socket.h
setsockopt( socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t, ) -> ::c_int1880 pub fn setsockopt(
1881 socket: ::c_int,
1882 level: ::c_int,
1883 name: ::c_int,
1884 value: *const ::c_void,
1885 option_len: socklen_t,
1886 ) -> ::c_int;
1887
1888 // socket.h
shutdown(s: ::c_int, how: ::c_int) -> ::c_int1889 pub fn shutdown(s: ::c_int, how: ::c_int) -> ::c_int;
1890
1891 // socket.h
socket( domain: ::c_int, _type: ::c_int, protocol: ::c_int, ) -> ::c_int1892 pub fn socket(
1893 domain: ::c_int,
1894 _type: ::c_int,
1895 protocol: ::c_int,
1896 ) -> ::c_int;
1897
socketpair( domain: ::c_int, type_: ::c_int, protocol: ::c_int, socket_vector: *mut ::c_int, ) -> ::c_int1898 pub fn socketpair(
1899 // Doesn't exist
1900 domain: ::c_int,
1901 type_: ::c_int,
1902 protocol: ::c_int,
1903 socket_vector: *mut ::c_int,
1904 ) -> ::c_int;
1905
1906 // icotl.h
ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int1907 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
1908
1909 // fcntl.h
fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int1910 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
1911
1912 // ntp_rfc2553.h for kernel
1913 // netdb.h for user
gai_strerror(errcode: ::c_int) -> *mut ::c_char1914 pub fn gai_strerror(errcode: ::c_int) -> *mut ::c_char;
1915
1916 // ioLib.h or
1917 // unistd.h
close(fd: ::c_int) -> ::c_int1918 pub fn close(fd: ::c_int) -> ::c_int;
1919
1920 // ioLib.h or
1921 // unistd.h
read( fd: ::c_int, buf: *mut ::c_void, count: ::size_t, ) -> ::ssize_t1922 pub fn read(
1923 // Since this is from FD< big errors might happen
1924 fd: ::c_int,
1925 buf: *mut ::c_void,
1926 count: ::size_t,
1927 ) -> ::ssize_t;
1928
1929 // ioLib.h or
1930 // unistd.h
write( fd: ::c_int, buf: *const ::c_void, count: ::size_t, ) -> ::ssize_t1931 pub fn write(
1932 fd: ::c_int,
1933 buf: *const ::c_void,
1934 count: ::size_t,
1935 ) -> ::ssize_t;
1936
1937 // ioLib.h or
1938 // unistd.h
isatty(fd: ::c_int) -> ::c_int1939 pub fn isatty(fd: ::c_int) -> ::c_int;
1940
1941 // ioLib.h or
1942 // unistd.h
dup(src: ::c_int) -> ::c_int1943 pub fn dup(src: ::c_int) -> ::c_int;
1944
1945 // ioLib.h or
1946 // unistd.h
dup2(src: ::c_int, dst: ::c_int) -> ::c_int1947 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
1948
1949 // ioLib.h or
1950 // unistd.h
pipe(fds: *mut ::c_int) -> ::c_int1951 pub fn pipe(fds: *mut ::c_int) -> ::c_int;
1952
1953 // ioLib.h or
1954 // unistd.h
unlink(pathname: *const ::c_char) -> ::c_int1955 pub fn unlink(pathname: *const ::c_char) -> ::c_int;
1956
1957 // unistd.h and
1958 // ioLib.h
lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t1959 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
1960
1961 // netdb.h
getaddrinfo( node: *const ::c_char, service: *const ::c_char, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> ::c_int1962 pub fn getaddrinfo(
1963 node: *const ::c_char,
1964 service: *const ::c_char,
1965 hints: *const addrinfo,
1966 res: *mut *mut addrinfo,
1967 ) -> ::c_int;
1968
1969 // netdb.h
freeaddrinfo(res: *mut addrinfo)1970 pub fn freeaddrinfo(res: *mut addrinfo);
1971
1972 // signal.h
signal( signum: ::c_int, handler: sighandler_t, ) -> sighandler_t1973 pub fn signal(
1974 // Probably wrong ...
1975 signum: ::c_int,
1976 handler: sighandler_t,
1977 ) -> sighandler_t;
1978
1979 // unistd.h
getpid() -> ::c_int1980 pub fn getpid() -> ::c_int; //should be pid_t, but is being dodged
1981
1982 // unistd.h
getppid() -> ::c_int1983 pub fn getppid() -> ::c_int;
1984
1985 // wait.h
waitpid( pid: ::c_int, status: *mut ::c_int, optons: ::c_int, ) -> ::c_int1986 pub fn waitpid(
1987 pid: ::c_int, //should be pid_t, but is being dodged
1988 status: *mut ::c_int,
1989 optons: ::c_int,
1990 ) -> ::c_int; //should be pid_t, but is being dodged
1991
1992 // unistd.h
sysconf(attr: ::c_int) -> ::c_long1993 pub fn sysconf(attr: ::c_int) -> ::c_long;
1994
1995 // unistd.h
1996 // For user space, return value is static inline int
1997 // For kernel space, exactly how it should be
getpagesize() -> ::c_int1998 pub fn getpagesize() -> ::c_int;
1999
2000 // stdlib.h
setenv( envVarName: *const ::c_char, envVarValue: *const ::c_char, overwrite: ::c_int, ) -> ::c_int2001 pub fn setenv(
2002 // setenv.c
2003 envVarName: *const ::c_char,
2004 envVarValue: *const ::c_char,
2005 overwrite: ::c_int,
2006 ) -> ::c_int;
2007
2008 // stdlib.h
unsetenv( envVarName: *const ::c_char, ) -> ::c_int2009 pub fn unsetenv(
2010 // setenv.c
2011 envVarName: *const ::c_char,
2012 ) -> ::c_int;
2013
2014 // unistd.h
link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int2015 pub fn link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int;
2016
2017 // unistd.h
readlink( path: *const ::c_char, buf: *mut ::c_char, bufsize: ::size_t, ) -> ::ssize_t2018 pub fn readlink(
2019 path: *const ::c_char,
2020 buf: *mut ::c_char,
2021 bufsize: ::size_t,
2022 ) -> ::ssize_t;
2023
2024 // unistd.h
symlink(path1: *const ::c_char, path2: *const ::c_char) -> ::c_int2025 pub fn symlink(path1: *const ::c_char, path2: *const ::c_char) -> ::c_int;
2026
2027 // dirent.h
opendir(name: *const ::c_char) -> *mut ::DIR2028 pub fn opendir(name: *const ::c_char) -> *mut ::DIR;
2029
2030 // unistd.h
rmdir(path: *const ::c_char) -> ::c_int2031 pub fn rmdir(path: *const ::c_char) -> ::c_int;
2032
2033 // stat.h
mkdir(dirName: *const ::c_char, mode: ::mode_t) -> ::c_int2034 pub fn mkdir(dirName: *const ::c_char, mode: ::mode_t) -> ::c_int;
2035
2036 // stat.h
chmod(path: *const ::c_char, mode: ::mode_t) -> ::c_int2037 pub fn chmod(path: *const ::c_char, mode: ::mode_t) -> ::c_int;
2038
2039 // stat.h
fchmod(attr1: ::c_int, attr2: ::mode_t) -> ::c_int2040 pub fn fchmod(attr1: ::c_int, attr2: ::mode_t) -> ::c_int;
2041
2042 // unistd.h
fsync(fd: ::c_int) -> ::c_int2043 pub fn fsync(fd: ::c_int) -> ::c_int;
2044
2045 // dirent.h
closedir(ptr: *mut ::DIR) -> ::c_int2046 pub fn closedir(ptr: *mut ::DIR) -> ::c_int;
2047
pwrite64( fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off64_t, ) -> ::ssize_t2048 pub fn pwrite64(
2049 fd: ::c_int, // if you want to use fd, you gotta fix these
2050 buf: *const ::c_void,
2051 count: ::size_t,
2052 offset: off64_t,
2053 ) -> ::ssize_t;
2054
pread64( fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off64_t, ) -> ::ssize_t2055 pub fn pread64(
2056 fd: ::c_int,
2057 buf: *const ::c_void,
2058 count: ::size_t,
2059 offset: off64_t,
2060 ) -> ::ssize_t;
2061
2062 // sched.h
sched_yield() -> ::c_int2063 pub fn sched_yield() -> ::c_int;
2064
2065 // errnoLib.h
errnoSet(err: ::c_int) -> ::c_int2066 pub fn errnoSet(err: ::c_int) -> ::c_int;
2067
2068 // errnoLib.h
errnoGet() -> ::c_int2069 pub fn errnoGet() -> ::c_int;
2070
fork( ) -> ::c_int2071 pub fn fork(// Does not exist at all
2072 ) -> ::c_int;
2073
2074 // unistd.h
_exit(status: ::c_int) -> !2075 pub fn _exit(status: ::c_int) -> !;
2076
2077 // unistd.h
setgid(gid: ::gid_t) -> ::c_int2078 pub fn setgid(gid: ::gid_t) -> ::c_int;
2079
2080 // unistd.h
getgid() -> ::gid_t2081 pub fn getgid() -> ::gid_t;
2082
2083 // unistd.h
setuid(uid: ::uid_t) -> ::c_int2084 pub fn setuid(uid: ::uid_t) -> ::c_int;
2085
2086 // unistd.h
getuid() -> ::uid_t2087 pub fn getuid() -> ::uid_t;
2088
setgroups( ngroups: ::c_int, grouplist: *const ::gid_t, ) -> ::c_int2089 pub fn setgroups(
2090 // Does not exist at all
2091 ngroups: ::c_int,
2092 grouplist: *const ::gid_t,
2093 ) -> ::c_int;
2094
2095 // signal.h
sigemptyset(__set: *mut sigset_t) -> ::c_int2096 pub fn sigemptyset(__set: *mut sigset_t) -> ::c_int;
2097
2098 // pthread.h for kernel
2099 // signal.h for user
pthread_sigmask( __how: ::c_int, __set: *const sigset_t, __oset: *mut sigset_t, ) -> ::c_int2100 pub fn pthread_sigmask(
2101 __how: ::c_int,
2102 __set: *const sigset_t,
2103 __oset: *mut sigset_t,
2104 ) -> ::c_int;
2105
execvp( c: *const ::c_char, argv: *const *const ::c_char, ) -> ::c_int2106 pub fn execvp(
2107 // Does not exist at all
2108 c: *const ::c_char,
2109 argv: *const *const ::c_char,
2110 ) -> ::c_int;
2111
2112 // signal.h for user
kill( __pid: ::c_int, __signo: ::c_int, ) -> ::c_int2113 pub fn kill(
2114 __pid: ::c_int, //should be pid_t, but is being dodged
2115 __signo: ::c_int,
2116 ) -> ::c_int;
2117
2118 // signal.h for user
sigqueue( __pid: ::c_int, __signo: ::c_int, __value: ::size_t, ) -> ::c_int2119 pub fn sigqueue(
2120 __pid: ::c_int, //should be pid_t, but is being dodged
2121 __signo: ::c_int,
2122 __value: ::size_t, // Actual type is const union sigval value,
2123 // which is a union of int and void *
2124 ) -> ::c_int;
2125
2126 // signal.h for user
_sigqueue( rtpId: ::RTP_ID, signo: ::c_int, pValue: *mut ::size_t, sigCode: ::c_int, ) -> ::c_int2127 pub fn _sigqueue(
2128 rtpId: ::RTP_ID,
2129 signo: ::c_int,
2130 pValue: *mut ::size_t, // Actual type is const union * sigval value,
2131 // which is a union of int and void *
2132 sigCode: ::c_int,
2133 ) -> ::c_int;
2134
2135 // signal.h
2136 // It seems like for kernel space, this function doesn't actually exist,
2137 // it just macros to kill
taskKill(taskId: ::TASK_ID, signo: ::c_int) -> ::c_int2138 pub fn taskKill(taskId: ::TASK_ID, signo: ::c_int) -> ::c_int;
2139
2140 // signal.h
raise(__signo: ::c_int) -> ::c_int2141 pub fn raise(__signo: ::c_int) -> ::c_int;
2142 // taskLibCommon.h
taskIdSelf() -> ::TASK_ID2143 pub fn taskIdSelf() -> ::TASK_ID;
2144
2145 // rtpLibCommon.h
rtpInfoGet(rtpId: ::RTP_ID, rtpStruct: *mut ::RTP_DESC) -> ::c_int2146 pub fn rtpInfoGet(rtpId: ::RTP_ID, rtpStruct: *mut ::RTP_DESC) -> ::c_int;
2147
2148 // ioLib.h
_realpath( fileName: *const ::c_char, resolvedName: *mut ::c_char, ) -> *mut ::c_char2149 pub fn _realpath(
2150 fileName: *const ::c_char,
2151 resolvedName: *mut ::c_char,
2152 ) -> *mut ::c_char;
2153
2154 // pathLib.h
_pathIsAbsolute( filepath: *const ::c_char, pNameTail: *const *const ::c_char, ) -> bool2155 pub fn _pathIsAbsolute(
2156 filepath: *const ::c_char,
2157 pNameTail: *const *const ::c_char,
2158 ) -> bool;
2159
writev( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, ) -> ::ssize_t2160 pub fn writev(
2161 fd: ::c_int,
2162 iov: *const ::iovec,
2163 iovcnt: ::c_int,
2164 ) -> ::ssize_t;
readv( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, ) -> ::ssize_t2165 pub fn readv(
2166 fd: ::c_int,
2167 iov: *const ::iovec,
2168 iovcnt: ::c_int,
2169 ) -> ::ssize_t;
2170 }
2171
dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int2172 pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int {
2173 unsafe { _rtld_dladdr(addr, info) }
2174 }
2175
2176 //Dummy functions, these don't really exist in VxWorks.
2177
2178 // wait.h macros
WIFEXITED(status: ::c_int) -> bool2179 pub fn WIFEXITED(status: ::c_int) -> bool {
2180 (status & 0xFF00) == 0
2181 }
WIFSIGNALED(status: ::c_int) -> bool2182 pub fn WIFSIGNALED(status: ::c_int) -> bool {
2183 (status & 0xFF00) != 0
2184 }
WIFSTOPPED(status: ::c_int) -> bool2185 pub fn WIFSTOPPED(status: ::c_int) -> bool {
2186 (status & 0xFF0000) != 0
2187 }
WEXITSTATUS(status: ::c_int) -> ::c_int2188 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
2189 status & 0xFF
2190 }
WTERMSIG(status: ::c_int) -> ::c_int2191 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
2192 (status >> 8) & 0xFF
2193 }
WSTOPSIG(status: ::c_int) -> ::c_int2194 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
2195 (status >> 16) & 0xFF
2196 }
2197
pread( _fd: ::c_int, _buf: *mut ::c_void, _count: ::size_t, _offset: off64_t, ) -> ::ssize_t2198 pub fn pread(
2199 _fd: ::c_int,
2200 _buf: *mut ::c_void,
2201 _count: ::size_t,
2202 _offset: off64_t,
2203 ) -> ::ssize_t {
2204 -1
2205 }
2206
pwrite( _fd: ::c_int, _buf: *const ::c_void, _count: ::size_t, _offset: off64_t, ) -> ::ssize_t2207 pub fn pwrite(
2208 _fd: ::c_int,
2209 _buf: *const ::c_void,
2210 _count: ::size_t,
2211 _offset: off64_t,
2212 ) -> ::ssize_t {
2213 -1
2214 }
posix_memalign( memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t, ) -> ::c_int2215 pub fn posix_memalign(
2216 memptr: *mut *mut ::c_void,
2217 align: ::size_t,
2218 size: ::size_t,
2219 ) -> ::c_int {
2220 // check to see if align is a power of 2 and if align is a multiple
2221 // of sizeof(void *)
2222 if (align & align - 1 != 0) || (align % size_of::<::size_t>() != 0) {
2223 return ::EINVAL;
2224 }
2225
2226 unsafe {
2227 // posix_memalign should not set errno
2228 let e = ::errnoGet();
2229
2230 let temp = memalign(align, size);
2231 ::errnoSet(e as ::c_int);
2232
2233 if temp.is_null() {
2234 ::ENOMEM
2235 } else {
2236 *memptr = temp;
2237 0
2238 }
2239 }
2240 }
2241
2242 // From sysconf.c -> doesn't seem to be supported?
getpwuid_r( _uid: ::uid_t, _pwd: *mut passwd, _buf: *mut ::c_char, _buflen: ::size_t, _result: *mut *mut passwd, ) -> ::c_int2243 pub fn getpwuid_r(
2244 _uid: ::uid_t,
2245 _pwd: *mut passwd,
2246 _buf: *mut ::c_char,
2247 _buflen: ::size_t,
2248 _result: *mut *mut passwd,
2249 ) -> ::c_int {
2250 0
2251 }
2252
2253 // VxWorks requires that resolvedName be allocated in userspace
realpath( fileName: *const ::c_char, resolvedName: *mut ::c_char, ) -> *mut ::c_char2254 pub fn realpath(
2255 fileName: *const ::c_char,
2256 resolvedName: *mut ::c_char,
2257 ) -> *mut ::c_char {
2258 unsafe {
2259 if resolvedName == null_mut::<::c_char>() {
2260 let emptyResolvedName =
2261 super::malloc(::_POSIX_PATH_MAX as _) as *mut ::c_char;
2262 let r = _realpath(fileName, emptyResolvedName);
2263
2264 if r == null_mut::<::c_char>() {
2265 super::free(emptyResolvedName as *mut _);
2266 }
2267 r
2268 } else {
2269 _realpath(fileName, resolvedName)
2270 }
2271 }
2272 }
2273
2274 cfg_if! {
2275 if #[cfg(libc_core_cvoid)] {
2276 pub use ::ffi::c_void;
2277 } else {
2278 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
2279 // enable more optimization opportunities around it recognizing things
2280 // like malloc/free.
2281 #[repr(u8)]
2282 #[allow(missing_copy_implementations)]
2283 #[allow(missing_debug_implementations)]
2284 pub enum c_void {
2285 // Two dummy variants so the #[repr] attribute can be used.
2286 #[doc(hidden)]
2287 __variant1,
2288 #[doc(hidden)]
2289 __variant2,
2290 }
2291 }
2292 }
2293
2294 cfg_if! {
2295 if #[cfg(target_arch = "aarch64")] {
2296 mod aarch64;
2297 pub use self::aarch64::*;
2298 } else if #[cfg(any(target_arch = "arm"))] {
2299 mod arm;
2300 pub use self::arm::*;
2301 } else if #[cfg(any(target_arch = "armv7"))] {
2302 mod armv7;
2303 pub use self::armv7::*;
2304 } else if #[cfg(any(target_arch = "x86"))] {
2305 mod x86;
2306 pub use self::x86::*;
2307 } else if #[cfg(any(target_arch = "x86_64"))] {
2308 mod x86_64;
2309 pub use self::x86_64::*;
2310 } else if #[cfg(any(target_arch = "powerpc"))] {
2311 mod powerpc;
2312 pub use self::powerpc::*;
2313 } else if #[cfg(any(target_arch = "powerpc64"))] {
2314 mod powerpc64;
2315 pub use self::powerpc64::*;
2316 } else {
2317 // Unknown target_arch
2318 }
2319 }
2320