summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Mabin <scott@mabez.dev>2022-03-04 14:58:35 +0000
committerScott Mabin <scott@mabez.dev>2022-03-04 14:58:35 +0000
commitab62380241b431beb929a2f986fe08375e87a091 (patch)
treeac0ec15d2ea4dc3f3eff9d812b2a159e5c5126fd
parent7650116c3005a64120b3f08e072ac87d4a839de4 (diff)
downloadrust-libc-ab62380241b431beb929a2f986fe08375e87a091.tar.gz
Correct the size of certain types on espidf platform
-rw-r--r--src/unix/mod.rs11
-rw-r--r--src/unix/newlib/mod.rs16
2 files changed, 22 insertions, 5 deletions
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 5ff2294e79..b6d08f7dc4 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 f1d738cb05..8f85afb41c 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;