public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] linux: Introduce INTERNAL_VSYSCALL
Date: Fri,  1 Mar 2024 15:17:33 +0000 (GMT)	[thread overview]
Message-ID: <20240301151733.DC3D03858C66@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c6c33339b45281590f9db138ba6c9d79acb1da27

commit c6c33339b45281590f9db138ba6c9d79acb1da27
Author: Evan Green <evan@rivosinc.com>
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 <evan@rivosinc.com>
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

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  */

                 reply	other threads:[~2024-03-01 15:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240301151733.DC3D03858C66@sourceware.org \
    --to=palmer@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).