Skip to content

Added clock_getcpuclockid to more targets #1867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 0 additions & 21 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
22 changes: 0 additions & 22 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
27 changes: 27 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 0 additions & 5 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down