From 5675256b8085ee93915e560ec4251f3a9915ecee Mon Sep 17 00:00:00 2001 From: Patrick Mooney Date: Fri, 22 Jan 2021 04:21:43 +0000 Subject: [PATCH] Add timer interface for illumos and Solaris --- src/unix/solarish/mod.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 0f53fe92dc9f5..32a8525187650 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -20,6 +20,7 @@ pub type rlim_t = ::c_ulong; pub type speed_t = ::c_uint; pub type tcflag_t = ::c_uint; pub type time_t = ::c_long; +pub type timer_t = ::c_int; pub type wchar_t = ::c_int; pub type nfds_t = ::c_ulong; pub type projid_t = ::c_int; @@ -120,6 +121,11 @@ s! { pub ifa_data: *mut ::c_void } + pub struct itimerspec { + pub it_interval: ::timespec, + pub it_value: ::timespec, + } + pub struct tm { pub tm_sec: ::c_int, pub tm_min: ::c_int, @@ -2656,6 +2662,21 @@ extern "C" { pub fn ntp_adjtime(buf: *mut timex) -> ::c_int; pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int; + pub fn timer_create( + clock_id: clockid_t, + evp: *mut sigevent, + timerid: *mut timer_t, + ) -> ::c_int; + pub fn timer_delete(timerid: timer_t) -> ::c_int; + pub fn timer_getoverrun(timerid: timer_t) -> ::c_int; + pub fn timer_gettime(timerid: timer_t, value: *mut itimerspec) -> ::c_int; + pub fn timer_settime( + timerid: timer_t, + flags: ::c_int, + value: *const itimerspec, + ovalue: *mut itimerspec, + ) -> ::c_int; + pub fn ucred_get(pid: ::pid_t) -> *mut ucred_t; pub fn getpeerucred(fd: ::c_int, ucred: *mut *mut ucred_t) -> ::c_int;