]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/sys/unix/fs.rs
Rename ErrorKind::Unknown to Uncategorized.
[rust.git] / library / std / src / sys / unix / fs.rs
index 45bae25a0c3822a6ce534cb634dd3dc68592fb8b..a428ce94c8e8632ea00bbceab87abba334f471ee 100644 (file)
@@ -48,7 +48,7 @@
     dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, readdir64_r, stat64,
 };
 
-pub use crate::sys_common::fs::remove_dir_all;
+pub use crate::sys_common::fs::{remove_dir_all, try_exists};
 
 pub struct File(FileDesc);
 
@@ -116,7 +116,7 @@ fn statx(
 
         match STATX_STATE.load(Ordering::Relaxed) {
             0 => {
-                // It is a trick to call `statx` with NULL pointers to check if the syscall
+                // It is a trick to call `statx` with null pointers to check if the syscall
                 // is available. According to the manual, it is expected to fail with EFAULT.
                 // We do this mainly for performance, since it is nearly hundreds times
                 // faster than a normal successful call.
@@ -358,7 +358,7 @@ pub fn created(&self) -> io::Result<SystemTime> {
                     }))
                 } else {
                     Err(io::Error::new_const(
-                        io::ErrorKind::Other,
+                        io::ErrorKind::Uncategorized,
                         &"creation time is not available for the filesystem",
                     ))
                 };
@@ -450,7 +450,7 @@ fn next(&mut self) -> Option<io::Result<DirEntry>> {
                 super::os::set_errno(0);
                 let entry_ptr = libc::readdir(self.inner.dirp.0);
                 if entry_ptr.is_null() {
-                    // NULL can mean either the end is reached or an error occurred.
+                    // null can mean either the end is reached or an error occurred.
                     // So we had to clear errno beforehand to check for an error now.
                     return match super::os::errno() {
                         0 => None,
@@ -1329,7 +1329,7 @@ fn fclonefileat(
     Ok(bytes_copied as u64)
 }
 
-#[cfg(not(target_os = "fuchsia"))]
+#[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
 pub fn chroot(dir: &Path) -> io::Result<()> {
     let dir = cstr(dir)?;
     cvt(unsafe { libc::chroot(dir.as_ptr()) })?;