]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
Fix missing declaration
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / x86_64 / gettimeofday.c
1 /* Copyright (C) 2002, 2003, 2007, 2011 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
18
19 #include <dl-vdso.h>
20
21
22 #define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000ul
23
24
25 #ifdef SHARED
26 void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday");
27
28 void *
29 gettimeofday_ifunc (void)
30 {
31 PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
32
33 /* If the vDSO is not available we fall back on the old vsyscall. */
34 return (_dl_vdso_vsym ("gettimeofday", &linux26)
35 ?: (void *) VSYSCALL_ADDR_vgettimeofday);
36 }
37 __asm (".type __gettimeofday, %gnu_indirect_function");
38 #else
39 # include <sys/time.h>
40 # include <sysdep.h>
41 # include <errno.h>
42
43 int
44 __gettimeofday (struct timeval *tv, struct timezone *tz)
45 {
46 return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
47 }
48 #endif
49
50 weak_alias (__gettimeofday, gettimeofday)
51 strong_alias (__gettimeofday, __gettimeofday_internal)