From 81c9783f4eb809c0a608ffde409b2f3facf1aa85 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Tue, 31 Mar 2026 00:07:39 +0800 Subject: [PATCH] newlib/espidf: Move DT_* to espidf/mod.rs The values are different from standard newlib. --- src/unix/mod.rs | 6 +++++- src/unix/newlib/espidf/mod.rs | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 79c3ef8be2220..46b356a9e800a 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -252,7 +252,11 @@ pub const SIG_IGN: sighandler_t = 1 as sighandler_t; pub const SIG_ERR: sighandler_t = !0 as sighandler_t; cfg_if! { - if #[cfg(all(not(target_os = "nto"), not(target_os = "aix")))] { + if #[cfg(all( + not(target_os = "nto"), + not(target_os = "aix"), + not(target_os = "espidf") + ))] { pub const DT_UNKNOWN: u8 = 0; pub const DT_FIFO: u8 = 1; pub const DT_CHR: u8 = 2; diff --git a/src/unix/newlib/espidf/mod.rs b/src/unix/newlib/espidf/mod.rs index d3b01b883566b..b791bbe265368 100644 --- a/src/unix/newlib/espidf/mod.rs +++ b/src/unix/newlib/espidf/mod.rs @@ -99,6 +99,17 @@ pub const NSIG: size_t = 32; pub const SOMAXCONN: c_int = 128; +pub const DT_UNKNOWN: u8 = 0; +pub const DT_REG: u8 = 1; +pub const DT_DIR: u8 = 2; +// Not used by esp-idf, but still defined in headers. +pub const DT_CHR: u8 = 4; +pub const DT_BLK: u8 = 6; +pub const DT_FIFO: u8 = 8; +pub const DT_LNK: u8 = 10; +pub const DT_SOCK: u8 = 12; +pub const DT_WHT: u8 = 14; + extern "C" { pub fn pthread_create( native: *mut crate::pthread_t,