summaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2012-11-01 01:45:53 +0100
committerThomas Schwinge <thomas@codesourcery.com>2012-11-01 01:45:53 +0100
commitcefc074b32d1eed87b2b96c8943d7f1864a5bb15 (patch)
tree1f43da63f9bae90772538a6c5b051e34983a22e7 /rt
parent0ce6f3added7475bfd0f2f551c6c97baccde6da5 (diff)
parent343dc156c34702751b3cc63736caa0649c59421a (diff)
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Diffstat (limited to 'rt')
-rw-r--r--rt/Makefile9
-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.c6
-rw-r--r--rt/clock_settime.c4
-rw-r--r--rt/tst-aio2.c3
-rw-r--r--rt/tst-aio3.c3
-rw-r--r--rt/tst-shm.c2
11 files changed, 104 insertions, 15 deletions
diff --git a/rt/Makefile b/rt/Makefile
index 941c471688..4805f8b5b7 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 \
@@ -77,4 +80,4 @@ ifeq (yes,$(build-bounded))
$(tests:%=$(objpfx)%-bp): $(objpfx)librt_b.a $(bounded-thread-library)
endif
-tst-mqueue7-ARGS = -- $(built-program-cmd)
+tst-mqueue7-ARGS = -- $(host-built-program-cmd)
diff --git a/rt/Versions b/rt/Versions
index 2921c9c8ab..91e3fd2a20 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 0000000000..16e4109210
--- /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 08972f54fd..4bead25685 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 576c9bf738..162c8a5697 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 1203f01179..5139e8724c 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 954a615018..d9a0e92d4b 100644
--- a/rt/clock_nanosleep.c
+++ b/rt/clock_nanosleep.c
@@ -1,5 +1,5 @@
/* High-resolution sleep with the specified clock. Stub version.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ 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
@@ -17,8 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <errno.h>
-#include <sys/time.h>
-
+#include <time.h>
int
clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
@@ -34,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 3b3c3c48d5..6f7cdd6edc 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>
diff --git a/rt/tst-aio2.c b/rt/tst-aio2.c
index 897d37d8bd..01a94fe270 100644
--- a/rt/tst-aio2.c
+++ b/rt/tst-aio2.c
@@ -1,5 +1,5 @@
/* Test for notification mechanism in lio_listio.
- Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
+#include <pthread.h>
static pthread_barrier_t b;
diff --git a/rt/tst-aio3.c b/rt/tst-aio3.c
index 4d1fe8e979..133e386cd3 100644
--- a/rt/tst-aio3.c
+++ b/rt/tst-aio3.c
@@ -1,5 +1,5 @@
/* Test for notification mechanism in lio_listio.
- Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
+ 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
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
+#include <pthread.h>
static pthread_barrier_t b;
diff --git a/rt/tst-shm.c b/rt/tst-shm.c
index 92593bd273..457b075a38 100644
--- a/rt/tst-shm.c
+++ b/rt/tst-shm.c
@@ -73,7 +73,7 @@ worker (int write_now)
error (EXIT_FAILURE, 0, "size incorrect");
mem = mmap (NULL, 4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (mem == NULL)
+ if (mem == MAP_FAILED)
error (EXIT_FAILURE, 0, "mmap failed");
ts.tv_sec = 0;