linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/exec: Fix build on older distros.
@ 2015-06-25 23:29 Vinson Lee
       [not found] ` <1435274950-17106-1-git-send-email-vlee-xCSkyg8dI+0RB7SZvlqPiA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Vinson Lee @ 2015-06-25 23:29 UTC (permalink / raw)
  To: Shuah Khan, David Drysdale, Andrew Morton, Geert Uytterhoeven,
	Michael Ellerman
  Cc: linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Vinson Lee

From: Vinson Lee <vlee-1v8oiQdgUNlBDgjK7y7TUQ@public.gmane.org>

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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org # 3.19+
Signed-off-by: Vinson Lee <vlee-1v8oiQdgUNlBDgjK7y7TUQ@public.gmane.org>
---
 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
+
 static char longpath[2 * PATH_MAX] = "";
 static char *envp[] = { "IN_TEST=yes", NULL, NULL };
 static char *argv[] = { "execveat", "99", NULL };
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/exec: Fix build on older distros.
       [not found] ` <1435274950-17106-1-git-send-email-vlee-xCSkyg8dI+0RB7SZvlqPiA@public.gmane.org>
@ 2015-06-26  6:17   ` David Drysdale
       [not found]     ` <CAHse=S817frpt-SGVQCWf5Fq3jV3mHdYEkU4XFhu48jkT6CKog-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: David Drysdale @ 2015-06-26  6:17 UTC (permalink / raw)
  To: Vinson Lee
  Cc: Shuah Khan, Andrew Morton, Geert Uytterhoeven, Michael Ellerman,
	Linux API, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Vinson Lee

On Fri, Jun 26, 2015 at 12:29 AM, Vinson Lee <vlee-xCSkyg8dI+0RB7SZvlqPiA@public.gmane.org> wrote:
> From: Vinson Lee <vlee-1v8oiQdgUNlBDgjK7y7TUQ@public.gmane.org>
>
> 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org # 3.19+
> Signed-off-by: Vinson Lee <vlee-1v8oiQdgUNlBDgjK7y7TUQ@public.gmane.org>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] selftests/exec: Fix build on older distros.
       [not found]     ` <CAHse=S817frpt-SGVQCWf5Fq3jV3mHdYEkU4XFhu48jkT6CKog-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-06-26 23:11       ` Vinson Lee
  0 siblings, 0 replies; 3+ messages in thread
From: Vinson Lee @ 2015-06-26 23:11 UTC (permalink / raw)
  To: Shuah Khan, David Drysdale, Andrew Morton, Geert Uytterhoeven,
	Michael Ellerman
  Cc: linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Vinson Lee

From: Vinson Lee <vlee-1v8oiQdgUNlBDgjK7y7TUQ@public.gmane.org>

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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org # 3.19+
Signed-off-by: Vinson Lee <vlee-1v8oiQdgUNlBDgjK7y7TUQ@public.gmane.org>
---
 tools/testing/selftests/exec/execveat.c | 34 +++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tools/testing/selftests/exec/execveat.c b/tools/testing/selftests/exec/execveat.c
index 8d5d1d2..30d2555 100644
--- a/tools/testing/selftests/exec/execveat.c
+++ b/tools/testing/selftests/exec/execveat.c
@@ -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 };
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-26 23:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-25 23:29 [PATCH] selftests/exec: Fix build on older distros Vinson Lee
     [not found] ` <1435274950-17106-1-git-send-email-vlee-xCSkyg8dI+0RB7SZvlqPiA@public.gmane.org>
2015-06-26  6:17   ` David Drysdale
     [not found]     ` <CAHse=S817frpt-SGVQCWf5Fq3jV3mHdYEkU4XFhu48jkT6CKog-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-26 23:11       ` [PATCH v2] " Vinson Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).