Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / unix / sysv / linux / x86_64 / time.c
blobc00b5bec0bbac97f954633db97aa4546fb1daee0
1 /* Copyright (C) 2001-2015 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #ifdef SHARED
19 /* Redefine time so that the compiler won't complain about the type
20 mismatch with the IFUNC selector in strong_alias, below. */
21 #undef time
22 #define time __redirect_time
23 #include <time.h>
25 #include <dl-vdso.h>
27 #define VSYSCALL_ADDR_vtime 0xffffffffff600400
29 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
30 ifunc symbol properly. */
31 extern __typeof (__redirect_time) __libc_time;
32 void *time_ifunc (void) __asm__ ("__libc_time");
34 void *
35 time_ifunc (void)
37 PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
39 /* If the vDSO is not available we fall back on the old vsyscall. */
40 return _dl_vdso_vsym ("__vdso_time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime;
42 __asm (".type __libc_time, %gnu_indirect_function");
44 #undef time
45 strong_alias (__libc_time, time)
46 libc_hidden_ver (__libc_time, time)
48 #else
50 # include <time.h>
51 # include <sysdep.h>
53 time_t
54 time (time_t *t)
56 INTERNAL_SYSCALL_DECL (err);
57 return INTERNAL_SYSCALL (time, err, 1, t);
60 #endif