[DTrace-devel] [PATCH 2/4] test: Use syscall in case of no execveat() wrapper
Kris Van Hees
kris.van.hees at oracle.com
Tue Oct 7 15:38:52 UTC 2025
On Mon, Oct 06, 2025 at 05:57:24PM -0400, eugene.loh--- via DTrace-devel wrote:
> 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.
Wow, we do? I am curious where...
> Do not assume libc has an execveat() wrapper: use syscall().
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees 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
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list