-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
C-API-requestCategory: API requestCategory: API requestE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.O-linux
Description
#include <sys/time.h>
int getitimer(int which, struct itimerval *value);
int setitimer(int which, const struct itimerval *restrict value, struct itimerval *restrict ovalue);
This is a minimal demo:
let tval = nix::libc::itimerval {
it_interval: nix::libc::timeval {
tv_sec: 0,
tv_usec: 0,
},
it_value: nix::libc::timeval {
tv_sec: 1,
tv_usec: 0,
},
};
if unsafe { setitimer(nix::libc::ITIMER_REAL, &tval as *const _, std::ptr::null_mut()) } == -1 {
panic!("setitimer");
}
let tval2 = nix::libc::itimerval {
it_interval: nix::libc::timeval {
tv_sec: 0,
tv_usec: 0,
},
it_value: nix::libc::timeval {
tv_sec: 0,
tv_usec: 0,
},
};
if unsafe { getitimer(nix::libc::ITIMER_REAL, &mut tval as *mut _) } == -1 {
panic!("getitimer");
}
I have found these two commits: e976c37, bc48202 -- getitimer
and setitimer
we introduced and dropped for netbsd target. Those definitions seem to work fine for me on Linux.
YangKeao, zombiezen, ishantheperson, nbars, Visic and 2 more
Metadata
Metadata
Assignees
Labels
C-API-requestCategory: API requestCategory: API requestE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.O-linux