Sha256: f17092b84553741aa2d2b44c6992b5d2c8c96cc2c2007fc9a2c6b2064485e53f

Contents?: true

Size: 1.18 KB

Versions: 47

Compression:

Stored size: 1.18 KB

Contents

use crate::fd::{AsFd, OwnedFd};
use crate::{backend, io};

pub use backend::time::types::{Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTimerFlags};

/// `timerfd_create(clockid, flags)`—Create a timer.
///
/// # References
///  - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/timerfd_create.2.html
#[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]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/timerfd_settime.2.html
#[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]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/timerfd_gettime.2.html
#[inline]
pub fn timerfd_gettime<Fd: AsFd>(fd: Fd) -> io::Result<Itimerspec> {
    backend::time::syscalls::timerfd_gettime(fd.as_fd())
}

Version data entries

47 entries across 38 versions & 1 rubygems

Version Path
wasmtime-7.0.0 ./ext/cargo-vendor/rustix-0.37.5/src/time/timerfd.rs
wasmtime-7.0.0 ./ext/cargo-vendor/rustix-0.36.11/src/time/timerfd.rs
wasmtime-6.0.1 ./ext/cargo-vendor/rustix-0.36.8/src/time/timerfd.rs
wasmtime-6.0.0 ./ext/cargo-vendor/rustix-0.36.8/src/time/timerfd.rs
wasmtime-5.0.0 ./ext/cargo-vendor/rustix-0.36.7/src/time/timerfd.rs
wasmtime-0.4.1 ./ext/cargo-vendor/rustix-0.36.5/src/time/timerfd.rs
wasmtime-0.4.0 ./ext/cargo-vendor/rustix-0.36.5/src/time/timerfd.rs