selftests/exec: Fix build on older distros.
Subsystems (3)
PATCH 1/1 selftests/exec: Fix build on older distros.
From: Vinson Lee <[email protected]>
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)
--- tools/testing/selftests/exec/execveat.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tools/testing/selftests/exec/execveat.c +10 -0
@@ -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 +static char longpath[2 *PATH_MAX ] ="" ;static char *envp[] = {"IN_TEST=yes" ,NULL ,NULL };static char *argv[] = {"execveat" ,"99" ,NULL };
Signature · 1 line
1.8.2.1
Quoted 27 lines · Vinson Lee
From: Vinson Lee <[email protected]>
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 [email protected] # 3.19+Signed-off-by Vinson Lee <[email protected]>--- tools/testing/selftests/exec/execveat.c | 10 ++++++++++ 1 file changed, 10 insertions(+)tools/testing/selftests/exec/execveat.c +0
-0@@ -20,6 +20,16 @@#include <string.h> #include <unistd.h>
tools/testing/selftests/exec/execveat.c line 32
Quoted 10 lines
tools/testing/selftests/exec/execveat.c +10
-0+#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)
Quoted 6 lines
tools/testing/selftests/exec/execveat.c +0
-1static char longpath[2 *PATH_MAX ] ="" ;static char *envp[] = {"IN_TEST=yes" ,NULL ,NULL };static char *argv[] = {"execveat" ,"99" ,NULL }; --1.8.2.1
PATCH v2 1/1 selftests/exec: Fix build on older distros.
From: Vinson Lee <[email protected]>
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)
--- tools/testing/selftests/exec/execveat.c | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
tools/testing/selftests/exec/execveat.c +34 -0
@@ -20,6 +20,40 @@#include <string.h> #include <unistd.h> +#if defined( __alpha__) +# ifndef O_CLOEXEC +# define O_CLOEXEC 010000000 +# endif +# ifndef O_PATH +# define O_PATH 040000000 +# endif +#elif defined(__hppa__) +# ifndef O_CLOEXEC +# define O_CLOEXEC 010000000 +# endif +# ifndef O_PATH +# define O_PATH 020000000 +# endif +#elif defined(__sparc__) +# ifndef O_CLOEXEC +# define O_CLOEXEC 0x400000 +# endif +# ifndef O_PATH +# define O_PATH 0x1000000 +# endif +#else +# ifndef O_CLOEXEC +# define O_CLOEXEC 02000000 +# endif +# ifndef O_PATH +# define O_PATH 010000000 +# endif +#endif + +#ifndef AT_EMPTY_PATH +# define AT_EMPTY_PATH 0x1000 +#endif +static char longpath[2 *PATH_MAX ] ="" ;static char *envp[] = {"IN_TEST=yes" ,NULL ,NULL };static char *argv[] = {"execveat" ,"99" ,NULL };
Signature · 1 line
1.8.2.1