Added clock_getcpuclockid to more targets

Previously clock_getcpuclockid was enabled only on linux, with this
change it is enabled on all linux_like and freebsdlike.
This commit is contained in:
Daniil Bondarev 2020-08-19 00:07:36 -07:00
parent 56930aacaa
commit ce5cb03544
6 changed files with 49 additions and 52 deletions

View file

@ -1590,10 +1590,22 @@ fn test_android(target: &str) {
// FIXME: Somehow we cannot find these fns on aarch64.
// https://github.com/rust-lang/libc/issues/1765
"lockf" | "preadv64" | "pwritev64" | "openpty" | "forkpty"
| "login_tty" | "getifaddrs" | "freeifaddrs" | "sethostname"
| "getgrgid_r" | "getgrnam_r" | "sigtimedwait" | "fmemopen"
| "open_memstream" | "open_wmemstream"
"lockf"
| "preadv64"
| "pwritev64"
| "openpty"
| "forkpty"
| "login_tty"
| "getifaddrs"
| "freeifaddrs"
| "sethostname"
| "getgrgid_r"
| "getgrnam_r"
| "sigtimedwait"
| "fmemopen"
| "open_memstream"
| "open_wmemstream"
| "clock_getcpuclockid"
if aarch64 =>
{
true

View file

@ -460,21 +460,6 @@ pub const RLIM_NLIMITS: ::rlim_t = 12;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
pub const CLOCK_REALTIME: ::clockid_t = 0;
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_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_MONOTONIC_PRECISE: ::clockid_t = 11;
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
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;
pub const CTL_UNSPEC: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
pub const CTL_VM: ::c_int = 2;
@ -1065,12 +1050,6 @@ extern "C" {
len: ::size_t,
prot: ::c_int,
) -> ::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;
pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;

View file

@ -447,21 +447,6 @@ pub const NOTE_NSECONDS: u32 = 0x00000008;
pub const MADV_PROTECT: ::c_int = 10;
pub const RUSAGE_THREAD: ::c_int = 1;
pub const CLOCK_REALTIME: ::clockid_t = 0;
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_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_MONOTONIC_PRECISE: ::clockid_t = 11;
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
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;
#[doc(hidden)]
#[deprecated(
since = "0.2.72",
@ -1222,13 +1207,6 @@ f! {
extern "C" {
pub fn __error() -> *mut ::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;
pub fn extattr_delete_fd(
fd: ::c_int,
attrnamespace: ::c_int,

View file

@ -638,6 +638,21 @@ pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
pub const RUSAGE_SELF: ::c_int = 0;
pub const RUSAGE_CHILDREN: ::c_int = -1;
pub const CLOCK_REALTIME: ::clockid_t = 0;
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_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_MONOTONIC_PRECISE: ::clockid_t = 11;
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
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;
pub const MADV_NORMAL: ::c_int = 0;
pub const MADV_RANDOM: ::c_int = 1;
pub const MADV_SEQUENTIAL: ::c_int = 2;
@ -1242,6 +1257,18 @@ extern "C" {
flags: ::c_ulong,
atflag: ::c_int,
) -> ::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;
pub fn clock_getcpuclockid(
pid: ::pid_t,
clk_id: *mut ::clockid_t,
) -> ::c_int;
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn endutxent();

View file

@ -2761,11 +2761,6 @@ extern "C" {
sevp: *mut ::sigevent,
) -> ::c_int;
pub fn clock_getcpuclockid(
pid: ::pid_t,
clk_id: *mut ::clockid_t,
) -> ::c_int;
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn setpwent();

View file

@ -1310,12 +1310,18 @@ extern "C" {
len: ::size_t,
vec: *mut ::c_uchar,
) -> ::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;
pub fn clock_getcpuclockid(
pid: ::pid_t,
clk_id: *mut ::clockid_t,
) -> ::c_int;
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn pthread_getattr_np(