diff --git a/include/time.h b/include/time.h
index 23d2580..832ee68 100644
--- a/include/time.h
+++ b/include/time.h
@@ -16,12 +16,10 @@ libc_hidden_proto (localtime)
libc_hidden_proto (strftime)
libc_hidden_proto (strptime)
-extern __typeof (clock_getres) __clock_getres;
extern __typeof (clock_gettime) __clock_gettime;
libc_hidden_proto (__clock_gettime)
extern __typeof (clock_settime) __clock_settime;
-extern __typeof (clock_nanosleep) __clock_nanosleep;
-extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
+libc_hidden_proto (__clock_settime)
/* Now define the internal interfaces. */
struct tm;
diff --git a/rt/Makefile b/rt/Makefile
index 14f38ef..de53133 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -28,9 +28,6 @@ aio-routines := aio_cancel aio_error aio_fsync aio_misc aio_read \
aio_read64 aio_return aio_suspend aio_write \
aio_write64 lio_listio lio_listio64 aio_sigqueue \
aio_notify
-clock-routines := clock_getcpuclockid \
- clock_getres clock_gettime clock_settime \
- clock_nanosleep
timer-routines := timer_create timer_delete timer_getoverr \
timer_gettime timer_settime
shm-routines := shm_open shm_unlink
@@ -38,22 +35,18 @@ mq-routines := mq_open mq_close mq_unlink mq_getattr mq_setattr \
mq_notify mq_send mq_receive mq_timedsend \
mq_timedreceive
-routines = $(clock-routines)
-
librt-routines = $(aio-routines) \
$(timer-routines) \
- $(shm-routines) $(mq-routines) \
- clock-compat
+ $(shm-routines) $(mq-routines)
-tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
+tests := tst-shm tst-timer tst-timer2 \
tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
tst-timer3 tst-timer4 tst-timer5 \
- tst-cpuclock1 tst-cpuclock2 \
- tst-cputimer1 tst-cputimer2 tst-cputimer3 \
- tst-clock2 tst-shm-cancel
+ tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
+ tst-shm-cancel
extra-libs := librt
extra-libs-others := $(extra-libs)
diff --git a/rt/Versions b/rt/Versions
index 91e3fd2..84d1345 100644
--- a/rt/Versions
+++ b/rt/Versions
@@ -1,15 +1,3 @@
-libc {
- GLIBC_2.17 {
- # c*
- clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
- clock_nanosleep;
- }
- GLIBC_PRIVATE {
- __clock_getres; __clock_gettime; __clock_settime; __clock_getcpuclockid;
- __clock_nanosleep;
- }
-}
-
librt {
GLIBC_2.1 {
# AIO functions.
@@ -18,10 +6,6 @@ librt {
aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
}
GLIBC_2.2 {
- # These have moved to libc and are still here only for compatibility.
- clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
- clock_nanosleep;
-
# s*
shm_open; shm_unlink;
diff --git a/rt/clock-compat.c b/rt/clock-compat.c
deleted file mode 100644
index 11e71aa..0000000
--- a/rt/clock-compat.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ABI compatibility redirects for clock_* symbols in librt.
- Copyright (C) 2012-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-
-/* The clock_* symbols were originally defined in librt and so
- are part of its ABI. As of 2.17, they have moved to libc.
- So we supply definitions for librt that just redirect to
- their libc counterparts. */
-
-#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)
-
-#include
-
-#if HAVE_IFUNC
-# undef INIT_ARCH
-# define INIT_ARCH()
-# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \
- compat_symbol (librt, name, name, GLIBC_2_2);
-#else
-# define COMPAT_REDIRECT(name, proto, arglist) \
- int \
- name proto \
- { \
- return __##name arglist; \
- } \
- compat_symbol (librt, name, name, GLIBC_2_2);
-#endif
-
-COMPAT_REDIRECT (clock_getres,
- (clockid_t clock_id, struct timespec *res),
- (clock_id, res))
-COMPAT_REDIRECT (clock_gettime,
- (clockid_t clock_id, struct timespec *tp),
- (clock_id, tp))
-COMPAT_REDIRECT (clock_settime,
- (clockid_t clock_id, const struct timespec *tp),
- (clock_id, tp))
-COMPAT_REDIRECT (clock_getcpuclockid,
- (pid_t pid, clockid_t *clock_id),
- (pid, clock_id))
-COMPAT_REDIRECT (clock_nanosleep,
- (clockid_t clock_id, int flags,
- const struct timespec *req,
- struct timespec *rem),
- (clock_id, flags, req, rem))
-
-#endif
diff --git a/rt/clock_getcpuclockid.c b/rt/clock_getcpuclockid.c
deleted file mode 100644
index 6bc42a0..0000000
--- a/rt/clock_getcpuclockid.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Get a clockid_t for the process CPU clock of a given process. Generic.
- Copyright (C) 2000-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-#include
-#include
-
-int
-__clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
-{
- /* We don't allow any process ID but our own. */
- if (pid != 0 && pid != getpid ())
- return EPERM;
-
-#ifdef CLOCK_PROCESS_CPUTIME_ID
- /* Store the number. */
- *clock_id = CLOCK_PROCESS_CPUTIME_ID;
-
- return 0;
-#else
- /* We don't have a timer for that. */
- return ENOENT;
-#endif
-}
-weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
diff --git a/rt/clock_getres.c b/rt/clock_getres.c
deleted file mode 100644
index 816f7b2..0000000
--- a/rt/clock_getres.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Get the resolution of a clock. Stub version.
- Copyright (C) 1999-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-#include
-
-/* Get resolution of clock. */
-int
-__clock_getres (clockid_t clock_id, struct timespec *res)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-weak_alias (__clock_getres, clock_getres)
-stub_warning (clock_getres)
diff --git a/rt/clock_gettime.c b/rt/clock_gettime.c
deleted file mode 100644
index 30a0124..0000000
--- a/rt/clock_gettime.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Get the current value of a clock. Stub version.
- Copyright (C) 1999-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-#include
-
-/* Get current value of CLOCK and store it in TP. */
-int
-__clock_gettime (clockid_t clock_id, struct timespec *tp)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-weak_alias (__clock_gettime, clock_gettime)
-libc_hidden_def (__clock_gettime)
-stub_warning (clock_gettime)
diff --git a/rt/clock_nanosleep.c b/rt/clock_nanosleep.c
deleted file mode 100644
index 15aa6f7..0000000
--- a/rt/clock_nanosleep.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* High-resolution sleep with the specified clock. Stub version.
- Copyright (C) 2000-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-#include
-
-int
-__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
- struct timespec *rem)
-{
- if (__builtin_expect (req->tv_nsec, 0) < 0
- || __builtin_expect (req->tv_nsec, 0) >= 1000000000)
- return EINVAL;
-
- if (flags != TIMER_ABSTIME && flags != 0)
- return EINVAL;
-
- /* Not implemented. */
- return ENOSYS;
-}
-weak_alias (__clock_nanosleep, clock_nanosleep)
-stub_warning (clock_nanosleep)
diff --git a/rt/clock_settime.c b/rt/clock_settime.c
deleted file mode 100644
index 0b6d4b2..0000000
--- a/rt/clock_settime.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Set a clock to a given value. Stub version.
- Copyright (C) 1999-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-#include
-
-/* Set CLOCK to value TP. */
-int
-__clock_settime (clockid_t clock_id, const struct timespec *tp)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-weak_alias (__clock_settime, clock_settime)
-stub_warning (clock_settime)
diff --git a/rt/tst-clock.c b/rt/tst-clock.c
deleted file mode 100644
index bec76d0..0000000
--- a/rt/tst-clock.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Test program for POSIX clock_* functions.
- Copyright (C) 2000-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper , 2000.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-#include
-#include
-#include
-
-
-/* We want to see output immediately. */
-#define STDOUT_UNBUFFERED
-
-/* We expect to run at least 10 seconds. */
-#define TIMEOUT 15
-
-static int
-clock_test (clockid_t cl)
-{
- struct timespec old_ts;
- struct timespec ts;
- struct timespec waitit;
- int result = 0;
- int i;
-
- memset (&ts, '\0', sizeof ts);
-
- waitit.tv_sec = 0;
- waitit.tv_nsec = 500000000;
-
- /* Get and print resolution of the clock. */
- if (clock_getres (cl, &ts) == 0)
- {
- if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
- {
- printf ("clock %d: nanosecond value of resolution wrong\n", cl);
- result = 1;
- }
- else
- printf ("clock %d: resolution = %jd.%09jd secs\n",
- cl, (intmax_t) ts.tv_sec, (intmax_t) ts.tv_nsec);
- }
- else
- {
- printf ("clock %d: cannot get resolution\n", cl);
- result = 1;
- }
-
- memset (&ts, '\0', sizeof ts);
- memset (&old_ts, '\0', sizeof old_ts);
-
- /* Next get the current time value a few times. */
- for (i = 0; i < 10; ++i)
- {
- if (clock_gettime (cl, &ts) == 0)
- {
- if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
- {
- printf ("clock %d: nanosecond value of time wrong (try %d)\n",
- cl, i);
- result = 1;
- }
- else
- {
- printf ("clock %d: time = %jd.%09jd secs\n",
- cl, (intmax_t) ts.tv_sec, (intmax_t) ts.tv_nsec);
-
- if (memcmp (&ts, &old_ts, sizeof ts) == 0)
- {
- printf ("clock %d: time hasn't changed (try %d)\n", cl, i);
- result = 1;
-
- old_ts = ts;
- }
- }
- }
- else
- {
- printf ("clock %d: cannot get time (try %d)\n", cl, i);
- result = 1;
- }
-
- /* Wait a bit before the next iteration. */
- nanosleep (&waitit, NULL);
- }
-
- return result;
-}
-
-static int
-do_test (void)
-{
- clockid_t cl;
- int result;
-
- result = clock_test (CLOCK_REALTIME);
-
- if (clock_getcpuclockid (0, &cl) == 0)
- /* XXX It's not yet a bug when this fails. */
- clock_test (cl);
- else
- printf("CPU clock unavailble, skipping test\n");
-
- return result;
-}
-#define TEST_FUNCTION do_test ()
-
-
-#include "../test-skeleton.c"
diff --git a/rt/tst-clock2.c b/rt/tst-clock2.c
deleted file mode 100644
index 4c8fb9f..0000000
--- a/rt/tst-clock2.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Test setting the monotonic clock. */
-
-#include
-#include
-
-#if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK
-
-# include
-# include
-
-static int
-do_test (void)
-{
- if (sysconf (_SC_MONOTONIC_CLOCK) <= 0)
- return 0;
-
- struct timespec ts;
- if (clock_gettime (CLOCK_MONOTONIC, &ts) != 0)
- {
- puts ("clock_gettime(CLOCK_MONOTONIC) failed");
- return 1;
- }
-
- /* Setting the monotonic clock must fail. */
- if (clock_settime (CLOCK_MONOTONIC, &ts) != -1)
- {
- puts ("clock_settime(CLOCK_MONOTONIC) did not fail");
- return 1;
- }
- if (errno != EINVAL)
- {
- printf ("clock_settime(CLOCK_MONOTONIC) set errno to %d, expected %d\n",
- errno, EINVAL);
- return 1;
- }
- return 0;
-}
-# define TEST_FUNCTION do_test ()
-
-#else
-# define TEST_FUNCTION 0
-#endif
-#include "../test-skeleton.c"
diff --git a/rt/tst-clock_nanosleep.c b/rt/tst-clock_nanosleep.c
deleted file mode 100644
index eb2b906..0000000
--- a/rt/tst-clock_nanosleep.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 2003-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-#include
-#include
-#include
-#include
-
-
-/* Test that clock_nanosleep() does sleep. */
-static int
-do_test (void)
-{
- /* Current time. */
- struct timeval tv1;
- (void) gettimeofday (&tv1, NULL);
-
- struct timespec ts;
- ts.tv_sec = 1;
- ts.tv_nsec = 0;
- TEMP_FAILURE_RETRY (clock_nanosleep (CLOCK_REALTIME, 0, &ts, &ts));
-
- /* At least one second must have passed. */
- struct timeval tv2;
- (void) gettimeofday (&tv2, NULL);
-
- tv2.tv_sec -= tv1.tv_sec;
- tv2.tv_usec -= tv1.tv_usec;
- if (tv2.tv_usec < 0)
- --tv2.tv_sec;
-
- if (tv2.tv_sec < 1)
- {
- puts ("clock_nanosleep didn't sleep long enough");
- return 1;
- }
-
- return 0;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/rt/tst-cpuclock1.c b/rt/tst-cpuclock1.c
deleted file mode 100644
index f6d76e3..0000000
--- a/rt/tst-cpuclock1.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/* Test program for process CPU clocks.
- Copyright (C) 2004-2018 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-/* This function is intended to rack up both user and system time. */
-static void
-chew_cpu (void)
-{
- while (1)
- {
- static volatile char buf[4096];
- for (int i = 0; i < 100; ++i)
- for (size_t j = 0; j < sizeof buf; ++j)
- buf[j] = 0xaa;
- int nullfd = open ("/dev/null", O_WRONLY);
- for (int i = 0; i < 100; ++i)
- for (size_t j = 0; j < sizeof buf; ++j)
- buf[j] = 0xbb;
- write (nullfd, (char *) buf, sizeof buf);
- close (nullfd);
- if (getppid () == 1)
- _exit (2);
- }
-}
-
-static int
-do_test (void)
-{
- int result = 0;
- clockid_t cl;
- int e;
- pid_t dead_child, child;
-
- /* Fork a child and let it die, to give us a PID known not be valid
- (assuming PIDs don't wrap around during the test). */
- {
- dead_child = fork ();
- if (dead_child == 0)
- _exit (0);
- if (dead_child < 0)
- {
- perror ("fork");
- return 1;
- }
- int x;
- if (wait (&x) != dead_child)
- {
- perror ("wait");
- return 2;
- }
- }
-
- /* POSIX says we should get ESRCH for this. */
- e = clock_getcpuclockid (dead_child, &cl);
- if (e != ENOSYS && e != ESRCH && e != EPERM)
- {
- printf ("clock_getcpuclockid on dead PID %d => %s\n",
- dead_child, strerror (e));
- result = 1;
- }
-
- /* Now give us a live child eating up CPU time. */
- child = fork ();
- if (child == 0)
- {
- chew_cpu ();
- _exit (1);
- }
- if (child < 0)
- {
- perror ("fork");
- return 1;
- }
-
- e = clock_getcpuclockid (child, &cl);
- if (e == EPERM)
- {
- puts ("clock_getcpuclockid does not support other processes");
- goto done;
- }
- if (e != 0)
- {
- printf ("clock_getcpuclockid on live PID %d => %s\n",
- child, strerror (e));
- result = 1;
- goto done;
- }
-
- const clockid_t child_clock = cl;
- struct timespec res;
- if (clock_getres (child_clock, &res) < 0)
- {
- printf ("clock_getres on live PID %d clock %lx => %s\n",
- child, (unsigned long int) child_clock, strerror (errno));
- result = 1;
- goto done;
- }
- printf ("live PID %d clock %lx resolution %ju.%.9ju\n",
- child, (unsigned long int) child_clock,
- (uintmax_t) res.tv_sec, (uintmax_t) res.tv_nsec);
-
- struct timespec before, after;
- if (clock_gettime (child_clock, &before) < 0)
- {
- printf ("clock_gettime on live PID %d clock %lx => %s\n",
- child, (unsigned long int) child_clock, strerror (errno));
- result = 1;
- goto done;
- }
- /* Should be close to 0.0. */
- printf ("live PID %d before sleep => %ju.%.9ju\n",
- child, (uintmax_t) before.tv_sec, (uintmax_t) before.tv_nsec);
-
- struct timespec sleeptime = { .tv_nsec = 500000000 };
- if (nanosleep (&sleeptime, NULL) != 0)
- {
- perror ("nanosleep");
- result = 1;
- goto done;
- }
-
- if (clock_gettime (child_clock, &after) < 0)
- {
- printf ("clock_gettime on live PID %d clock %lx => %s\n",
- child, (unsigned long int) child_clock, strerror (errno));
- result = 1;
- goto done;
- }
- /* Should be close to 0.5. */
- printf ("live PID %d after sleep => %ju.%.9ju\n",
- child, (uintmax_t) after.tv_sec, (uintmax_t) after.tv_nsec);
-
- struct timespec diff = { .tv_sec = after.tv_sec - before.tv_sec,
- .tv_nsec = after.tv_nsec - before.tv_nsec };
- if (diff.tv_nsec < 0)
- {
- --diff.tv_sec;
- diff.tv_nsec += 1000000000;
- }
- if (diff.tv_sec != 0
- || diff.tv_nsec > 600000000
- || diff.tv_nsec < 100000000)
- {
- printf ("before - after %ju.%.9ju outside reasonable range\n",
- (uintmax_t) diff.tv_sec, (uintmax_t) diff.tv_nsec);
- result = 1;
- }
-
- sleeptime.tv_nsec = 100000000;
- e = clock_nanosleep (child_clock, 0, &sleeptime, NULL);
- if (e == EINVAL || e == ENOTSUP || e == ENOSYS)
- {
- printf ("clock_nanosleep not supported for other process clock: %s\n",
- strerror (e));
- }
- else if (e != 0)
- {
- printf ("clock_nanosleep on other process clock: %s\n", strerror (e));
- result = 1;
- }
- else
- {
- struct timespec afterns;
- if (clock_gettime (child_clock, &afterns) < 0)
- {
- printf ("clock_gettime on live PID %d clock %lx => %s\n",
- child, (unsigned long int) child_clock, strerror (errno));
- result = 1;
- }
- else
- {
- struct timespec d = { .tv_sec = afterns.tv_sec - after.tv_sec,
- .tv_nsec = afterns.tv_nsec - after.tv_nsec };
- if (d.tv_nsec < 0)
- {
- --d.tv_sec;
- d.tv_nsec += 1000000000;
- }
- if (d.tv_sec > 0
- || d.tv_nsec < sleeptime.tv_nsec
- || d.tv_nsec > sleeptime.tv_nsec * 2)
- {
- printf ("nanosleep time %ju.%.9ju outside reasonable range\n",
- (uintmax_t) d.tv_sec, (uintmax_t) d.tv_nsec);
- result = 1;
- }
- }
- }
-
- if (kill (child, SIGKILL) != 0)
- {
- perror ("kill");
- result = 2;
- goto done;
- }
-
- /* Wait long enough to let the child finish dying. */
-
- sleeptime.tv_nsec = 200000000;
- if (nanosleep (&sleeptime, NULL) != 0)
- {
- perror ("nanosleep");
- result = 1;
- goto done;
- }
-
- struct timespec dead;
- if (clock_gettime (child_clock, &dead) < 0)
- {
- printf ("clock_gettime on dead PID %d clock %lx => %s\n",
- child, (unsigned long int) child_clock, strerror (errno));
- result = 1;
- goto done;
- }
- /* Should be close to 0.6. */
- printf ("dead PID %d => %ju.%.9ju\n",
- child, (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
-
- diff.tv_sec = dead.tv_sec - after.tv_sec;
- diff.tv_nsec = dead.tv_nsec - after.tv_nsec;
- if (diff.tv_nsec < 0)
- {
- --diff.tv_sec;
- diff.tv_nsec += 1000000000;
- }
- if (diff.tv_sec != 0 || diff.tv_nsec > 200000000)
- {
- printf ("dead - after %ju.%.9ju outside reasonable range\n",
- (uintmax_t) diff.tv_sec, (uintmax_t) diff.tv_nsec);
- result = 1;
- }
-
- /* Now reap the child and verify that its clock is no longer valid. */
- {
- int x;
- if (waitpid (child, &x, 0) != child)
- {
- perror ("waitpid");
- result = 1;
- }
- }
-
- if (clock_gettime (child_clock, &dead) == 0)
- {
- printf ("clock_gettime on reaped PID %d clock %lx => %ju%.9ju\n",
- child, (unsigned long int) child_clock,
- (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
- result = 1;
- }
- else
- {
- if (errno != EINVAL)
- result = 1;
- printf ("clock_gettime on reaped PID %d clock %lx => %s\n",
- child, (unsigned long int) child_clock, strerror (errno));
- }
-
- if (clock_getres (child_clock, &dead) == 0)
- {
- printf ("clock_getres on reaped PID %d clock %lx => %ju%.9ju\n",
- child, (unsigned long int) child_clock,
- (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
- result = 1;
- }
- else
- {
- if (errno != EINVAL)
- result = 1;
- printf ("clock_getres on reaped PID %d clock %lx => %s\n",
- child, (unsigned long int) child_clock, strerror (errno));
- }
-
- return result;
-
- done:
- {
- if (kill (child, SIGKILL) != 0 && errno != ESRCH)
- {
- perror ("kill");
- return 2;
- }
- int x;
- if (waitpid (child, &x, 0) != child && errno != ECHILD)
- {
- perror ("waitpid");
- return 2;
- }
- }
-
- return result;
-}
-
-
-#define TIMEOUT 5
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index e3fc051..f89ef9a 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -711,6 +711,11 @@ GLIBC_2.2.6 clntudp_bufcreate F
GLIBC_2.2.6 clntudp_create F
GLIBC_2.2.6 clntunix_create F
GLIBC_2.2.6 clock F
+GLIBC_2.2.6 clock_getcpuclockid F
+GLIBC_2.2.6 clock_getres F
+GLIBC_2.2.6 clock_gettime F
+GLIBC_2.2.6 clock_nanosleep F
+GLIBC_2.2.6 clock_settime F
GLIBC_2.2.6 close F
GLIBC_2.2.6 closedir F
GLIBC_2.2.6 closelog F
diff --git a/sysdeps/mach/hurd/i386/librt.abilist b/sysdeps/mach/hurd/i386/librt.abilist
index d5fe32b..3726e41 100644
--- a/sysdeps/mach/hurd/i386/librt.abilist
+++ b/sysdeps/mach/hurd/i386/librt.abilist
@@ -13,11 +13,6 @@ GLIBC_2.2.6 aio_suspend F
GLIBC_2.2.6 aio_suspend64 F
GLIBC_2.2.6 aio_write F
GLIBC_2.2.6 aio_write64 F
-GLIBC_2.2.6 clock_getcpuclockid F
-GLIBC_2.2.6 clock_getres F
-GLIBC_2.2.6 clock_gettime F
-GLIBC_2.2.6 clock_nanosleep F
-GLIBC_2.2.6 clock_settime F
GLIBC_2.2.6 lio_listio F
GLIBC_2.2.6 lio_listio64 F
GLIBC_2.2.6 shm_open F
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index 5b0d8eb..7408197 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/sysdeps/posix/clock_getres.c
@@ -22,7 +22,7 @@
#include
#include
#include
-
+#include
static inline int
realtime_getres (struct timespec *res)
@@ -62,4 +62,11 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
return retval;
}
-weak_alias (__clock_getres, clock_getres)
+
+versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
+/* clock_getres moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getres, __clock_getres_2);
+compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index f3ebbe1..3ad8ea8 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -17,24 +17,9 @@
. */
#include
-#include
#include
#include
-#include
-#include
-
-
-static inline int
-realtime_gettime (struct timespec *tp)
-{
- struct timeval tv;
- int retval = __gettimeofday (&tv, NULL);
- if (retval == 0)
- /* Convert into `timespec'. */
- TIMEVAL_TO_TIMESPEC (&tv, tp);
- return retval;
-}
-
+#include
/* Get current value of CLOCK and store it in TP. */
int
@@ -60,5 +45,12 @@ __clock_gettime (clockid_t clock_id, struct timespec *tp)
return retval;
}
-weak_alias (__clock_gettime, clock_gettime)
libc_hidden_def (__clock_gettime)
+
+versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
+/* clock_gettime moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_gettime, __clock_gettime_2);
+compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/clock_nanosleep.c b/sysdeps/unix/clock_nanosleep.c
index 13dd0f4..6513e2d 100644
--- a/sysdeps/unix/clock_nanosleep.c
+++ b/sysdeps/unix/clock_nanosleep.c
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
/* This implementation assumes that these is only a `nanosleep' system
call. So we have to remap all other activities. */
@@ -76,4 +77,11 @@ __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
return __nanosleep (req, rem), 0 ? errno : 0;
}
-weak_alias (__clock_nanosleep, clock_nanosleep)
+
+versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
+/* clock_nanosleep moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_nanosleep, __clock_nanosleep_2);
+compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index 4f5640f..123b6f4 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -18,8 +18,7 @@
#include
#include
#include
-#include
-
+#include
/* Set CLOCK to value TP. */
int
@@ -51,4 +50,12 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
return retval;
}
-weak_alias (__clock_settime, clock_settime)
+libc_hidden_def (__clock_settime)
+
+versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
+/* clock_settime moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_settime, __clock_settime_2);
+compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index e22b916..77f0432 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -1863,6 +1863,11 @@ GLIBC_2.2 __xpg_sigpause F
GLIBC_2.2 _flushlbf F
GLIBC_2.2 _res_hconf D 0x48
GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 dcngettext F
GLIBC_2.2 dngettext F
GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/alpha/librt.abilist b/sysdeps/unix/sysv/linux/alpha/librt.abilist
index d7a049c..71f86e0 100644
--- a/sysdeps/unix/sysv/linux/alpha/librt.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
index a231812..e748ec2 100644
--- a/sysdeps/unix/sysv/linux/arm/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
@@ -759,6 +759,11 @@ GLIBC_2.4 clntudp_bufcreate F
GLIBC_2.4 clntudp_create F
GLIBC_2.4 clntunix_create F
GLIBC_2.4 clock F
+GLIBC_2.4 clock_getcpuclockid F
+GLIBC_2.4 clock_getres F
+GLIBC_2.4 clock_gettime F
+GLIBC_2.4 clock_nanosleep F
+GLIBC_2.4 clock_settime F
GLIBC_2.4 clone F
GLIBC_2.4 close F
GLIBC_2.4 closedir F
diff --git a/sysdeps/unix/sysv/linux/arm/librt.abilist b/sysdeps/unix/sysv/linux/arm/librt.abilist
index cfbbd27..3c0647b 100644
--- a/sysdeps/unix/sysv/linux/arm/librt.abilist
+++ b/sysdeps/unix/sysv/linux/arm/librt.abilist
@@ -13,11 +13,6 @@ GLIBC_2.4 aio_suspend F
GLIBC_2.4 aio_suspend64 F
GLIBC_2.4 aio_write F
GLIBC_2.4 aio_write64 F
-GLIBC_2.4 clock_getcpuclockid F
-GLIBC_2.4 clock_getres F
-GLIBC_2.4 clock_gettime F
-GLIBC_2.4 clock_nanosleep F
-GLIBC_2.4 clock_settime F
GLIBC_2.4 lio_listio F
GLIBC_2.4 lio_listio64 F
GLIBC_2.4 mq_close F
diff --git a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
index 190a479..877f4f3 100644
--- a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
+++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
@@ -20,6 +20,7 @@
#include
#include
#include "kernel-posix-cpu-timers.h"
+#include
int
__clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
@@ -45,4 +46,11 @@ __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
else
return INTERNAL_SYSCALL_ERRNO (r, err);
}
-weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
+
+versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17);
+/* clock_getcpuclockid moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getcpuclockid, __clock_getcpuclockid_2);
+compat_symbol (libc, __clock_getcpuclockid_2, clock_getcpuclockid, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index 2517e66..1fbb638 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -26,10 +26,19 @@
#endif
#include
+#include
+
/* Get resolution of clock. */
int
__clock_getres (clockid_t clock_id, struct timespec *res)
{
return INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
}
-weak_alias (__clock_getres, clock_getres)
+
+versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
+/* clock_getres moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getres, __clock_getres_2);
+compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index dadfc51..3f8feb3 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -26,11 +26,20 @@
#endif
#include
+#include
+
/* Get current value of CLOCK and store it in TP. */
int
__clock_gettime (clockid_t clock_id, struct timespec *tp)
{
return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
}
-weak_alias (__clock_gettime, clock_gettime)
libc_hidden_def (__clock_gettime)
+
+versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
+/* clock_gettime moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_gettime, __clock_gettime_2);
+compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c
index 93d5d6e..a90da63 100644
--- a/sysdeps/unix/sysv/linux/clock_nanosleep.c
+++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c
@@ -21,6 +21,7 @@
#include
#include "kernel-posix-cpu-timers.h"
+#include
/* We can simply use the syscall. The CPU clocks are not supported
with this function. */
@@ -51,4 +52,11 @@ __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
return (INTERNAL_SYSCALL_ERROR_P (r, err)
? INTERNAL_SYSCALL_ERRNO (r, err) : 0);
}
-weak_alias (__clock_nanosleep, clock_nanosleep)
+
+versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
+/* clock_nanosleep moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_nanosleep, __clock_nanosleep_2);
+compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/clock_settime.c b/sysdeps/unix/sysv/linux/clock_settime.c
index c71461a..21efc6c 100644
--- a/sysdeps/unix/sysv/linux/clock_settime.c
+++ b/sysdeps/unix/sysv/linux/clock_settime.c
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
#include "kernel-posix-cpu-timers.h"
@@ -34,4 +35,12 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
return INLINE_SYSCALL_CALL (clock_settime, clock_id, tp);
}
-weak_alias (__clock_settime, clock_settime)
+libc_hidden_def (__clock_settime)
+
+versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
+/* clock_settime moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_settime, __clock_settime_2);
+compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
+#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 24b11b1..d34f040 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -615,6 +615,11 @@ GLIBC_2.2 clntudp_bufcreate F
GLIBC_2.2 clntudp_create F
GLIBC_2.2 clntunix_create F
GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 clone F
GLIBC_2.2 close F
GLIBC_2.2 closedir F
diff --git a/sysdeps/unix/sysv/linux/hppa/librt.abilist b/sysdeps/unix/sysv/linux/hppa/librt.abilist
index 595f1b7..bb03781 100644
--- a/sysdeps/unix/sysv/linux/hppa/librt.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 9762c81..48e838f 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -1869,6 +1869,11 @@ GLIBC_2.2 _flushlbf F
GLIBC_2.2 _res_hconf D 0x30
GLIBC_2.2 alphasort64 F
GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 dcngettext F
GLIBC_2.2 dngettext F
GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/i386/librt.abilist b/sysdeps/unix/sysv/linux/i386/librt.abilist
index 595f1b7..bb03781 100644
--- a/sysdeps/unix/sysv/linux/i386/librt.abilist
+++ b/sysdeps/unix/sysv/linux/i386/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index 50c94ad..e9fe069 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -627,6 +627,11 @@ GLIBC_2.2 clntudp_bufcreate F
GLIBC_2.2 clntudp_create F
GLIBC_2.2 clntunix_create F
GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 close F
GLIBC_2.2 closedir F
GLIBC_2.2 closelog F
diff --git a/sysdeps/unix/sysv/linux/ia64/librt.abilist b/sysdeps/unix/sysv/linux/ia64/librt.abilist
index 804622a..08384c9 100644
--- a/sysdeps/unix/sysv/linux/ia64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index f57be98..98f07b7 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -748,6 +748,11 @@ GLIBC_2.4 clntudp_bufcreate F
GLIBC_2.4 clntudp_create F
GLIBC_2.4 clntunix_create F
GLIBC_2.4 clock F
+GLIBC_2.4 clock_getcpuclockid F
+GLIBC_2.4 clock_getres F
+GLIBC_2.4 clock_gettime F
+GLIBC_2.4 clock_nanosleep F
+GLIBC_2.4 clock_settime F
GLIBC_2.4 clone F
GLIBC_2.4 close F
GLIBC_2.4 closedir F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
index cfbbd27..3c0647b 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
@@ -13,11 +13,6 @@ GLIBC_2.4 aio_suspend F
GLIBC_2.4 aio_suspend64 F
GLIBC_2.4 aio_write F
GLIBC_2.4 aio_write64 F
-GLIBC_2.4 clock_getcpuclockid F
-GLIBC_2.4 clock_getres F
-GLIBC_2.4 clock_gettime F
-GLIBC_2.4 clock_nanosleep F
-GLIBC_2.4 clock_settime F
GLIBC_2.4 lio_listio F
GLIBC_2.4 lio_listio64 F
GLIBC_2.4 mq_close F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index ddc7ebc..6a60d78 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -1825,6 +1825,11 @@ GLIBC_2.2 _flushlbf F
GLIBC_2.2 _res_hconf D 0x30
GLIBC_2.2 alphasort64 F
GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 dcngettext F
GLIBC_2.2 dngettext F
GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
index 595f1b7..bb03781 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/microblaze/librt.abilist b/sysdeps/unix/sysv/linux/microblaze/librt.abilist
index fb85d87..889dfbc 100644
--- a/sysdeps/unix/sysv/linux/microblaze/librt.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/librt.abilist
@@ -14,11 +14,6 @@ GLIBC_2.18 aio_suspend F
GLIBC_2.18 aio_suspend64 F
GLIBC_2.18 aio_write F
GLIBC_2.18 aio_write64 F
-GLIBC_2.18 clock_getcpuclockid F
-GLIBC_2.18 clock_getres F
-GLIBC_2.18 clock_gettime F
-GLIBC_2.18 clock_nanosleep F
-GLIBC_2.18 clock_settime F
GLIBC_2.18 lio_listio F
GLIBC_2.18 lio_listio64 F
GLIBC_2.18 mq_close F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index dda9797..34a2458 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -1612,6 +1612,11 @@ GLIBC_2.2 capget F
GLIBC_2.2 capset F
GLIBC_2.2 cbc_crypt F
GLIBC_2.2 clntunix_create F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 creat64 F
GLIBC_2.2 dcngettext F
GLIBC_2.2 des_setparity F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist b/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
index 84837c8..1539c1c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
@@ -13,11 +13,6 @@ GLIBC_2.2 aio_suspend F
GLIBC_2.2 aio_suspend64 F
GLIBC_2.2 aio_write F
GLIBC_2.2 aio_write64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 lio_listio F
GLIBC_2.2 lio_listio64 F
GLIBC_2.2 shm_open F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 42e930d..176a572 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -1610,6 +1610,11 @@ GLIBC_2.2 capget F
GLIBC_2.2 capset F
GLIBC_2.2 cbc_crypt F
GLIBC_2.2 clntunix_create F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 creat64 F
GLIBC_2.2 dcngettext F
GLIBC_2.2 des_setparity F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist b/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
index 84837c8..1539c1c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
@@ -13,11 +13,6 @@ GLIBC_2.2 aio_suspend F
GLIBC_2.2 aio_suspend64 F
GLIBC_2.2 aio_write F
GLIBC_2.2 aio_write64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 lio_listio F
GLIBC_2.2 lio_listio64 F
GLIBC_2.2 shm_open F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index f89b44f..5a66ffd 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -1611,6 +1611,11 @@ GLIBC_2.2 capget F
GLIBC_2.2 capset F
GLIBC_2.2 cbc_crypt F
GLIBC_2.2 clntunix_create F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 creat64 F
GLIBC_2.2 dcngettext F
GLIBC_2.2 des_setparity F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 1486af1..a817f33 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -1607,6 +1607,11 @@ GLIBC_2.2 capget F
GLIBC_2.2 capset F
GLIBC_2.2 cbc_crypt F
GLIBC_2.2 clntunix_create F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 creat64 F
GLIBC_2.2 dcngettext F
GLIBC_2.2 des_setparity F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 45839ed..d5e121b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -1830,6 +1830,11 @@ GLIBC_2.2 __xstat64 F
GLIBC_2.2 _flushlbf F
GLIBC_2.2 _res_hconf D 0x30
GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 dcngettext F
GLIBC_2.2 dngettext F
GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
index 595f1b7..bb03781 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 344e5ae..3dfddbd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -1834,6 +1834,11 @@ GLIBC_2.2 __xstat64 F
GLIBC_2.2 _flushlbf F
GLIBC_2.2 _res_hconf D 0x30
GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 dcngettext F
GLIBC_2.2 dngettext F
GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
index 8c1781a..06ce341 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
@@ -670,6 +670,11 @@ GLIBC_2.3 clntudp_bufcreate F
GLIBC_2.3 clntudp_create F
GLIBC_2.3 clntunix_create F
GLIBC_2.3 clock F
+GLIBC_2.3 clock_getcpuclockid F
+GLIBC_2.3 clock_getres F
+GLIBC_2.3 clock_gettime F
+GLIBC_2.3 clock_nanosleep F
+GLIBC_2.3 clock_settime F
GLIBC_2.3 clone F
GLIBC_2.3 close F
GLIBC_2.3 closedir F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/librt.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/librt.abilist
index e76b7eb..6a5bd96 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/librt.abilist
@@ -13,11 +13,6 @@ GLIBC_2.3 aio_suspend F
GLIBC_2.3 aio_suspend64 F
GLIBC_2.3 aio_write F
GLIBC_2.3 aio_write64 F
-GLIBC_2.3 clock_getcpuclockid F
-GLIBC_2.3 clock_getres F
-GLIBC_2.3 clock_gettime F
-GLIBC_2.3 clock_nanosleep F
-GLIBC_2.3 clock_settime F
GLIBC_2.3 lio_listio F
GLIBC_2.3 lio_listio64 F
GLIBC_2.3 shm_open F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 3a5ec2a..02ff949 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -1829,6 +1829,11 @@ GLIBC_2.2 _flushlbf F
GLIBC_2.2 _res_hconf D 0x30
GLIBC_2.2 alphasort64 F
GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 dcngettext F
GLIBC_2.2 dngettext F
GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
index 595f1b7..bb03781 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 3b54655..96693d4 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -632,6 +632,11 @@ GLIBC_2.2 clntudp_bufcreate F
GLIBC_2.2 clntudp_create F
GLIBC_2.2 clntunix_create F
GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 clone F
GLIBC_2.2 close F
GLIBC_2.2 closedir F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
index 41be3bb..5905498 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
@@ -13,11 +13,6 @@ GLIBC_2.2 aio_suspend F
GLIBC_2.2 aio_suspend64 F
GLIBC_2.2 aio_write F
GLIBC_2.2 aio_write64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 lio_listio F
GLIBC_2.2 lio_listio64 F
GLIBC_2.2 shm_open F
diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
index 1f4e648..b126bda 100644
--- a/sysdeps/unix/sysv/linux/sh/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
@@ -618,6 +618,11 @@ GLIBC_2.2 clntudp_bufcreate F
GLIBC_2.2 clntudp_create F
GLIBC_2.2 clntunix_create F
GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 clone F
GLIBC_2.2 close F
GLIBC_2.2 closedir F
diff --git a/sysdeps/unix/sysv/linux/sh/librt.abilist b/sysdeps/unix/sysv/linux/sh/librt.abilist
index 595f1b7..bb03781 100644
--- a/sysdeps/unix/sysv/linux/sh/librt.abilist
+++ b/sysdeps/unix/sysv/linux/sh/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index d308ac8..63b78d8 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -1826,6 +1826,11 @@ GLIBC_2.2 __xstat64 F
GLIBC_2.2 _flushlbf F
GLIBC_2.2 _res_hconf D 0x30
GLIBC_2.2 bind_textdomain_codeset F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 dcngettext F
GLIBC_2.2 dngettext F
GLIBC_2.2 fgetpos F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
index cb874f4..38f0aad 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 6731ebf..a899eb6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -660,6 +660,11 @@ GLIBC_2.2 clntudp_bufcreate F
GLIBC_2.2 clntudp_create F
GLIBC_2.2 clntunix_create F
GLIBC_2.2 clock F
+GLIBC_2.2 clock_getcpuclockid F
+GLIBC_2.2 clock_getres F
+GLIBC_2.2 clock_gettime F
+GLIBC_2.2 clock_nanosleep F
+GLIBC_2.2 clock_settime F
GLIBC_2.2 clone F
GLIBC_2.2 close F
GLIBC_2.2 closedir F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
index d7a049c..71f86e0 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
@@ -15,11 +15,6 @@ GLIBC_2.1 aio_write F
GLIBC_2.1 aio_write64 F
GLIBC_2.1 lio_listio F
GLIBC_2.1 lio_listio64 F
-GLIBC_2.2 clock_getcpuclockid F
-GLIBC_2.2 clock_getres F
-GLIBC_2.2 clock_gettime F
-GLIBC_2.2 clock_nanosleep F
-GLIBC_2.2 clock_settime F
GLIBC_2.2 shm_open F
GLIBC_2.2 shm_unlink F
GLIBC_2.2 timer_create F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 816e4a7..0ebb018 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -621,6 +621,11 @@ GLIBC_2.2.5 clntudp_bufcreate F
GLIBC_2.2.5 clntudp_create F
GLIBC_2.2.5 clntunix_create F
GLIBC_2.2.5 clock F
+GLIBC_2.2.5 clock_getcpuclockid F
+GLIBC_2.2.5 clock_getres F
+GLIBC_2.2.5 clock_gettime F
+GLIBC_2.2.5 clock_nanosleep F
+GLIBC_2.2.5 clock_settime F
GLIBC_2.2.5 clone F
GLIBC_2.2.5 close F
GLIBC_2.2.5 closedir F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist b/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
index e2e8b60..95e3f22 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
@@ -13,11 +13,6 @@ GLIBC_2.2.5 aio_suspend F
GLIBC_2.2.5 aio_suspend64 F
GLIBC_2.2.5 aio_write F
GLIBC_2.2.5 aio_write64 F
-GLIBC_2.2.5 clock_getcpuclockid F
-GLIBC_2.2.5 clock_getres F
-GLIBC_2.2.5 clock_gettime F
-GLIBC_2.2.5 clock_nanosleep F
-GLIBC_2.2.5 clock_settime F
GLIBC_2.2.5 lio_listio F
GLIBC_2.2.5 lio_listio64 F
GLIBC_2.2.5 shm_open F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 6fee16a..0b6b3fa 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -660,6 +660,11 @@ GLIBC_2.16 clntudp_create F
GLIBC_2.16 clntunix_create F
GLIBC_2.16 clock F
GLIBC_2.16 clock_adjtime F
+GLIBC_2.16 clock_getcpuclockid F
+GLIBC_2.16 clock_getres F
+GLIBC_2.16 clock_gettime F
+GLIBC_2.16 clock_nanosleep F
+GLIBC_2.16 clock_settime F
GLIBC_2.16 clone F
GLIBC_2.16 close F
GLIBC_2.16 closedir F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
index 94e84e4..66969fb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist
@@ -14,11 +14,6 @@ GLIBC_2.16 aio_suspend F
GLIBC_2.16 aio_suspend64 F
GLIBC_2.16 aio_write F
GLIBC_2.16 aio_write64 F
-GLIBC_2.16 clock_getcpuclockid F
-GLIBC_2.16 clock_getres F
-GLIBC_2.16 clock_gettime F
-GLIBC_2.16 clock_nanosleep F
-GLIBC_2.16 clock_settime F
GLIBC_2.16 lio_listio F
GLIBC_2.16 lio_listio64 F
GLIBC_2.16 mq_close F
diff --git a/time/Makefile b/time/Makefile
index ec3e39d..6a68481 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -36,14 +36,18 @@ routines := offtime asctime clock ctime ctime_r difftime \
stime dysize timegm ftime \
getdate strptime strptime_l \
strftime wcsftime strftime_l wcsftime_l \
- timespec_get
+ timespec_get \
+ clock_getcpuclockid clock_getres \
+ clock_gettime clock_settime clock_nanosleep
+
aux := era alt_digit lc-time-cleanup
tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime \
- tst-tzname tst-y2039
+ tst-tzname tst-y2039 \
+ tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1
include ../Rules
diff --git a/time/Versions b/time/Versions
index fd83818..8788e19 100644
--- a/time/Versions
+++ b/time/Versions
@@ -49,6 +49,10 @@ libc {
GLIBC_2.2 {
# w*
wcsftime;
+
+ # c*; actually in librt in version 2.2, moved to libc in 2.17
+ clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
+ clock_nanosleep;
}
GLIBC_2.3 {
# these internal names are used by libstdc++
@@ -65,4 +69,13 @@ libc {
GLIBC_2.16 {
timespec_get;
}
+ GLIBC_2.17 {
+ # c*
+ clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
+ clock_nanosleep;
+ }
+ GLIBC_PRIVATE {
+ # same as clock_gettime; used in other libraries
+ __clock_gettime;
+ }
}
diff --git a/time/clock_getcpuclockid.c b/time/clock_getcpuclockid.c
new file mode 100644
index 0000000..81b8624
--- /dev/null
+++ b/time/clock_getcpuclockid.c
@@ -0,0 +1,47 @@
+/* Get a clockid_t for the process CPU clock of a given process. Generic.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#include
+#include
+#include
+#include
+
+int
+__clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
+{
+ /* We don't allow any process ID but our own. */
+ if (pid != 0 && pid != getpid ())
+ return EPERM;
+
+#ifdef CLOCK_PROCESS_CPUTIME_ID
+ /* Store the number. */
+ *clock_id = CLOCK_PROCESS_CPUTIME_ID;
+
+ return 0;
+#else
+ /* We don't have a timer for that. */
+ return ENOENT;
+#endif
+}
+versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17);
+/* clock_getcpuclockid moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getcpuclockid, __clock_getcpuclockid_2);
+compat_symbol (libc, __clock_getcpuclockid_2, clock_getcpuclockid, GLIBC_2_2);
+#endif
diff --git a/time/clock_getres.c b/time/clock_getres.c
new file mode 100644
index 0000000..e831539
--- /dev/null
+++ b/time/clock_getres.c
@@ -0,0 +1,39 @@
+/* Get the resolution of a clock. Stub version.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#include
+#include
+#include
+
+/* Get resolution of clock. */
+int
+__clock_getres (clockid_t clock_id, struct timespec *res)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
+/* clock_getres moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getres, __clock_getres_2);
+compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
+#endif
+
+stub_warning (clock_getres)
diff --git a/time/clock_gettime.c b/time/clock_gettime.c
new file mode 100644
index 0000000..4a5f808
--- /dev/null
+++ b/time/clock_gettime.c
@@ -0,0 +1,40 @@
+/* Get the current value of a clock. Stub version.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#include
+#include
+#include
+
+/* Get current value of CLOCK and store it in TP. */
+int
+__clock_gettime (clockid_t clock_id, struct timespec *tp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__clock_gettime)
+
+versioned_symbol (libc, __clock_gettime, clock_gettime, GLIBC_2_17);
+/* clock_gettime moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_gettime, __clock_gettime_2);
+compat_symbol (libc, __clock_gettime_2, clock_gettime, GLIBC_2_2);
+#endif
+
+stub_warning (clock_gettime)
diff --git a/time/clock_nanosleep.c b/time/clock_nanosleep.c
new file mode 100644
index 0000000..a314b16
--- /dev/null
+++ b/time/clock_nanosleep.c
@@ -0,0 +1,46 @@
+/* High-resolution sleep with the specified clock. Stub version.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#include
+#include
+#include
+
+int
+__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
+ struct timespec *rem)
+{
+ if (__builtin_expect (req->tv_nsec, 0) < 0
+ || __builtin_expect (req->tv_nsec, 0) >= 1000000000)
+ return EINVAL;
+
+ if (flags != TIMER_ABSTIME && flags != 0)
+ return EINVAL;
+
+ /* Not implemented. */
+ return ENOSYS;
+}
+
+versioned_symbol (libc, __clock_nanosleep, clock_nanosleep, GLIBC_2_17);
+/* clock_nanosleep moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_nanosleep, __clock_nanosleep_2);
+compat_symbol (libc, __clock_nanosleep_2, clock_nanosleep, GLIBC_2_2);
+#endif
+
+stub_warning (clock_nanosleep)
diff --git a/time/clock_settime.c b/time/clock_settime.c
new file mode 100644
index 0000000..2091239
--- /dev/null
+++ b/time/clock_settime.c
@@ -0,0 +1,40 @@
+/* Set a clock to a given value. Stub version.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#include
+#include
+#include
+
+/* Set CLOCK to value TP. */
+int
+__clock_settime (clockid_t clock_id, const struct timespec *tp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__clock_settime)
+
+versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
+/* clock_settime moved to libc in version 2.17;
+ old binaries may expect the symbol version it had in librt. */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_settime, __clock_settime_2);
+compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
+#endif
+
+stub_warning (clock_settime)
diff --git a/time/tst-clock.c b/time/tst-clock.c
new file mode 100644
index 0000000..bec76d0
--- /dev/null
+++ b/time/tst-clock.c
@@ -0,0 +1,124 @@
+/* Test program for POSIX clock_* functions.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper , 2000.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#include
+#include
+#include
+#include
+
+
+/* We want to see output immediately. */
+#define STDOUT_UNBUFFERED
+
+/* We expect to run at least 10 seconds. */
+#define TIMEOUT 15
+
+static int
+clock_test (clockid_t cl)
+{
+ struct timespec old_ts;
+ struct timespec ts;
+ struct timespec waitit;
+ int result = 0;
+ int i;
+
+ memset (&ts, '\0', sizeof ts);
+
+ waitit.tv_sec = 0;
+ waitit.tv_nsec = 500000000;
+
+ /* Get and print resolution of the clock. */
+ if (clock_getres (cl, &ts) == 0)
+ {
+ if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
+ {
+ printf ("clock %d: nanosecond value of resolution wrong\n", cl);
+ result = 1;
+ }
+ else
+ printf ("clock %d: resolution = %jd.%09jd secs\n",
+ cl, (intmax_t) ts.tv_sec, (intmax_t) ts.tv_nsec);
+ }
+ else
+ {
+ printf ("clock %d: cannot get resolution\n", cl);
+ result = 1;
+ }
+
+ memset (&ts, '\0', sizeof ts);
+ memset (&old_ts, '\0', sizeof old_ts);
+
+ /* Next get the current time value a few times. */
+ for (i = 0; i < 10; ++i)
+ {
+ if (clock_gettime (cl, &ts) == 0)
+ {
+ if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
+ {
+ printf ("clock %d: nanosecond value of time wrong (try %d)\n",
+ cl, i);
+ result = 1;
+ }
+ else
+ {
+ printf ("clock %d: time = %jd.%09jd secs\n",
+ cl, (intmax_t) ts.tv_sec, (intmax_t) ts.tv_nsec);
+
+ if (memcmp (&ts, &old_ts, sizeof ts) == 0)
+ {
+ printf ("clock %d: time hasn't changed (try %d)\n", cl, i);
+ result = 1;
+
+ old_ts = ts;
+ }
+ }
+ }
+ else
+ {
+ printf ("clock %d: cannot get time (try %d)\n", cl, i);
+ result = 1;
+ }
+
+ /* Wait a bit before the next iteration. */
+ nanosleep (&waitit, NULL);
+ }
+
+ return result;
+}
+
+static int
+do_test (void)
+{
+ clockid_t cl;
+ int result;
+
+ result = clock_test (CLOCK_REALTIME);
+
+ if (clock_getcpuclockid (0, &cl) == 0)
+ /* XXX It's not yet a bug when this fails. */
+ clock_test (cl);
+ else
+ printf("CPU clock unavailble, skipping test\n");
+
+ return result;
+}
+#define TEST_FUNCTION do_test ()
+
+
+#include "../test-skeleton.c"
diff --git a/time/tst-clock2.c b/time/tst-clock2.c
new file mode 100644
index 0000000..4c8fb9f
--- /dev/null
+++ b/time/tst-clock2.c
@@ -0,0 +1,43 @@
+/* Test setting the monotonic clock. */
+
+#include
+#include
+
+#if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK
+
+# include
+# include
+
+static int
+do_test (void)
+{
+ if (sysconf (_SC_MONOTONIC_CLOCK) <= 0)
+ return 0;
+
+ struct timespec ts;
+ if (clock_gettime (CLOCK_MONOTONIC, &ts) != 0)
+ {
+ puts ("clock_gettime(CLOCK_MONOTONIC) failed");
+ return 1;
+ }
+
+ /* Setting the monotonic clock must fail. */
+ if (clock_settime (CLOCK_MONOTONIC, &ts) != -1)
+ {
+ puts ("clock_settime(CLOCK_MONOTONIC) did not fail");
+ return 1;
+ }
+ if (errno != EINVAL)
+ {
+ printf ("clock_settime(CLOCK_MONOTONIC) set errno to %d, expected %d\n",
+ errno, EINVAL);
+ return 1;
+ }
+ return 0;
+}
+# define TEST_FUNCTION do_test ()
+
+#else
+# define TEST_FUNCTION 0
+#endif
+#include "../test-skeleton.c"
diff --git a/time/tst-clock_nanosleep.c b/time/tst-clock_nanosleep.c
new file mode 100644
index 0000000..eb2b906
--- /dev/null
+++ b/time/tst-clock_nanosleep.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2003-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#include
+#include
+#include
+#include
+#include
+
+
+/* Test that clock_nanosleep() does sleep. */
+static int
+do_test (void)
+{
+ /* Current time. */
+ struct timeval tv1;
+ (void) gettimeofday (&tv1, NULL);
+
+ struct timespec ts;
+ ts.tv_sec = 1;
+ ts.tv_nsec = 0;
+ TEMP_FAILURE_RETRY (clock_nanosleep (CLOCK_REALTIME, 0, &ts, &ts));
+
+ /* At least one second must have passed. */
+ struct timeval tv2;
+ (void) gettimeofday (&tv2, NULL);
+
+ tv2.tv_sec -= tv1.tv_sec;
+ tv2.tv_usec -= tv1.tv_usec;
+ if (tv2.tv_usec < 0)
+ --tv2.tv_sec;
+
+ if (tv2.tv_sec < 1)
+ {
+ puts ("clock_nanosleep didn't sleep long enough");
+ return 1;
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/time/tst-cpuclock1.c b/time/tst-cpuclock1.c
new file mode 100644
index 0000000..f6d76e3
--- /dev/null
+++ b/time/tst-cpuclock1.c
@@ -0,0 +1,321 @@
+/* Test program for process CPU clocks.
+ Copyright (C) 2004-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* This function is intended to rack up both user and system time. */
+static void
+chew_cpu (void)
+{
+ while (1)
+ {
+ static volatile char buf[4096];
+ for (int i = 0; i < 100; ++i)
+ for (size_t j = 0; j < sizeof buf; ++j)
+ buf[j] = 0xaa;
+ int nullfd = open ("/dev/null", O_WRONLY);
+ for (int i = 0; i < 100; ++i)
+ for (size_t j = 0; j < sizeof buf; ++j)
+ buf[j] = 0xbb;
+ write (nullfd, (char *) buf, sizeof buf);
+ close (nullfd);
+ if (getppid () == 1)
+ _exit (2);
+ }
+}
+
+static int
+do_test (void)
+{
+ int result = 0;
+ clockid_t cl;
+ int e;
+ pid_t dead_child, child;
+
+ /* Fork a child and let it die, to give us a PID known not be valid
+ (assuming PIDs don't wrap around during the test). */
+ {
+ dead_child = fork ();
+ if (dead_child == 0)
+ _exit (0);
+ if (dead_child < 0)
+ {
+ perror ("fork");
+ return 1;
+ }
+ int x;
+ if (wait (&x) != dead_child)
+ {
+ perror ("wait");
+ return 2;
+ }
+ }
+
+ /* POSIX says we should get ESRCH for this. */
+ e = clock_getcpuclockid (dead_child, &cl);
+ if (e != ENOSYS && e != ESRCH && e != EPERM)
+ {
+ printf ("clock_getcpuclockid on dead PID %d => %s\n",
+ dead_child, strerror (e));
+ result = 1;
+ }
+
+ /* Now give us a live child eating up CPU time. */
+ child = fork ();
+ if (child == 0)
+ {
+ chew_cpu ();
+ _exit (1);
+ }
+ if (child < 0)
+ {
+ perror ("fork");
+ return 1;
+ }
+
+ e = clock_getcpuclockid (child, &cl);
+ if (e == EPERM)
+ {
+ puts ("clock_getcpuclockid does not support other processes");
+ goto done;
+ }
+ if (e != 0)
+ {
+ printf ("clock_getcpuclockid on live PID %d => %s\n",
+ child, strerror (e));
+ result = 1;
+ goto done;
+ }
+
+ const clockid_t child_clock = cl;
+ struct timespec res;
+ if (clock_getres (child_clock, &res) < 0)
+ {
+ printf ("clock_getres on live PID %d clock %lx => %s\n",
+ child, (unsigned long int) child_clock, strerror (errno));
+ result = 1;
+ goto done;
+ }
+ printf ("live PID %d clock %lx resolution %ju.%.9ju\n",
+ child, (unsigned long int) child_clock,
+ (uintmax_t) res.tv_sec, (uintmax_t) res.tv_nsec);
+
+ struct timespec before, after;
+ if (clock_gettime (child_clock, &before) < 0)
+ {
+ printf ("clock_gettime on live PID %d clock %lx => %s\n",
+ child, (unsigned long int) child_clock, strerror (errno));
+ result = 1;
+ goto done;
+ }
+ /* Should be close to 0.0. */
+ printf ("live PID %d before sleep => %ju.%.9ju\n",
+ child, (uintmax_t) before.tv_sec, (uintmax_t) before.tv_nsec);
+
+ struct timespec sleeptime = { .tv_nsec = 500000000 };
+ if (nanosleep (&sleeptime, NULL) != 0)
+ {
+ perror ("nanosleep");
+ result = 1;
+ goto done;
+ }
+
+ if (clock_gettime (child_clock, &after) < 0)
+ {
+ printf ("clock_gettime on live PID %d clock %lx => %s\n",
+ child, (unsigned long int) child_clock, strerror (errno));
+ result = 1;
+ goto done;
+ }
+ /* Should be close to 0.5. */
+ printf ("live PID %d after sleep => %ju.%.9ju\n",
+ child, (uintmax_t) after.tv_sec, (uintmax_t) after.tv_nsec);
+
+ struct timespec diff = { .tv_sec = after.tv_sec - before.tv_sec,
+ .tv_nsec = after.tv_nsec - before.tv_nsec };
+ if (diff.tv_nsec < 0)
+ {
+ --diff.tv_sec;
+ diff.tv_nsec += 1000000000;
+ }
+ if (diff.tv_sec != 0
+ || diff.tv_nsec > 600000000
+ || diff.tv_nsec < 100000000)
+ {
+ printf ("before - after %ju.%.9ju outside reasonable range\n",
+ (uintmax_t) diff.tv_sec, (uintmax_t) diff.tv_nsec);
+ result = 1;
+ }
+
+ sleeptime.tv_nsec = 100000000;
+ e = clock_nanosleep (child_clock, 0, &sleeptime, NULL);
+ if (e == EINVAL || e == ENOTSUP || e == ENOSYS)
+ {
+ printf ("clock_nanosleep not supported for other process clock: %s\n",
+ strerror (e));
+ }
+ else if (e != 0)
+ {
+ printf ("clock_nanosleep on other process clock: %s\n", strerror (e));
+ result = 1;
+ }
+ else
+ {
+ struct timespec afterns;
+ if (clock_gettime (child_clock, &afterns) < 0)
+ {
+ printf ("clock_gettime on live PID %d clock %lx => %s\n",
+ child, (unsigned long int) child_clock, strerror (errno));
+ result = 1;
+ }
+ else
+ {
+ struct timespec d = { .tv_sec = afterns.tv_sec - after.tv_sec,
+ .tv_nsec = afterns.tv_nsec - after.tv_nsec };
+ if (d.tv_nsec < 0)
+ {
+ --d.tv_sec;
+ d.tv_nsec += 1000000000;
+ }
+ if (d.tv_sec > 0
+ || d.tv_nsec < sleeptime.tv_nsec
+ || d.tv_nsec > sleeptime.tv_nsec * 2)
+ {
+ printf ("nanosleep time %ju.%.9ju outside reasonable range\n",
+ (uintmax_t) d.tv_sec, (uintmax_t) d.tv_nsec);
+ result = 1;
+ }
+ }
+ }
+
+ if (kill (child, SIGKILL) != 0)
+ {
+ perror ("kill");
+ result = 2;
+ goto done;
+ }
+
+ /* Wait long enough to let the child finish dying. */
+
+ sleeptime.tv_nsec = 200000000;
+ if (nanosleep (&sleeptime, NULL) != 0)
+ {
+ perror ("nanosleep");
+ result = 1;
+ goto done;
+ }
+
+ struct timespec dead;
+ if (clock_gettime (child_clock, &dead) < 0)
+ {
+ printf ("clock_gettime on dead PID %d clock %lx => %s\n",
+ child, (unsigned long int) child_clock, strerror (errno));
+ result = 1;
+ goto done;
+ }
+ /* Should be close to 0.6. */
+ printf ("dead PID %d => %ju.%.9ju\n",
+ child, (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
+
+ diff.tv_sec = dead.tv_sec - after.tv_sec;
+ diff.tv_nsec = dead.tv_nsec - after.tv_nsec;
+ if (diff.tv_nsec < 0)
+ {
+ --diff.tv_sec;
+ diff.tv_nsec += 1000000000;
+ }
+ if (diff.tv_sec != 0 || diff.tv_nsec > 200000000)
+ {
+ printf ("dead - after %ju.%.9ju outside reasonable range\n",
+ (uintmax_t) diff.tv_sec, (uintmax_t) diff.tv_nsec);
+ result = 1;
+ }
+
+ /* Now reap the child and verify that its clock is no longer valid. */
+ {
+ int x;
+ if (waitpid (child, &x, 0) != child)
+ {
+ perror ("waitpid");
+ result = 1;
+ }
+ }
+
+ if (clock_gettime (child_clock, &dead) == 0)
+ {
+ printf ("clock_gettime on reaped PID %d clock %lx => %ju%.9ju\n",
+ child, (unsigned long int) child_clock,
+ (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
+ result = 1;
+ }
+ else
+ {
+ if (errno != EINVAL)
+ result = 1;
+ printf ("clock_gettime on reaped PID %d clock %lx => %s\n",
+ child, (unsigned long int) child_clock, strerror (errno));
+ }
+
+ if (clock_getres (child_clock, &dead) == 0)
+ {
+ printf ("clock_getres on reaped PID %d clock %lx => %ju%.9ju\n",
+ child, (unsigned long int) child_clock,
+ (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
+ result = 1;
+ }
+ else
+ {
+ if (errno != EINVAL)
+ result = 1;
+ printf ("clock_getres on reaped PID %d clock %lx => %s\n",
+ child, (unsigned long int) child_clock, strerror (errno));
+ }
+
+ return result;
+
+ done:
+ {
+ if (kill (child, SIGKILL) != 0 && errno != ESRCH)
+ {
+ perror ("kill");
+ return 2;
+ }
+ int x;
+ if (waitpid (child, &x, 0) != child && errno != ECHILD)
+ {
+ perror ("waitpid");
+ return 2;
+ }
+ }
+
+ return result;
+}
+
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"