Skip to content

Commit 697c717

Browse files
author
B I Mohammed Abbas
committed
Add chroot unsupported implementation for VxWorks
1 parent 63d2997 commit 697c717

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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
}

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -1980,14 +1980,20 @@ pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
19801980
#[cfg(target_os = "vxworks")]
19811981
pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
19821982
let (_, _, _) = (path, uid, gid);
1983-
Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks",))
1983+
Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks"))
19841984
}
19851985

19861986
#[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
19871987
pub fn chroot(dir: &Path) -> io::Result<()> {
19881988
run_path_with_cstr(dir, &|dir| cvt(unsafe { libc::chroot(dir.as_ptr()) }).map(|_| ()))
19891989
}
19901990

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+
19911997
pub use remove_dir_impl::remove_dir_all;
19921998

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

0 commit comments

Comments
 (0)