//! The `cwd` function, representing the current working directory. //! //! # Safety //! //! This file uses `AT_FDCWD`, which is a raw file descriptor, but which is //! always valid.
#![allow(unsafe_code)]
usecrate::backend; use backend::c; use backend::fd::{BorrowedFd, RawFd};
/// `AT_FDCWD`—A handle representing the current working directory. /// /// This is a file descriptor which refers to the process current directory /// which can be used as the directory argument in `*at` functions such as /// [`openat`]. /// /// # References /// - [POSIX] /// /// [`openat`]: crate::fs::openat /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html // SAFETY: `AT_FDCWD` is a reserved value that is never dynamically // allocated, so it'll remain valid for the duration of `'static`. #[doc(alias = "AT_FDCWD")] pubconst CWD: BorrowedFd<'static> = unsafe { BorrowedFd::<'static>::borrow_raw(c::AT_FDCWD as RawFd) };
/// Return the value of [`CWD`]. #[deprecated(note = "Use `CWD` in place of `cwd()`.")] pubconstfn cwd() -> BorrowedFd<'static> { let at_fdcwd = c::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`. unsafe { BorrowedFd::<'static>::borrow_raw(at_fdcwd) }
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-06-18)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.