mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Rollup merge of #127480 - biabbas:vxworks, r=workingjubilee
Fix build failure on vxworks #127084 PR to address issue #127084 . 1. Skip `reset_segpipe` for vxworks 2. Return unimplemented error for vxworks from settimes and lchown 3. Temporarily skip dirfd for vxworks 4. Add allow unused unsafe on read_at and write_at functions in unix/fs.rs 5. Using cfg disable ON_BROKEN_PIPE_FLAG_USED and on_broken_pipe_flag_used() for vxworks 6. Remove old crate::syscommon:🧵:min_stack() reference from process_vxworks.rs and update to set stack size of rtpthread Thank you.
This commit is contained in:
commit
ce523d65e0
@ -1064,7 +1064,7 @@ pub fn lchown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io:
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "unix_chroot", since = "1.56.0")]
|
||||
#[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
|
||||
#[cfg(not(target_os = "fuchsia"))]
|
||||
pub fn chroot<P: AsRef<Path>>(dir: P) -> io::Result<()> {
|
||||
sys::fs::chroot(dir.as_ref())
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ impl FileDesc {
|
||||
(&mut me).read_to_end(buf)
|
||||
}
|
||||
|
||||
#[cfg_attr(target_os = "vxworks", allow(unused_unsafe))]
|
||||
pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
|
||||
#[cfg(not(any(
|
||||
all(target_os = "linux", not(target_env = "musl")),
|
||||
@ -318,6 +319,7 @@ impl FileDesc {
|
||||
cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))
|
||||
}
|
||||
|
||||
#[cfg_attr(target_os = "vxworks", allow(unused_unsafe))]
|
||||
pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
|
||||
#[cfg(not(any(
|
||||
all(target_os = "linux", not(target_env = "musl")),
|
||||
|
@ -857,6 +857,7 @@ impl Drop for Dir {
|
||||
target_os = "espidf",
|
||||
target_os = "fuchsia",
|
||||
target_os = "horizon",
|
||||
target_os = "vxworks",
|
||||
)))]
|
||||
{
|
||||
let fd = unsafe { libc::dirfd(self.0) };
|
||||
@ -1313,7 +1314,12 @@ impl File {
|
||||
}
|
||||
|
||||
pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
|
||||
#[cfg(not(any(target_os = "redox", target_os = "espidf", target_os = "horizon")))]
|
||||
#[cfg(not(any(
|
||||
target_os = "redox",
|
||||
target_os = "espidf",
|
||||
target_os = "horizon",
|
||||
target_os = "vxworks"
|
||||
)))]
|
||||
let to_timespec = |time: Option<SystemTime>| match time {
|
||||
Some(time) if let Some(ts) = time.t.to_timespec() => Ok(ts),
|
||||
Some(time) if time > crate::sys::time::UNIX_EPOCH => Err(io::const_io_error!(
|
||||
@ -1327,10 +1333,11 @@ impl File {
|
||||
None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }),
|
||||
};
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon"))] {
|
||||
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "vxworks"))] {
|
||||
// Redox doesn't appear to support `UTIME_OMIT`.
|
||||
// ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
|
||||
// the same as for Redox.
|
||||
// `futimens` and `UTIME_OMIT` are a work in progress for vxworks.
|
||||
let _ = times;
|
||||
Err(io::const_io_error!(
|
||||
io::ErrorKind::Unsupported,
|
||||
@ -1962,6 +1969,7 @@ pub fn fchown(fd: c_int, uid: u32, gid: u32) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "vxworks"))]
|
||||
pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
|
||||
run_path_with_cstr(path, &|path| {
|
||||
cvt(unsafe { libc::lchown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
|
||||
@ -1969,11 +1977,23 @@ pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(target_os = "vxworks")]
|
||||
pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
|
||||
let (_, _, _) = (path, uid, gid);
|
||||
Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks"))
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
|
||||
pub fn chroot(dir: &Path) -> io::Result<()> {
|
||||
run_path_with_cstr(dir, &|dir| cvt(unsafe { libc::chroot(dir.as_ptr()) }).map(|_| ()))
|
||||
}
|
||||
|
||||
#[cfg(target_os = "vxworks")]
|
||||
pub fn chroot(dir: &Path) -> io::Result<()> {
|
||||
let _ = dir;
|
||||
Err(io::const_io_error!(io::ErrorKind::Unsupported, "chroot not supported by vxworks"))
|
||||
}
|
||||
|
||||
pub use remove_dir_impl::remove_dir_all;
|
||||
|
||||
// Fallback for REDOX, ESP-ID, Horizon, Vita, Vxworks and Miri
|
||||
|
@ -164,6 +164,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
|
||||
target_os = "emscripten",
|
||||
target_os = "fuchsia",
|
||||
target_os = "horizon",
|
||||
target_os = "vxworks",
|
||||
// Unikraft's `signal` implementation is currently broken:
|
||||
// https://github.com/unikraft/lib-musl/issues/57
|
||||
target_vendor = "unikraft",
|
||||
@ -209,6 +210,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
|
||||
target_os = "emscripten",
|
||||
target_os = "fuchsia",
|
||||
target_os = "horizon",
|
||||
target_os = "vxworks",
|
||||
)))]
|
||||
static ON_BROKEN_PIPE_FLAG_USED: crate::sync::atomic::AtomicBool =
|
||||
crate::sync::atomic::AtomicBool::new(false);
|
||||
@ -218,6 +220,7 @@ static ON_BROKEN_PIPE_FLAG_USED: crate::sync::atomic::AtomicBool =
|
||||
target_os = "emscripten",
|
||||
target_os = "fuchsia",
|
||||
target_os = "horizon",
|
||||
target_os = "vxworks",
|
||||
)))]
|
||||
pub(crate) fn on_broken_pipe_flag_used() -> bool {
|
||||
ON_BROKEN_PIPE_FLAG_USED.load(crate::sync::atomic::Ordering::Relaxed)
|
||||
|
@ -3,8 +3,8 @@ use crate::io::{self, ErrorKind};
|
||||
use crate::num::NonZero;
|
||||
use crate::sys;
|
||||
use crate::sys::cvt;
|
||||
use crate::sys::pal::unix::thread;
|
||||
use crate::sys::process::process_common::*;
|
||||
use crate::sys_common::thread;
|
||||
use libc::RTP_ID;
|
||||
use libc::{self, c_char, c_int};
|
||||
|
||||
@ -68,7 +68,12 @@ impl Command {
|
||||
.as_ref()
|
||||
.map(|c| c.as_ptr())
|
||||
.unwrap_or_else(|| *sys::os::environ() as *const _);
|
||||
let stack_size = thread::min_stack();
|
||||
let stack_size = crate::cmp::max(
|
||||
crate::env::var_os("RUST_MIN_STACK")
|
||||
.and_then(|s| s.to_str().and_then(|s| s.parse().ok()))
|
||||
.unwrap_or(thread::DEFAULT_MIN_STACK_SIZE),
|
||||
libc::PTHREAD_STACK_MIN,
|
||||
);
|
||||
|
||||
// ensure that access to the environment is synchronized
|
||||
let _lock = sys::os::env_read_lock();
|
||||
|
Loading…
Reference in New Issue
Block a user