Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f4dc23c

Browse files
authoredJul 24, 2024··
Unrolled build for rust-lang#127480
Rollup merge of rust-lang#127480 - biabbas:vxworks, r=workingjubilee Fix build failure on vxworks rust-lang#127084 PR to address issue rust-lang#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::thread::min_stack() reference from process_vxworks.rs and update to set stack size of rtpthread Thank you.
2 parents 2ccafed + 0ea5694 commit f4dc23c

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed
 

‎library/std/src/os/unix/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ pub fn lchown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io:
10641064
/// }
10651065
/// ```
10661066
#[stable(feature = "unix_chroot", since = "1.56.0")]
1067-
#[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
1067+
#[cfg(not(target_os = "fuchsia"))]
10681068
pub fn chroot<P: AsRef<Path>>(dir: P) -> io::Result<()> {
10691069
sys::fs::chroot(dir.as_ref())
10701070
}

‎library/std/src/sys/pal/unix/fd.rs

+2
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ impl FileDesc {
125125
(&mut me).read_to_end(buf)
126126
}
127127

128+
#[cfg_attr(target_os = "vxworks", allow(unused_unsafe))]
128129
pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
129130
#[cfg(not(any(
130131
all(target_os = "linux", not(target_env = "musl")),
@@ -318,6 +319,7 @@ impl FileDesc {
318319
cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))
319320
}
320321

322+
#[cfg_attr(target_os = "vxworks", allow(unused_unsafe))]
321323
pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
322324
#[cfg(not(any(
323325
all(target_os = "linux", not(target_env = "musl")),

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

+22-2
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,7 @@ impl Drop for Dir {
857857
target_os = "espidf",
858858
target_os = "fuchsia",
859859
target_os = "horizon",
860+
target_os = "vxworks",
860861
)))]
861862
{
862863
let fd = unsafe { libc::dirfd(self.0) };
@@ -1313,7 +1314,12 @@ impl File {
13131314
}
13141315

13151316
pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
1316-
#[cfg(not(any(target_os = "redox", target_os = "espidf", target_os = "horizon")))]
1317+
#[cfg(not(any(
1318+
target_os = "redox",
1319+
target_os = "espidf",
1320+
target_os = "horizon",
1321+
target_os = "vxworks"
1322+
)))]
13171323
let to_timespec = |time: Option<SystemTime>| match time {
13181324
Some(time) if let Some(ts) = time.t.to_timespec() => Ok(ts),
13191325
Some(time) if time > crate::sys::time::UNIX_EPOCH => Err(io::const_io_error!(
@@ -1327,10 +1333,11 @@ impl File {
13271333
None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }),
13281334
};
13291335
cfg_if::cfg_if! {
1330-
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon"))] {
1336+
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "vxworks"))] {
13311337
// Redox doesn't appear to support `UTIME_OMIT`.
13321338
// ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
13331339
// the same as for Redox.
1340+
// `futimens` and `UTIME_OMIT` are a work in progress for vxworks.
13341341
let _ = times;
13351342
Err(io::const_io_error!(
13361343
io::ErrorKind::Unsupported,
@@ -1962,18 +1969,31 @@ pub fn fchown(fd: c_int, uid: u32, gid: u32) -> io::Result<()> {
19621969
Ok(())
19631970
}
19641971

1972+
#[cfg(not(target_os = "vxworks"))]
19651973
pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
19661974
run_path_with_cstr(path, &|path| {
19671975
cvt(unsafe { libc::lchown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
19681976
.map(|_| ())
19691977
})
19701978
}
19711979

1980+
#[cfg(target_os = "vxworks")]
1981+
pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
1982+
let (_, _, _) = (path, uid, gid);
1983+
Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks"))
1984+
}
1985+
19721986
#[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
19731987
pub fn chroot(dir: &Path) -> io::Result<()> {
19741988
run_path_with_cstr(dir, &|dir| cvt(unsafe { libc::chroot(dir.as_ptr()) }).map(|_| ()))
19751989
}
19761990

1991+
#[cfg(target_os = "vxworks")]
1992+
pub fn chroot(dir: &Path) -> io::Result<()> {
1993+
let _ = dir;
1994+
Err(io::const_io_error!(io::ErrorKind::Unsupported, "chroot not supported by vxworks"))
1995+
}
1996+
19771997
pub use remove_dir_impl::remove_dir_all;
19781998

19791999
// Fallback for REDOX, ESP-ID, Horizon, Vita, Vxworks and Miri

‎library/std/src/sys/pal/unix/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
164164
target_os = "emscripten",
165165
target_os = "fuchsia",
166166
target_os = "horizon",
167+
target_os = "vxworks",
167168
// Unikraft's `signal` implementation is currently broken:
168169
// https://github.com/unikraft/lib-musl/issues/57
169170
target_vendor = "unikraft",
@@ -209,6 +210,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
209210
target_os = "emscripten",
210211
target_os = "fuchsia",
211212
target_os = "horizon",
213+
target_os = "vxworks",
212214
)))]
213215
static ON_BROKEN_PIPE_FLAG_USED: crate::sync::atomic::AtomicBool =
214216
crate::sync::atomic::AtomicBool::new(false);
@@ -218,6 +220,7 @@ static ON_BROKEN_PIPE_FLAG_USED: crate::sync::atomic::AtomicBool =
218220
target_os = "emscripten",
219221
target_os = "fuchsia",
220222
target_os = "horizon",
223+
target_os = "vxworks",
221224
)))]
222225
pub(crate) fn on_broken_pipe_flag_used() -> bool {
223226
ON_BROKEN_PIPE_FLAG_USED.load(crate::sync::atomic::Ordering::Relaxed)

‎library/std/src/sys/pal/unix/process/process_vxworks.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use crate::io::{self, ErrorKind};
33
use crate::num::NonZero;
44
use crate::sys;
55
use crate::sys::cvt;
6+
use crate::sys::pal::unix::thread;
67
use crate::sys::process::process_common::*;
7-
use crate::sys_common::thread;
88
use libc::RTP_ID;
99
use libc::{self, c_char, c_int};
1010

@@ -68,7 +68,12 @@ impl Command {
6868
.as_ref()
6969
.map(|c| c.as_ptr())
7070
.unwrap_or_else(|| *sys::os::environ() as *const _);
71-
let stack_size = thread::min_stack();
71+
let stack_size = crate::cmp::max(
72+
crate::env::var_os("RUST_MIN_STACK")
73+
.and_then(|s| s.to_str().and_then(|s| s.parse().ok()))
74+
.unwrap_or(thread::DEFAULT_MIN_STACK_SIZE),
75+
libc::PTHREAD_STACK_MIN,
76+
);
7277

7378
// ensure that access to the environment is synchronized
7479
let _lock = sys::os::env_read_lock();

0 commit comments

Comments
 (0)
Please sign in to comment.