summaryrefslogtreecommitdiff
path: root/src/sys/timerfd.rs
diff options
context:
space:
mode:
authorRyan Zoeller <rtzoeller@rtzoeller.com>2022-04-07 23:17:37 -0500
committerRyan Zoeller <rtzoeller@rtzoeller.com>2022-06-26 19:36:45 -0500
commit1fa1bb19b0ba905a7d89ad3d0496d0970245a3f1 (patch)
treec8422479d09eb2fc2ac77be025b248b6210e8e5a /src/sys/timerfd.rs
parent84b02b98a9e9d5f368241fefaebee2319dc058a9 (diff)
downloadnix-1fa1bb19b0ba905a7d89ad3d0496d0970245a3f1.zip
Document aliases for functions like getuid()
Add the autocfg crate as a build dependency, and introduce has_doc_alias as a conditional compilation symbol.
Diffstat (limited to 'src/sys/timerfd.rs')
-rw-r--r--src/sys/timerfd.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sys/timerfd.rs b/src/sys/timerfd.rs
index 18acbae3..42860658 100644
--- a/src/sys/timerfd.rs
+++ b/src/sys/timerfd.rs
@@ -92,6 +92,7 @@ impl TimerFd {
/// Creates a new timer based on the clock defined by `clockid`. The
/// underlying fd can be assigned specific flags with `flags` (CLOEXEC,
/// NONBLOCK). The underlying fd will be closed on drop.
+ #[cfg_attr(has_doc_alias, doc(alias("timerfd_create")))]
pub fn new(clockid: ClockId, flags: TimerFlags) -> Result<Self> {
Errno::result(unsafe { libc::timerfd_create(clockid as i32, flags.bits()) })
.map(|fd| Self { fd })
@@ -133,6 +134,7 @@ impl TimerFd {
///
/// Note: Setting a one shot alarm with a 0s TimeSpec disables the alarm
/// altogether.
+ #[cfg_attr(has_doc_alias, doc(alias("timerfd_settime")))]
pub fn set(&self, expiration: Expiration, flags: TimerSetTimeFlags) -> Result<()> {
let timerspec: TimerSpec = expiration.into();
Errno::result(unsafe {
@@ -147,6 +149,7 @@ impl TimerFd {
}
/// Get the parameters for the alarm currently set, if any.
+ #[cfg_attr(has_doc_alias, doc(alias("timerfd_gettime")))]
pub fn get(&self) -> Result<Option<Expiration>> {
let mut timerspec = TimerSpec::none();
Errno::result(unsafe { libc::timerfd_gettime(self.fd, timerspec.as_mut()) }).map(|_| {
@@ -163,6 +166,7 @@ impl TimerFd {
}
/// Remove the alarm if any is set.
+ #[cfg_attr(has_doc_alias, doc(alias("timerfd_settime")))]
pub fn unset(&self) -> Result<()> {
Errno::result(unsafe {
libc::timerfd_settime(