This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/4] Consolidate gettimeofday across aarch64/s390/tile
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Nathan Lynch <Nathan_Lynch at mentor dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 15 Apr 2015 18:24:21 -0300
- Subject: Re: [PATCH 2/4] Consolidate gettimeofday across aarch64/s390/tile
- Authentication-results: sourceware.org; auth=none
- References: <552EC85F dot 6080506 at linaro dot org> <552ED19E dot 1020401 at mentor dot com>
Hi
On 15-04-2015 18:01, Nathan Lynch wrote:
> On 04/15/2015 03:21 PM, Adhemerval Zanella wrote:
>> diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c
>> new file mode 100644
>> index 0000000..5eaafc0
>> --- /dev/null
>> +++ b/sysdeps/unix/sysv/linux/gettimeofday.c
>> @@ -0,0 +1,35 @@
>
> [...]
>
>> +#include <errno.h>
>> +#include <sys/time.h>
>> +#if HAVE_GETTIMEOFDAY_VSYSCAL
>
> Name it HAVE_GETTIMEOFDAY_VSYSCALL instead?
I will change it, thanks.
> ^
>
>> +# include <bits/libc-vdso.h>
>> +#endif
>> +
>> +/* Get the current time of day and timezone information,
>> + putting it into *tv and *tz. If tz is null, *tz is not filled.
>> + Returns 0 on success, -1 on errors. */
>> +int
>> +__gettimeofday (struct timeval *tv, struct timezone *tz)
>> +{
>> + return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
>> +}
>
> Rather than adding no-op INLINE_VSYSCALL definitions to all
> architectures (patch #1), couldn't the common gettimeofday code be made
> to effectively do:
>
> #if HAVE_GETTIMEOFDAY_VSYSCALL
> return INLINE_VSYSCALL (gettimeofday, ...);
> #else
> return INLINE_SYSCALL (gettimeofday, ...);
> #endif
>
My idea is to exactly get rid of this kind of #if in code and a further cleanup
I am planning to do is to move the INLINE_VSYSCALL in a platform neutral header
and make the vDSO declaration a macro to be used systematically in all ports.