diff options
Diffstat (limited to 'vendor/rustix/src/fs/at.rs')
-rw-r--r-- | vendor/rustix/src/fs/at.rs | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs index 0434b56ef..f40c46ce6 100644 --- a/vendor/rustix/src/fs/at.rs +++ b/vendor/rustix/src/fs/at.rs @@ -6,14 +6,18 @@ //! [`cwd`]: crate::fs::CWD use crate::fd::OwnedFd; +#[cfg(not(any(target_os = "espidf", target_os = "vita")))] +use crate::fs::Access; +#[cfg(not(target_os = "espidf"))] +use crate::fs::AtFlags; #[cfg(apple)] use crate::fs::CloneFlags; -#[cfg(not(any(apple, target_os = "espidf", target_os = "wasi")))] -use crate::fs::FileType; #[cfg(linux_kernel)] use crate::fs::RenameFlags; #[cfg(not(any(target_os = "aix", target_os = "espidf")))] use crate::fs::Stat; +#[cfg(not(any(apple, target_os = "espidf", target_os = "vita", target_os = "wasi")))] +use crate::fs::{Dev, FileType}; #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] use crate::fs::{Gid, Uid}; use crate::fs::{Mode, OFlags}; @@ -26,24 +30,19 @@ use { alloc::vec::Vec, backend::fd::BorrowedFd, }; -#[cfg(not(target_os = "espidf"))] -use { - crate::fs::{Access, AtFlags, Timestamps}, - crate::timespec::Nsecs, -}; - -pub use backend::fs::types::{Dev, RawMode}; +#[cfg(not(any(target_os = "espidf", target_os = "vita")))] +use {crate::fs::Timestamps, crate::timespec::Nsecs}; /// `UTIME_NOW` for use with [`utimensat`]. /// /// [`utimensat`]: crate::fs::utimensat -#[cfg(not(any(target_os = "espidf", target_os = "redox")))] +#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "vita")))] pub const UTIME_NOW: Nsecs = backend::c::UTIME_NOW as Nsecs; /// `UTIME_OMIT` for use with [`utimensat`]. /// /// [`utimensat`]: crate::fs::utimensat -#[cfg(not(any(target_os = "espidf", target_os = "redox")))] +#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "vita")))] pub const UTIME_OMIT: Nsecs = backend::c::UTIME_OMIT as Nsecs; /// `openat(dirfd, path, oflags, mode)`—Opens a file. @@ -104,8 +103,8 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R debug_assert!(nread <= buffer.capacity()); if nread < buffer.capacity() { - // SAFETY: From the [documentation]: - // "On success, these calls return the number of bytes placed in buf." + // SAFETY: From the [documentation]: “On success, these calls + // return the number of bytes placed in buf.” // // [documentation]: https://man7.org/linux/man-pages/man2/readlinkat.2.html unsafe { @@ -113,13 +112,13 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R } // SAFETY: - // - "readlink places the contents of the symbolic link pathname in the buffer - // buf" - // - [POSIX definition 3.271: Pathname]: "A string that is used to identify a - // file." - // - [POSIX definition 3.375: String]: "A contiguous sequence of bytes - // terminated by and including the first null byte." - // - "readlink does not append a terminating null byte to buf." + // - “readlink places the contents of the symbolic link pathname in + // the buffer buf” + // - [POSIX definition 3.271: Pathname]: “A string that is used to + // identify a file.” + // - [POSIX definition 3.375: String]: “A contiguous sequence of + // bytes terminated by and including the first null byte.” + // - “readlink does not append a terminating null byte to buf.” // // Thus, there will be no NUL bytes in the string. // @@ -130,9 +129,8 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R } } - buffer.reserve(buffer.capacity() + 1); // use `Vec` reallocation - // strategy to grow capacity - // exponentially + // Use `Vec` reallocation strategy to grow capacity exponentially. + buffer.reserve(buffer.capacity() + 1); } } @@ -182,8 +180,8 @@ pub fn linkat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>( /// `unlinkat(fd, path, flags)`—Unlinks a file or remove a directory. /// -/// With the [`REMOVEDIR`] flag, this removes a directory. This is in place -/// of a `rmdirat` function. +/// With the [`REMOVEDIR`] flag, this removes a directory. This is in place of +/// a `rmdirat` function. /// /// # References /// - [POSIX] @@ -314,7 +312,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 = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "vita")))] #[inline] #[doc(alias = "faccessat")] pub fn accessat<P: path::Arg, Fd: AsFd>( @@ -334,7 +332,7 @@ pub fn accessat<P: path::Arg, Fd: AsFd>( /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html /// [Linux]: https://man7.org/linux/man-pages/man2/utimensat.2.html -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "vita")))] #[inline] pub fn utimensat<P: path::Arg, Fd: AsFd>( dirfd: Fd, @@ -396,7 +394,7 @@ pub fn fclonefileat<Fd: AsFd, DstFd: AsFd, P: path::Arg>( /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknodat.html /// [Linux]: https://man7.org/linux/man-pages/man2/mknodat.2.html -#[cfg(not(any(apple, target_os = "espidf", target_os = "wasi")))] +#[cfg(not(any(apple, target_os = "espidf", target_os = "vita", target_os = "wasi")))] #[inline] pub fn mknodat<P: path::Arg, Fd: AsFd>( dirfd: Fd, |