1- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
1+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
22use crate :: backend:: c;
3- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
3+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
44#[ cfg( fix_y2038) ]
55use crate :: timespec:: LibcTimespec ;
6- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
6+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
77#[ cfg( fix_y2038) ]
88use crate :: timespec:: Timespec ;
9- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
9+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
1010use bitflags:: bitflags;
1111
1212/// `struct itimerspec` for use with [`timerfd_gettime`] and
1313/// [`timerfd_settime`].
1414///
1515/// [`timerfd_gettime`]: crate::time::timerfd_gettime
1616/// [`timerfd_settime`]: crate::time::timerfd_settime
17- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
17+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
1818#[ cfg( not( fix_y2038) ) ]
1919pub type Itimerspec = c:: itimerspec ;
2020
@@ -23,7 +23,7 @@ pub type Itimerspec = c::itimerspec;
2323///
2424/// [`timerfd_gettime`]: crate::time::timerfd_gettime
2525/// [`timerfd_settime`]: crate::time::timerfd_settime
26- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
26+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
2727#[ cfg( fix_y2038) ]
2828#[ repr( C ) ]
2929#[ derive( Debug , Clone ) ]
@@ -35,13 +35,13 @@ pub struct Itimerspec {
3535}
3636
3737/// On most platforms, `LibcItimerspec` is just `Itimerspec`.
38- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
38+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
3939#[ cfg( not( fix_y2038) ) ]
4040pub ( crate ) type LibcItimerspec = Itimerspec ;
4141
4242/// On 32-bit glibc platforms, `LibcTimespec` differs from `Timespec`, so we
4343/// define our own struct, with bidirectional `From` impls.
44- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
44+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
4545#[ cfg( fix_y2038) ]
4646#[ repr( C ) ]
4747#[ derive( Debug , Clone ) ]
@@ -50,7 +50,7 @@ pub(crate) struct LibcItimerspec {
5050 pub it_value : LibcTimespec ,
5151}
5252
53- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
53+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
5454#[ cfg( fix_y2038) ]
5555impl From < LibcItimerspec > for Itimerspec {
5656 #[ inline]
@@ -62,7 +62,7 @@ impl From<LibcItimerspec> for Itimerspec {
6262 }
6363}
6464
65- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
65+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
6666#[ cfg( fix_y2038) ]
6767impl From < Itimerspec > for LibcItimerspec {
6868 #[ inline]
@@ -74,7 +74,7 @@ impl From<Itimerspec> for LibcItimerspec {
7474 }
7575}
7676
77- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
77+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
7878bitflags ! {
7979 /// `TFD_*` flags for use with [`timerfd_create`].
8080 ///
@@ -95,7 +95,7 @@ bitflags! {
9595 }
9696}
9797
98- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
98+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
9999bitflags ! {
100100 /// `TFD_TIMER_*` flags for use with [`timerfd_settime`].
101101 ///
@@ -108,7 +108,7 @@ bitflags! {
108108 const ABSTIME = bitcast!( c:: TFD_TIMER_ABSTIME ) ;
109109
110110 /// `TFD_TIMER_CANCEL_ON_SET`
111- #[ cfg( linux_kernel) ]
111+ #[ cfg( any ( linux_kernel, target_os = "freebsd" ) ) ]
112112 #[ doc( alias = "TFD_TIMER_CANCEL_ON_SET" ) ]
113113 const CANCEL_ON_SET = bitcast!( c:: TFD_TIMER_CANCEL_ON_SET ) ;
114114
@@ -120,7 +120,7 @@ bitflags! {
120120/// `CLOCK_*` constants for use with [`timerfd_create`].
121121///
122122/// [`timerfd_create`]: crate::time::timerfd_create
123- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
123+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
124124#[ derive( Debug , Copy , Clone , Eq , PartialEq , Hash ) ]
125125#[ repr( u32 ) ]
126126#[ non_exhaustive]
@@ -157,6 +157,7 @@ pub enum TimerfdClockId {
157157 /// This clock is like `Realtime`, but can wake up a suspended system.
158158 ///
159159 /// Use of this clock requires the `CAP_WAKE_ALARM` Linux capability.
160+ #[ cfg( linux_kernel) ]
160161 #[ doc( alias = "CLOCK_REALTIME_ALARM" ) ]
161162 RealtimeAlarm = bitcast ! ( c:: CLOCK_REALTIME_ALARM ) ,
162163
@@ -165,11 +166,12 @@ pub enum TimerfdClockId {
165166 /// This clock is like `Boottime`, but can wake up a suspended system.
166167 ///
167168 /// Use of this clock requires the `CAP_WAKE_ALARM` Linux capability.
169+ #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
168170 #[ doc( alias = "CLOCK_BOOTTIME_ALARM" ) ]
169171 BoottimeAlarm = bitcast ! ( c:: CLOCK_BOOTTIME_ALARM ) ,
170172}
171173
172- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
174+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
173175#[ test]
174176fn test_types ( ) {
175177 assert_eq_size ! ( TimerfdFlags , c:: c_int) ;
0 commit comments