Skip to content

Commit 8d3753e

Browse files
committed
NetBSD: Introduce time.rs, fix the values of CLOCK_*_CPUTIME_ID
Link: https://github.com/NetBSD/src/blob/6ace5fed3bd010695a1b88ca6c1f8a5af7793ffb/sys/sys/time.h#L305-L306 (backport <#4782>) (cherry picked from commit 57213d4)
1 parent 2eb715f commit 8d3753e

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

src/new/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ cfg_if! {
185185
} else if #[cfg(target_os = "netbsd")] {
186186
pub use sys::ipc::*;
187187
pub use sys::statvfs::*;
188+
pub use sys::time::*;
188189
pub use sys::timex::*;
189190
pub use sys::types::*;
190191
pub use utmp_::*;

src/new/netbsd/sys/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
55
pub(crate) mod ipc;
66
pub(crate) mod statvfs;
7+
pub(crate) mod time;
78
pub(crate) mod timex;
89
pub(crate) mod types;

src/new/netbsd/sys/time.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! Header: `sys/time.h`
2+
//!
3+
//! <https://github.com/NetBSD/src/blob/trunk/sys/sys/time.h>
4+
5+
s! {
6+
pub struct itimerspec {
7+
pub it_interval: crate::timespec,
8+
pub it_value: crate::timespec,
9+
}
10+
}
11+
12+
pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 0x20000000;
13+
pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 0x40000000;

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,6 @@ s! {
167167
pub mq_curmsgs: c_long,
168168
}
169169

170-
pub struct itimerspec {
171-
pub it_interval: crate::timespec,
172-
pub it_value: crate::timespec,
173-
}
174-
175170
pub struct sigset_t {
176171
__bits: [u32; 4],
177172
}
@@ -1340,8 +1335,6 @@ pub const fn _IOC(inout: c_ulong, group: c_ulong, num: c_ulong, len: c_ulong) ->
13401335
| (num)
13411336
}
13421337

1343-
pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 2;
1344-
pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 4;
13451338
pub const NTP_API: c_int = 4;
13461339

13471340
pub const LITTLE_ENDIAN: c_int = 1234;
@@ -2281,12 +2274,12 @@ extern "C" {
22812274

22822275
// Added in `NetBSD` 10.0
22832276
pub fn timerfd_create(clockid: crate::clockid_t, flags: c_int) -> c_int;
2284-
pub fn timerfd_gettime(fd: c_int, curr_value: *mut itimerspec) -> c_int;
2277+
pub fn timerfd_gettime(fd: c_int, curr_value: *mut crate::itimerspec) -> c_int;
22852278
pub fn timerfd_settime(
22862279
fd: c_int,
22872280
flags: c_int,
2288-
new_value: *const itimerspec,
2289-
old_value: *mut itimerspec,
2281+
new_value: *const crate::itimerspec,
2282+
old_value: *mut crate::itimerspec,
22902283
) -> c_int;
22912284

22922285
pub fn qsort_r(

0 commit comments

Comments
 (0)