diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:25 +0000 |
commit | 5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch) | |
tree | 35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /vendor/rustix/src/fs | |
parent | Adding debian version 1.66.0+dfsg1-1. (diff) | |
download | rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip |
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/fs')
-rw-r--r-- | vendor/rustix/src/fs/abs.rs | 42 | ||||
-rw-r--r-- | vendor/rustix/src/fs/at.rs | 55 | ||||
-rw-r--r-- | vendor/rustix/src/fs/constants.rs | 15 | ||||
-rw-r--r-- | vendor/rustix/src/fs/copy_file_range.rs | 6 | ||||
-rw-r--r-- | vendor/rustix/src/fs/cwd.rs | 6 | ||||
-rw-r--r-- | vendor/rustix/src/fs/dir.rs | 4 | ||||
-rw-r--r-- | vendor/rustix/src/fs/fadvise.rs | 8 | ||||
-rw-r--r-- | vendor/rustix/src/fs/fcntl.rs | 72 | ||||
-rw-r--r-- | vendor/rustix/src/fs/fcntl_darwin.rs | 8 | ||||
-rw-r--r-- | vendor/rustix/src/fs/fcopyfile.rs | 16 | ||||
-rw-r--r-- | vendor/rustix/src/fs/fd.rs | 97 | ||||
-rw-r--r-- | vendor/rustix/src/fs/file_type.rs | 4 | ||||
-rw-r--r-- | vendor/rustix/src/fs/getpath.rs | 6 | ||||
-rw-r--r-- | vendor/rustix/src/fs/makedev.rs | 8 | ||||
-rw-r--r-- | vendor/rustix/src/fs/memfd_create.rs | 8 | ||||
-rw-r--r-- | vendor/rustix/src/fs/mod.rs | 51 | ||||
-rw-r--r-- | vendor/rustix/src/fs/openat2.rs | 10 | ||||
-rw-r--r-- | vendor/rustix/src/fs/sendfile.rs | 6 | ||||
-rw-r--r-- | vendor/rustix/src/fs/statx.rs | 10 |
19 files changed, 249 insertions, 183 deletions
diff --git a/vendor/rustix/src/fs/abs.rs b/vendor/rustix/src/fs/abs.rs index 25556304b..a0d6cdecb 100644 --- a/vendor/rustix/src/fs/abs.rs +++ b/vendor/rustix/src/fs/abs.rs @@ -1,33 +1,69 @@ //! POSIX-style filesystem functions which operate on bare paths. #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", + target_os = "solaris", target_os = "wasi", )))] use crate::fs::StatFs; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", - target_os = "netbsd", target_os = "redox", + target_os = "solaris", target_os = "wasi", )))] -use crate::{imp, io, path}; +use { + crate::fs::StatVfs, + crate::{backend, io, path}, +}; /// `statfs`—Queries filesystem metadata. /// +/// Compared to [`statvfs`], this function often provides more information, +/// though it's less portable. +/// /// # References /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man2/statfs.2.html #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", + target_os = "solaris", target_os = "wasi", )))] #[inline] pub fn statfs<P: path::Arg>(path: P) -> io::Result<StatFs> { - path.into_with_c_str(imp::fs::syscalls::statfs) + path.into_with_c_str(backend::fs::syscalls::statfs) +} + +/// `statvfs`—Queries filesystem metadata, POSIX version. +/// +/// Compared to [`statfs`], this function often provides less information, +/// but it is more portable. But even so, filesystems are very diverse and not +/// all the fields are meaningful for every filesystem. And `f_fsid` doesn't +/// seem to have a clear meaning anywhere. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/statvfs.html +/// [Linux]: https://man7.org/linux/man-pages/man2/statvfs.2.html +#[cfg(not(any( + target_os = "haiku", + target_os = "illumos", + target_os = "redox", + target_os = "solaris", + target_os = "wasi", +)))] +#[inline] +pub fn statvfs<P: path::Arg>(path: P) -> io::Result<StatVfs> { + path.into_with_c_str(backend::fs::syscalls::statvfs) } diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs index 2ecd90324..463c247c0 100644 --- a/vendor/rustix/src/fs/at.rs +++ b/vendor/rustix/src/fs/at.rs @@ -5,8 +5,9 @@ //! //! [`cwd`]: crate::fs::cwd +use crate::fd::OwnedFd; use crate::ffi::{CStr, CString}; -#[cfg(not(target_os = "illumos"))] +#[cfg(not(any(target_os = "illumos", target_os = "solaris")))] use crate::fs::Access; #[cfg(any(target_os = "ios", target_os = "macos"))] use crate::fs::CloneFlags; @@ -15,28 +16,27 @@ use crate::fs::FileType; #[cfg(any(target_os = "android", target_os = "linux"))] use crate::fs::RenameFlags; use crate::fs::{AtFlags, Mode, OFlags, Stat, Timestamps}; -use crate::io::{self, OwnedFd}; use crate::path::SMALL_PATH_BUFFER_SIZE; #[cfg(not(target_os = "wasi"))] use crate::process::{Gid, Uid}; -use crate::{imp, path}; +use crate::{backend, io, path}; use alloc::vec::Vec; -use imp::fd::{AsFd, BorrowedFd}; -use imp::time::types::Nsecs; +use backend::fd::{AsFd, BorrowedFd}; +use backend::time::types::Nsecs; -pub use imp::fs::types::{Dev, RawMode}; +pub use backend::fs::types::{Dev, RawMode}; /// `UTIME_NOW` for use with [`utimensat`]. /// /// [`utimensat`]: crate::fs::utimensat #[cfg(not(target_os = "redox"))] -pub const UTIME_NOW: Nsecs = imp::fs::types::UTIME_NOW as Nsecs; +pub const UTIME_NOW: Nsecs = backend::fs::types::UTIME_NOW as Nsecs; /// `UTIME_OMIT` for use with [`utimensat`]. /// /// [`utimensat`]: crate::fs::utimensat #[cfg(not(target_os = "redox"))] -pub const UTIME_OMIT: Nsecs = imp::fs::types::UTIME_OMIT as Nsecs; +pub const UTIME_OMIT: Nsecs = backend::fs::types::UTIME_OMIT as Nsecs; /// `openat(dirfd, path, oflags, mode)`—Opens a file. /// @@ -59,7 +59,9 @@ pub fn openat<P: path::Arg, Fd: AsFd>( oflags: OFlags, create_mode: Mode, ) -> io::Result<OwnedFd> { - path.into_with_c_str(|path| imp::fs::syscalls::openat(dirfd.as_fd(), path, oflags, create_mode)) + path.into_with_c_str(|path| { + backend::fs::syscalls::openat(dirfd.as_fd(), path, oflags, create_mode) + }) } /// `readlinkat(fd, path)`—Reads the contents of a symlink. @@ -89,7 +91,7 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R buffer.resize(buffer.capacity(), 0_u8); loop { - let nread = imp::fs::syscalls::readlinkat(dirfd.as_fd(), path, &mut buffer)?; + let nread = backend::fs::syscalls::readlinkat(dirfd.as_fd(), path, &mut buffer)?; let nread = nread as usize; assert!(nread <= buffer.len()); @@ -112,7 +114,7 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R /// [Linux]: https://man7.org/linux/man-pages/man2/mkdirat.2.html #[inline] pub fn mkdirat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, mode: Mode) -> io::Result<()> { - path.into_with_c_str(|path| imp::fs::syscalls::mkdirat(dirfd.as_fd(), path, mode)) + path.into_with_c_str(|path| backend::fs::syscalls::mkdirat(dirfd.as_fd(), path, mode)) } /// `linkat(old_dirfd, old_path, new_dirfd, new_path, flags)`—Creates a hard @@ -134,7 +136,7 @@ pub fn linkat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>( ) -> io::Result<()> { old_path.into_with_c_str(|old_path| { new_path.into_with_c_str(|new_path| { - imp::fs::syscalls::linkat( + backend::fs::syscalls::linkat( old_dirfd.as_fd(), old_path, new_dirfd.as_fd(), @@ -159,7 +161,7 @@ pub fn linkat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>( /// [Linux]: https://man7.org/linux/man-pages/man2/unlinkat.2.html #[inline] pub fn unlinkat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<()> { - path.into_with_c_str(|path| imp::fs::syscalls::unlinkat(dirfd.as_fd(), path, flags)) + path.into_with_c_str(|path| backend::fs::syscalls::unlinkat(dirfd.as_fd(), path, flags)) } /// `renameat(old_dirfd, old_path, new_dirfd, new_path)`—Renames a file or @@ -180,7 +182,12 @@ pub fn renameat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>( ) -> io::Result<()> { old_path.into_with_c_str(|old_path| { new_path.into_with_c_str(|new_path| { - imp::fs::syscalls::renameat(old_dirfd.as_fd(), old_path, new_dirfd.as_fd(), new_path) + backend::fs::syscalls::renameat( + old_dirfd.as_fd(), + old_path, + new_dirfd.as_fd(), + new_path, + ) }) }) } @@ -204,7 +211,7 @@ pub fn renameat_with<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>( ) -> io::Result<()> { old_path.into_with_c_str(|old_path| { new_path.into_with_c_str(|new_path| { - imp::fs::syscalls::renameat2( + backend::fs::syscalls::renameat2( old_dirfd.as_fd(), old_path, new_dirfd.as_fd(), @@ -231,7 +238,7 @@ pub fn symlinkat<P: path::Arg, Q: path::Arg, Fd: AsFd>( ) -> io::Result<()> { old_path.into_with_c_str(|old_path| { new_path.into_with_c_str(|new_path| { - imp::fs::syscalls::symlinkat(old_path, new_dirfd.as_fd(), new_path) + backend::fs::syscalls::symlinkat(old_path, new_dirfd.as_fd(), new_path) }) }) } @@ -252,7 +259,7 @@ pub fn symlinkat<P: path::Arg, Q: path::Arg, Fd: AsFd>( #[inline] #[doc(alias = "fstatat")] pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<Stat> { - path.into_with_c_str(|path| imp::fs::syscalls::statat(dirfd.as_fd(), path, flags)) + path.into_with_c_str(|path| backend::fs::syscalls::statat(dirfd.as_fd(), path, flags)) } /// `faccessat(dirfd, path, access, flags)`—Tests permissions for a file or @@ -264,7 +271,7 @@ pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io: /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html /// [Linux]: https://man7.org/linux/man-pages/man2/faccessat.2.html -#[cfg(not(target_os = "illumos"))] +#[cfg(not(any(target_os = "illumos", target_os = "solaris")))] #[inline] #[doc(alias = "faccessat")] pub fn accessat<P: path::Arg, Fd: AsFd>( @@ -273,7 +280,7 @@ pub fn accessat<P: path::Arg, Fd: AsFd>( access: Access, flags: AtFlags, ) -> io::Result<()> { - path.into_with_c_str(|path| imp::fs::syscalls::accessat(dirfd.as_fd(), path, access, flags)) + path.into_with_c_str(|path| backend::fs::syscalls::accessat(dirfd.as_fd(), path, access, flags)) } /// `utimensat(dirfd, path, times, flags)`—Sets file or directory timestamps. @@ -291,7 +298,7 @@ pub fn utimensat<P: path::Arg, Fd: AsFd>( times: &Timestamps, flags: AtFlags, ) -> io::Result<()> { - path.into_with_c_str(|path| imp::fs::syscalls::utimensat(dirfd.as_fd(), path, times, flags)) + path.into_with_c_str(|path| backend::fs::syscalls::utimensat(dirfd.as_fd(), path, times, flags)) } /// `fchmodat(dirfd, path, mode, 0)`—Sets file or directory permissions. @@ -312,7 +319,7 @@ pub fn utimensat<P: path::Arg, Fd: AsFd>( #[inline] #[doc(alias = "fchmodat")] pub fn chmodat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, mode: Mode) -> io::Result<()> { - path.into_with_c_str(|path| imp::fs::syscalls::chmodat(dirfd.as_fd(), path, mode)) + path.into_with_c_str(|path| backend::fs::syscalls::chmodat(dirfd.as_fd(), path, mode)) } /// `fclonefileat(src, dst_dir, dst, flags)`—Efficiently copies between files. @@ -330,7 +337,7 @@ pub fn fclonefileat<Fd: AsFd, DstFd: AsFd, P: path::Arg>( flags: CloneFlags, ) -> io::Result<()> { dst.into_with_c_str(|dst| { - imp::fs::syscalls::fclonefileat(src.as_fd(), dst_dir.as_fd(), &dst, flags) + backend::fs::syscalls::fclonefileat(src.as_fd(), dst_dir.as_fd(), dst, flags) }) } @@ -352,7 +359,7 @@ pub fn mknodat<P: path::Arg, Fd: AsFd>( dev: Dev, ) -> io::Result<()> { path.into_with_c_str(|path| { - imp::fs::syscalls::mknodat(dirfd.as_fd(), path, file_type, mode, dev) + backend::fs::syscalls::mknodat(dirfd.as_fd(), path, file_type, mode, dev) }) } @@ -375,6 +382,6 @@ pub fn chownat<P: path::Arg, Fd: AsFd>( flags: AtFlags, ) -> io::Result<()> { path.into_with_c_str(|path| { - imp::fs::syscalls::chownat(dirfd.as_fd(), path, owner, group, flags) + backend::fs::syscalls::chownat(dirfd.as_fd(), path, owner, group, flags) }) } diff --git a/vendor/rustix/src/fs/constants.rs b/vendor/rustix/src/fs/constants.rs index b6893a92e..11b53fd2a 100644 --- a/vendor/rustix/src/fs/constants.rs +++ b/vendor/rustix/src/fs/constants.rs @@ -1,19 +1,20 @@ //! Filesystem API constants, translated into `bitflags` constants. -use crate::imp; +use crate::backend; -pub use imp::fs::types::{Access, FdFlags, Mode, OFlags}; +pub use crate::io::FdFlags; +pub use backend::fs::types::{Access, Mode, OFlags}; #[cfg(not(target_os = "redox"))] -pub use imp::fs::types::AtFlags; +pub use backend::fs::types::AtFlags; #[cfg(any(target_os = "ios", target_os = "macos"))] -pub use imp::fs::types::{CloneFlags, CopyfileFlags}; +pub use backend::fs::types::{CloneFlags, CopyfileFlags}; #[cfg(any(target_os = "android", target_os = "linux"))] -pub use imp::fs::types::{RenameFlags, ResolveFlags}; +pub use backend::fs::types::{RenameFlags, ResolveFlags}; #[cfg(not(target_os = "redox"))] -pub use imp::fs::types::Dev; +pub use backend::fs::types::Dev; -pub use imp::time::types::{Nsecs, Secs, Timespec}; +pub use backend::time::types::{Nsecs, Secs, Timespec}; diff --git a/vendor/rustix/src/fs/copy_file_range.rs b/vendor/rustix/src/fs/copy_file_range.rs index b12190472..4b118b30e 100644 --- a/vendor/rustix/src/fs/copy_file_range.rs +++ b/vendor/rustix/src/fs/copy_file_range.rs @@ -1,5 +1,5 @@ -use crate::{imp, io}; -use imp::fd::AsFd; +use crate::{backend, io}; +use backend::fd::AsFd; /// `copy_file_range(fd_in, off_in, fd_out, off_out, len, 0)`—Copies data /// from one file to another. @@ -16,5 +16,5 @@ pub fn copy_file_range<InFd: AsFd, OutFd: AsFd>( off_out: Option<&mut u64>, len: u64, ) -> io::Result<u64> { - imp::fs::syscalls::copy_file_range(fd_in.as_fd(), off_in, fd_out.as_fd(), off_out, len) + backend::fs::syscalls::copy_file_range(fd_in.as_fd(), off_in, fd_out.as_fd(), off_out, len) } diff --git a/vendor/rustix/src/fs/cwd.rs b/vendor/rustix/src/fs/cwd.rs index 95f97f85d..d0455cd6c 100644 --- a/vendor/rustix/src/fs/cwd.rs +++ b/vendor/rustix/src/fs/cwd.rs @@ -7,8 +7,8 @@ #![allow(unsafe_code)] -use crate::imp; -use imp::fd::{BorrowedFd, RawFd}; +use crate::backend; +use backend::fd::{BorrowedFd, RawFd}; /// `AT_FDCWD`—Returns a handle representing the current working directory. /// @@ -24,7 +24,7 @@ use imp::fd::{BorrowedFd, RawFd}; #[inline] #[doc(alias = "AT_FDCWD")] pub const fn cwd() -> BorrowedFd<'static> { - let at_fdcwd = imp::io::types::AT_FDCWD as RawFd; + let at_fdcwd = backend::io::types::AT_FDCWD as RawFd; // Safety: `AT_FDCWD` is a reserved value that is never dynamically // allocated, so it'll remain valid for the duration of `'static`. diff --git a/vendor/rustix/src/fs/dir.rs b/vendor/rustix/src/fs/dir.rs index f9d7ff871..94bc0a3ee 100644 --- a/vendor/rustix/src/fs/dir.rs +++ b/vendor/rustix/src/fs/dir.rs @@ -1,5 +1,5 @@ //! `Dir` and `Entry`. -use crate::imp; +use crate::backend; -pub use imp::fs::dir::{Dir, DirEntry}; +pub use backend::fs::dir::{Dir, DirEntry}; diff --git a/vendor/rustix/src/fs/fadvise.rs b/vendor/rustix/src/fs/fadvise.rs index ead3ad9a3..5bc3a588a 100644 --- a/vendor/rustix/src/fs/fadvise.rs +++ b/vendor/rustix/src/fs/fadvise.rs @@ -1,7 +1,7 @@ -use crate::{imp, io}; -use imp::fd::AsFd; +use crate::{backend, io}; +use backend::fd::AsFd; -pub use imp::fs::types::Advice; +pub use backend::fs::types::Advice; /// `posix_fadvise(fd, offset, len, advice)`—Declares an expected access /// pattern for a file. @@ -15,5 +15,5 @@ pub use imp::fs::types::Advice; #[inline] #[doc(alias = "posix_fadvise")] pub fn fadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64, advice: Advice) -> io::Result<()> { - imp::fs::syscalls::fadvise(fd.as_fd(), offset, len, advice) + backend::fs::syscalls::fadvise(fd.as_fd(), offset, len, advice) } diff --git a/vendor/rustix/src/fs/fcntl.rs b/vendor/rustix/src/fs/fcntl.rs index 7f89873b5..80ac858c0 100644 --- a/vendor/rustix/src/fs/fcntl.rs +++ b/vendor/rustix/src/fs/fcntl.rs @@ -3,38 +3,16 @@ //! a type-safe API, rustix makes them all separate functions so that they //! can have dedicated static type signatures. -use crate::imp; -use crate::io::{self, OwnedFd}; -use imp::fd::{AsFd, RawFd}; -use imp::fs::types::{FdFlags, OFlags}; +use crate::{backend, io}; +use backend::fd::AsFd; +use backend::fs::types::OFlags; -/// `fcntl(fd, F_GETFD)`—Returns a file descriptor's flags. -/// -/// # References -/// - [POSIX] -/// - [Linux] -/// -/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html -/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html -#[inline] -#[doc(alias = "F_GETFD")] -pub fn fcntl_getfd<Fd: AsFd>(fd: Fd) -> io::Result<FdFlags> { - imp::fs::syscalls::fcntl_getfd(fd.as_fd()) -} - -/// `fcntl(fd, F_SETFD, flags)`—Sets a file descriptor's flags. -/// -/// # References -/// - [POSIX] -/// - [Linux] -/// -/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html -/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html -#[inline] -#[doc(alias = "F_SETFD")] -pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> { - imp::fs::syscalls::fcntl_setfd(fd.as_fd(), flags) -} +// These `fcntl` functions like in the `io` module because they're not specific +// to files, directories, or memfd objects. We re-export them here in the `fs` +// module because the other the `fcntl` functions are here. +#[cfg(not(target_os = "wasi"))] +pub use crate::io::fcntl_dupfd_cloexec; +pub use crate::io::{fcntl_getfd, fcntl_setfd}; /// `fcntl(fd, F_GETFL)`—Returns a file descriptor's access mode and status. /// @@ -47,7 +25,7 @@ pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> { #[inline] #[doc(alias = "F_GETFL")] pub fn fcntl_getfl<Fd: AsFd>(fd: Fd) -> io::Result<OFlags> { - imp::fs::syscalls::fcntl_getfl(fd.as_fd()) + backend::fs::syscalls::fcntl_getfl(fd.as_fd()) } /// `fcntl(fd, F_SETFL, flags)`—Sets a file descriptor's status. @@ -61,7 +39,7 @@ pub fn fcntl_getfl<Fd: AsFd>(fd: Fd) -> io::Result<OFlags> { #[inline] #[doc(alias = "F_SETFL")] pub fn fcntl_setfl<Fd: AsFd>(fd: Fd, flags: OFlags) -> io::Result<()> { - imp::fs::syscalls::fcntl_setfl(fd.as_fd(), flags) + backend::fs::syscalls::fcntl_setfl(fd.as_fd(), flags) } /// `fcntl(fd, F_GET_SEALS)` @@ -79,7 +57,7 @@ pub fn fcntl_setfl<Fd: AsFd>(fd: Fd, flags: OFlags) -> io::Result<()> { #[inline] #[doc(alias = "F_GET_SEALS")] pub fn fcntl_get_seals<Fd: AsFd>(fd: Fd) -> io::Result<SealFlags> { - imp::fs::syscalls::fcntl_get_seals(fd.as_fd()) + backend::fs::syscalls::fcntl_get_seals(fd.as_fd()) } #[cfg(any( @@ -88,7 +66,7 @@ pub fn fcntl_get_seals<Fd: AsFd>(fd: Fd) -> io::Result<SealFlags> { target_os = "fuchsia", target_os = "linux", ))] -pub use imp::fs::types::SealFlags; +pub use backend::fs::types::SealFlags; /// `fcntl(fd, F_ADD_SEALS)` /// @@ -105,27 +83,5 @@ pub use imp::fs::types::SealFlags; #[inline] #[doc(alias = "F_ADD_SEALS")] pub fn fcntl_add_seals<Fd: AsFd>(fd: Fd, seals: SealFlags) -> io::Result<()> { - imp::fs::syscalls::fcntl_add_seals(fd.as_fd(), seals) -} - -/// `fcntl(fd, F_DUPFD_CLOEXEC)`—Creates a new `OwnedFd` instance, with value -/// at least `min`, that has `O_CLOEXEC` set and that shares the same -/// underlying [file description] as `fd`. -/// -/// POSIX guarantees that `F_DUPFD_CLOEXEC` will use the lowest unused file -/// descriptor which is at least `min`, however it is not safe in general to -/// rely on this, as file descriptors may be unexpectedly allocated on other -/// threads or in libraries. -/// -/// # References -/// - [POSIX] -/// - [Linux] -/// -/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html -/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html -#[cfg(not(target_os = "wasi"))] -#[inline] -#[doc(alias = "F_DUPFD_CLOEXEC")] -pub fn fcntl_dupfd_cloexec<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd> { - imp::fs::syscalls::fcntl_dupfd_cloexec(fd.as_fd(), min) + backend::fs::syscalls::fcntl_add_seals(fd.as_fd(), seals) } diff --git a/vendor/rustix/src/fs/fcntl_darwin.rs b/vendor/rustix/src/fs/fcntl_darwin.rs index 17d8f844f..6d624ee47 100644 --- a/vendor/rustix/src/fs/fcntl_darwin.rs +++ b/vendor/rustix/src/fs/fcntl_darwin.rs @@ -1,5 +1,5 @@ -use crate::{imp, io}; -use imp::fd::AsFd; +use crate::{backend, io}; +use backend::fd::AsFd; /// `fcntl(fd, F_RDADVISE, radvisory { offset, len })` /// @@ -9,7 +9,7 @@ use imp::fd::AsFd; /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html #[inline] pub fn fcntl_rdadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64) -> io::Result<()> { - imp::fs::syscalls::fcntl_rdadvise(fd.as_fd(), offset, len) + backend::fs::syscalls::fcntl_rdadvise(fd.as_fd(), offset, len) } /// `fcntl(fd, F_FULLFSYNC)` @@ -20,5 +20,5 @@ pub fn fcntl_rdadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64) -> io::Result<()> /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html #[inline] pub fn fcntl_fullfsync<Fd: AsFd>(fd: Fd) -> io::Result<()> { - imp::fs::syscalls::fcntl_fullfsync(fd.as_fd()) + backend::fs::syscalls::fcntl_fullfsync(fd.as_fd()) } diff --git a/vendor/rustix/src/fs/fcopyfile.rs b/vendor/rustix/src/fs/fcopyfile.rs index c5b00ce10..d8931733f 100644 --- a/vendor/rustix/src/fs/fcopyfile.rs +++ b/vendor/rustix/src/fs/fcopyfile.rs @@ -1,9 +1,9 @@ use crate::fs::CopyfileFlags; -use crate::{imp, io}; -use imp::fd::AsFd; +use crate::{backend, io}; +use backend::fd::AsFd; /// `copyfile_state_t` -pub use imp::fs::types::copyfile_state_t; +pub use backend::fs::types::copyfile_state_t; /// `fcopyfile(from, to, state, flags)` /// @@ -23,7 +23,7 @@ pub unsafe fn fcopyfile<FromFd: AsFd, ToFd: AsFd>( state: copyfile_state_t, flags: CopyfileFlags, ) -> io::Result<()> { - imp::fs::syscalls::fcopyfile(from.as_fd(), to.as_fd(), state, flags) + backend::fs::syscalls::fcopyfile(from.as_fd(), to.as_fd(), state, flags) } /// `copyfile_state_alloc()` @@ -34,7 +34,7 @@ pub unsafe fn fcopyfile<FromFd: AsFd, ToFd: AsFd>( /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/fcopyfile.3.html #[inline] pub fn copyfile_state_alloc() -> io::Result<copyfile_state_t> { - imp::fs::syscalls::copyfile_state_alloc() + backend::fs::syscalls::copyfile_state_alloc() } /// `copyfile_state_free(state)` @@ -50,7 +50,7 @@ pub fn copyfile_state_alloc() -> io::Result<copyfile_state_t> { /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/fcopyfile.3.html #[inline] pub unsafe fn copyfile_state_free(state: copyfile_state_t) -> io::Result<()> { - imp::fs::syscalls::copyfile_state_free(state) + backend::fs::syscalls::copyfile_state_free(state) } /// `copyfile_state_get(state, COPYFILE_STATE_COPIED)` @@ -66,7 +66,7 @@ pub unsafe fn copyfile_state_free(state: copyfile_state_t) -> io::Result<()> { /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/fcopyfile.3.html #[inline] pub unsafe fn copyfile_state_get_copied(state: copyfile_state_t) -> io::Result<u64> { - imp::fs::syscalls::copyfile_state_get_copied(state) + backend::fs::syscalls::copyfile_state_get_copied(state) } /// `copyfile_state_get(state, flags, dst)` @@ -86,5 +86,5 @@ pub unsafe fn copyfile_state_get( flag: u32, dst: *mut core::ffi::c_void, ) -> io::Result<()> { - imp::fs::syscalls::copyfile_state_get(state, flag, dst) + backend::fs::syscalls::copyfile_state_get(state, flag, dst) } diff --git a/vendor/rustix/src/fs/fd.rs b/vendor/rustix/src/fs/fd.rs index b41579fb8..6bea89547 100644 --- a/vendor/rustix/src/fs/fd.rs +++ b/vendor/rustix/src/fs/fd.rs @@ -5,33 +5,46 @@ use crate::fs::Mode; use crate::io::SeekFrom; #[cfg(not(target_os = "wasi"))] use crate::process::{Gid, Uid}; -use crate::{imp, io}; -use imp::fd::{AsFd, BorrowedFd}; +use crate::{backend, io}; +use backend::fd::{AsFd, BorrowedFd}; -#[cfg(not(target_os = "wasi"))] -pub use imp::fs::types::FlockOperation; +#[cfg(not(any(target_os = "solaris", target_os = "wasi")))] +pub use backend::fs::types::FlockOperation; #[cfg(not(any( + target_os = "aix", target_os = "dragonfly", target_os = "illumos", target_os = "netbsd", target_os = "openbsd", target_os = "redox", + target_os = "solaris", )))] -pub use imp::fs::types::FallocateFlags; +pub use backend::fs::types::FallocateFlags; -pub use imp::fs::types::Stat; +pub use backend::fs::types::Stat; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", + target_os = "solaris", + target_os = "wasi", +)))] +pub use backend::fs::types::StatFs; + +#[cfg(not(any( + target_os = "haiku", + target_os = "illumos", + target_os = "redox", + target_os = "solaris", target_os = "wasi", )))] -pub use imp::fs::types::StatFs; +pub use backend::fs::types::{StatVfs, StatVfsMountFlags}; #[cfg(any(target_os = "android", target_os = "linux"))] -pub use imp::fs::types::FsWord; +pub use backend::fs::types::FsWord; /// Timestamps used by [`utimensat`] and [`futimens`]. /// @@ -55,7 +68,7 @@ pub struct Timestamps { /// /// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION #[cfg(any(target_os = "android", target_os = "linux"))] -pub const PROC_SUPER_MAGIC: FsWord = imp::fs::types::PROC_SUPER_MAGIC; +pub const PROC_SUPER_MAGIC: FsWord = backend::fs::types::PROC_SUPER_MAGIC; /// The filesystem magic number for NFS. /// @@ -63,7 +76,7 @@ pub const PROC_SUPER_MAGIC: FsWord = imp::fs::types::PROC_SUPER_MAGIC; /// /// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION #[cfg(any(target_os = "android", target_os = "linux"))] -pub const NFS_SUPER_MAGIC: FsWord = imp::fs::types::NFS_SUPER_MAGIC; +pub const NFS_SUPER_MAGIC: FsWord = backend::fs::types::NFS_SUPER_MAGIC; /// `lseek(fd, offset, whence)`—Repositions a file descriptor within a file. /// @@ -75,7 +88,7 @@ pub const NFS_SUPER_MAGIC: FsWord = imp::fs::types::NFS_SUPER_MAGIC; /// [Linux]: https://man7.org/linux/man-pages/man2/lseek.2.html #[inline] pub fn seek<Fd: AsFd>(fd: Fd, pos: SeekFrom) -> io::Result<u64> { - imp::fs::syscalls::seek(fd.as_fd(), pos) + backend::fs::syscalls::seek(fd.as_fd(), pos) } /// `lseek(fd, 0, SEEK_CUR)`—Returns the current position within a file. @@ -92,7 +105,7 @@ pub fn seek<Fd: AsFd>(fd: Fd, pos: SeekFrom) -> io::Result<u64> { /// [Linux]: https://man7.org/linux/man-pages/man2/lseek.2.html #[inline] pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> { - imp::fs::syscalls::tell(fd.as_fd()) + backend::fs::syscalls::tell(fd.as_fd()) } /// `fchmod(fd)`—Sets open file or directory permissions. @@ -109,7 +122,7 @@ pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> { #[cfg(not(target_os = "wasi"))] #[inline] pub fn fchmod<Fd: AsFd>(fd: Fd, mode: Mode) -> io::Result<()> { - imp::fs::syscalls::fchmod(fd.as_fd(), mode) + backend::fs::syscalls::fchmod(fd.as_fd(), mode) } /// `fchown(fd)`—Sets open file or directory ownership. @@ -123,7 +136,7 @@ pub fn fchmod<Fd: AsFd>(fd: Fd, mode: Mode) -> io::Result<()> { #[cfg(not(target_os = "wasi"))] #[inline] pub fn fchown<Fd: AsFd>(fd: Fd, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> { - imp::fs::syscalls::fchown(fd.as_fd(), owner, group) + backend::fs::syscalls::fchown(fd.as_fd(), owner, group) } /// `fstat(fd)`—Queries metadata for an open file or directory. @@ -141,24 +154,55 @@ pub fn fchown<Fd: AsFd>(fd: Fd, owner: Option<Uid>, group: Option<Gid>) -> io::R /// [`FileType::from_raw_mode`]: crate::fs::FileType::from_raw_mode #[inline] pub fn fstat<Fd: AsFd>(fd: Fd) -> io::Result<Stat> { - imp::fs::syscalls::fstat(fd.as_fd()) + backend::fs::syscalls::fstat(fd.as_fd()) } /// `fstatfs(fd)`—Queries filesystem statistics for an open file or directory. /// +/// Compared to [`fstatvfs`], this function often provides more information, +/// though it's less portable. +/// /// # References /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man2/fstatfs.2.html #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", + target_os = "solaris", target_os = "wasi", -)))] // not implemented in libc for netbsd yet +)))] #[inline] pub fn fstatfs<Fd: AsFd>(fd: Fd) -> io::Result<StatFs> { - imp::fs::syscalls::fstatfs(fd.as_fd()) + backend::fs::syscalls::fstatfs(fd.as_fd()) +} + +/// `fstatvfs(fd)`—Queries filesystem statistics for an open file or +/// directory, POSIX version. +/// +/// Compared to [`fstatfs`], this function often provides less information, +/// but it is more portable. But even so, filesystems are very diverse and not +/// all the fields are meaningful for every filesystem. And `f_fsid` doesn't +/// seem to have a clear meaning anywhere. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html +/// [Linux]: https://man7.org/linux/man-pages/man2/fstatvfs.2.html +#[cfg(not(any( + target_os = "haiku", + target_os = "illumos", + target_os = "redox", + target_os = "solaris", + target_os = "wasi", +)))] +#[inline] +pub fn fstatvfs<Fd: AsFd>(fd: Fd) -> io::Result<StatVfs> { + backend::fs::syscalls::fstatvfs(fd.as_fd()) } /// `futimens(fd, times)`—Sets timestamps for an open file or directory. @@ -171,7 +215,7 @@ pub fn fstatfs<Fd: AsFd>(fd: Fd) -> io::Result<StatFs> { /// [Linux]: https://man7.org/linux/man-pages/man2/utimensat.2.html #[inline] pub fn futimens<Fd: AsFd>(fd: Fd, times: &Timestamps) -> io::Result<()> { - imp::fs::syscalls::futimens(fd.as_fd(), times) + backend::fs::syscalls::futimens(fd.as_fd(), times) } /// `fallocate(fd, mode, offset, len)`—Adjusts file allocation. @@ -190,16 +234,18 @@ pub fn futimens<Fd: AsFd>(fd: Fd, times: &Timestamps) -> io::Result<()> { /// [Linux `fallocate`]: https://man7.org/linux/man-pages/man2/fallocate.2.html /// [Linux `posix_fallocate`]: https://man7.org/linux/man-pages/man3/posix_fallocate.3.html #[cfg(not(any( + target_os = "aix", target_os = "dragonfly", target_os = "illumos", target_os = "netbsd", target_os = "openbsd", target_os = "redox", + target_os = "solaris", )))] // not implemented in libc for netbsd yet #[inline] #[doc(alias = "posix_fallocate")] pub fn fallocate<Fd: AsFd>(fd: Fd, mode: FallocateFlags, offset: u64, len: u64) -> io::Result<()> { - imp::fs::syscalls::fallocate(fd.as_fd(), mode, offset, len) + backend::fs::syscalls::fallocate(fd.as_fd(), mode, offset, len) } /// `fcntl(fd, F_GETFL) & O_ACCMODE` @@ -214,7 +260,7 @@ pub fn is_file_read_write<Fd: AsFd>(fd: Fd) -> io::Result<(bool, bool)> { } pub(crate) fn _is_file_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> { - let mode = imp::fs::syscalls::fcntl_getfl(fd)?; + let mode = backend::fs::syscalls::fcntl_getfl(fd)?; // Check for `O_PATH`. #[cfg(any( @@ -252,7 +298,7 @@ pub(crate) fn _is_file_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool) /// [`fcntl_fullfsync`]: https://docs.rs/rustix/*/x86_64-apple-darwin/rustix/fs/fn.fcntl_fullfsync.html #[inline] pub fn fsync<Fd: AsFd>(fd: Fd) -> io::Result<()> { - imp::fs::syscalls::fsync(fd.as_fd()) + backend::fs::syscalls::fsync(fd.as_fd()) } /// `fdatasync(fd)`—Ensures that file data is written to the underlying @@ -266,13 +312,14 @@ pub fn fsync<Fd: AsFd>(fd: Fd) -> io::Result<()> { /// [Linux]: https://man7.org/linux/man-pages/man2/fdatasync.2.html #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", )))] #[inline] pub fn fdatasync<Fd: AsFd>(fd: Fd) -> io::Result<()> { - imp::fs::syscalls::fdatasync(fd.as_fd()) + backend::fs::syscalls::fdatasync(fd.as_fd()) } /// `ftruncate(fd, length)`—Sets the length of a file. @@ -285,7 +332,7 @@ pub fn fdatasync<Fd: AsFd>(fd: Fd) -> io::Result<()> { /// [Linux]: https://man7.org/linux/man-pages/man2/ftruncate.2.html #[inline] pub fn ftruncate<Fd: AsFd>(fd: Fd, length: u64) -> io::Result<()> { - imp::fs::syscalls::ftruncate(fd.as_fd(), length) + backend::fs::syscalls::ftruncate(fd.as_fd(), length) } /// `flock(fd, operation)`—Acquire or release an advisory lock on an open file. @@ -294,8 +341,8 @@ pub fn ftruncate<Fd: AsFd>(fd: Fd, length: u64) -> io::Result<()> { /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man2/flock.2.html -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "solaris", target_os = "wasi")))] #[inline] pub fn flock<Fd: AsFd>(fd: Fd, operation: FlockOperation) -> io::Result<()> { - imp::fs::syscalls::flock(fd.as_fd(), operation) + backend::fs::syscalls::flock(fd.as_fd(), operation) } diff --git a/vendor/rustix/src/fs/file_type.rs b/vendor/rustix/src/fs/file_type.rs index 75935c794..cf8fc1d38 100644 --- a/vendor/rustix/src/fs/file_type.rs +++ b/vendor/rustix/src/fs/file_type.rs @@ -1,4 +1,4 @@ -use crate::imp; +use crate::backend; /// `S_IF*` constants. -pub use imp::fs::types::FileType; +pub use backend::fs::types::FileType; diff --git a/vendor/rustix/src/fs/getpath.rs b/vendor/rustix/src/fs/getpath.rs index bc40890d1..8e14ff2f2 100644 --- a/vendor/rustix/src/fs/getpath.rs +++ b/vendor/rustix/src/fs/getpath.rs @@ -1,6 +1,6 @@ use crate::ffi::CString; -use crate::{imp, io}; -use imp::fd::AsFd; +use crate::{backend, io}; +use backend::fd::AsFd; /// `fcntl(fd, F_GETPATH)` /// @@ -10,5 +10,5 @@ use imp::fd::AsFd; /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html #[inline] pub fn getpath<Fd: AsFd>(fd: Fd) -> io::Result<CString> { - imp::fs::syscalls::getpath(fd.as_fd()) + backend::fs::syscalls::getpath(fd.as_fd()) } diff --git a/vendor/rustix/src/fs/makedev.rs b/vendor/rustix/src/fs/makedev.rs index 75cc42540..5793058ff 100644 --- a/vendor/rustix/src/fs/makedev.rs +++ b/vendor/rustix/src/fs/makedev.rs @@ -1,5 +1,5 @@ +use crate::backend; use crate::fs::Dev; -use crate::imp; /// `makedev(maj, min)` /// @@ -9,7 +9,7 @@ use crate::imp; /// [Linux]: https://man7.org/linux/man-pages/man3/makedev.3.html #[inline] pub fn makedev(maj: u32, min: u32) -> Dev { - imp::fs::makedev::makedev(maj, min) + backend::fs::makedev::makedev(maj, min) } /// `minor(dev)` @@ -20,7 +20,7 @@ pub fn makedev(maj: u32, min: u32) -> Dev { /// [Linux]: https://man7.org/linux/man-pages/man3/minor.3.html #[inline] pub fn minor(dev: Dev) -> u32 { - imp::fs::makedev::minor(dev) + backend::fs::makedev::minor(dev) } /// `major(dev)` @@ -31,5 +31,5 @@ pub fn minor(dev: Dev) -> u32 { /// [Linux]: https://man7.org/linux/man-pages/man3/major.3.html #[inline] pub fn major(dev: Dev) -> u32 { - imp::fs::makedev::major(dev) + backend::fs::makedev::major(dev) } diff --git a/vendor/rustix/src/fs/memfd_create.rs b/vendor/rustix/src/fs/memfd_create.rs index 74b432739..dad964777 100644 --- a/vendor/rustix/src/fs/memfd_create.rs +++ b/vendor/rustix/src/fs/memfd_create.rs @@ -1,7 +1,7 @@ -use crate::io::{self, OwnedFd}; -use crate::{imp, path}; +use crate::fd::OwnedFd; +use crate::{backend, io, path}; -pub use imp::fs::types::MemfdFlags; +pub use backend::fs::types::MemfdFlags; /// `memfd_create(path, flags)` /// @@ -11,5 +11,5 @@ pub use imp::fs::types::MemfdFlags; /// [Linux]: https://man7.org/linux/man-pages/man2/memfd_create.2.html #[inline] pub fn memfd_create<P: path::Arg>(path: P, flags: MemfdFlags) -> io::Result<OwnedFd> { - path.into_with_c_str(|path| imp::fs::syscalls::memfd_create(path, flags)) + path.into_with_c_str(|path| backend::fs::syscalls::memfd_create(path, flags)) } diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs index 49b9c3b51..fa7f93aec 100644 --- a/vendor/rustix/src/fs/mod.rs +++ b/vendor/rustix/src/fs/mod.rs @@ -1,9 +1,7 @@ //! Filesystem operations. -#[cfg(feature = "fs")] mod abs; #[cfg(not(target_os = "redox"))] -#[cfg(any(feature = "fs", feature = "procfs"))] mod at; mod constants; #[cfg(any(target_os = "android", target_os = "linux"))] @@ -11,16 +9,17 @@ mod copy_file_range; #[cfg(not(target_os = "redox"))] mod cwd; #[cfg(not(target_os = "redox"))] -#[cfg(any(feature = "fs", feature = "procfs"))] mod dir; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd", target_os = "redox", + target_os = "solaris", )))] mod fadvise; pub(crate) mod fcntl; @@ -35,19 +34,20 @@ mod getpath; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd", target_os = "redox", + target_os = "solaris", target_os = "wasi", )))] mod makedev; #[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))] mod memfd_create; #[cfg(any(target_os = "android", target_os = "linux"))] -#[cfg(feature = "fs")] mod openat2; #[cfg(target_os = "linux")] mod sendfile; @@ -55,18 +55,25 @@ mod sendfile; mod statx; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", + target_os = "solaris", target_os = "wasi", )))] -#[cfg(feature = "fs")] pub use abs::statfs; -#[cfg(not(any(target_os = "illumos", target_os = "redox")))] -#[cfg(feature = "fs")] +#[cfg(not(any( + target_os = "haiku", + target_os = "illumos", + target_os = "redox", + target_os = "solaris", + target_os = "wasi", +)))] +pub use abs::statvfs; +#[cfg(not(any(target_os = "illumos", target_os = "redox", target_os = "solaris")))] pub use at::accessat; #[cfg(any(target_os = "ios", target_os = "macos"))] -#[cfg(feature = "fs")] pub use at::fclonefileat; #[cfg(not(any( target_os = "ios", @@ -74,16 +81,12 @@ pub use at::fclonefileat; target_os = "redox", target_os = "wasi", )))] -#[cfg(feature = "fs")] pub use at::mknodat; #[cfg(any(target_os = "android", target_os = "linux"))] -#[cfg(feature = "fs")] pub use at::renameat_with; #[cfg(not(any(target_os = "redox", target_os = "wasi")))] -#[cfg(feature = "fs")] pub use at::{chmodat, chownat}; #[cfg(not(target_os = "redox"))] -#[cfg(any(feature = "fs", feature = "procfs"))] pub use at::{ linkat, mkdirat, openat, readlinkat, renameat, statat, symlinkat, unlinkat, utimensat, RawMode, UTIME_NOW, UTIME_OMIT, @@ -105,16 +108,17 @@ pub use copy_file_range::copy_file_range; #[cfg(not(target_os = "redox"))] pub use cwd::cwd; #[cfg(not(target_os = "redox"))] -#[cfg(any(feature = "fs", feature = "procfs"))] pub use dir::{Dir, DirEntry}; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd", target_os = "redox", + target_os = "solaris", )))] pub use fadvise::{fadvise, Advice}; #[cfg(not(target_os = "wasi"))] @@ -136,30 +140,44 @@ pub use fcopyfile::{ }; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", )))] pub use fd::fdatasync; #[cfg(not(any( + target_os = "aix", target_os = "dragonfly", target_os = "illumos", target_os = "netbsd", target_os = "openbsd", target_os = "redox", + target_os = "solaris", )))] pub use fd::{fallocate, FallocateFlags}; #[cfg(not(target_os = "wasi"))] -pub use fd::{fchmod, fchown, flock, FlockOperation}; +pub use fd::{fchmod, fchown}; +#[cfg(not(any(target_os = "solaris", target_os = "wasi")))] +pub use fd::{flock, FlockOperation}; pub use fd::{fstat, fsync, ftruncate, futimens, is_file_read_write, seek, tell, Stat, Timestamps}; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", + target_os = "solaris", target_os = "wasi", )))] -// not implemented in libc for netbsd yet pub use fd::{fstatfs, StatFs}; +#[cfg(not(any( + target_os = "haiku", + target_os = "illumos", + target_os = "redox", + target_os = "solaris", + target_os = "wasi", +)))] +pub use fd::{fstatvfs, StatVfs, StatVfsMountFlags}; #[cfg(any(target_os = "android", target_os = "linux"))] pub use fd::{FsWord, NFS_SUPER_MAGIC, PROC_SUPER_MAGIC}; pub use file_type::FileType; @@ -168,19 +186,20 @@ pub use getpath::getpath; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd", target_os = "redox", + target_os = "solaris", target_os = "wasi", )))] pub use makedev::{major, makedev, minor}; #[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))] pub use memfd_create::{memfd_create, MemfdFlags}; #[cfg(any(target_os = "android", target_os = "linux"))] -#[cfg(feature = "fs")] pub use openat2::openat2; #[cfg(target_os = "linux")] pub use sendfile::sendfile; diff --git a/vendor/rustix/src/fs/openat2.rs b/vendor/rustix/src/fs/openat2.rs index d6f77357b..4918e0034 100644 --- a/vendor/rustix/src/fs/openat2.rs +++ b/vendor/rustix/src/fs/openat2.rs @@ -1,7 +1,7 @@ -use crate::io::{self, OwnedFd}; -use crate::{imp, path}; -use imp::fd::AsFd; -use imp::fs::types::{Mode, OFlags, ResolveFlags}; +use crate::fd::OwnedFd; +use crate::{backend, io, path}; +use backend::fd::AsFd; +use backend::fs::types::{Mode, OFlags, ResolveFlags}; /// `openat2(dirfd, path, OpenHow { oflags, mode, resolve }, sizeof(OpenHow))` /// @@ -18,6 +18,6 @@ pub fn openat2<Fd: AsFd, P: path::Arg>( resolve: ResolveFlags, ) -> io::Result<OwnedFd> { path.into_with_c_str(|path| { - imp::fs::syscalls::openat2(dirfd.as_fd(), path, oflags, mode, resolve) + backend::fs::syscalls::openat2(dirfd.as_fd(), path, oflags, mode, resolve) }) } diff --git a/vendor/rustix/src/fs/sendfile.rs b/vendor/rustix/src/fs/sendfile.rs index a4d8c24d4..472ad37b2 100644 --- a/vendor/rustix/src/fs/sendfile.rs +++ b/vendor/rustix/src/fs/sendfile.rs @@ -1,5 +1,5 @@ -use crate::{imp, io}; -use imp::fd::AsFd; +use crate::{backend, io}; +use backend::fd::AsFd; /// `sendfile(out_fd, in_fd, offset, count)` /// @@ -15,5 +15,5 @@ pub fn sendfile<OutFd: AsFd, InFd: AsFd>( offset: Option<&mut u64>, count: usize, ) -> io::Result<usize> { - imp::fs::syscalls::sendfile(out_fd.as_fd(), in_fd.as_fd(), offset, count) + backend::fs::syscalls::sendfile(out_fd.as_fd(), in_fd.as_fd(), offset, count) } diff --git a/vendor/rustix/src/fs/statx.rs b/vendor/rustix/src/fs/statx.rs index fa1d36779..383f109ce 100644 --- a/vendor/rustix/src/fs/statx.rs +++ b/vendor/rustix/src/fs/statx.rs @@ -3,10 +3,10 @@ use crate::fd::{AsFd, BorrowedFd}; use crate::ffi::CStr; use crate::fs::AtFlags; -use crate::{imp, io, path}; +use crate::{backend, io, path}; use core::sync::atomic::{AtomicU8, Ordering}; -pub use imp::fs::types::{Statx, StatxFlags, StatxTimestamp}; +pub use backend::fs::types::{Statx, StatxFlags, StatxTimestamp}; /// `statx(dirfd, path, flags, mask, statxbuf)` /// @@ -47,7 +47,7 @@ fn _statx( match STATX_STATE.load(Ordering::Relaxed) { 0 => statx_init(dirfd, path, flags, mask), 1 => Err(io::Errno::NOSYS), - _ => imp::fs::syscalls::statx(dirfd, path, flags, mask), + _ => backend::fs::syscalls::statx(dirfd, path, flags, mask), } } @@ -58,7 +58,7 @@ fn statx_init( flags: AtFlags, mask: StatxFlags, ) -> io::Result<Statx> { - match imp::fs::syscalls::statx(dirfd, path, flags, mask) { + match backend::fs::syscalls::statx(dirfd, path, flags, mask) { Err(io::Errno::NOSYS) => statx_error_nosys(), Err(io::Errno::PERM) => statx_error_perm(), result => { @@ -82,7 +82,7 @@ fn statx_error_perm() -> io::Result<Statx> { // Some old versions of Docker have `statx` fail with `PERM` when it isn't // recognized. Check whether `statx` really is available, and if so, fail // with `PERM`, and if not, treat it like `NOSYS`. - if imp::fs::syscalls::is_statx_available() { + if backend::fs::syscalls::is_statx_available() { STATX_STATE.store(2, Ordering::Relaxed); Err(io::Errno::PERM) } else { |