Re: [PATCH] selftests/exec: Fix build on older distros.

From: David Drysdale
Date: Fri Jun 26 2015 - 02:18:17 EST


On Fri, Jun 26, 2015 at 12:29 AM, Vinson Lee <vlee@xxxxxxxxxxxxxxxx> wrote:
> From: Vinson Lee <vlee@xxxxxxxxxxx>
>
> This patch fixes this build error on CentOS 5.
>
> execveat.c: In function âcheck_execveat_pathmaxâ:
> execveat.c:185: error: âAT_EMPTY_PATHâ undeclared (first use in this function)
> execveat.c:185: error: (Each undeclared identifier is reported only once
> execveat.c:185: error: for each function it appears in.)
> execveat.c: In function ârun_testsâ:
> execveat.c:221: error: âO_PATHâ undeclared (first use in this function)
> execveat.c:222: error: âO_CLOEXECâ undeclared (first use in this function)
> execveat.c:258: error: âAT_EMPTY_PATHâ undeclared (first use in this function)
>
> Cc: stable@xxxxxxxxxxxxxxx # 3.19+
> Signed-off-by: Vinson Lee <vlee@xxxxxxxxxxx>
> ---
> tools/testing/selftests/exec/execveat.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/exec/execveat.c b/tools/testing/selftests/exec/execveat.c
> index 8d5d1d2..170148d 100644
> --- a/tools/testing/selftests/exec/execveat.c
> +++ b/tools/testing/selftests/exec/execveat.c
> @@ -20,6 +20,16 @@
> #include <string.h>
> #include <unistd.h>
>
> +#ifndef AT_EMPTY_PATH
> +# define AT_EMPTY_PATH 0x1000
> +#endif
> +#ifndef O_PATH
> +# define O_PATH 010000000
> +#endif
> +#ifndef O_CLOEXEC
> +# define O_CLOEXEC 02000000
> +#endif
> +

Won't those definitions affect the arch-independence of the test?

(The O_* constants are sadly arch-specific:
http://lxr.free-electrons.com/ident?i=O_PATH)

> static char longpath[2 * PATH_MAX] = "";
> static char *envp[] = { "IN_TEST=yes", NULL, NULL };
> static char *argv[] = { "execveat", "99", NULL };
> --
> 1.8.2.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/