Skip to content

Commit 2a8bfe4

Browse files
authored
Merge pull request #1867 from xonatius/clock_getcpuclockid_more_targets
Added clock_getcpuclockid to more targets
2 parents 56930aa + ce5cb03 commit 2a8bfe4

File tree

6 files changed

+49
-52
lines changed

6 files changed

+49
-52
lines changed

libc-test/build.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -1590,10 +1590,22 @@ fn test_android(target: &str) {
15901590

15911591
// FIXME: Somehow we cannot find these fns on aarch64.
15921592
// https://github.com/rust-lang/libc/issues/1765
1593-
"lockf" | "preadv64" | "pwritev64" | "openpty" | "forkpty"
1594-
| "login_tty" | "getifaddrs" | "freeifaddrs" | "sethostname"
1595-
| "getgrgid_r" | "getgrnam_r" | "sigtimedwait" | "fmemopen"
1596-
| "open_memstream" | "open_wmemstream"
1593+
"lockf"
1594+
| "preadv64"
1595+
| "pwritev64"
1596+
| "openpty"
1597+
| "forkpty"
1598+
| "login_tty"
1599+
| "getifaddrs"
1600+
| "freeifaddrs"
1601+
| "sethostname"
1602+
| "getgrgid_r"
1603+
| "getgrnam_r"
1604+
| "sigtimedwait"
1605+
| "fmemopen"
1606+
| "open_memstream"
1607+
| "open_wmemstream"
1608+
| "clock_getcpuclockid"
15971609
if aarch64 =>
15981610
{
15991611
true

src/unix/bsd/freebsdlike/dragonfly/mod.rs

-21
Original file line numberDiff line numberDiff line change
@@ -460,21 +460,6 @@ pub const RLIM_NLIMITS: ::rlim_t = 12;
460460
pub const Q_GETQUOTA: ::c_int = 0x300;
461461
pub const Q_SETQUOTA: ::c_int = 0x400;
462462

463-
pub const CLOCK_REALTIME: ::clockid_t = 0;
464-
pub const CLOCK_VIRTUAL: ::clockid_t = 1;
465-
pub const CLOCK_PROF: ::clockid_t = 2;
466-
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
467-
pub const CLOCK_UPTIME: ::clockid_t = 5;
468-
pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
469-
pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
470-
pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
471-
pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
472-
pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
473-
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
474-
pub const CLOCK_SECOND: ::clockid_t = 13;
475-
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
476-
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
477-
478463
pub const CTL_UNSPEC: ::c_int = 0;
479464
pub const CTL_KERN: ::c_int = 1;
480465
pub const CTL_VM: ::c_int = 2;
@@ -1065,12 +1050,6 @@ extern "C" {
10651050
len: ::size_t,
10661051
prot: ::c_int,
10671052
) -> ::c_int;
1068-
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1069-
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1070-
pub fn clock_settime(
1071-
clk_id: ::clockid_t,
1072-
tp: *const ::timespec,
1073-
) -> ::c_int;
10741053

10751054
pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;
10761055

src/unix/bsd/freebsdlike/freebsd/mod.rs

-22
Original file line numberDiff line numberDiff line change
@@ -447,21 +447,6 @@ pub const NOTE_NSECONDS: u32 = 0x00000008;
447447
pub const MADV_PROTECT: ::c_int = 10;
448448
pub const RUSAGE_THREAD: ::c_int = 1;
449449

450-
pub const CLOCK_REALTIME: ::clockid_t = 0;
451-
pub const CLOCK_VIRTUAL: ::clockid_t = 1;
452-
pub const CLOCK_PROF: ::clockid_t = 2;
453-
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
454-
pub const CLOCK_UPTIME: ::clockid_t = 5;
455-
pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
456-
pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
457-
pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
458-
pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
459-
pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
460-
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
461-
pub const CLOCK_SECOND: ::clockid_t = 13;
462-
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
463-
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
464-
465450
#[doc(hidden)]
466451
#[deprecated(
467452
since = "0.2.72",
@@ -1222,13 +1207,6 @@ f! {
12221207
extern "C" {
12231208
pub fn __error() -> *mut ::c_int;
12241209

1225-
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1226-
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1227-
pub fn clock_settime(
1228-
clk_id: ::clockid_t,
1229-
tp: *const ::timespec,
1230-
) -> ::c_int;
1231-
12321210
pub fn extattr_delete_fd(
12331211
fd: ::c_int,
12341212
attrnamespace: ::c_int,

src/unix/bsd/freebsdlike/mod.rs

+27
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,21 @@ pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
638638
pub const RUSAGE_SELF: ::c_int = 0;
639639
pub const RUSAGE_CHILDREN: ::c_int = -1;
640640

641+
pub const CLOCK_REALTIME: ::clockid_t = 0;
642+
pub const CLOCK_VIRTUAL: ::clockid_t = 1;
643+
pub const CLOCK_PROF: ::clockid_t = 2;
644+
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
645+
pub const CLOCK_UPTIME: ::clockid_t = 5;
646+
pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
647+
pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
648+
pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
649+
pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
650+
pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
651+
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
652+
pub const CLOCK_SECOND: ::clockid_t = 13;
653+
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
654+
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
655+
641656
pub const MADV_NORMAL: ::c_int = 0;
642657
pub const MADV_RANDOM: ::c_int = 1;
643658
pub const MADV_SEQUENTIAL: ::c_int = 2;
@@ -1242,6 +1257,18 @@ extern "C" {
12421257
flags: ::c_ulong,
12431258
atflag: ::c_int,
12441259
) -> ::c_int;
1260+
1261+
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1262+
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1263+
pub fn clock_settime(
1264+
clk_id: ::clockid_t,
1265+
tp: *const ::timespec,
1266+
) -> ::c_int;
1267+
pub fn clock_getcpuclockid(
1268+
pid: ::pid_t,
1269+
clk_id: *mut ::clockid_t,
1270+
) -> ::c_int;
1271+
12451272
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
12461273
pub fn duplocale(base: ::locale_t) -> ::locale_t;
12471274
pub fn endutxent();

src/unix/linux_like/linux/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -2761,11 +2761,6 @@ extern "C" {
27612761
sevp: *mut ::sigevent,
27622762
) -> ::c_int;
27632763

2764-
pub fn clock_getcpuclockid(
2765-
pid: ::pid_t,
2766-
clk_id: *mut ::clockid_t,
2767-
) -> ::c_int;
2768-
27692764
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
27702765

27712766
pub fn setpwent();

src/unix/linux_like/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1310,12 +1310,18 @@ extern "C" {
13101310
len: ::size_t,
13111311
vec: *mut ::c_uchar,
13121312
) -> ::c_int;
1313+
13131314
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
13141315
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
13151316
pub fn clock_settime(
13161317
clk_id: ::clockid_t,
13171318
tp: *const ::timespec,
13181319
) -> ::c_int;
1320+
pub fn clock_getcpuclockid(
1321+
pid: ::pid_t,
1322+
clk_id: *mut ::clockid_t,
1323+
) -> ::c_int;
1324+
13191325
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
13201326

13211327
pub fn pthread_getattr_np(

0 commit comments

Comments
 (0)