From c7061bddd5c73336effff7284061ae21bfed70e4 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sat, 19 Feb 2022 17:42:38 +0100 Subject: [PATCH 1/2] Remove support for env and process functionality --- library/std/src/sys/unix/os.rs | 10 +++++----- library/std/src/sys/unix/process/mod.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index da546a480c718..628cf265d84aa 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -129,12 +129,12 @@ pub fn error_string(errno: i32) -> String { } } -#[cfg(target_os = "espidf")] +#[cfg(any(target_os = "espidf", target_os = "horizon"))] pub fn getcwd() -> io::Result { Ok(PathBuf::from("/")) } -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] pub fn getcwd() -> io::Result { let mut buf = Vec::with_capacity(512); loop { @@ -161,12 +161,12 @@ pub fn getcwd() -> io::Result { } } -#[cfg(target_os = "espidf")] +#[cfg(any(target_os = "espidf", target_os = "horizon"))] pub fn chdir(p: &path::Path) -> io::Result<()> { super::unsupported::unsupported() } -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] pub fn chdir(p: &path::Path) -> io::Result<()> { let p: &OsStr = p.as_ref(); let p = CString::new(p.as_bytes())?; @@ -560,7 +560,7 @@ pub fn unsetenv(n: &OsStr) -> io::Result<()> { } } -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] pub fn page_size() -> usize { unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize } } diff --git a/library/std/src/sys/unix/process/mod.rs b/library/std/src/sys/unix/process/mod.rs index 0165ece849ee5..422fc44ba1cf2 100644 --- a/library/std/src/sys/unix/process/mod.rs +++ b/library/std/src/sys/unix/process/mod.rs @@ -13,7 +13,7 @@ cfg_if::cfg_if! { } else if #[cfg(target_os = "vxworks")] { #[path = "process_vxworks.rs"] mod process_inner; - } else if #[cfg(target_os = "espidf")] { + } else if #[cfg(any(target_os = "espidf", target_os = "horizon"))] { #[path = "process_unsupported.rs"] mod process_inner; } else { From 04450aa646fabd023524782c66bcf5421fb46eac Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sun, 20 Feb 2022 13:56:05 +0100 Subject: [PATCH 2/2] Readd supported env functionality --- library/std/src/sys/unix/os.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index 628cf265d84aa..00f7f2ab4219a 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -129,12 +129,12 @@ pub fn error_string(errno: i32) -> String { } } -#[cfg(any(target_os = "espidf", target_os = "horizon"))] +#[cfg(target_os = "espidf")] pub fn getcwd() -> io::Result { Ok(PathBuf::from("/")) } -#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] +#[cfg(not(target_os = "espidf"))] pub fn getcwd() -> io::Result { let mut buf = Vec::with_capacity(512); loop { @@ -560,7 +560,7 @@ pub fn unsetenv(n: &OsStr) -> io::Result<()> { } } -#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] +#[cfg(not(target_os = "espidf"))] pub fn page_size() -> usize { unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize } }