aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorEvan Green <evan@rivosinc.com>2024-02-27 14:56:38 -0800
committerPalmer Dabbelt <palmer@rivosinc.com>2024-03-01 07:14:56 -0800
commitc6c33339b45281590f9db138ba6c9d79acb1da27 (patch)
tree0734d08f9d44f8b1c28ca687f5339e737f8e3693 /sysdeps/unix
parent426d0e1aa8f17426d13707594111df712d2b8911 (diff)
downloadglibc-c6c33339b45281590f9db138ba6c9d79acb1da27.zip
glibc-c6c33339b45281590f9db138ba6c9d79acb1da27.tar.gz
glibc-c6c33339b45281590f9db138ba6c9d79acb1da27.tar.bz2
linux: Introduce INTERNAL_VSYSCALL
Add an INTERNAL_VSYSCALL() macro that makes a vDSO call, falling back to a regular syscall, but without setting errno. Instead, the return value is plumbed straight out of the macro. Signed-off-by: Evan Green <evan@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/sysdep-vdso.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
index 189319a..2f53ada 100644
--- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -53,4 +53,16 @@
sc_ret; \
})
+#define INTERNAL_VSYSCALL(name, nr, args...) \
+ ({ \
+ long int sc_ret = -ENOSYS; \
+ \
+ __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \
+ if (vdsop != NULL) \
+ sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \
+ if (sc_ret == -ENOSYS) \
+ sc_ret = INTERNAL_SYSCALL_CALL (name, ##args); \
+ sc_ret; \
+ })
+
#endif /* SYSDEP_VDSO_LINUX_H */