This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PowerPC: Add time vDSO support
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Mon, 29 Apr 2013 11:27:38 -0700 (PDT)
- Subject: Re: PowerPC: Add time vDSO support
- References: <517EB999 dot 5000504 at linux dot vnet dot ibm dot com>
> (VDSO_IFUNC_RET): Fix compiler warning on cast.
"Cast to void *" is what you're doing here, so say that.
You can say, "Cast to void * to silence compiler warning."
> #if defined(__PPC64__) || defined(__powerpc64__)
> -#define VDSO_IFUNC_RET(value) &value
> +#define VDSO_IFUNC_RET(value) (void*)(&value)
Should be: ((void *) &(value))
> #else
> -#define VDSO_IFUNC_RET(value) value
> +#define VDSO_IFUNC_RET(value) (void*)(value)
Should be: ((void *) (value))
> +++ b/sysdeps/unix/sysv/linux/powerpc/time.c
> @@ -0,0 +1,63 @@
> +/* Copyright (C) 2013 Free Software Foundation, Inc.
Top line of each new file is a descriptive comment.
> +#ifdef SHARED
> +
> +# include <time.h>
> +# include <sysdep.h>
> +# include <bits/libc-vdso.h>
> +
> +void *time_ifunc (void) __asm__ ("time");
No need for __ flavors in libc source code.
> +static time_t
> +__time_syscall (time_t *t)
No need for __ prefix on a static.
> + if (INLINE_VSYSCALL (gettimeofday, 2, &tv, NULL))
Canonical failure test would be "< 0".
> +void *
> +time_ifunc (void)
> +{
> + /* If the vDSO is not available we fall back syscall. */
"fall back to the syscall"