]>
Commit | Line | Data |
---|---|---|
04277e02 | 1 | /* Copyright (C) 2018-2019 Free Software Foundation, Inc. |
3c7b9f1f SE |
2 | |
3 | This file is part of the GNU C Library. | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public License as | |
7 | published by the Free Software Foundation; either version 2.1 of the | |
8 | License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, see | |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
3c7b9f1f SE |
18 | |
19 | /* Get the current time of day and timezone information, | |
20 | putting it into *tv and *tz. If tz is null, *tz is not filled. | |
21 | Returns 0 on success, -1 on errors. */ | |
22 | ||
b8386c28 AZ |
23 | #include <sys/time.h> |
24 | ||
3c7b9f1f SE |
25 | #ifdef SHARED |
26 | ||
3c7b9f1f SE |
27 | # include <dl-vdso.h> |
28 | # include <sysdep-vdso.h> | |
29 | ||
30 | /* Used as a fallback in the ifunc resolver if VDSO is not available | |
31 | and for libc.so internal __gettimeofday calls. */ | |
32 | ||
33 | static int | |
34 | __gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz) | |
35 | { | |
36 | return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); | |
37 | } | |
38 | ||
b8386c28 AZ |
39 | # define INIT_ARCH() |
40 | libc_ifunc_hidden (__gettimeofday, __gettimeofday, | |
41 | (get_vdso_symbol ("__kernel_gettimeofday") | |
42 | ?: __gettimeofday_vsyscall)) | |
43 | libc_hidden_def (__gettimeofday) | |
3c7b9f1f SE |
44 | |
45 | #else | |
46 | ||
3c7b9f1f SE |
47 | # include <sysdep.h> |
48 | int | |
49 | __gettimeofday (struct timeval *tv, struct timezone *tz) | |
50 | { | |
51 | return INLINE_SYSCALL (gettimeofday, 2, tv, tz); | |
52 | } | |
53 | libc_hidden_def (__gettimeofday) | |
54 | ||
55 | #endif | |
56 | ||
57 | weak_alias (__gettimeofday, gettimeofday) | |
58 | libc_hidden_weak (gettimeofday) |