summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/fs/at.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/fs/at.rs')
-rw-r--r--vendor/rustix/src/fs/at.rs55
1 files changed, 31 insertions, 24 deletions
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)
})
}