File tree 2 files changed +35
-5
lines changed
2 files changed +35
-5
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,13 @@ impl ClockId {
21
21
}
22
22
23
23
/// Returns `ClockId` of a `pid` CPU-time clock
24
- #[ cfg( target_os = "linux" ) ]
24
+ #[ cfg( any(
25
+ target_os = "freebsd" ,
26
+ target_os = "dragonfly" ,
27
+ target_os = "linux" ,
28
+ target_os = "android" ,
29
+ target_os = "emscripten" ,
30
+ ) ) ]
25
31
pub fn pid_cpu_clock_id ( pid : Pid ) -> Result < Self > {
26
32
clock_getcpuclockid ( pid)
27
33
}
@@ -229,7 +235,13 @@ pub fn clock_settime(clock_id: ClockId, timespec: TimeSpec) -> Result<()> {
229
235
230
236
/// Get the clock id of the specified process id, (see
231
237
/// [clock_getcpuclockid(3)](https://www.man7.org/linux/man-pages/man3/clock_getcpuclockid.3.html)).
232
- #[ cfg( target_os = "linux" ) ]
238
+ #[ cfg( any(
239
+ target_os = "freebsd" ,
240
+ target_os = "dragonfly" ,
241
+ target_os = "linux" ,
242
+ target_os = "android" ,
243
+ target_os = "emscripten" ,
244
+ ) ) ]
233
245
pub fn clock_getcpuclockid ( pid : Pid ) -> Result < ClockId > {
234
246
let mut clk_id: MaybeUninit < libc:: clockid_t > = MaybeUninit :: uninit ( ) ;
235
247
let ret = unsafe { libc:: clock_getcpuclockid ( pid. into ( ) , clk_id. as_mut_ptr ( ) ) } ;
Original file line number Diff line number Diff line change 1
- #[ cfg( target_os = "linux" ) ]
1
+ #[ cfg( any(
2
+ target_os = "freebsd" ,
3
+ target_os = "dragonfly" ,
4
+ target_os = "linux" ,
5
+ target_os = "android" ,
6
+ target_os = "emscripten" ,
7
+ ) ) ]
2
8
use nix:: time:: clock_getcpuclockid;
3
9
use nix:: time:: { clock_getres, clock_gettime, ClockId } ;
4
10
@@ -12,7 +18,13 @@ pub fn test_clock_gettime() {
12
18
assert ! ( clock_gettime( ClockId :: CLOCK_REALTIME ) . is_ok( ) ) ;
13
19
}
14
20
15
- #[ cfg( target_os = "linux" ) ]
21
+ #[ cfg( any(
22
+ target_os = "freebsd" ,
23
+ target_os = "dragonfly" ,
24
+ target_os = "linux" ,
25
+ target_os = "android" ,
26
+ target_os = "emscripten" ,
27
+ ) ) ]
16
28
#[ test]
17
29
pub fn test_clock_getcpuclockid ( ) {
18
30
let clock_id = clock_getcpuclockid ( nix:: unistd:: Pid :: this ( ) ) . unwrap ( ) ;
@@ -29,7 +41,13 @@ pub fn test_clock_id_now() {
29
41
assert ! ( ClockId :: CLOCK_REALTIME . now( ) . is_ok( ) ) ;
30
42
}
31
43
32
- #[ cfg( target_os = "linux" ) ]
44
+ #[ cfg( any(
45
+ target_os = "freebsd" ,
46
+ target_os = "dragonfly" ,
47
+ target_os = "linux" ,
48
+ target_os = "android" ,
49
+ target_os = "emscripten" ,
50
+ ) ) ]
33
51
#[ test]
34
52
pub fn test_clock_id_pid_cpu_clock_id ( ) {
35
53
assert ! ( ClockId :: pid_cpu_clock_id( nix:: unistd:: Pid :: this( ) )
You can’t perform that action at this time.
0 commit comments