summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/fs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/rustix/src/fs
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.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.rs36
-rw-r--r--vendor/rustix/src/fs/at.rs27
-rw-r--r--vendor/rustix/src/fs/fcntl.rs2
-rw-r--r--vendor/rustix/src/fs/fd.rs6
-rw-r--r--vendor/rustix/src/fs/ioctl.rs52
-rw-r--r--vendor/rustix/src/fs/mod.rs4
-rw-r--r--vendor/rustix/src/fs/mount.rs10
-rw-r--r--vendor/rustix/src/fs/raw_dir.rs6
-rw-r--r--vendor/rustix/src/fs/seek_from.rs29
-rw-r--r--vendor/rustix/src/fs/statx.rs29
-rw-r--r--vendor/rustix/src/fs/xattr.rs3
11 files changed, 167 insertions, 37 deletions
diff --git a/vendor/rustix/src/fs/abs.rs b/vendor/rustix/src/fs/abs.rs
index 81e991772..f57bd00fe 100644
--- a/vendor/rustix/src/fs/abs.rs
+++ b/vendor/rustix/src/fs/abs.rs
@@ -1,7 +1,6 @@
//! POSIX-style filesystem functions which operate on bare paths.
use crate::fd::OwnedFd;
-use crate::ffi::{CStr, CString};
#[cfg(not(target_os = "espidf"))]
use crate::fs::Access;
#[cfg(not(any(
@@ -17,9 +16,15 @@ use crate::fs::StatFs;
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use crate::fs::StatVfs;
use crate::fs::{Mode, OFlags, Stat};
-use crate::path::SMALL_PATH_BUFFER_SIZE;
+#[cfg(not(target_os = "wasi"))]
+use crate::ugid::{Gid, Uid};
use crate::{backend, io, path};
-use alloc::vec::Vec;
+#[cfg(feature = "alloc")]
+use {
+ crate::ffi::{CStr, CString},
+ crate::path::SMALL_PATH_BUFFER_SIZE,
+ alloc::vec::Vec,
+};
/// `open(path, oflags, mode)`—Opens a file.
///
@@ -101,11 +106,13 @@ pub fn lstat<P: path::Arg>(path: P) -> io::Result<Stat> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html
/// [Linux]: https://man7.org/linux/man-pages/man2/readlink.2.html
+#[cfg(feature = "alloc")]
#[inline]
pub fn readlink<P: path::Arg, B: Into<Vec<u8>>>(path: P, reuse: B) -> io::Result<CString> {
path.into_with_c_str(|path| _readlink(path, reuse.into()))
}
+#[cfg(feature = "alloc")]
fn _readlink(path: &CStr, mut buffer: Vec<u8>) -> io::Result<CString> {
// This code would benefit from having a better way to read into
// uninitialized memory, but that requires `unsafe`.
@@ -170,12 +177,21 @@ pub fn rmdir<P: path::Arg>(path: P) -> io::Result<()> {
/// `link(old_path, new_path)`—Creates a hard link.
///
+/// POSIX leaves it implementation-defined whether `link` follows a symlink in
+/// `old_path`, or creates a new link to the symbolic link itself. On platforms
+/// which have it, [`linkat`] avoids this problem since it has an [`AtFlags`]
+/// paramter and the [`AtFlags::SYMLINK_FOLLOW`] flag determines whether
+/// symlinks should be followed.
+///
/// # References
/// - [POSIX]
/// - [Linux]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html
/// [Linux]: https://man7.org/linux/man-pages/man2/link.2.html
+/// [`linkat`]: crate::fs::linkat
+/// [`AtFlags`]: crate::fs::AtFlags
+/// [`AtFlags::SYMLINK_FOLLOW`]: crate::fs::AtFlags::SYMLINK_FOLLOW
#[inline]
pub fn link<P: path::Arg, Q: path::Arg>(old_path: P, new_path: Q) -> io::Result<()> {
old_path.into_with_c_str(|old_path| {
@@ -266,3 +282,17 @@ pub fn statfs<P: path::Arg>(path: P) -> io::Result<StatFs> {
pub fn statvfs<P: path::Arg>(path: P) -> io::Result<StatVfs> {
path.into_with_c_str(backend::fs::syscalls::statvfs)
}
+
+/// `chown(path, owner, group)`—Sets open file or directory ownership.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/chown.2.html
+#[cfg(not(target_os = "wasi"))]
+#[inline]
+pub fn chown<P: path::Arg>(path: P, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> {
+ path.into_with_c_str(|path| backend::fs::syscalls::chown(path, owner, group))
+}
diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs
index 5bd90fab5..0434b56ef 100644
--- a/vendor/rustix/src/fs/at.rs
+++ b/vendor/rustix/src/fs/at.rs
@@ -3,26 +3,32 @@
//! The `dirfd` argument to these functions may be a file descriptor for a
//! directory, or the special value [`CWD`].
//!
-//! [`cwd`]: crate::fs::cwd::CWD
+//! [`cwd`]: crate::fs::CWD
use crate::fd::OwnedFd;
-use crate::ffi::{CStr, CString};
#[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(target_os = "espidf", target_os = "wasi")))]
use crate::fs::{Gid, Uid};
use crate::fs::{Mode, OFlags};
-use crate::path::SMALL_PATH_BUFFER_SIZE;
use crate::{backend, io, path};
-use alloc::vec::Vec;
-use backend::fd::{AsFd, BorrowedFd};
+use backend::fd::AsFd;
+#[cfg(feature = "alloc")]
+use {
+ crate::ffi::{CStr, CString},
+ crate::path::SMALL_PATH_BUFFER_SIZE,
+ alloc::vec::Vec,
+ backend::fd::BorrowedFd,
+};
#[cfg(not(target_os = "espidf"))]
use {
- crate::fs::{Access, AtFlags, Stat, Timestamps},
+ crate::fs::{Access, AtFlags, Timestamps},
crate::timespec::Nsecs,
};
@@ -76,6 +82,7 @@ pub fn openat<P: path::Arg, Fd: AsFd>(
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlinkat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/readlinkat.2.html
+#[cfg(feature = "alloc")]
#[inline]
pub fn readlinkat<P: path::Arg, Fd: AsFd, B: Into<Vec<u8>>>(
dirfd: Fd,
@@ -85,6 +92,7 @@ pub fn readlinkat<P: path::Arg, Fd: AsFd, B: Into<Vec<u8>>>(
path.into_with_c_str(|path| _readlinkat(dirfd.as_fd(), path, reuse.into()))
}
+#[cfg(feature = "alloc")]
#[allow(unsafe_code)]
fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::Result<CString> {
buffer.clear();
@@ -96,8 +104,10 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R
debug_assert!(nread <= buffer.capacity());
if nread < buffer.capacity() {
- // SAFETY from the man page:
+ // 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 {
buffer.set_len(nread);
}
@@ -280,7 +290,8 @@ pub fn symlinkat<P: path::Arg, Q: path::Arg, Fd: AsFd>(
/// [Linux]: https://man7.org/linux/man-pages/man2/fstatat.2.html
/// [`Mode::from_raw_mode`]: crate::fs::Mode::from_raw_mode
/// [`FileType::from_raw_mode`]: crate::fs::FileType::from_raw_mode
-#[cfg(not(target_os = "espidf"))]
+// TODO: Add `stat64xat` to upstream libc bindings and reenable this for AIX.
+#[cfg(not(any(target_os = "aix", target_os = "espidf")))]
#[inline]
#[doc(alias = "fstatat")]
pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<Stat> {
diff --git a/vendor/rustix/src/fs/fcntl.rs b/vendor/rustix/src/fs/fcntl.rs
index f7f4790cb..facbc9fa3 100644
--- a/vendor/rustix/src/fs/fcntl.rs
+++ b/vendor/rustix/src/fs/fcntl.rs
@@ -15,7 +15,7 @@ use crate::{backend, io};
use backend::fd::AsFd;
use backend::fs::types::OFlags;
-// These `fcntl` functions like in the `io` module because they're not specific
+// These `fcntl` functions live 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(any(target_os = "espidf", target_os = "wasi")))]
diff --git a/vendor/rustix/src/fs/fd.rs b/vendor/rustix/src/fs/fd.rs
index 43b2e57b1..94de43daa 100644
--- a/vendor/rustix/src/fs/fd.rs
+++ b/vendor/rustix/src/fs/fd.rs
@@ -105,7 +105,7 @@ pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
backend::fs::syscalls::tell(fd.as_fd())
}
-/// `fchmod(fd)`—Sets open file or directory permissions.
+/// `fchmod(fd, mode)`—Sets open file or directory permissions.
///
/// This implementation does not support `O_PATH` file descriptors, even on
/// platforms where the host libc emulates it.
@@ -122,7 +122,7 @@ pub fn fchmod<Fd: AsFd>(fd: Fd, mode: Mode) -> io::Result<()> {
backend::fs::syscalls::fchmod(fd.as_fd(), mode)
}
-/// `fchown(fd)`—Sets open file or directory ownership.
+/// `fchown(fd, owner, group)`—Sets open file or directory ownership.
///
/// # References
/// - [POSIX]
@@ -256,7 +256,7 @@ pub(crate) fn _is_file_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)
let mode = backend::fs::syscalls::fcntl_getfl(fd)?;
// Check for `O_PATH`.
- #[cfg(any(linux_kernel, target_os = "fuchsia", target_os = "emscripten"))]
+ #[cfg(any(linux_kernel, target_os = "emscripten", target_os = "fuchsia"))]
if mode.contains(OFlags::PATH) {
return Ok((false, false));
}
diff --git a/vendor/rustix/src/fs/ioctl.rs b/vendor/rustix/src/fs/ioctl.rs
index 28e0c8588..75222752f 100644
--- a/vendor/rustix/src/fs/ioctl.rs
+++ b/vendor/rustix/src/fs/ioctl.rs
@@ -1,11 +1,17 @@
//! Filesystem-oriented `ioctl` functions.
+#![allow(unsafe_code)]
+
#[cfg(linux_kernel)]
use {
crate::fd::AsFd,
- crate::{backend, io},
+ crate::{backend, io, ioctl},
+ backend::c,
};
+#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+use crate::fd::{AsRawFd, BorrowedFd};
+
/// `ioctl(fd, BLKSSZGET)`—Returns the logical block size of a block device.
///
/// This is mentioned in the [Linux `openat` manual page].
@@ -15,7 +21,11 @@ use {
#[inline]
#[doc(alias = "BLKSSZGET")]
pub fn ioctl_blksszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
- backend::fs::syscalls::ioctl_blksszget(fd.as_fd())
+ // SAFETY: BLZSSZGET is a getter opcode that gets a u32.
+ unsafe {
+ let ctl = ioctl::Getter::<ioctl::BadOpcode<{ c::BLKSSZGET }>, c::c_uint>::new();
+ ioctl::ioctl(fd, ctl)
+ }
}
/// `ioctl(fd, BLKPBSZGET)`—Returns the physical block size of a block device.
@@ -23,7 +33,11 @@ pub fn ioctl_blksszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
#[inline]
#[doc(alias = "BLKPBSZGET")]
pub fn ioctl_blkpbszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
- backend::fs::syscalls::ioctl_blkpbszget(fd.as_fd())
+ // SAFETY: BLKPBSZGET is a getter opcode that gets a u32.
+ unsafe {
+ let ctl = ioctl::Getter::<ioctl::BadOpcode<{ c::BLKPBSZGET }>, c::c_uint>::new();
+ ioctl::ioctl(fd, ctl)
+ }
}
/// `ioctl(fd, FICLONE, src_fd)`—Share data between open files.
@@ -38,7 +52,7 @@ pub fn ioctl_blkpbszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
#[inline]
#[doc(alias = "FICLONE")]
pub fn ioctl_ficlone<Fd: AsFd, SrcFd: AsFd>(fd: Fd, src_fd: SrcFd) -> io::Result<()> {
- backend::fs::syscalls::ioctl_ficlone(fd.as_fd(), src_fd.as_fd())
+ unsafe { ioctl::ioctl(fd, Ficlone(src_fd.as_fd())) }
}
/// `ioctl(fd, EXT4_IOC_RESIZE_FS, blocks)`—Resize ext4 filesystem on fd.
@@ -46,5 +60,33 @@ pub fn ioctl_ficlone<Fd: AsFd, SrcFd: AsFd>(fd: Fd, src_fd: SrcFd) -> io::Result
#[inline]
#[doc(alias = "EXT4_IOC_RESIZE_FS")]
pub fn ext4_ioc_resize_fs<Fd: AsFd>(fd: Fd, blocks: u64) -> io::Result<()> {
- backend::fs::syscalls::ext4_ioc_resize_fs(fd.as_fd(), blocks)
+ // SAFETY: EXT4_IOC_RESIZE_FS is a pointer setter opcode.
+ unsafe {
+ let ctl = ioctl::Setter::<ioctl::BadOpcode<{ backend::fs::EXT4_IOC_RESIZE_FS }>, u64>::new(
+ blocks,
+ );
+ ioctl::ioctl(fd, ctl)
+ }
+}
+
+#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+struct Ficlone<'a>(BorrowedFd<'a>);
+
+#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+unsafe impl ioctl::Ioctl for Ficlone<'_> {
+ type Output = ();
+
+ const IS_MUTATING: bool = false;
+ const OPCODE: ioctl::Opcode = ioctl::Opcode::old(c::FICLONE as ioctl::RawOpcode);
+
+ fn as_ptr(&mut self) -> *mut c::c_void {
+ self.0.as_raw_fd() as *mut c::c_void
+ }
+
+ unsafe fn output_from_ptr(
+ _: ioctl::IoctlOutput,
+ _: *mut c::c_void,
+ ) -> io::Result<Self::Output> {
+ Ok(())
+ }
}
diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs
index fbfaa12c9..1ea0d1351 100644
--- a/vendor/rustix/src/fs/mod.rs
+++ b/vendor/rustix/src/fs/mod.rs
@@ -9,7 +9,7 @@ mod copy_file_range;
#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
#[cfg(not(target_os = "haiku"))] // Haiku needs <https://github.com/rust-lang/rust/pull/112371>
mod cwd;
-#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
+#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
mod dir;
#[cfg(not(any(
apple,
@@ -71,7 +71,7 @@ pub use copy_file_range::copy_file_range;
#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
#[cfg(not(target_os = "haiku"))] // Haiku needs <https://github.com/rust-lang/rust/pull/112371>
pub use cwd::*;
-#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
+#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
pub use dir::{Dir, DirEntry};
#[cfg(not(any(
apple,
diff --git a/vendor/rustix/src/fs/mount.rs b/vendor/rustix/src/fs/mount.rs
index d1e6a8238..0f04b7f69 100644
--- a/vendor/rustix/src/fs/mount.rs
+++ b/vendor/rustix/src/fs/mount.rs
@@ -3,43 +3,53 @@
//! These have been moved to a new `rustix::mount` module.
#[deprecated(note = "rustix::fs::UnmountFlags` moved to `rustix::mount::UnmountFlags`.")]
+#[doc(hidden)]
pub use crate::mount::UnmountFlags;
#[deprecated(note = "rustix::fs::MountFlags` moved to `rustix::mount::MountFlags`.")]
+#[doc(hidden)]
pub use crate::mount::MountFlags;
#[deprecated(
note = "rustix::fs::MountPropagationFlags` moved to `rustix::mount::MountPropagationFlags`."
)]
+#[doc(hidden)]
pub use crate::mount::MountPropagationFlags;
#[deprecated(note = "`rustix::fs::mount` moved to `rustix::mount::mount`.")]
+#[doc(hidden)]
pub use crate::mount::mount;
#[deprecated(note = "`rustix::fs::unmount` moved to `rustix::mount::unmount`.")]
+#[doc(hidden)]
pub use crate::mount::unmount;
#[deprecated(
note = "`rustix::fs::remount` is renamed and moved to `rustix::mount::mount_remount`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_remount as remount;
#[deprecated(
note = "`rustix::fs::bind_mount` is renamed and moved to `rustix::mount::mount_bind`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_bind as bind_mount;
#[deprecated(
note = "`rustix::fs::recursive_bind_mount` is renamed and moved to `rustix::mount::mount_recursive_bind`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_recursive_bind as recursive_bind_mount;
#[deprecated(
note = "`rustix::fs::change_mount` is renamed and moved to `rustix::mount::mount_change`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_change as change_mount;
#[deprecated(
note = "`rustix::fs::move_mount` is renamed and moved to `rustix::mount::mount_move`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_move as move_mount;
diff --git a/vendor/rustix/src/fs/raw_dir.rs b/vendor/rustix/src/fs/raw_dir.rs
index 3131e0649..fd8aefa3a 100644
--- a/vendor/rustix/src/fs/raw_dir.rs
+++ b/vendor/rustix/src/fs/raw_dir.rs
@@ -136,7 +136,7 @@ impl<'buf, Fd: AsFd> RawDir<'buf, Fd> {
}
}
-/// A raw directory entry, similar to `std::fs::DirEntry`.
+/// A raw directory entry, similar to [`std::fs::DirEntry`].
///
/// Unlike the std version, this may represent the `.` or `..` entries.
pub struct RawDirEntry<'a> {
@@ -193,10 +193,10 @@ impl<'buf, Fd: AsFd> RawDir<'buf, Fd> {
/// with GAT support once one becomes available.
#[allow(unsafe_code)]
#[allow(clippy::should_implement_trait)]
- pub fn next(&mut self) -> Option<io::Result<RawDirEntry>> {
+ pub fn next(&mut self) -> Option<io::Result<RawDirEntry<'_>>> {
if self.is_buffer_empty() {
match getdents_uninit(self.fd.as_fd(), self.buf) {
- Ok(bytes_read) if bytes_read == 0 => return None,
+ Ok(0) => return None,
Ok(bytes_read) => {
self.initialized = bytes_read;
self.offset = 0;
diff --git a/vendor/rustix/src/fs/seek_from.rs b/vendor/rustix/src/fs/seek_from.rs
index cca23ed62..c08abd2e6 100644
--- a/vendor/rustix/src/fs/seek_from.rs
+++ b/vendor/rustix/src/fs/seek_from.rs
@@ -4,9 +4,12 @@
/// Enumeration of possible methods to seek within an I/O object.
///
-/// It is used by the [`Seek`] trait.
+/// It is used by the [`seek`] function.
///
-/// [`Seek`]: std::io::Seek
+/// This is similar to [`std::io::SeekFrom`], however it adds platform-specific
+/// seek options.
+///
+/// [`seek`]: crate::fs::seek
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub enum SeekFrom {
@@ -30,19 +33,21 @@ pub enum SeekFrom {
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
Current(#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))] i64),
- /// Sets the offset to the current position plus the specified number of bytes,
- /// plus the distance to the next byte which is not in a hole.
+ /// Sets the offset to the current position plus the specified number of
+ /// bytes, plus the distance to the next byte which is not in a hole.
///
- /// If the offset is in a hole at the end of the file, the seek will produce
- /// an `NXIO` error.
- #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ /// If the offset is in a hole at the end of the file, the seek will fail
+ /// with [`Errno::NXIO`].
+ ///
+ /// [`Errno::NXIO`]: crate::io::Errno::NXIO
+ #[cfg(any(apple, freebsdlike, linux_kernel, solarish))]
Data(i64),
- /// Sets the offset to the current position plus the specified number of bytes,
- /// plus the distance to the next byte which is in a hole.
+ /// Sets the offset to the current position plus the specified number of
+ /// bytes, plus the distance to the next byte which is in a hole.
///
- /// If there is no hole past the offset, it will be set to the end of the file
- /// i.e. there is an implicit hole at the end of any file.
- #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ /// If there is no hole past the offset, it will be set to the end of the
+ /// file i.e. there is an implicit hole at the end of any file.
+ #[cfg(any(apple, freebsdlike, linux_kernel, solarish))]
Hole(i64),
}
diff --git a/vendor/rustix/src/fs/statx.rs b/vendor/rustix/src/fs/statx.rs
index 32ae84ed3..1791697af 100644
--- a/vendor/rustix/src/fs/statx.rs
+++ b/vendor/rustix/src/fs/statx.rs
@@ -21,6 +21,35 @@ use compat::statx as _statx;
/// # References
/// - [Linux]
///
+/// # Examples
+///
+/// ```
+/// # use std::path::Path;
+/// # use std::io;
+/// # use rustix::fs::{AtFlags, StatxFlags};
+/// # use rustix::fd::BorrowedFd;
+/// /// Try to determine if the provided path is a mount root. Will return `Ok(None)` if
+/// /// the kernel is not new enough to support statx() or [`libc::STATX_ATTR_MOUNT_ROOT`].
+/// fn is_mountpoint(root: BorrowedFd<'_>, path: &Path) -> io::Result<Option<bool>> {
+/// use rustix::fs::{AtFlags, StatxFlags};
+///
+/// let mountroot_flag = libc::STATX_ATTR_MOUNT_ROOT as u64;
+/// match rustix::fs::statx(
+/// root,
+/// path,
+/// AtFlags::NO_AUTOMOUNT | AtFlags::SYMLINK_NOFOLLOW,
+/// StatxFlags::empty(),
+/// ) {
+/// Ok(r) => {
+/// let present = (r.stx_attributes_mask & mountroot_flag) > 0;
+/// Ok(present.then(|| r.stx_attributes & mountroot_flag > 0))
+/// }
+/// Err(e) if e == rustix::io::Errno::NOSYS => Ok(None),
+/// Err(e) => Err(e.into()),
+/// }
+/// }
+/// ```
+///
/// [Linux]: https://man7.org/linux/man-pages/man2/statx.2.html
#[inline]
pub fn statx<P: path::Arg, Fd: AsFd>(
diff --git a/vendor/rustix/src/fs/xattr.rs b/vendor/rustix/src/fs/xattr.rs
index 01fe7d569..53612f71f 100644
--- a/vendor/rustix/src/fs/xattr.rs
+++ b/vendor/rustix/src/fs/xattr.rs
@@ -14,6 +14,9 @@ bitflags! {
/// `XATTR_REPLACE`
const REPLACE = c::XATTR_REPLACE as c::c_uint;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}