Skip to content

Commit d85f265

Browse files
authored
Merge pull request rust-lang#344 from letheed/master
Add clock_nanosleep for linux and solaris
2 parents 670f0b3 + 58b7dfb commit d85f265

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/unix/notbsd/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9;
219219
// 2014.) See also musl/mod.rs
220220
// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
221221
// pub const CLOCK_TAI: clockid_t = 11;
222+
pub const TIMER_ABSTIME: ::c_int = 1;
222223

223224
pub const RLIMIT_CPU: ::c_int = 0;
224225
pub const RLIMIT_FSIZE: ::c_int = 1;
@@ -730,6 +731,10 @@ extern {
730731
vec: *mut ::c_uchar) -> ::c_int;
731732
pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
732733
pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
734+
pub fn clock_nanosleep(clk_id: clockid_t,
735+
flags: ::c_int,
736+
rqtp: *const ::timespec,
737+
rmtp: *mut ::timespec) -> ::c_int;
733738
pub fn prctl(option: ::c_int, ...) -> ::c_int;
734739
pub fn pthread_getattr_np(native: ::pthread_t,
735740
attr: *mut ::pthread_attr_t) -> ::c_int;

src/unix/solaris/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ pub const SIGSTKSZ: ::size_t = 8192;
724724
// __CLOCK_REALTIME0==0 is an obsoleted version of CLOCK_REALTIME==3
725725
pub const CLOCK_REALTIME: clockid_t = 3;
726726
pub const CLOCK_MONOTONIC: clockid_t = 4;
727+
pub const TIMER_RELTIME: ::c_int = 0;
728+
pub const TIMER_ABSTIME: ::c_int = 1;
727729

728730
pub const RLIMIT_CPU: ::c_int = 0;
729731
pub const RLIMIT_FSIZE: ::c_int = 1;
@@ -959,6 +961,10 @@ extern {
959961
-> ::c_int;
960962
pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
961963
pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
964+
pub fn clock_nanosleep(clk_id: clockid_t,
965+
flags: ::c_int,
966+
rqtp: *const ::timespec,
967+
rmtp: *mut ::timespec) -> ::c_int;
962968
pub fn getnameinfo(sa: *const ::sockaddr,
963969
salen: ::socklen_t,
964970
host: *mut ::c_char,
@@ -1028,4 +1034,3 @@ extern {
10281034
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
10291035
clock_id: clockid_t) -> ::c_int;
10301036
}
1031-

0 commit comments

Comments
 (0)