]>
Commit | Line | Data |
---|---|---|
d4697bc9 | 1 | /* Copyright (C) 2001-2014 Free Software Foundation, Inc. |
2b904739 AJ |
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 | |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
2b904739 | 17 | |
50604220 | 18 | #ifdef SHARED |
f85fa270 L |
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> | |
24 | ||
91b392a4 UD |
25 | #include <dl-vdso.h> |
26 | ||
2b904739 AJ |
27 | #define VSYSCALL_ADDR_vtime 0xffffffffff600400 |
28 | ||
f85fa270 L |
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"); | |
2b904739 | 33 | |
91b392a4 UD |
34 | void * |
35 | time_ifunc (void) | |
36 | { | |
37 | PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); | |
35107e0c | 38 | |
91b392a4 | 39 | /* If the vDSO is not available we fall back on the old vsyscall. */ |
8542dee3 | 40 | return _dl_vdso_vsym ("__vdso_time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime; |
91b392a4 | 41 | } |
f85fa270 L |
42 | __asm (".type __libc_time, %gnu_indirect_function"); |
43 | ||
44 | #undef time | |
45 | strong_alias (__libc_time, time) | |
46 | libc_hidden_ver (__libc_time, time) | |
50604220 | 47 | |
c738465a | 48 | #else |
50604220 | 49 | |
91b392a4 | 50 | # include <time.h> |
ef606249 | 51 | # include <sysdep.h> |
91b392a4 UD |
52 | |
53 | time_t | |
54 | time (time_t *t) | |
55 | { | |
ef606249 UD |
56 | INTERNAL_SYSCALL_DECL (err); |
57 | return INTERNAL_SYSCALL (time, err, 1, t); | |
91b392a4 | 58 | } |
50604220 | 59 | |
c738465a | 60 | #endif |