From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1992) id DC3D03858C66; Fri, 1 Mar 2024 15:17:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC3D03858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709306253; bh=KgJ8BPezZcyknnlV17y39LsIN0gyzZO2Yw+U1U0Z1XE=; h=From:To:Subject:Date:From; b=QAe6ISXcBJ1COLKTY4VXVYfwTObuQs/T/FmVqWDnSJN0y5vpitTZSq3MDrvsWCNy0 2hdkvZk76aHT8CQpwBSO7FWwFx4voF1yPpcAuXVHNfvKfzpZXj0Ar3zW6/5zDsroEh ee9yOJJkMU93WyvcB3pRddT9CYj4CnPnvZjx3onw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Palmer Dabbelt To: glibc-cvs@sourceware.org Subject: [glibc] linux: Introduce INTERNAL_VSYSCALL X-Act-Checkin: glibc X-Git-Author: Evan Green X-Git-Refname: refs/heads/master X-Git-Oldrev: 426d0e1aa8f17426d13707594111df712d2b8911 X-Git-Newrev: c6c33339b45281590f9db138ba6c9d79acb1da27 Message-Id: <20240301151733.DC3D03858C66@sourceware.org> Date: Fri, 1 Mar 2024 15:17:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c6c33339b45281590f9db138ba6c9d79acb1da27 commit c6c33339b45281590f9db138ba6c9d79acb1da27 Author: Evan Green Date: Tue Feb 27 14:56:38 2024 -0800 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 Signed-off-by: Palmer Dabbelt Diff: --- sysdeps/unix/sysv/linux/sysdep-vdso.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h index 189319ad98..2f53ada6e5 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 */