[DTrace-devel] [PATCH 2/4] test: Use syscall in case of no execveat() wrapper

eugene.loh at oracle.com eugene.loh at oracle.com
Mon Oct 6 21:57:24 UTC 2025


From: Eugene Loh <eugene.loh at oracle.com>

While execveat() appeared in kernel 3.19, GNU C library support
came later.  We are still testing on some systems with older libc.

Do not assume libc has an execveat() wrapper:  use syscall().

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 test/unittest/proc/tst.exec-execveat.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/unittest/proc/tst.exec-execveat.sh b/test/unittest/proc/tst.exec-execveat.sh
index db68a5043..e4b9dfa5e 100755
--- a/test/unittest/proc/tst.exec-execveat.sh
+++ b/test/unittest/proc/tst.exec-execveat.sh
@@ -17,7 +17,7 @@ cd $DIRNAME
 cat << EOF > parent.c
 #include <stdio.h>
 #include <linux/fcntl.h>      /* Definition of AT_* constants */
-#define __USE_GNU             /* so unistd.h will find execveat */
+#include <sys/syscall.h>      /* Definition of SYS_* constants */
 #include <unistd.h>
 
 int main(int c, char **v) {
@@ -26,7 +26,7 @@ int main(int c, char **v) {
   int rc;
 
   printf("exec\n");
-  rc = execveat(AT_FDCWD, "bogus_direc/bogus_exec", argv, envp, 0);
+  rc = syscall(__NR_execveat, AT_FDCWD, "bogus_direc/bogus_exec", argv, envp, 0);
 
   return 0;
 }
-- 
2.47.3




More information about the DTrace-devel mailing list