This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[ping][PATCH] Fix symbol definitions for __clock_* functions
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 10 Jun 2013 14:09:00 +0530
- Subject: [ping][PATCH] Fix symbol definitions for __clock_* functions
- References: <20130521145455 dot GL8927 at spoyarek dot pnq dot redhat dot com> <20130523191651 dot 0C1F82C0A1 at topped-with-meat dot com> <20130603113056 dot GQ2145 at spoyarek dot pnq dot redhat dot com>
Ping!
On Mon, Jun 03, 2013 at 05:00:57PM +0530, Siddhesh Poyarekar wrote:
> Hi,
>
> Here's an updated patch that fixes symbol definitions for all clock_*
> functions and adds a hidden definition of __clock_gettime for use
> within the library. Tested to verify that this does not break
> anything in the testsuite.
>
> Siddhesh
>
> * include/time.h (__clock_gettime): Add hidden prototype.
> * rt/clock_getcpuclockid.c (clock_getcpuclockid): Rename to
> __clock_getcpuclockid and add a weak alias.
> * sysdeps/unix/sysv/linux/clock_getcpuclockid.c
> (clock_getcpuclockid): Likewise.
> * rt/clock_getres.c (clock_getres): Rename to __clock_getres
> and add a weak alias.
> * sysdeps/posix/clock_getres.c (clock_getres): Likewise.
> * rt/clock_gettime.c (clock_gettime): Rename to
> __clock_gettime and add a weak alias.
> * sysdeps/unix/clock_gettime.c (clock_gettime): Likewise.
> * rt/clock_nanosleep.c (clock_nanosleep): Rename to
> __clock_nanosleep and add a weak alias.
> * sysdeps/unix/clock_nanosleep.c (clock_nanosleep): Likewise.
> * sysdeps/unix/sysv/linux/clock_nanosleep.c (clock_nanosleep):
> Likewise.
> * rt/clock_settime.c (clock_settime): Rename to
> __clock_settime and add a weak alias.
> * sysdeps/unix/clock_settime.c (clock_settime): Likewise.
>
>
> diff --git a/include/time.h b/include/time.h
> index 9be15b9..8dd10dc 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -21,6 +21,7 @@ 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;
> diff --git a/rt/clock_getcpuclockid.c b/rt/clock_getcpuclockid.c
> index 44d7724..d16ce14 100644
> --- a/rt/clock_getcpuclockid.c
> +++ b/rt/clock_getcpuclockid.c
> @@ -21,7 +21,7 @@
> #include <unistd.h>
>
> int
> -clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
> +__clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
> {
> /* We don't allow any process ID but our own. */
> if (pid != 0 && pid != getpid ())
> @@ -37,4 +37,4 @@ clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
> return ENOENT;
> #endif
> }
> -strong_alias (clock_getcpuclockid, __clock_getcpuclockid)
> +weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
> diff --git a/rt/clock_getres.c b/rt/clock_getres.c
> index cd59b14..df19c40 100644
> --- a/rt/clock_getres.c
> +++ b/rt/clock_getres.c
> @@ -21,10 +21,10 @@
>
> /* Get resolution of clock. */
> int
> -clock_getres (clockid_t clock_id, struct timespec *res)
> +__clock_getres (clockid_t clock_id, struct timespec *res)
> {
> __set_errno (ENOSYS);
> return -1;
> }
> -strong_alias (clock_getres, __clock_getres)
> +weak_alias (__clock_getres, clock_getres)
> stub_warning (clock_getres)
> diff --git a/rt/clock_gettime.c b/rt/clock_gettime.c
> index cc7936d..1c9e524 100644
> --- a/rt/clock_gettime.c
> +++ b/rt/clock_gettime.c
> @@ -21,10 +21,11 @@
>
> /* Get current value of CLOCK and store it in TP. */
> int
> -clock_gettime (clockid_t clock_id, struct timespec *tp)
> +__clock_gettime (clockid_t clock_id, struct timespec *tp)
> {
> __set_errno (ENOSYS);
> return -1;
> }
> -strong_alias (clock_gettime, __clock_gettime)
> +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
> index 24f8bc6..8779147 100644
> --- a/rt/clock_nanosleep.c
> +++ b/rt/clock_nanosleep.c
> @@ -20,8 +20,8 @@
> #include <time.h>
>
> int
> -clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
> - struct timespec *rem)
> +__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)
> @@ -33,5 +33,5 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
> /* Not implemented. */
> return ENOSYS;
> }
> -strong_alias (clock_nanosleep, __clock_nanosleep)
> +weak_alias (__clock_nanosleep, clock_nanosleep)
> stub_warning (clock_nanosleep)
> diff --git a/rt/clock_settime.c b/rt/clock_settime.c
> index 411a7ee..9249f26 100644
> --- a/rt/clock_settime.c
> +++ b/rt/clock_settime.c
> @@ -21,10 +21,10 @@
>
> /* Set CLOCK to value TP. */
> int
> -clock_settime (clockid_t clock_id, const struct timespec *tp)
> +__clock_settime (clockid_t clock_id, const struct timespec *tp)
> {
> __set_errno (ENOSYS);
> return -1;
> }
> -strong_alias (clock_settime, __clock_settime)
> +weak_alias (__clock_settime, clock_settime)
> stub_warning (clock_settime)
> diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
> index 7581f32..5d898e4 100644
> --- a/sysdeps/posix/clock_getres.c
> +++ b/sysdeps/posix/clock_getres.c
> @@ -76,7 +76,7 @@ realtime_getres (struct timespec *res)
>
> /* Get resolution of clock. */
> int
> -clock_getres (clockid_t clock_id, struct timespec *res)
> +__clock_getres (clockid_t clock_id, struct timespec *res)
> {
> int retval = -1;
>
> @@ -115,4 +115,4 @@ clock_getres (clockid_t clock_id, struct timespec *res)
>
> return retval;
> }
> -strong_alias (clock_getres, __clock_getres)
> +weak_alias (__clock_getres, clock_getres)
> diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
> index 1c64f07..d46057a 100644
> --- a/sysdeps/unix/clock_gettime.c
> +++ b/sysdeps/unix/clock_gettime.c
> @@ -89,7 +89,7 @@ realtime_gettime (struct timespec *tp)
>
> /* Get current value of CLOCK and store it in TP. */
> int
> -clock_gettime (clockid_t clock_id, struct timespec *tp)
> +__clock_gettime (clockid_t clock_id, struct timespec *tp)
> {
> int retval = -1;
>
> @@ -132,4 +132,5 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
>
> return retval;
> }
> -strong_alias (clock_gettime, __clock_gettime)
> +weak_alias (__clock_gettime, clock_gettime)
> +libc_hidden_def (__clock_gettime)
> diff --git a/sysdeps/unix/clock_nanosleep.c b/sysdeps/unix/clock_nanosleep.c
> index 33fee7b..0079324 100644
> --- a/sysdeps/unix/clock_nanosleep.c
> +++ b/sysdeps/unix/clock_nanosleep.c
> @@ -39,8 +39,8 @@
> /* This implementation assumes that these is only a `nanosleep' system
> call. So we have to remap all other activities. */
> int
> -clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
> - struct timespec *rem)
> +__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
> + struct timespec *rem)
> {
> struct timespec now;
>
> @@ -98,4 +98,4 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
>
> return __builtin_expect (nanosleep (req, rem), 0) ? errno : 0;
> }
> -strong_alias (clock_nanosleep, __clock_nanosleep)
> +weak_alias (__clock_nanosleep, clock_nanosleep)
> diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
> index 48269cc..6605e9e 100644
> --- a/sysdeps/unix/clock_settime.c
> +++ b/sysdeps/unix/clock_settime.c
> @@ -72,7 +72,7 @@ hp_timing_settime (clockid_t clock_id, const struct timespec *tp)
>
> /* Set CLOCK to value TP. */
> int
> -clock_settime (clockid_t clock_id, const struct timespec *tp)
> +__clock_settime (clockid_t clock_id, const struct timespec *tp)
> {
> int retval;
>
> @@ -124,4 +124,4 @@ clock_settime (clockid_t clock_id, const struct timespec *tp)
>
> return retval;
> }
> -strong_alias (clock_settime, __clock_settime)
> +weak_alias (__clock_settime, clock_settime)
> diff --git a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
> index 5c89c66..e234bdc 100644
> --- a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
> +++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
> @@ -23,7 +23,7 @@
> #include "kernel-posix-cpu-timers.h"
>
> int
> -clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
> +__clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
> {
> /* The clockid_t value is a simple computation from the PID.
> But we do a clock_getres call to validate it. */
> @@ -46,4 +46,4 @@ clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
> else
> return INTERNAL_SYSCALL_ERRNO (r, err);
> }
> -strong_alias (clock_getcpuclockid, __clock_getcpuclockid)
> +weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
> diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c
> index 41bc5e9..2e496d2 100644
> --- a/sysdeps/unix/sysv/linux/clock_nanosleep.c
> +++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c
> @@ -26,8 +26,8 @@
> /* We can simply use the syscall. The CPU clocks are not supported
> with this function. */
> int
> -clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
> - struct timespec *rem)
> +__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
> + struct timespec *rem)
> {
> INTERNAL_SYSCALL_DECL (err);
> int r;
> @@ -52,4 +52,4 @@ 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);
> }
> -strong_alias (clock_nanosleep, __clock_nanosleep)
> +weak_alias (__clock_nanosleep, clock_nanosleep)