Add crt1-2.0.o for glibc 2.0 compatibility tests
[glibc.git] / sysdeps / unix / sysv / linux / sysdep-vdso.h
blob2f53ada6e57aaf94a8ab3263338ccfe1285f3855
1 /* vDSO common definition for Linux.
2 Copyright (C) 2015-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #ifndef SYSDEP_VDSO_LINUX_H
20 # define SYSDEP_VDSO_LINUX_H
22 #include <ldsodefs.h>
24 #ifndef INTERNAL_VSYSCALL_CALL
25 # define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \
26 funcptr (args)
27 #endif
29 #define INLINE_VSYSCALL(name, nr, args...) \
30 ({ \
31 __label__ out; \
32 __label__ iserr; \
33 long int sc_ret; \
35 __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \
36 if (vdsop != NULL) \
37 { \
38 sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \
39 if (!INTERNAL_SYSCALL_ERROR_P (sc_ret)) \
40 goto out; \
41 if (INTERNAL_SYSCALL_ERRNO (sc_ret) != ENOSYS) \
42 goto iserr; \
43 } \
45 sc_ret = INTERNAL_SYSCALL_CALL (name, ##args); \
46 if (INTERNAL_SYSCALL_ERROR_P (sc_ret)) \
47 { \
48 iserr: \
49 __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret)); \
50 sc_ret = -1L; \
51 } \
52 out: \
53 sc_ret; \
56 #define INTERNAL_VSYSCALL(name, nr, args...) \
57 ({ \
58 long int sc_ret = -ENOSYS; \
60 __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \
61 if (vdsop != NULL) \
62 sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \
63 if (sc_ret == -ENOSYS) \
64 sc_ret = INTERNAL_SYSCALL_CALL (name, ##args); \
65 sc_ret; \
68 #endif /* SYSDEP_VDSO_LINUX_H */