diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 59fd7254441f4..66ab0d5ca988a 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -14,6 +14,7 @@ pub type intptr_t = isize; pub type uintptr_t = usize; pub type ssize_t = isize; +#[cfg(not(target_os = "nuttx"))] pub type pid_t = i32; pub type in_addr_t = u32; pub type in_port_t = u16; diff --git a/src/unix/nuttx/mod.rs b/src/unix/nuttx/mod.rs index 0f65225fe48f3..62b3cba42c7ef 100644 --- a/src/unix/nuttx/mod.rs +++ b/src/unix/nuttx/mod.rs @@ -6,6 +6,7 @@ use crate::{ DIR, }; +pub type pid_t = c_int; pub type nlink_t = u16; pub type ino_t = u16; pub type blkcnt_t = u64; @@ -24,13 +25,20 @@ pub type pthread_rwlockattr_t = i32; pub type pthread_t = i32; pub type rlim_t = i64; pub type sa_family_t = u16; -pub type socklen_t = u32; +pub type socklen_t = c_uint; pub type speed_t = usize; pub type suseconds_t = i32; pub type tcflag_t = u32; -pub type clockid_t = i32; +pub type clockid_t = c_int; pub type time_t = i64; -pub type wchar_t = i32; + +cfg_if! { + if #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] { + pub type wchar_t = c_int; + } else if #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] { + pub type wchar_t = c_uint; + } +} s! { pub struct stat {