From 49be10a8179165d24bbb8eb3490c4ca6f94b42c4 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Fri, 1 Nov 2019 07:42:33 -0700 Subject: Update libc crate to 0.2.66 This change updates the libc crate to version 0.2.66. Import subrepo libc/:libc at 4f11029a68040c90acf771976b019c1ef273a8cd --- libc/src/vxworks/aarch64.rs | 1 + libc/src/vxworks/arm.rs | 1 + libc/src/vxworks/armv7.rs | 2 - libc/src/vxworks/mod.rs | 1169 +++++++++++++++++------------------------ libc/src/vxworks/powerpc.rs | 1 + libc/src/vxworks/powerpc64.rs | 1 + libc/src/vxworks/x86.rs | 1 + libc/src/vxworks/x86_64.rs | 3 +- 8 files changed, 475 insertions(+), 704 deletions(-) delete mode 100644 libc/src/vxworks/armv7.rs (limited to 'libc/src/vxworks') diff --git a/libc/src/vxworks/aarch64.rs b/libc/src/vxworks/aarch64.rs index 577c8be..4032488 100644 --- a/libc/src/vxworks/aarch64.rs +++ b/libc/src/vxworks/aarch64.rs @@ -1,3 +1,4 @@ pub type c_char = u8; +pub type wchar_t = u32; pub type c_long = i64; pub type c_ulong = u64; diff --git a/libc/src/vxworks/arm.rs b/libc/src/vxworks/arm.rs index cfdce82..5524006 100644 --- a/libc/src/vxworks/arm.rs +++ b/libc/src/vxworks/arm.rs @@ -1,3 +1,4 @@ pub type c_char = u8; +pub type wchar_t = u32; pub type c_long = i32; pub type c_ulong = u32; diff --git a/libc/src/vxworks/armv7.rs b/libc/src/vxworks/armv7.rs deleted file mode 100644 index 9b0b338..0000000 --- a/libc/src/vxworks/armv7.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub type c_long = i32; -pub type c_ulong = u32; diff --git a/libc/src/vxworks/mod.rs b/libc/src/vxworks/mod.rs index 19aa2b6..a086ded 100755 --- a/libc/src/vxworks/mod.rs +++ b/libc/src/vxworks/mod.rs @@ -1,4 +1,5 @@ -//! Hacking together the definitions for VxWorks Bindings +//! Interface to VxWorks C library + use core::mem::size_of; use core::ptr::null_mut; @@ -24,33 +25,30 @@ pub type c_ulonglong = u64; pub type intmax_t = i64; pub type uintmax_t = u64; -pub type size_t = usize; -pub type ptrdiff_t = isize; -pub type intptr_t = isize; pub type uintptr_t = usize; -pub type ssize_t = isize; +pub type intptr_t = isize; +pub type ptrdiff_t = isize; +pub type size_t = ::uintptr_t; +pub type ssize_t = ::intptr_t; -pub type pid_t = i32; +pub type pid_t = ::c_int; pub type in_addr_t = u32; -pub type in_port_t = u16; pub type sighandler_t = ::size_t; -pub type cc_t = ::c_uchar; +pub type cpuset_t = u32; pub type blkcnt_t = ::c_long; pub type blksize_t = ::c_long; pub type ino_t = ::c_ulong; -pub type ino32_t = u32; -pub type off_t = ::c_longlong; -pub type rlim_t = ::c_ulonglong; +pub type rlim_t = ::c_ulong; pub type suseconds_t = ::c_long; pub type time_t = ::c_long; -pub type wchar_t = ::c_int; + pub type errno_t = ::c_int; pub type useconds_t = ::c_ulong; -pub type socklen_t = ::c_int; +pub type socklen_t = ::c_uint; pub type pthread_t = ::c_ulong; @@ -64,24 +62,20 @@ pub type uid_t = ::c_ushort; pub type gid_t = ::c_ushort; pub type sigset_t = ::c_ulonglong; pub type key_t = ::c_long; -pub type shmatt_t = ::c_ulong; - -pub type mqd_t = ::c_int; pub type nfds_t = ::c_uint; -pub type nl_item = ::c_int; pub type stat64 = ::stat; pub type pthread_key_t = ::c_ulong; // From b_off_t.h -pub type off64_t = ::c_longlong; -pub type off_t64 = ::c_longlong; +pub type off_t = ::c_longlong; +pub type off64_t = off_t; // From b_BOOL.h -pub type BOOL = ::c_int; // excuse me what +pub type BOOL = ::c_int; -//Straight from vxWind.h .. +// From vxWind.h .. pub type _Vx_OBJ_HANDLE = ::c_int; pub type _Vx_TASK_ID = ::_Vx_OBJ_HANDLE; pub type _Vx_MSG_Q_ID = ::_Vx_OBJ_HANDLE; @@ -99,43 +93,28 @@ pub type SD_ID = ::OBJ_HANDLE; pub type CONDVAR_ID = ::OBJ_HANDLE; // From vxTypes.h -pub type _Vx_usr_arg_t = ::ssize_t; // c_int for LP32 -pub type _Vx_exit_code_t = ::ssize_t; // c_int for LP32 +pub type _Vx_usr_arg_t = isize; +pub type _Vx_exit_code_t = isize; pub type _Vx_ticks_t = ::c_uint; pub type _Vx_ticks64_t = ::c_ulonglong; -// From vxTypesBase.h -pub type va_list = *mut ::c_char; - pub type sa_family_t = ::c_uchar; -// structs that only exist in userspace -s! { - // b_struct_vx_eventsResourceCb.h - pub struct _Vx_EVENTS_RSRC { - pub registered : ::c_uint, - pub taskId : ::c_int, - pub options : ::c_uchar, - pub pad : [::c_uchar; 3], - } - - // b_struct_vx_semaphore.h - pub struct _Vx_semaphore { - pub magic : ::c_uint, - pub semType: ::c_uint, - pub options: ::c_uint, - pub recurse: ::c_uint, - pub owned_k: ::c_uint, // owned_k is volatile - pub semId_k: ::_Vx_SEM_ID_KERNEL, - pub state : ::c_uint, //state is union of _Vx_UINT and _Vx_UINT - pub events : ::_Vx_EVENTS_RSRC, +#[cfg_attr(feature = "extra_traits", derive(Debug))] +pub enum _Vx_semaphore {} +impl ::Copy for _Vx_semaphore {} +impl ::Clone for _Vx_semaphore { + fn clone(&self) -> _Vx_semaphore { + *self } +} +s! { // b_pthread_condattr_t.h pub struct pthread_condattr_t { pub condAttrStatus: ::c_int, pub condAttrPshared: ::c_int, - pub _CondAttrClockId: ::clockid_t, + pub condAttrClockId: ::clockid_t, } // b_pthread_cond_t.h @@ -146,23 +125,25 @@ s! { pub condRefCount: ::c_int, pub condMutex: *mut ::pthread_mutex_t, pub condAttr: ::pthread_condattr_t, - pub condSemName: [::c_char; PTHREAD_SHARED_SEM_NAME_MAX] + pub condSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX] } // b_pthread_rwlockattr_t.h pub struct pthread_rwlockattr_t { pub rwlockAttrStatus: ::c_int, + pub rwlockAttrPshared: ::c_int, pub rwlockAttrMaxReaders: ::c_uint, + pub rwlockAttrConformOpt: ::c_uint, } // b_pthread_rwlock_t.h pub struct pthread_rwlock_t { pub rwlockSemId: :: _Vx_SEM_ID, - pub rwlockReadersRefCount: ::c_int, + pub rwlockReadersRefCount: ::c_uint, pub rwlockValid: ::c_int, pub rwlockInitted: ::c_int, pub rwlockAttr: ::pthread_rwlockattr_t, - pub rwlockName: [::c_char; PTHREAD_SHARED_SEM_NAME_MAX] + pub rwlockSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX] } // b_struct_timeval.h @@ -172,29 +153,38 @@ s! { } // socket.h + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } + pub struct sockaddr { pub sa_len : ::c_uchar, pub sa_family : sa_family_t, pub sa_data : [::c_char; 14], } - // socket.h - pub struct sockaddr_storage { - pub ss_len : ::c_uchar, - pub ss_family : ::sa_family_t, - pub __ss_pad1 : [::c_char; _SS_PAD1SIZE], - pub __ss_align : i32, - // pub __ss_pad2 : [::c_char; _SS_PAD2SIZE], - pub __ss_pad2 : [::c_char; 32], - pub __ss_pad3 : [::c_char; 32], - pub __ss_pad4 : [::c_char; 32], - pub __ss_pad5 : [::c_char; 32], - } pub struct iovec { pub iov_base: *mut ::c_void, pub iov_len: ::size_t, } + pub struct msghdr { + pub msg_name: *mut c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: ::c_int, + pub msg_control: *mut c_void, + pub msg_controllen: socklen_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: socklen_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + // poll.h pub struct pollfd { pub fd : ::c_int, @@ -202,40 +192,10 @@ s! { pub revents : ::c_short, } - // dirent.h - pub struct dirent { - pub d_ino : ::ino_t, - // pub d_name : [::c_char; (_PARM_NAME_MAX + 1)], - pub d_name : [::c_char; 32], - pub d_name1 : [::c_char; 32], - pub d_name2 : [::c_char; 32], - pub d_name3 : [::c_char; 32], - pub d_name4 : [::c_char; 32], - pub d_name5 : [::c_char; 32], - pub d_name6 : [::c_char; 32], - pub d_name7 : [::c_char; 32], - } - - pub struct dirent64 { - pub d_ino : ::ino_t, - pub d_off : ::off64_t, - pub d_reclen : u16, - pub d_type : u8, - // pub d_name : [::c_char; 256], - pub d_name : [::c_char; 32], - pub d_name1 : [::c_char; 32], - pub d_name2 : [::c_char; 32], - pub d_name3 : [::c_char; 32], - pub d_name4 : [::c_char; 32], - pub d_name5 : [::c_char; 32], - pub d_name6 : [::c_char; 32], - pub d_name7 : [::c_char; 32], - } // Doesn't seem like it exists anymore - // resource.h - pub struct rlimit { /* Is this really needed? Questionable ... */ - pub rlim_cur : ::size_t, - pub rlim_max : ::size_t, + pub struct rlimit { + pub rlim_cur : ::rlim_t, + pub rlim_max : ::rlim_t, } // stat.h @@ -247,7 +207,7 @@ s! { pub st_uid : ::uid_t, pub st_gid : ::gid_t, pub st_rdev : ::dev_t, - pub st_size : ::off64_t, + pub st_size : ::off_t, pub st_atime : ::time_t, pub st_mtime : ::time_t, pub st_ctime : ::time_t, @@ -292,11 +252,9 @@ s! { } // signal.h - pub struct sigaction { // pulled from kernel side, - pub sa_u : ::size_t, - // This is a union of two function pointers. - // Under the assumption that function pointers are the same - // size as other pointers, we can replace the union with size_t + + pub struct sigaction { + pub sa_u : ::sa_u_t, pub sa_mask : ::sigset_t, pub sa_flags : ::c_int, } @@ -312,24 +270,12 @@ s! { pub struct siginfo_t { pub si_signo : ::c_int, pub si_code : ::c_int, - // This field is a union of int and void * in vxworks - // The size has been set to the larger of the two - pub si_value : ::size_t, - } - - pub struct ipc_perm { - pub __key : key_t, - pub uid : uid_t, - pub gid : gid_t, - pub cuid : uid_t, - pub cgid : gid_t, - pub mode : ::c_ushort, - pub __seq : ::c_ushort, - } - - pub struct shmid_ds { - pub shm_perm : ipc_perm, - pub shm_segsz : ::c_int, + pub si_value : ::sigval, + pub si_errno : ::c_int, + pub si_status: ::c_int, + pub si_addr: *mut ::c_void, + pub si_uid: ::uid_t, + pub si_pid: ::pid_t, } // pthread.h (krnl) @@ -351,7 +297,7 @@ s! { pub mutexCondRefCount: ::c_int, pub mutexSavPriority: ::c_int, pub mutexAttr: ::pthread_mutexattr_t, - pub mutexSemName: [::c_char; PTHREAD_SHARED_SEM_NAME_MAX], + pub mutexSemName: [::c_char; _PTHREAD_SHARED_SEM_NAME_MAX], } // b_struct_timespec.h @@ -360,6 +306,19 @@ s! { pub tv_nsec: ::c_long, } + // time.h + pub struct tm { + pub tm_sec: ::c_int, + pub tm_min: ::c_int, + pub tm_hour: ::c_int, + pub tm_mday: ::c_int, + pub tm_mon: ::c_int, + pub tm_year: ::c_int, + pub tm_wday: ::c_int, + pub tm_yday: ::c_int, + pub tm_isdst: ::c_int, + } + // in.h pub struct in_addr { pub s_addr: in_addr_t, @@ -372,6 +331,7 @@ s! { } // in6.h + #[repr(align(4))] pub struct in6_addr { pub s6_addr: [u8; 16], } @@ -404,9 +364,6 @@ s! { } // in6.h - // There is a different implementation in ipv6.h in - // krnl directory, but this seems to only happen - // when the VSB is built for ipv6 only. pub struct sockaddr_in6 { pub sin6_len : u8, pub sin6_family : u8, @@ -416,21 +373,25 @@ s! { pub sin6_scope_id: u32, } - pub struct sockaddr_un { - pub sun_family: sa_family_t, - //pub sun_path: [::c_char; 108] - pub sun_path: [::c_char; 32], - pub sun_path1: [::c_char; 32], - pub sun_path2: [::c_char; 32], - pub sun_path3: [::c_char; 12], + pub struct Dl_info { + pub dli_fname: *const ::c_char, + pub dli_fbase: *mut ::c_void, + pub dli_sname: *const ::c_char, + pub dli_saddr: *mut ::c_void, + } +} + +s_no_extra_traits! { + // dirent.h + pub struct dirent { + pub d_ino : ::ino_t, + pub d_name : [::c_char; _PARM_NAME_MAX as usize + 1], } - pub struct passwd { - pub pw_name: *mut ::c_char, - pub pw_uid: ::uid_t, - pub pw_gid: ::gid_t, - pub pw_dir: *mut ::c_char, - pub pw_shell: *mut ::c_char, + pub struct sockaddr_un { + pub sun_len: u8, + pub sun_family: sa_family_t, + pub sun_path: [::c_char; 104] } // rtpLibCommon.h @@ -440,25 +401,141 @@ s! { pub entrAddr : *mut ::c_void, pub initTaskId: ::TASK_ID, pub parentId : ::RTP_ID, - //pub pathName : [::c_char; (VX_RTP_NAME_LENGTH + 1)], - pub pathName : [::c_char; 32], - pub pathName1 : [::c_char; 32], - pub pathName2 : [::c_char; 32], - pub pathName3 : [::c_char; 32], - pub pathName4 : [::c_char; 32], - pub pathName5 : [::c_char; 32], - pub pathName6 : [::c_char; 32], - pub pathName7 : [::c_char; 32], - pub taskCnt : u32, + pub pathName : [::c_char; VX_RTP_NAME_LENGTH as usize + 1], + pub taskCnt : ::c_int, pub textStart : *mut ::c_void, pub textEnd : *mut ::c_void, } + // socket.h + pub struct sockaddr_storage { + pub ss_len : ::c_uchar, + pub ss_family : ::sa_family_t, + pub __ss_pad1 : [::c_char; _SS_PAD1SIZE], + pub __ss_align : i32, + pub __ss_pad2 : [::c_char; _SS_PAD2SIZE], + } - pub struct Dl_info { - pub dli_fname: *const ::c_char, - pub dli_fbase: *mut ::c_void, - pub dli_sname: *const ::c_char, - pub dli_saddr: *mut ::c_void, + pub union sa_u_t { + pub sa_handler : ::Option !>, + pub sa_sigaction: ::Option !>, + } + + pub union sigval { + pub sival_int : ::c_int, + pub sival_ptr : *mut ::c_void, + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_ino", &self.d_ino) + .field("d_name", &&self.d_name[..]) + .finish() + } + } + + impl ::fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_un") + .field("sun_len", &self.sun_len) + .field("sun_family", &self.sun_family) + .field("sun_path", &&self.sun_path[..]) + .finish() + } + } + + impl ::fmt::Debug for RTP_DESC { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("RTP_DESC") + .field("status", &self.status) + .field("options", &self.options) + .field("entrAddr", &self.entrAddr) + .field("initTaskId", &self.initTaskId) + .field("parentId", &self.parentId) + .field("pathName", &&self.pathName[..]) + .field("taskCnt", &self.taskCnt) + .field("textStart", &self.textStart) + .field("textEnd", &self.textEnd) + .finish() + } + } + impl ::fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_storage") + .field("ss_len", &self.ss_len) + .field("ss_family", &self.ss_family) + .field("__ss_pad1", &&self.__ss_pad1[..]) + .field("__ss_align", &self.__ss_align) + .field("__ss_pad2", &&self.__ss_pad2[..]) + .finish() + } + } + + impl PartialEq for sa_u_t { + fn eq(&self, other: &sa_u_t) -> bool { + unsafe { + let h1 = match self.sa_handler { + Some(handler) => handler as usize, + None => 0 as usize, + }; + let h2 = match other.sa_handler { + Some(handler) => handler as usize, + None => 0 as usize, + }; + h1 == h2 + } + } + } + impl Eq for sa_u_t {} + impl ::fmt::Debug for sa_u_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + unsafe { + let h = match self.sa_handler { + Some(handler) => handler as usize, + None => 0 as usize, + }; + + f.debug_struct("sa_u_t") + .field("sa_handler", &h) + .finish() + } + } + } + impl ::hash::Hash for sa_u_t { + fn hash(&self, state: &mut H) { + unsafe { + let h = match self.sa_handler { + Some(handler) => handler as usize, + None => 0 as usize, + }; + h.hash(state) + } + } + } + + impl PartialEq for sigval { + fn eq(&self, other: &sigval) -> bool { + unsafe { self.sival_ptr as usize == other.sival_ptr as usize } + } + } + impl Eq for sigval {} + impl ::fmt::Debug for sigval { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigval") + .field("sival_ptr", unsafe { &(self.sival_ptr as usize) }) + .finish() + } + } + impl ::hash::Hash for sigval { + fn hash(&self, state: &mut H) { + unsafe { (self.sival_ptr as usize).hash(state) }; + } + } } } @@ -473,6 +550,8 @@ pub const EAI_SERVICE: ::c_int = 9; pub const EAI_SOCKTYPE: ::c_int = 10; pub const EAI_SYSTEM: ::c_int = 11; +// This is not defined in vxWorks, but we have to define it here +// to make the building pass for getrandom and libstd, FIXME pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; //Clock Lib Stuff @@ -481,7 +560,7 @@ pub const CLOCK_MONOTONIC: ::c_int = 0x1; pub const CLOCK_PROCESS_CPUTIME_ID: ::c_int = 0x2; pub const CLOCK_THREAD_CPUTIME_ID: ::c_int = 0x3; pub const TIMER_ABSTIME: ::c_int = 0x1; -pub const TIME_RELTIME: ::c_int = 0xFFFFFFFE; +pub const TIMER_RELTIME: ::c_int = 0x0; // PTHREAD STUFF pub const PTHREAD_INITIALIZED_OBJ: ::c_int = 0xF70990EF; @@ -499,35 +578,38 @@ pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; pub const PTHREAD_STACK_MIN: usize = 4096; -pub const PTHREAD_SHARED_SEM_NAME_MAX: usize = 30; - -pub const EFAULT: ::c_int = 14; -pub const EBUSY: ::c_int = 16; -pub const EEXIST: ::c_int = 17; -pub const ENODEV: ::c_int = 19; -pub const EINVAL: ::c_int = 22; -pub const EPIPE: ::c_int = 32; -pub const ERANGE: ::c_int = 34; +pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30; // ERRNO STUFF +pub const OK: ::c_int = 0; pub const EPERM: ::c_int = 1; /* Not owner */ pub const ENOENT: ::c_int = 2; /* No such file or directory */ pub const ESRCH: ::c_int = 3; /* No such process */ pub const EINTR: ::c_int = 4; /* Interrupted system call */ -pub const EIOA: ::c_int = 5; /* I/O error */ +pub const EIO: ::c_int = 5; /* I/O error */ pub const ENXIO: ::c_int = 6; /* No such device or address */ pub const E2BIG: ::c_int = 7; /* Arg list too long */ pub const ENOEXEC: ::c_int = 8; /* Exec format error */ pub const EBADF: ::c_int = 9; /* Bad file number */ -pub const CHILD: ::c_int = 10; /* No children */ +pub const ECHILD: ::c_int = 10; /* No children */ pub const EAGAIN: ::c_int = 11; /* No more processes */ pub const ENOMEM: ::c_int = 12; /* Not enough core */ pub const EACCES: ::c_int = 13; /* Permission denied */ +pub const EFAULT: ::c_int = 14; +pub const ENOTEMPTY: ::c_int = 15; +pub const EBUSY: ::c_int = 16; +pub const EEXIST: ::c_int = 17; +pub const ENODEV: ::c_int = 19; +pub const ENOTDIR: ::c_int = 20; +pub const EISDIR: ::c_int = 21; +pub const EINVAL: ::c_int = 22; +pub const ENAMETOOLONG: ::c_int = 26; +pub const EFBIG: ::c_int = 27; +pub const ENOSPC: ::c_int = 28; +pub const EROFS: ::c_int = 30; +pub const EPIPE: ::c_int = 32; pub const EDEADLK: ::c_int = 33; -pub const EINPROGRESS: ::c_int = 68; -pub const EALREADY: ::c_int = 69; -pub const EWOULDBLOCK: ::c_int = 70; -pub const ENOSYS: ::c_int = 71; +pub const ERANGE: ::c_int = 38; pub const EDESTADDRREQ: ::c_int = 40; pub const EPROTOTYPE: ::c_int = 41; pub const ENOPROTOOPT: ::c_int = 42; @@ -550,81 +632,44 @@ pub const ESHUTDOWN: ::c_int = 58; pub const ETOOMANYREFS: ::c_int = 59; pub const ETIMEDOUT: ::c_int = 60; pub const ECONNREFUSED: ::c_int = 61; +pub const EINPROGRESS: ::c_int = 68; +pub const EALREADY: ::c_int = 69; +pub const EWOULDBLOCK: ::c_int = 70; +pub const ENOSYS: ::c_int = 71; +pub const EDQUOT: ::c_int = 83; +pub const ESTALE: ::c_int = 88; // NFS errnos: Refer to pkgs_v2/storage/fs/nfs/h/nfs/nfsCommon.h const M_nfsStat: ::c_int = 48 << 16; enum nfsstat { - NFS_OK = 0, - NFSERR_PERM = 1, - NFSERR_NOENT = 2, - NFSERR_IO = 5, - NFSERR_NXIO = 6, - NFSERR_ACCESS = 13, - NFSERR_EXIST = 17, - NFSERR_XDEV = 18, - NFSERR_NODEV = 19, - NFSERR_NOTDIR = 20, - NFSERR_ISDIR = 21, - NFSERR_INVAL = 22, - NFSERR_FBIG = 27, - NFSERR_NOSPC = 28, - NFSERR_ROFS = 30, - NFSERR_MLINK = 31, - NFSERR_NAMETOOLONG = 63, - NFSERR_NOTEMPTY = 66, - NFSERR_DQUOT = 69, - NFSERR_STALE = 70, NFSERR_REMOTE = 71, NFSERR_WFLUSH = 99, NFSERR_BADHANDLE = 10001, NFSERR_NOT_SYNC = 10002, NFSERR_BAD_COOKIE = 10003, - NFSERR_NOTSUPP = 10004, NFSERR_TOOSMALL = 10005, - NFSERR_SERVERFAULT = 10006, NFSERR_BADTYPE = 10007, NFSERR_JUKEBOX = 10008, } -pub const S_nfsLib_NFS_OK: ::c_int = M_nfsStat | nfsstat::NFS_OK as ::c_int; -pub const S_nfsLib_NFSERR_PERM: ::c_int = - M_nfsStat | nfsstat::NFSERR_PERM as ::c_int; -pub const S_nfsLib_NFSERR_NOENT: ::c_int = - M_nfsStat | nfsstat::NFSERR_NOENT as ::c_int; -pub const S_nfsLib_NFSERR_IO: ::c_int = - M_nfsStat | nfsstat::NFSERR_IO as ::c_int; -pub const S_nfsLib_NFSERR_NXIO: ::c_int = - M_nfsStat | nfsstat::NFSERR_NXIO as ::c_int; -pub const S_nfsLib_NFSERR_ACCESS: ::c_int = - M_nfsStat | nfsstat::NFSERR_ACCESS as ::c_int; -pub const S_nfsLib_NFSERR_EXIST: ::c_int = - M_nfsStat | nfsstat::NFSERR_EXIST as ::c_int; -pub const S_nfsLib_NFSERR_XDEV: ::c_int = - M_nfsStat | nfsstat::NFSERR_XDEV as ::c_int; -pub const S_nfsLib_NFSERR_NODEV: ::c_int = - M_nfsStat | nfsstat::NFSERR_NODEV as ::c_int; -pub const S_nfsLib_NFSERR_NOTDIR: ::c_int = - M_nfsStat | nfsstat::NFSERR_NOTDIR as ::c_int; -pub const S_nfsLib_NFSERR_ISDIR: ::c_int = - M_nfsStat | nfsstat::NFSERR_ISDIR as ::c_int; -pub const S_nfsLib_NFSERR_INVAL: ::c_int = - M_nfsStat | nfsstat::NFSERR_INVAL as ::c_int; -pub const S_nfsLib_NFSERR_FBIG: ::c_int = - M_nfsStat | nfsstat::NFSERR_FBIG as ::c_int; -pub const S_nfsLib_NFSERR_NOSPC: ::c_int = - M_nfsStat | nfsstat::NFSERR_NOSPC as ::c_int; -pub const S_nfsLib_NFSERR_ROFS: ::c_int = - M_nfsStat | nfsstat::NFSERR_ROFS as ::c_int; -pub const S_nfsLib_NFSERR_MLINK: ::c_int = - M_nfsStat | nfsstat::NFSERR_MLINK as ::c_int; -pub const S_nfsLib_NFSERR_NAMETOOLONG: ::c_int = - M_nfsStat | nfsstat::NFSERR_NAMETOOLONG as ::c_int; -pub const S_nfsLib_NFSERR_NOTEMPTY: ::c_int = - M_nfsStat | nfsstat::NFSERR_NOTEMPTY as ::c_int; -pub const S_nfsLib_NFSERR_DQUOT: ::c_int = - M_nfsStat | nfsstat::NFSERR_DQUOT as ::c_int; -pub const S_nfsLib_NFSERR_STALE: ::c_int = - M_nfsStat | nfsstat::NFSERR_STALE as ::c_int; +pub const S_nfsLib_NFS_OK: ::c_int = OK; +pub const S_nfsLib_NFSERR_PERM: ::c_int = EPERM; +pub const S_nfsLib_NFSERR_NOENT: ::c_int = ENOENT; +pub const S_nfsLib_NFSERR_IO: ::c_int = EIO; +pub const S_nfsLib_NFSERR_NXIO: ::c_int = ENXIO; +pub const S_nfsLib_NFSERR_ACCESS: ::c_int = EACCES; +pub const S_nfsLib_NFSERR_EXIST: ::c_int = EEXIST; +pub const S_nfsLib_NFSERR_ENODEV: ::c_int = ENODEV; +pub const S_nfsLib_NFSERR_NOTDIR: ::c_int = ENOTDIR; +pub const S_nfsLib_NFSERR_ISDIR: ::c_int = EISDIR; +pub const S_nfsLib_NFSERR_INVAL: ::c_int = EINVAL; +pub const S_nfsLib_NFSERR_FBIG: ::c_int = EFBIG; +pub const S_nfsLib_NFSERR_NOSPC: ::c_int = ENOSPC; +pub const S_nfsLib_NFSERR_ROFS: ::c_int = EROFS; +pub const S_nfsLib_NFSERR_NAMETOOLONG: ::c_int = ENAMETOOLONG; +pub const S_nfsLib_NFSERR_NOTEMPTY: ::c_int = ENOTEMPTY; +pub const S_nfsLib_NFSERR_DQUOT: ::c_int = EDQUOT; +pub const S_nfsLib_NFSERR_STALE: ::c_int = ESTALE; pub const S_nfsLib_NFSERR_WFLUSH: ::c_int = M_nfsStat | nfsstat::NFSERR_WFLUSH as ::c_int; pub const S_nfsLib_NFSERR_REMOTE: ::c_int = @@ -635,27 +680,34 @@ pub const S_nfsLib_NFSERR_NOT_SYNC: ::c_int = M_nfsStat | nfsstat::NFSERR_NOT_SYNC as ::c_int; pub const S_nfsLib_NFSERR_BAD_COOKIE: ::c_int = M_nfsStat | nfsstat::NFSERR_BAD_COOKIE as ::c_int; -pub const S_nfsLib_NFSERR_NOTSUPP: ::c_int = - M_nfsStat | nfsstat::NFSERR_NOTSUPP as ::c_int; +pub const S_nfsLib_NFSERR_NOTSUPP: ::c_int = EOPNOTSUPP; pub const S_nfsLib_NFSERR_TOOSMALL: ::c_int = M_nfsStat | nfsstat::NFSERR_TOOSMALL as ::c_int; -pub const S_nfsLib_NFSERR_SERVERFAULT: ::c_int = - M_nfsStat | nfsstat::NFSERR_SERVERFAULT as ::c_int; +pub const S_nfsLib_NFSERR_SERVERFAULT: ::c_int = EIO; pub const S_nfsLib_NFSERR_BADTYPE: ::c_int = M_nfsStat | nfsstat::NFSERR_BADTYPE as ::c_int; pub const S_nfsLib_NFSERR_JUKEBOX: ::c_int = M_nfsStat | nfsstat::NFSERR_JUKEBOX as ::c_int; -// IP Stuff? These are allll guesswork +// in.h pub const IPPROTO_IP: ::c_int = 0; -pub const IP_TTL: ::c_int = 4; // not sure if this is right -pub const IP_ADD_MEMBERSHIP: ::c_int = 11; -pub const IP_DROP_MEMBERSHIP: ::c_int = 12; -pub const IPV6_V6ONLY: ::c_int = 26; -pub const IP_MULTICAST_TTL: ::c_int = 33; -pub const IP_MULTICAST_LOOP: ::c_int = 34; -pub const IPV6_MULTICAST_LOOP: ::c_int = 19; -pub const IPPROTO_IPV6: ::c_int = 41; // or this one, for that matter +pub const IPPROTO_IPV6: ::c_int = 41; + +pub const IP_TTL: ::c_int = 4; +pub const IP_MULTICAST_IF: ::c_int = 9; +pub const IP_MULTICAST_TTL: ::c_int = 10; +pub const IP_MULTICAST_LOOP: ::c_int = 11; +pub const IP_ADD_MEMBERSHIP: ::c_int = 12; +pub const IP_DROP_MEMBERSHIP: ::c_int = 13; + +// in6.h +pub const IPV6_V6ONLY: ::c_int = 1; +pub const IPV6_UNICAST_HOPS: ::c_int = 4; +pub const IPV6_MULTICAST_IF: ::c_int = 9; +pub const IPV6_MULTICAST_HOPS: ::c_int = 10; +pub const IPV6_MULTICAST_LOOP: ::c_int = 11; +pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12; +pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13; // STAT Stuff pub const S_IFMT: ::c_int = 0xf000; @@ -666,7 +718,6 @@ pub const S_IFBLK: ::c_int = 0x6000; pub const S_IFREG: ::c_int = 0x8000; pub const S_IFLNK: ::c_int = 0xa000; pub const S_IFSHM: ::c_int = 0xb000; -pub const S_IFDEVMEM: ::c_int = 0xd000; pub const S_IFSOCK: ::c_int = 0xc000; pub const S_ISUID: ::c_int = 0x0800; pub const S_ISGID: ::c_int = 0x0400; @@ -684,21 +735,39 @@ pub const S_IWOTH: ::c_int = 0x0002; pub const S_IXOTH: ::c_int = 0x0001; pub const S_IRWXO: ::c_int = 0x0007; +// socket.h pub const SOL_SOCKET: ::c_int = 0xffff; -pub const SO_BROADCAST: ::c_int = 0x001e; + +pub const SO_DEBUG: ::c_int = 0x0001; +pub const SO_REUSEADDR: ::c_int = 0x0004; +pub const SO_KEEPALIVE: ::c_int = 0x0008; +pub const SO_DONTROUTE: ::c_int = 0x0010; +pub const SO_RCVLOWAT: ::c_int = 0x0012; +pub const SO_SNDLOWAT: ::c_int = 0x0013; pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_ACCEPTCONN: ::c_int = 0x001e; +pub const SO_BROADCAST: ::c_int = 0x0020; +pub const SO_USELOOPBACK: ::c_int = 0x0040; +pub const SO_LINGER: ::c_int = 0x0080; +pub const SO_REUSEPORT: ::c_int = 0x0200; + +pub const SO_VLAN: ::c_int = 0x8000; + +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_TYPE: ::c_int = 0x1008; +pub const SO_BINDTODEVICE: ::c_int = 0x1010; +pub const SO_OOBINLINE: ::c_int = 0x1011; +pub const SO_CONNTIMEO: ::c_int = 0x100a; + pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; pub const SOCK_RAW: ::c_int = 3; pub const SOCK_RDM: ::c_int = 4; pub const SOCK_SEQPACKET: ::c_int = 5; pub const SOCK_PACKET: ::c_int = 10; -pub const SO_DEBUG: ::c_int = 0x0001; -pub const SO_REUSEADDR: ::c_int = 0x0004; -pub const SO_KEEPALIVE: ::c_int = 0x0008; -pub const SO_DONTROUTE: ::c_int = 0x0010; -pub const SO_RCVLOWAT: ::c_int = 0x0012; pub const _SS_MAXSIZE: usize = 128; pub const _SS_ALIGNSIZE: usize = size_of::(); @@ -739,7 +808,7 @@ pub const AF_SOCKDEV: ::c_int = 31; pub const AF_TIPC: ::c_int = 33; pub const AF_MIPC: ::c_int = 34; pub const AF_MIPC_SAFE: ::c_int = 35; -pub const AF_MAX: ::c_int = 36; +pub const AF_MAX: ::c_int = 37; pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; @@ -752,11 +821,9 @@ pub const TCP_NOPUSH: ::c_int = 3; pub const TCP_KEEPIDLE: ::c_int = 4; pub const TCP_KEEPINTVL: ::c_int = 5; pub const TCP_KEEPCNT: ::c_int = 6; -pub const SO_ERROR: ::c_int = 4; -// IO Lib Definitions: - -pub const FIONREAD: ::c_int = 1; +// ioLib.h +pub const FIONREAD: ::c_int = 0x40040001; pub const FIOFLUSH: ::c_int = 2; pub const FIOOPTIONS: ::c_int = 3; pub const FIOBAUDRATE: ::c_int = 4; @@ -767,11 +834,14 @@ pub const FIOWHERE: ::c_int = 8; pub const FIODIRENTRY: ::c_int = 9; pub const FIORENAME: ::c_int = 10; pub const FIOREADYCHANGE: ::c_int = 11; -pub const FIOWRITE: ::c_int = 12; pub const FIODISKCHANGE: ::c_int = 13; pub const FIOCANCEL: ::c_int = 14; pub const FIOSQUEEZE: ::c_int = 15; -pub const FIONBIO: ::c_int = -1878786032; // it goes on ... +pub const FIOGETNAME: ::c_int = 18; +pub const FIONBIO: ::c_int = 0x90040010; + +// limits.h +pub const PATH_MAX: ::c_int = _PARM_PATH_MAX; pub const _POSIX_PATH_MAX: ::c_int = 256; // Some poll stuff @@ -782,11 +852,11 @@ pub const POLLRDNORM: ::c_short = 0x0040; pub const POLLWRNORM: ::c_short = POLLOUT; pub const POLLRDBAND: ::c_short = 0x0080; pub const POLLWRBAND: ::c_short = 0x0100; -pub const POLLER: ::c_short = 0x0008; +pub const POLLERR: ::c_short = 0x0008; pub const POLLHUP: ::c_short = 0x0010; pub const POLLNVAL: ::c_short = 0x0020; -//Some Fcntlcom Stuff (look at fcntlcom.h to find definitions) +// fnctlcom.h pub const FD_CLOEXEC: ::c_int = 1; pub const F_DUPFD: ::c_int = 0; pub const F_GETFD: ::c_int = 1; @@ -800,25 +870,10 @@ pub const F_SETLK: ::c_int = 8; pub const F_SETLKW: ::c_int = 9; pub const F_DUPFD_CLOEXEC: ::c_int = 14; -//Some Dirent.h stuff -pub const DT_UNKNOWN: ::c_uchar = 0x0; -pub const DT_FIFO: ::c_uchar = 0x1; -pub const DT_CHR: ::c_uchar = 0x2; -pub const DT_DIR: ::c_uchar = 0x4; -pub const DT_BLK: ::c_uchar = 0x6; -pub const DT_REG: ::c_uchar = 0x8; -pub const DT_LNK: ::c_uchar = 0xA; -pub const DT_SOCK: ::c_uchar = 0xC; -pub const DT_WHT: ::c_uchar = 0xE; - -// Other Random Stuff -pub const VXSIM_EWOULDBLOCK: ::c_int = 70; -pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; -pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; - +// signal.h pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub const SIG_IGN: sighandler_t = 1 as sighandler_t; -pub const SIG_ERR: sighandler_t = !0 as sighandler_t; +pub const SIG_ERR: sighandler_t = -1 as isize as sighandler_t; pub const SIGHUP: ::c_int = 1; pub const SIGINT: ::c_int = 2; @@ -857,8 +912,8 @@ pub const SI_CHILD: ::c_int = -6; pub const SI_KILL: ::c_int = SI_USER; // vxParams.h definitions -pub const _PARM_NAME_MAX: usize = 255; -pub const _PARM_PATH_MAX: usize = 1024; +pub const _PARM_NAME_MAX: ::c_int = 255; +pub const _PARM_PATH_MAX: ::c_int = 1024; // WAIT STUFF pub const WNOHANG: ::c_int = 0x01; @@ -877,15 +932,15 @@ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { mutexValid: PTHREAD_VALID_OBJ, mutexInitted: PTHREAD_UNUSED_YET_OBJ, mutexCondRefCount: 0, - mutexSavPriority: 0, + mutexSavPriority: -1, mutexAttr: PTHREAD_MUTEXATTR_INITIALIZER, - mutexSemName: [0; PTHREAD_SHARED_SEM_NAME_MAX], + mutexSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX], }; const PTHREAD_CONDATTR_INITIALIZER: pthread_condattr_t = pthread_condattr_t { - condAttrStatus: 0, - condAttrPshared: 0, - _CondAttrClockId: CLOCK_REALTIME, + condAttrStatus: 0xf70990ef, + condAttrPshared: 1, + condAttrClockId: CLOCK_REALTIME, }; pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { condSemId: null_mut(), @@ -894,13 +949,15 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { condRefCount: 0, condMutex: null_mut(), condAttr: PTHREAD_CONDATTR_INITIALIZER, - condSemName: [0; PTHREAD_SHARED_SEM_NAME_MAX], + condSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX], }; const PTHREAD_RWLOCKATTR_INITIALIZER: pthread_rwlockattr_t = pthread_rwlockattr_t { rwlockAttrStatus: PTHREAD_INITIALIZED_OBJ, + rwlockAttrPshared: 1, rwlockAttrMaxReaders: 0, + rwlockAttrConformOpt: 1, }; pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { rwlockSemId: null_mut(), @@ -908,7 +965,7 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { rwlockValid: PTHREAD_VALID_OBJ, rwlockInitted: PTHREAD_UNUSED_YET_OBJ, rwlockAttr: PTHREAD_RWLOCKATTR_INITIALIZER, - rwlockName: [0; PTHREAD_SHARED_SEM_NAME_MAX], + rwlockSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX], }; pub const SEEK_SET: ::c_int = 0; @@ -916,21 +973,22 @@ pub const SEEK_CUR: ::c_int = 1; pub const SEEK_END: ::c_int = 2; // rtpLibCommon.h -pub const VX_RTP_NAME_LENGTH: usize = 255; +pub const VX_RTP_NAME_LENGTH: ::c_int = 255; +pub const RTP_ID_ERROR: ::RTP_ID = -1; -//Some unsupported stuff -pub const _SC_GETPW_R_SIZE_MAX: ::c_int = -1; // Via unistd.h -pub const _SC_PAGESIZE: ::c_int = 64; +// h/public/unistd.h +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 21; // Via unistd.h +pub const _SC_PAGESIZE: ::c_int = 39; pub const O_ACCMODE: ::c_int = 3; pub const O_CLOEXEC: ::c_int = 0x100000; // fcntlcom pub const O_EXCL: ::c_int = 0x0800; pub const O_CREAT: ::c_int = 0x0200; pub const O_TRUNC: ::c_int = 0x0400; pub const O_APPEND: ::c_int = 0x0008; -pub const O_RDWR: ::c_int = 2; -pub const O_WRONLY: ::c_int = 1; +pub const O_RDWR: ::c_int = 0x0002; +pub const O_WRONLY: ::c_int = 0x0001; pub const O_RDONLY: ::c_int = 0; -pub const O_NONBLOCK: ::c_int = 0x4; +pub const O_NONBLOCK: ::c_int = 0x4000; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} @@ -949,7 +1007,49 @@ impl ::Clone for fpos_t { } } -extern { +f! { + pub fn CMSG_ALIGN(len: usize) -> usize { + len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) + } + + pub fn CMSG_NXTHDR(mhdr: *const msghdr, + cmsg: *const cmsghdr) -> *mut cmsghdr { + let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize) + + CMSG_ALIGN(::mem::size_of::<::cmsghdr>()); + let max = (*mhdr).msg_control as usize + + (*mhdr).msg_controllen as usize; + if next <= max { + (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) + as *mut ::cmsghdr + } else { + 0 as *mut ::cmsghdr + } + } + + pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { + if (*mhdr).msg_controllen as usize > 0 { + (*mhdr).msg_control as *mut cmsghdr + } else { + 0 as *mut cmsghdr + } + } + + pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar { + (cmsg as *mut ::c_uchar) + .offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize) + } + + pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::())) + as ::c_uint + } + + pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { + CMSG_ALIGN(::mem::size_of::()) as ::c_uint + length + } +} + +extern "C" { pub fn isalnum(c: c_int) -> c_int; pub fn isalpha(c: c_int) -> c_int; pub fn iscntrl(c: c_int) -> c_int; @@ -961,17 +1061,10 @@ extern { pub fn isspace(c: c_int) -> c_int; pub fn isupper(c: c_int) -> c_int; pub fn isxdigit(c: c_int) -> c_int; + pub fn isblank(c: c_int) -> c_int; pub fn tolower(c: c_int) -> c_int; pub fn toupper(c: c_int) -> c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "fopen$UNIX2003" - )] pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "freopen$UNIX2003" - )] pub fn freopen( filename: *const c_char, mode: *const c_char, @@ -995,10 +1088,6 @@ extern { pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "fputs$UNIX2003" - )] pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; pub fn puts(s: *const c_char) -> c_int; pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; @@ -1008,10 +1097,6 @@ extern { nobj: size_t, stream: *mut FILE, ) -> size_t; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "fwrite$UNIX2003" - )] pub fn fwrite( ptr: *const c_void, size: size_t, @@ -1021,18 +1106,12 @@ extern { pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; pub fn ftell(stream: *mut FILE) -> c_long; pub fn rewind(stream: *mut FILE); - #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; pub fn feof(stream: *mut FILE) -> c_int; pub fn ferror(stream: *mut FILE) -> c_int; pub fn perror(s: *const c_char); pub fn atoi(s: *const c_char) -> c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "strtod$UNIX2003" - )] pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; pub fn strtol( s: *const c_char, @@ -1050,12 +1129,7 @@ extern { pub fn free(p: *mut c_void); pub fn abort() -> !; pub fn exit(status: c_int) -> !; - // pub fn _exit(status: c_int) -> !; - pub fn atexit(cb: extern fn()) -> c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "system$UNIX2003" - )] + pub fn atexit(cb: extern "C" fn()) -> c_int; pub fn system(s: *const c_char) -> c_int; pub fn getenv(s: *const c_char) -> *mut c_char; @@ -1088,11 +1162,6 @@ extern { n: size_t, ) -> c_int; pub fn strlen(cs: *const c_char) -> size_t; - pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "strerror$UNIX2003" - )] pub fn strerror(n: c_int) -> *mut c_char; pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; @@ -1118,12 +1187,7 @@ extern { pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; } -extern { - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] - pub fn getpwnam(name: *const ::c_char) -> *mut passwd; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")] - pub fn getpwuid(uid: ::uid_t) -> *mut passwd; - +extern "C" { pub fn fprintf( stream: *mut ::FILE, format: *const ::c_char, @@ -1147,120 +1211,16 @@ extern { -> ::c_int; pub fn getchar_unlocked() -> ::c_int; pub fn putchar_unlocked(c: ::c_int) -> ::c_int; - pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; - - pub fn pclose(stream: *mut ::FILE) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "fdopen$UNIX2003" - )] pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; pub fn fileno(stream: *mut ::FILE) -> ::c_int; - - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "open$UNIX2003" - )] - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "creat$UNIX2003" - )] pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; - - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn rewinddir(dirp: *mut ::DIR); - - pub fn openat( - dirfd: ::c_int, - pathname: *const ::c_char, - flags: ::c_int, - ... - ) -> ::c_int; - pub fn fchmodat( - dirfd: ::c_int, - pathname: *const ::c_char, - mode: ::mode_t, - flags: ::c_int, - ) -> ::c_int; pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int; - pub fn fchownat( - dirfd: ::c_int, - pathname: *const ::c_char, - owner: ::uid_t, - group: ::gid_t, - flags: ::c_int, - ) -> ::c_int; - #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")] - #[cfg_attr(target_os = "freebsd", link_name = "fstatat@FBSD_1.1")] - pub fn fstatat( - dirfd: ::c_int, - pathname: *const ::c_char, - buf: *mut stat, - flags: ::c_int, - ) -> ::c_int; - pub fn linkat( - olddirfd: ::c_int, - oldpath: *const ::c_char, - newdirfd: ::c_int, - newpath: *const ::c_char, - flags: ::c_int, - ) -> ::c_int; - pub fn mkdirat( - dirfd: ::c_int, - pathname: *const ::c_char, - mode: ::mode_t, - ) -> ::c_int; - pub fn readlinkat( - dirfd: ::c_int, - pathname: *const ::c_char, - buf: *mut ::c_char, - bufsiz: ::size_t, - ) -> ::ssize_t; - pub fn renameat( - olddirfd: ::c_int, - oldpath: *const ::c_char, - newdirfd: ::c_int, - newpath: *const ::c_char, - ) -> ::c_int; - pub fn symlinkat( - target: *const ::c_char, - newdirfd: ::c_int, - linkpath: *const ::c_char, - ) -> ::c_int; - pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; pub fn alarm(seconds: ::c_uint) -> ::c_uint; pub fn fchdir(dirfd: ::c_int) -> ::c_int; pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "lchown$UNIX2003" - )] - pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; - pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; - pub fn execle( - path: *const ::c_char, - arg0: *const ::c_char, - ... - ) -> ::c_int; - pub fn execlp( - file: *const ::c_char, - arg0: *const ::c_char, - ... - ) -> ::c_int; - pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int; - pub fn execve( - prog: *const c_char, - argv: *const *const c_char, - envp: *const *const c_char, - ) -> ::c_int; - /* - pub fn execvp(c: *const c_char, - argv: *const *const c_char) -> ::c_int; - */ - // pub fn fork() -> pid_t; pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; pub fn getegid() -> gid_t; pub fn geteuid() -> uid_t; @@ -1275,46 +1235,14 @@ extern { pub fn pause() -> ::c_int; pub fn seteuid(uid: uid_t) -> ::c_int; pub fn setegid(gid: gid_t) -> ::c_int; - pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; - pub fn setsid() -> pid_t; pub fn sleep(secs: ::c_uint) -> ::c_uint; - pub fn tcgetpgrp(fd: ::c_int) -> pid_t; - pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; pub fn ttyname(fd: ::c_int) -> *mut c_char; pub fn wait(status: *mut ::c_int) -> pid_t; - /* - pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, - offset: off_t) -> ::ssize_t; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "pwrite$UNIX2003")] - pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, - offset: off_t) -> ::ssize_t; - */ pub fn umask(mask: mode_t) -> mode_t; - - // #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] - // pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; - - /* - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "kill$UNIX2003")] - pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; - */ - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "killpg$UNIX2003" - )] - pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int; - pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; - pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; pub fn mlockall(flags: ::c_int) -> ::c_int; pub fn munlockall() -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "mmap$UNIX2003" - )] pub fn mmap( addr: *mut ::c_void, len: ::size_t, @@ -1323,44 +1251,11 @@ extern { fd: ::c_int, offset: off_t, ) -> *mut ::c_void; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "munmap$UNIX2003" - )] pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; - - pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; - pub fn if_indextoname( - ifindex: ::c_uint, - ifname: *mut ::c_char, - ) -> *mut ::c_char; - pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "getrlimit$UNIX2003" - )] - pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "setrlimit$UNIX2003" - )] - pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int; - // #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] - // pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; - - /* - #[cfg_attr(any(target_os = "macos", target_os = "ios"), - link_name = "realpath$DARWIN_EXTSN")] - pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) - -> *mut ::c_char; - */ - pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; - - #[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")] pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; - pub fn pthread_exit(value: *mut ::c_void); + pub fn pthread_exit(value: *mut ::c_void) -> !; pub fn pthread_attr_setdetachstate( attr: *mut ::pthread_attr_t, state: ::c_int, @@ -1378,84 +1273,53 @@ extern { oldact: *mut sigaction, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] pub fn utimes( filename: *const ::c_char, times: *const ::timeval, ) -> ::c_int; + + #[link_name = "_rtld_dlopen"] pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; + + #[link_name = "_rtld_dlerror"] pub fn dlerror() -> *mut ::c_char; + + #[link_name = "_rtld_dlsym"] pub fn dlsym( handle: *mut ::c_void, symbol: *const ::c_char, ) -> *mut ::c_void; + + #[link_name = "_rtld_dlclose"] pub fn dlclose(handle: *mut ::c_void) -> ::c_int; - pub fn res_init() -> ::c_int; - /* - #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] + + #[link_name = "_rtld_dladdr"] + pub fn dladdr(addr: *mut ::c_void, info: *mut Dl_info) -> ::c_int; + + // time.h pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; - #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "mktime$UNIX2003")] - #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] pub fn mktime(tm: *mut tm) -> time_t; - #[cfg_attr(target_os = "netbsd", link_name = "__time50")] pub fn time(time: *mut time_t) -> time_t; - #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")] pub fn gmtime(time_p: *const time_t) -> *mut tm; - #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")] pub fn localtime(time_p: *const time_t) -> *mut tm; - */ - #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")] + pub fn timegm(tm: *mut tm) -> time_t; pub fn difftime(time1: time_t, time0: time_t) -> ::c_double; - - #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] - #[cfg_attr(target_os = "freebsd", link_name = "mknod@FBSD_1.0")] - pub fn mknod( - pathname: *const ::c_char, - mode: ::mode_t, - dev: ::dev_t, - ) -> ::c_int; pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; - // pub fn getservbyname(name: *const ::c_char, - // proto: *const ::c_char) -> *mut servent; - // pub fn getprotobyname(name: *const ::c_char) -> *mut protoent; - // pub fn getprotobynumber(proto: ::c_int) -> *mut protoent; - pub fn chroot(name: *const ::c_char) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "usleep$UNIX2003" - )] - pub fn usleep(secs: ::c_uint) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "putenv$UNIX2003" - )] + pub fn usleep(secs: ::useconds_t) -> ::c_int; pub fn putenv(string: *mut c_char) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__select50")] - // pub fn select(nfds: ::c_int, - // readfs: *mut fd_set, - // writefds: *mut fd_set, - // errorfds: *mut fd_set, - // timeout: *mut timeval) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")] pub fn setlocale( category: ::c_int, locale: *const ::c_char, ) -> *mut ::c_char; - // pub fn localeconv() -> *mut lconv; pub fn sigprocmask( how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")] pub fn sigpending(set: *mut sigset_t) -> ::c_int; - pub fn getsid(pid: pid_t) -> pid_t; - pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; pub fn fseeko( @@ -1464,51 +1328,24 @@ extern { whence: ::c_int, ) -> ::c_int; pub fn ftello(stream: *mut ::FILE) -> ::off_t; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "tcdrain$UNIX2003" - )] - pub fn tcdrain(fd: ::c_int) -> ::c_int; - pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; - pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; - pub fn tcgetsid(fd: ::c_int) -> ::pid_t; - pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; pub fn mkstemp(template: *mut ::c_char) -> ::c_int; - pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char; pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); pub fn closelog(); pub fn setlogmask(maskpri: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")] pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "nice$UNIX2003" - )] - pub fn nice(incr: ::c_int) -> ::c_int; - - pub fn grantpt(fd: ::c_int) -> ::c_int; - pub fn posix_openpt(flags: ::c_int) -> ::c_int; - pub fn ptsname(fd: ::c_int) -> *mut ::c_char; - pub fn unlockpt(fd: ::c_int) -> ::c_int; - - pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char; pub fn getline( lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE, ) -> ssize_t; - pub fn _rtld_dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; } -extern { - // this is gonna be a big one - +extern "C" { // stdlib.h - // This function may not be defined for armv7 pub fn memalign(block_size: ::size_t, size_arg: ::size_t) -> *mut ::c_void; @@ -1519,10 +1356,7 @@ extern { pub fn chdir(attr: *const ::c_char) -> ::c_int; // pthread.h - pub fn pthread_mutexattr_init( - /* PTHREAD STUFF */ - attr: *mut pthread_mutexattr_t, - ) -> ::c_int; + pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; // pthread.h pub fn pthread_mutexattr_destroy( @@ -1584,7 +1418,7 @@ extern { pub fn pthread_create( pThread: *mut ::pthread_t, pAttr: *const ::pthread_attr_t, - start_routine: extern fn(*mut ::c_void) -> *mut ::c_void, + start_routine: extern "C" fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int; @@ -1596,9 +1430,9 @@ extern { // int pthread_atfork (void (*)(void), void (*)(void), void (*)(void)); pub fn pthread_atfork( - prepare: ::Option, - parent: ::Option, - child: ::Option, + prepare: ::Option, + parent: ::Option, + child: ::Option, ) -> ::c_int; // stat.h pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; @@ -1621,12 +1455,7 @@ extern { // fcntl.h or // ioLib.h - pub fn open( - // this might be hacked - path: *const ::c_char, - oflag: ::c_int, - ... - ) -> ::c_int; + pub fn open(path: *const ::c_char, oflag: ::c_int, ...) -> ::c_int; // poll.h pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; @@ -1727,7 +1556,7 @@ extern { // pthread.h pub fn pthread_key_create( key: *mut ::pthread_key_t, - dtor: ::Option, + dtor: ::Option, ) -> ::c_int; // pthread.h @@ -1858,6 +1687,12 @@ extern { pFromLen: *mut ::socklen_t, ) -> ::ssize_t; + pub fn recvmsg( + socket: ::c_int, + mp: *mut ::msghdr, + flags: ::c_int, + ) -> ::ssize_t; + // socket.h pub fn send( socket: ::c_int, @@ -1866,6 +1701,12 @@ extern { flags: ::c_int, ) -> ::ssize_t; + pub fn sendmsg( + socket: ::c_int, + mp: *const ::msghdr, + flags: ::c_int, + ) -> ::ssize_t; + // socket.h pub fn sendto( socket: ::c_int, @@ -1895,14 +1736,6 @@ extern { protocol: ::c_int, ) -> ::c_int; - pub fn socketpair( - // Doesn't exist - domain: ::c_int, - type_: ::c_int, - protocol: ::c_int, - socket_vector: *mut ::c_int, - ) -> ::c_int; - // icotl.h pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; @@ -1919,12 +1752,8 @@ extern { // ioLib.h or // unistd.h - pub fn read( - // Since this is from FD< big errors might happen - fd: ::c_int, - buf: *mut ::c_void, - count: ::size_t, - ) -> ::ssize_t; + pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) + -> ::ssize_t; // ioLib.h or // unistd.h @@ -1970,33 +1799,21 @@ extern { pub fn freeaddrinfo(res: *mut addrinfo); // signal.h - pub fn signal( - // Probably wrong ... - signum: ::c_int, - handler: sighandler_t, - ) -> sighandler_t; + pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; // unistd.h - pub fn getpid() -> ::c_int; //should be pid_t, but is being dodged + pub fn getpid() -> pid_t; // unistd.h - pub fn getppid() -> ::c_int; + pub fn getppid() -> pid_t; // wait.h - pub fn waitpid( - pid: ::c_int, //should be pid_t, but is being dodged - status: *mut ::c_int, - optons: ::c_int, - ) -> ::c_int; //should be pid_t, but is being dodged + pub fn waitpid(pid: pid_t, status: *mut ::c_int, optons: ::c_int) + -> pid_t; // unistd.h pub fn sysconf(attr: ::c_int) -> ::c_long; - // unistd.h - // For user space, return value is static inline int - // For kernel space, exactly how it should be - pub fn getpagesize() -> ::c_int; - // stdlib.h pub fn setenv( // setenv.c @@ -2011,6 +1828,12 @@ extern { envVarName: *const ::c_char, ) -> ::c_int; + // stdlib.h + pub fn realpath( + fileName: *const ::c_char, + resolvedName: *mut ::c_char, + ) -> *mut ::c_char; + // unistd.h pub fn link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int; @@ -2045,20 +1868,6 @@ extern { // dirent.h pub fn closedir(ptr: *mut ::DIR) -> ::c_int; - pub fn pwrite64( - fd: ::c_int, // if you want to use fd, you gotta fix these - buf: *const ::c_void, - count: ::size_t, - offset: off64_t, - ) -> ::ssize_t; - - pub fn pread64( - fd: ::c_int, - buf: *const ::c_void, - count: ::size_t, - offset: off64_t, - ) -> ::ssize_t; - // sched.h pub fn sched_yield() -> ::c_int; @@ -2068,9 +1877,6 @@ extern { // errnoLib.h pub fn errnoGet() -> ::c_int; - pub fn fork(// Does not exist at all - ) -> ::c_int; - // unistd.h pub fn _exit(status: ::c_int) -> !; @@ -2086,12 +1892,6 @@ extern { // unistd.h pub fn getuid() -> ::uid_t; - pub fn setgroups( - // Does not exist at all - ngroups: ::c_int, - grouplist: *const ::gid_t, - ) -> ::c_int; - // signal.h pub fn sigemptyset(__set: *mut sigset_t) -> ::c_int; @@ -2103,47 +1903,45 @@ extern { __oset: *mut sigset_t, ) -> ::c_int; - pub fn execvp( - // Does not exist at all - c: *const ::c_char, - argv: *const *const ::c_char, - ) -> ::c_int; - // signal.h for user - pub fn kill( - __pid: ::c_int, //should be pid_t, but is being dodged - __signo: ::c_int, - ) -> ::c_int; + pub fn kill(__pid: pid_t, __signo: ::c_int) -> ::c_int; // signal.h for user pub fn sigqueue( - __pid: ::c_int, //should be pid_t, but is being dodged + __pid: pid_t, __signo: ::c_int, - __value: ::size_t, // Actual type is const union sigval value, - // which is a union of int and void * + __value: ::sigval, ) -> ::c_int; // signal.h for user pub fn _sigqueue( rtpId: ::RTP_ID, signo: ::c_int, - pValue: *mut ::size_t, // Actual type is const union * sigval value, - // which is a union of int and void * + pValue: *const ::sigval, sigCode: ::c_int, ) -> ::c_int; // signal.h - // It seems like for kernel space, this function doesn't actually exist, - // it just macros to kill pub fn taskKill(taskId: ::TASK_ID, signo: ::c_int) -> ::c_int; // signal.h pub fn raise(__signo: ::c_int) -> ::c_int; + // taskLibCommon.h pub fn taskIdSelf() -> ::TASK_ID; + pub fn taskDelay(ticks: ::_Vx_ticks_t) -> ::c_int; // rtpLibCommon.h pub fn rtpInfoGet(rtpId: ::RTP_ID, rtpStruct: *mut ::RTP_DESC) -> ::c_int; + pub fn 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_ID; // ioLib.h pub fn _realpath( @@ -2154,8 +1952,8 @@ extern { // pathLib.h pub fn _pathIsAbsolute( filepath: *const ::c_char, - pNameTail: *const *const ::c_char, - ) -> bool; + pNameTail: *mut *const ::c_char, + ) -> BOOL; pub fn writev( fd: ::c_int, @@ -2167,10 +1965,12 @@ extern { iov: *const ::iovec, iovcnt: ::c_int, ) -> ::ssize_t; -} -pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int { - unsafe { _rtld_dladdr(addr, info) } + // randomNumGen.h + pub fn randBytes(buf: *mut c_uchar, length: c_int) -> c_int; + pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int; + pub fn randUBytes(buf: *mut c_uchar, length: c_int) -> c_int; + pub fn randSecure() -> c_int; } //Dummy functions, these don't really exist in VxWorks. @@ -2219,7 +2019,9 @@ pub fn posix_memalign( ) -> ::c_int { // check to see if align is a power of 2 and if align is a multiple // of sizeof(void *) - if (align & align - 1 != 0) || (align % size_of::<::size_t>() != 0) { + if (align & align - 1 != 0) + || (align as usize % size_of::<::size_t>() != 0) + { return ::EINVAL; } @@ -2239,38 +2041,6 @@ pub fn posix_memalign( } } -// From sysconf.c -> doesn't seem to be supported? -pub fn getpwuid_r( - _uid: ::uid_t, - _pwd: *mut passwd, - _buf: *mut ::c_char, - _buflen: ::size_t, - _result: *mut *mut passwd, -) -> ::c_int { - 0 -} - -// VxWorks requires that resolvedName be allocated in userspace -pub fn realpath( - fileName: *const ::c_char, - resolvedName: *mut ::c_char, -) -> *mut ::c_char { - unsafe { - if resolvedName == null_mut::<::c_char>() { - let emptyResolvedName = - super::malloc(::_POSIX_PATH_MAX as _) as *mut ::c_char; - let r = _realpath(fileName, emptyResolvedName); - - if r == null_mut::<::c_char>() { - super::free(emptyResolvedName as *mut _); - } - r - } else { - _realpath(fileName, resolvedName) - } - } -} - cfg_if! { if #[cfg(libc_core_cvoid)] { pub use ::ffi::c_void; @@ -2298,9 +2068,6 @@ cfg_if! { } else if #[cfg(any(target_arch = "arm"))] { mod arm; pub use self::arm::*; - } else if #[cfg(any(target_arch = "armv7"))] { - mod armv7; - pub use self::armv7::*; } else if #[cfg(any(target_arch = "x86"))] { mod x86; pub use self::x86::*; diff --git a/libc/src/vxworks/powerpc.rs b/libc/src/vxworks/powerpc.rs index cfdce82..5524006 100644 --- a/libc/src/vxworks/powerpc.rs +++ b/libc/src/vxworks/powerpc.rs @@ -1,3 +1,4 @@ pub type c_char = u8; +pub type wchar_t = u32; pub type c_long = i32; pub type c_ulong = u32; diff --git a/libc/src/vxworks/powerpc64.rs b/libc/src/vxworks/powerpc64.rs index 577c8be..4032488 100644 --- a/libc/src/vxworks/powerpc64.rs +++ b/libc/src/vxworks/powerpc64.rs @@ -1,3 +1,4 @@ pub type c_char = u8; +pub type wchar_t = u32; pub type c_long = i64; pub type c_ulong = u64; diff --git a/libc/src/vxworks/x86.rs b/libc/src/vxworks/x86.rs index 81ba145..e617bb8 100644 --- a/libc/src/vxworks/x86.rs +++ b/libc/src/vxworks/x86.rs @@ -1,3 +1,4 @@ pub type c_char = i8; +pub type wchar_t = i32; pub type c_long = i32; pub type c_ulong = u32; diff --git a/libc/src/vxworks/x86_64.rs b/libc/src/vxworks/x86_64.rs index 27b9412..5e95ea2 100644 --- a/libc/src/vxworks/x86_64.rs +++ b/libc/src/vxworks/x86_64.rs @@ -1,3 +1,4 @@ +pub type c_char = i8; +pub type wchar_t = i32; pub type c_long = i64; pub type c_ulong = u64; -pub type c_char = i8; -- cgit v1.2.3