1
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
1
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
2
2
use crate :: backend:: c;
3
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
3
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
4
4
#[ cfg( fix_y2038) ]
5
5
use crate :: timespec:: LibcTimespec ;
6
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
6
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
7
7
#[ cfg( fix_y2038) ]
8
8
use crate :: timespec:: Timespec ;
9
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
9
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
10
10
use bitflags:: bitflags;
11
11
12
12
/// `struct itimerspec` for use with [`timerfd_gettime`] and
13
13
/// [`timerfd_settime`].
14
14
///
15
15
/// [`timerfd_gettime`]: crate::time::timerfd_gettime
16
16
/// [`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") ) ]
18
18
#[ cfg( not( fix_y2038) ) ]
19
19
pub type Itimerspec = c:: itimerspec ;
20
20
@@ -23,7 +23,7 @@ pub type Itimerspec = c::itimerspec;
23
23
///
24
24
/// [`timerfd_gettime`]: crate::time::timerfd_gettime
25
25
/// [`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") ) ]
27
27
#[ cfg( fix_y2038) ]
28
28
#[ repr( C ) ]
29
29
#[ derive( Debug , Clone ) ]
@@ -35,13 +35,13 @@ pub struct Itimerspec {
35
35
}
36
36
37
37
/// 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") ) ]
39
39
#[ cfg( not( fix_y2038) ) ]
40
40
pub ( crate ) type LibcItimerspec = Itimerspec ;
41
41
42
42
/// On 32-bit glibc platforms, `LibcTimespec` differs from `Timespec`, so we
43
43
/// 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") ) ]
45
45
#[ cfg( fix_y2038) ]
46
46
#[ repr( C ) ]
47
47
#[ derive( Debug , Clone ) ]
@@ -50,7 +50,7 @@ pub(crate) struct LibcItimerspec {
50
50
pub it_value : LibcTimespec ,
51
51
}
52
52
53
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
53
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
54
54
#[ cfg( fix_y2038) ]
55
55
impl From < LibcItimerspec > for Itimerspec {
56
56
#[ inline]
@@ -62,7 +62,7 @@ impl From<LibcItimerspec> for Itimerspec {
62
62
}
63
63
}
64
64
65
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
65
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
66
66
#[ cfg( fix_y2038) ]
67
67
impl From < Itimerspec > for LibcItimerspec {
68
68
#[ inline]
@@ -74,7 +74,7 @@ impl From<Itimerspec> for LibcItimerspec {
74
74
}
75
75
}
76
76
77
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
77
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
78
78
bitflags ! {
79
79
/// `TFD_*` flags for use with [`timerfd_create`].
80
80
///
@@ -95,7 +95,7 @@ bitflags! {
95
95
}
96
96
}
97
97
98
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
98
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
99
99
bitflags ! {
100
100
/// `TFD_TIMER_*` flags for use with [`timerfd_settime`].
101
101
///
@@ -108,7 +108,7 @@ bitflags! {
108
108
const ABSTIME = bitcast!( c:: TFD_TIMER_ABSTIME ) ;
109
109
110
110
/// `TFD_TIMER_CANCEL_ON_SET`
111
- #[ cfg( linux_kernel) ]
111
+ #[ cfg( any ( linux_kernel, target_os = "freebsd" ) ) ]
112
112
#[ doc( alias = "TFD_TIMER_CANCEL_ON_SET" ) ]
113
113
const CANCEL_ON_SET = bitcast!( c:: TFD_TIMER_CANCEL_ON_SET ) ;
114
114
@@ -120,7 +120,7 @@ bitflags! {
120
120
/// `CLOCK_*` constants for use with [`timerfd_create`].
121
121
///
122
122
/// [`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") ) ]
124
124
#[ derive( Debug , Copy , Clone , Eq , PartialEq , Hash ) ]
125
125
#[ repr( u32 ) ]
126
126
#[ non_exhaustive]
@@ -157,6 +157,7 @@ pub enum TimerfdClockId {
157
157
/// This clock is like `Realtime`, but can wake up a suspended system.
158
158
///
159
159
/// Use of this clock requires the `CAP_WAKE_ALARM` Linux capability.
160
+ #[ cfg( linux_kernel) ]
160
161
#[ doc( alias = "CLOCK_REALTIME_ALARM" ) ]
161
162
RealtimeAlarm = bitcast ! ( c:: CLOCK_REALTIME_ALARM ) ,
162
163
@@ -165,11 +166,12 @@ pub enum TimerfdClockId {
165
166
/// This clock is like `Boottime`, but can wake up a suspended system.
166
167
///
167
168
/// Use of this clock requires the `CAP_WAKE_ALARM` Linux capability.
169
+ #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
168
170
#[ doc( alias = "CLOCK_BOOTTIME_ALARM" ) ]
169
171
BoottimeAlarm = bitcast ! ( c:: CLOCK_BOOTTIME_ALARM ) ,
170
172
}
171
173
172
- #[ cfg( any( linux_kernel, target_os = "fuchsia" ) ) ]
174
+ #[ cfg( any( linux_kernel, target_os = "freebsd" , target_os = " fuchsia") ) ]
173
175
#[ test]
174
176
fn test_types ( ) {
175
177
assert_eq_size ! ( TimerfdFlags , c:: c_int) ;
0 commit comments