Skip to content

Commit

Permalink
clock_nanosleep for dragonflybsd, moving constants freebsd only too.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 31, 2023
1 parent c204453 commit b27bf46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions libc-test/semver/dragonfly.txt
Expand Up @@ -1263,6 +1263,7 @@ chroot
clearerr
clock_getcpuclockid
clock_getres
clock_nanosleep
clock_settime
cmsgcred
cmsghdr
Expand Down
12 changes: 5 additions & 7 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Expand Up @@ -4728,6 +4728,11 @@ pub const RB_POWERCYCLE: ::c_int = 0x400000;
pub const RB_PROBE: ::c_int = 0x10000000;
pub const RB_MULTIPLE: ::c_int = 0x20000000;

// sys/time.h
pub const CLOCK_BOOTTIME: ::clockid_t = ::CLOCK_UPTIME;
pub const CLOCK_REALTIME_COARSE: ::clockid_t = ::CLOCK_REALTIME_FAST;
pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = ::CLOCK_MONOTONIC_FAST;

// sys/timerfd.h

pub const TFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
Expand Down Expand Up @@ -5363,13 +5368,6 @@ extern "C" {
pub fn getpagesizes(pagesize: *mut ::size_t, nelem: ::c_int) -> ::c_int;

pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int;
pub fn clock_nanosleep(
clk_id: ::clockid_t,
flags: ::c_int,
rqtp: *const ::timespec,
rmtp: *mut ::timespec,
) -> ::c_int;

pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char;

pub fn shm_create_largepage(
Expand Down
10 changes: 7 additions & 3 deletions src/unix/bsd/freebsdlike/mod.rs
Expand Up @@ -824,15 +824,12 @@ pub const CLOCK_VIRTUAL: ::clockid_t = 1;
pub const CLOCK_PROF: ::clockid_t = 2;
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
pub const CLOCK_UPTIME: ::clockid_t = 5;
pub const CLOCK_BOOTTIME: ::clockid_t = CLOCK_UPTIME;
pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
pub const CLOCK_REALTIME_COARSE: ::clockid_t = CLOCK_REALTIME_FAST;
pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = CLOCK_MONOTONIC_FAST;
pub const CLOCK_SECOND: ::clockid_t = 13;
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
Expand Down Expand Up @@ -1493,6 +1490,13 @@ extern "C" {
atflag: ::c_int,
) -> ::c_int;

pub fn clock_nanosleep(
clk_id: ::clockid_t,
flags: ::c_int,
rqtp: *const ::timespec,
rmtp: *mut ::timespec,
) -> ::c_int;

pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
Expand Down

0 comments on commit b27bf46

Please sign in to comment.