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

Kris Van Hees <[email protected]>
Newsgroups dev.linux.lists.dtrace
Message-ID <[email protected]>
On Mon, Oct 06, 2025 at 05:57:24PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <[email protected]>
> 
> While execveat() appeared in kernel 3.19, GNU C library support
> came later.  We are still testing on some systems with older libc.

Wow, we do?  I am curious where...

> Do not assume libc has an execveat() wrapper:  use syscall().
> 
> Signed-off-by: Eugene Loh <[email protected]>

Reviewed-by: Kris Van Hees <[email protected]>

> ---
>  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
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> [email protected]
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.