aboutsummaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-10-24 14:50:46 -0700
committerRoland McGrath <roland@hack.frob.com>2012-10-24 14:50:46 -0700
commit6e6249d0b461b952d0f544792372663feb6d792a (patch)
tree555d1ac3a5e2ca9030d15f2e1760aea1a2e69ba7 /rt
parent0cae3f4b033e441d820f4521fa5736e4e6e4d713 (diff)
downloadglibc-6e6249d0b461b952d0f544792372663feb6d792a.zip
glibc-6e6249d0b461b952d0f544792372663feb6d792a.tar.gz
glibc-6e6249d0b461b952d0f544792372663feb6d792a.tar.bz2
BZ#14743: Move clock_* symbols from librt to libc.
Diffstat (limited to 'rt')
-rw-r--r--rt/Makefile7
-rw-r--r--rt/Versions14
-rw-r--r--rt/clock-compat.c65
-rw-r--r--rt/clock_getcpuclockid.c4
-rw-r--r--rt/clock_getres.c4
-rw-r--r--rt/clock_gettime.c5
-rw-r--r--rt/clock_nanosleep.c1
-rw-r--r--rt/clock_settime.c4
8 files changed, 96 insertions, 8 deletions
diff --git a/rt/Makefile b/rt/Makefile
index 26d4ffa..4805f8b 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -36,9 +36,12 @@ 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) \
- $(clock-routines) $(timer-routines) \
- $(shm-routines) $(mq-routines)
+ $(timer-routines) \
+ $(shm-routines) $(mq-routines) \
+ clock-compat
tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
diff --git a/rt/Versions b/rt/Versions
index 2921c9c..91e3fd2 100644
--- a/rt/Versions
+++ b/rt/Versions
@@ -1,3 +1,15 @@
+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.
@@ -6,7 +18,7 @@ librt {
aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
}
GLIBC_2.2 {
- # c*
+ # These have moved to libc and are still here only for compatibility.
clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
clock_nanosleep;
diff --git a/rt/clock-compat.c b/rt/clock-compat.c
new file mode 100644
index 0000000..16e4109
--- /dev/null
+++ b/rt/clock-compat.c
@@ -0,0 +1,65 @@
+/* ABI compatibility redirects for clock_* symbols in librt.
+ Copyright (C) 2012 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <shlib-compat.h>
+
+/* 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 <time.h>
+
+#ifdef HAVE_IFUNC
+# define COMPAT_REDIRECT(name, proto, arglist) \
+ __typeof (name) *name##_ifunc (void) asm (#name); \
+ __typeof (name) *name##_ifunc (void) \
+ { \
+ return &__##name; \
+ } \
+ asm (".type " #name ", %gnu_indirect_function");
+#else
+# define COMPAT_REDIRECT(name, proto, arglist) \
+ int \
+ name proto \
+ { \
+ return __##name arglist; \
+ }
+#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
index 08972f5..4bead25 100644
--- a/rt/clock_getcpuclockid.c
+++ b/rt/clock_getcpuclockid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Get a clockid_t for the process CPU clock of a given process. Generic.
+ Copyright (C) 2000-2012 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
@@ -36,3 +37,4 @@ clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
return ENOENT;
#endif
}
+strong_alias (clock_getcpuclockid, __clock_getcpuclockid)
diff --git a/rt/clock_getres.c b/rt/clock_getres.c
index 576c9bf..162c8a5 100644
--- a/rt/clock_getres.c
+++ b/rt/clock_getres.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Get the resolution of a clock. Stub version.
+ Copyright (C) 1999-2012 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
@@ -25,5 +26,6 @@ clock_getres (clockid_t clock_id, struct timespec *res)
__set_errno (ENOSYS);
return -1;
}
+strong_alias (clock_getres, __clock_getres)
stub_warning (clock_getres)
#include <stub-tag.h>
diff --git a/rt/clock_gettime.c b/rt/clock_gettime.c
index 1203f01..5139e87 100644
--- a/rt/clock_gettime.c
+++ b/rt/clock_gettime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2005 Free Software Foundation, Inc.
+/* Get the current value of a clock. Stub version.
+ Copyright (C) 1999-2012 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
@@ -25,6 +26,6 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
__set_errno (ENOSYS);
return -1;
}
-librt_hidden_def (clock_gettime)
+strong_alias (clock_gettime, __clock_gettime)
stub_warning (clock_gettime)
#include <stub-tag.h>
diff --git a/rt/clock_nanosleep.c b/rt/clock_nanosleep.c
index 0b16ad2..d9a0e92 100644
--- a/rt/clock_nanosleep.c
+++ b/rt/clock_nanosleep.c
@@ -33,5 +33,6 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
/* Not implemented. */
return ENOSYS;
}
+strong_alias (clock_nanosleep, __clock_nanosleep)
stub_warning (clock_nanosleep)
#include <stub-tag.h>
diff --git a/rt/clock_settime.c b/rt/clock_settime.c
index 3b3c3c4..6f7cdd6 100644
--- a/rt/clock_settime.c
+++ b/rt/clock_settime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Set a clock to a given value. Stub version.
+ Copyright (C) 1999-2012 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
@@ -25,5 +26,6 @@ clock_settime (clockid_t clock_id, const struct timespec *tp)
__set_errno (ENOSYS);
return -1;
}
+strong_alias (clock_settime, __clock_settime)
stub_warning (clock_settime)
#include <stub-tag.h>