Skip to content

Commit caab9c9

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 10dc5e5 commit caab9c9

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
@@ -2200,7 +2200,7 @@ pub fn link(original: &CStr, link: &CStr) -> io::Result<()> {
22002200
target_os = "qurt" => {
22012201
// QuRT doesn't support hard links
22022202
let _ = (original, link);
2203-
return Err(io::const_error!(io::ErrorKind::Unsupported, "link not supported on QuRT"));
2203+
Err(io::const_error!(io::ErrorKind::Unsupported, "link not supported on QuRT"))
22042204
}
22052205
any(
22062206
// VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead.
@@ -2219,14 +2219,15 @@ pub fn link(original: &CStr, link: &CStr) -> io::Result<()> {
22192219
target_env = "nto70",
22202220
) => {
22212221
cvt(unsafe { libc::link(original.as_ptr(), link.as_ptr()) })?;
2222+
Ok(())
22222223
}
22232224
_ => {
22242225
// Where we can, use `linkat` instead of `link`; see the comment above
22252226
// this one for details on why.
22262227
cvt(unsafe { libc::linkat(libc::AT_FDCWD, original.as_ptr(), libc::AT_FDCWD, link.as_ptr(), 0) })?;
2228+
Ok(())
22272229
}
22282230
}
2229-
Ok(())
22302231
}
22312232

22322233
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)