Skip to content

Commit 14aa853

Browse files
committed
fixup! std: add platform support for hexagon-unknown-qurt
- Add errno_location link_name for QuRT (_Geterrno) - Enable unix stdio path for QuRT (remove not(target_os = "qurt") gate) - Exclude getppid export on QuRT (no process spawning support) - Fix link() match arms to return Ok(()) from each branch
1 parent d0b000c commit 14aa853

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

library/std/src/sys/fs/unix.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@ pub fn link(original: &CStr, link: &CStr) -> io::Result<()> {
22052205
target_os = "qurt" => {
22062206
// QuRT doesn't support hard links
22072207
let _ = (original, link);
2208-
return Err(io::const_error!(io::ErrorKind::Unsupported, "link not supported on QuRT"));
2208+
Err(io::const_error!(io::ErrorKind::Unsupported, "link not supported on QuRT"))
22092209
}
22102210
any(
22112211
// VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead.
@@ -2224,14 +2224,15 @@ pub fn link(original: &CStr, link: &CStr) -> io::Result<()> {
22242224
target_env = "nto70",
22252225
) => {
22262226
cvt(unsafe { libc::link(original.as_ptr(), link.as_ptr()) })?;
2227+
Ok(())
22272228
}
22282229
_ => {
22292230
// Where we can, use `linkat` instead of `link`; see the comment above
22302231
// this one for details on why.
22312232
cvt(unsafe { libc::linkat(libc::AT_FDCWD, original.as_ptr(), libc::AT_FDCWD, link.as_ptr(), 0) })?;
2233+
Ok(())
22322234
}
22332235
}
2234-
Ok(())
22352236
}
22362237

22372238
pub fn stat(p: &CStr) -> io::Result<FileAttr> {

library/std/src/sys/io/error/unix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ unsafe extern "C" {
3030
#[cfg_attr(any(target_os = "freebsd", target_vendor = "apple"), link_name = "__error")]
3131
#[cfg_attr(target_os = "haiku", link_name = "_errnop")]
3232
#[cfg_attr(target_os = "aix", link_name = "_Errno")]
33+
#[cfg_attr(target_os = "qurt", link_name = "_Geterrno")]
3334
// SAFETY: this will always return the same pointer on a given thread.
3435
#[unsafe(ffi_const)]
3536
pub safe fn errno_location() -> *mut c_int;

library/std/src/sys/process/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cfg_select! {
2727
mod env;
2828

2929
pub use env::CommandEnvs;
30-
#[cfg(target_family = "unix")]
30+
#[cfg(all(target_family = "unix", not(target_os = "qurt")))]
3131
pub use imp::getppid;
3232
pub use imp::{
3333
ChildPipe, Command, CommandArgs, EnvKey, ExitCode, ExitStatus, ExitStatusError, Process, Stdio,

library/std/src/sys/stdio/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
cfg_select! {
44
any(
5-
all(target_family = "unix", not(target_os = "qurt")),
5+
target_family = "unix",
66
target_os = "hermit",
77
target_os = "wasi"
88
) => {

0 commit comments

Comments
 (0)