Skip to content

Commit 80d5bba

Browse files
committed
Auto merge of #2418 - devnexen:netbsd_timer_api, r=Amanieu
netbsd aff timer api
2 parents 372a8c6 + 0d00164 commit 80d5bba

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

libc-test/semver/netbsd.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,7 @@ in6_pktinfo
12091209
in_pktinfo
12101210
initgroups
12111211
ipc_perm
1212+
itimerspec
12121213
kevent
12131214
key_t
12141215
killpg
@@ -1380,6 +1381,12 @@ syscall
13801381
sysctl
13811382
sysctlbyname
13821383
telldir
1384+
timer_create
1385+
timer_delete
1386+
timer_getoverrun
1387+
timer_gettime
1388+
timer_settime
1389+
timer_t
13831390
timex
13841391
truncate
13851392
ttyname_r

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub type shmatt_t = ::c_uint;
1313
pub type cpuid_t = u64;
1414
pub type cpuset_t = _cpuset;
1515
pub type pthread_spin_t = ::c_uchar;
16+
pub type timer_t = ::c_int;
1617

1718
// elf.h
1819

@@ -120,6 +121,11 @@ s! {
120121
pub mq_curmsgs: ::c_long,
121122
}
122123

124+
pub struct itimerspec {
125+
pub it_interval: ::timespec,
126+
pub it_value: ::timespec,
127+
}
128+
123129
pub struct sigset_t {
124130
__bits: [u32; 4],
125131
}
@@ -2256,6 +2262,21 @@ extern "C" {
22562262
) -> ::size_t;
22572263
pub fn iconv_close(cd: iconv_t) -> ::c_int;
22582264

2265+
pub fn timer_create(
2266+
clockid: ::clockid_t,
2267+
sevp: *mut ::sigevent,
2268+
timerid: *mut ::timer_t,
2269+
) -> ::c_int;
2270+
pub fn timer_delete(timerid: ::timer_t) -> ::c_int;
2271+
pub fn timer_getoverrun(timerid: ::timer_t) -> ::c_int;
2272+
pub fn timer_gettime(timerid: ::timer_t, curr_value: *mut ::itimerspec) -> ::c_int;
2273+
pub fn timer_settime(
2274+
timerid: ::timer_t,
2275+
flags: ::c_int,
2276+
new_value: *const ::itimerspec,
2277+
old_value: *mut ::itimerspec,
2278+
) -> ::c_int;
2279+
22592280
// Added in `NetBSD` 7.0
22602281
pub fn explicit_memset(b: *mut ::c_void, c: ::c_int, len: ::size_t);
22612282
pub fn consttime_memequal(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;

0 commit comments

Comments
 (0)