Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

108
vendor/rustix/src/time/clock.rs vendored Normal file
View File

@@ -0,0 +1,108 @@
use crate::{backend, io};
pub use crate::timespec::{Nsecs, Secs, Timespec};
/// `clockid_t`
#[cfg(not(target_os = "wasi"))]
pub use crate::clockid::{ClockId, DynamicClockId};
/// `clock_getres(id)`—Returns the resolution of a clock.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [FreeBSD]
/// - [NetBSD]
/// - [OpenBSD]
/// - [DragonFly BSD]
/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_getres.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_getres.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_getres&sektion=2
/// [NetBSD]: https://man.netbsd.org/clock_getres.2
/// [OpenBSD]: https://man.openbsd.org/clock_getres.2
/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_getres&section=2
/// [illumos]: https://illumos.org/man/3C/clock_getres
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[inline]
#[must_use]
pub fn clock_getres(id: ClockId) -> Timespec {
backend::time::syscalls::clock_getres(id)
}
/// `clock_gettime(id)`—Returns the current value of a clock.
///
/// This function uses `ClockId` which only contains clocks which are known to
/// always be supported at runtime, allowing this function to be infallible.
/// For a greater set of clocks and dynamic clock support, see
/// [`clock_gettime_dynamic`].
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [FreeBSD]
/// - [NetBSD]
/// - [OpenBSD]
/// - [DragonFly BSD]
/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_gettime.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_gettime.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_getres&sektion=2
/// [NetBSD]: https://man.netbsd.org/clock_getres.2
/// [OpenBSD]: https://man.openbsd.org/clock_getres.2
/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_getres&section=2
/// [illumos]: https://illumos.org/man/3C/clock_gettime
#[cfg(not(target_os = "wasi"))]
#[inline]
#[must_use]
pub fn clock_gettime(id: ClockId) -> Timespec {
backend::time::syscalls::clock_gettime(id)
}
/// Like [`clock_gettime`] but with support for dynamic clocks.
///
/// # References
/// - [POSIX]
/// - [Linux]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_gettime.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_gettime.2.html
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn clock_gettime_dynamic(id: DynamicClockId<'_>) -> io::Result<Timespec> {
backend::time::syscalls::clock_gettime_dynamic(id)
}
/// `clock_settime(id, timespec)`—Sets the current value of a settable clock.
///
/// This fails with [`io::Errno::INVAL`] if the clock is not settable, and
/// [`io::Errno::ACCESS`] if the current process does not have permission to
/// set it.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [FreeBSD]
/// - [NetBSD]
/// - [OpenBSD]
/// - [DragonFly BSD]
/// - [illumos]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock_settime.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_settime.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_settime&sektion=2
/// [NetBSD]: https://man.netbsd.org/clock_settime.2
/// [OpenBSD]: https://man.openbsd.org/clock_settime.2
/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_settime&section=2
/// [illumos]: https://illumos.org/man/3C/clock_settime
#[cfg(not(any(
target_os = "redox",
target_os = "wasi",
all(apple, not(target_os = "macos"))
)))]
#[inline]
pub fn clock_settime(id: ClockId, timespec: Timespec) -> io::Result<()> {
backend::time::syscalls::clock_settime(id, timespec)
}

23
vendor/rustix/src/time/mod.rs vendored Normal file
View File

@@ -0,0 +1,23 @@
//! Time-related operations.
mod clock;
#[cfg(any(
linux_kernel,
target_os = "freebsd",
target_os = "fuchsia",
target_os = "illumos",
target_os = "netbsd"
))]
mod timerfd;
// TODO: Convert WASI'S clock APIs to use handles rather than ambient clock
// identifiers, update `wasi-libc`, and then add support in `rustix`.
pub use clock::*;
#[cfg(any(
linux_kernel,
target_os = "freebsd",
target_os = "fuchsia",
target_os = "illumos",
target_os = "netbsd"
))]
pub use timerfd::*;

77
vendor/rustix/src/time/timerfd.rs vendored Normal file
View File

@@ -0,0 +1,77 @@
use crate::fd::{AsFd, OwnedFd};
use crate::timespec::Timespec;
use crate::{backend, io};
pub use backend::time::types::{TimerfdClockId, TimerfdFlags, TimerfdTimerFlags};
/// `struct itimerspec` for use with [`timerfd_gettime`] and
/// [`timerfd_settime`].
///
/// [`timerfd_gettime`]: crate::time::timerfd_gettime
/// [`timerfd_settime`]: crate::time::timerfd_settime
#[derive(Debug, Clone)]
pub struct Itimerspec {
/// Interval between times.
pub it_interval: Timespec,
/// Value of the time.
pub it_value: Timespec,
}
/// `timerfd_create(clockid, flags)`—Create a timer.
///
/// For a higher-level API to timerfd functionality, see the [timerfd] crate.
///
/// [timerfd]: https://crates.io/crates/timerfd
///
/// # References
/// - [Linux]
/// - [FreeBSD]
/// - [illumos]
/// - [NetBSD]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/timerfd_create.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=timerfd_create&sektion=2
/// [illumos]: https://illumos.org/man/3C/timerfd_create
/// [NetBSD]: https://man.netbsd.org/timerfd_create.2
#[inline]
pub fn timerfd_create(clockid: TimerfdClockId, flags: TimerfdFlags) -> io::Result<OwnedFd> {
backend::time::syscalls::timerfd_create(clockid, flags)
}
/// `timerfd_settime(clockid, flags, new_value)`—Set the time on a timer.
///
/// # References
/// - [Linux]
/// - [FreeBSD]
/// - [illumos]
/// - [NetBSD]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/timerfd_settime.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=timerfd_settime&sektion=2
/// [illumos]: https://illumos.org/man/3C/timerfd_settime
/// [NetBSD]: https://man.netbsd.org/timerfd_settime.2
#[inline]
pub fn timerfd_settime<Fd: AsFd>(
fd: Fd,
flags: TimerfdTimerFlags,
new_value: &Itimerspec,
) -> io::Result<Itimerspec> {
backend::time::syscalls::timerfd_settime(fd.as_fd(), flags, new_value)
}
/// `timerfd_gettime(clockid, flags)`—Query a timer.
///
/// # References
/// - [Linux]
/// - [FreeBSD]
/// - [illumos]
/// - [NetBSD]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/timerfd_gettime.2.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=timerfd_gettime&sektion=2
/// [illumos]: https://illumos.org/man/3C/timerfd_gettime
/// [NetBSD]: https://man.netbsd.org/timerfd_gettime.2
#[inline]
pub fn timerfd_gettime<Fd: AsFd>(fd: Fd) -> io::Result<Itimerspec> {
backend::time::syscalls::timerfd_gettime(fd.as_fd())
}