From ab62380241b431beb929a2f986fe08375e87a091 Mon Sep 17 00:00:00 2001 From: Scott Mabin Date: Fri, 4 Mar 2022 14:58:35 +0000 Subject: [PATCH] Correct the size of certain types on espidf platform --- src/unix/mod.rs | 11 +++++++++-- src/unix/newlib/mod.rs | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 5ff2294e797c3..b6d08f7dc4365 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -23,8 +23,15 @@ pub type uintptr_t = usize; pub type ssize_t = isize; pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; +cfg_if! { + if #[cfg(target_os = "espidf")] { + pub type uid_t = ::c_ushort; + pub type gid_t = ::c_ushort; + } else { + pub type uid_t = u32; + pub type gid_t = u32; + } +} pub type in_addr_t = u32; pub type in_port_t = u16; pub type sighandler_t = ::size_t; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index f1d738cb05b8e..8f85afb41c9c1 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -1,17 +1,27 @@ pub type blkcnt_t = i32; pub type blksize_t = i32; pub type clockid_t = ::c_ulong; -pub type dev_t = u32; + +cfg_if! { + if #[cfg(target_os = "espidf")] { + pub type dev_t = ::c_short; + pub type ino_t = ::c_ushort; + pub type off_t = ::c_long; + } else { + pub type dev_t = u32; + pub type ino_t = u32; + pub type off_t = i64; + } +} + pub type fsblkcnt_t = u64; pub type fsfilcnt_t = u32; pub type id_t = u32; -pub type ino_t = u32; pub type key_t = ::c_int; pub type loff_t = ::c_longlong; pub type mode_t = ::c_uint; pub type nfds_t = u32; pub type nlink_t = ::c_ushort; -pub type off_t = i64; pub type pthread_t = ::c_ulong; pub type pthread_key_t = ::c_uint; pub type rlim_t = u32;