* [LTP] [PATCH v5 1/2] lib/cloner.c: add more args @ 2013-12-18 9:29 zenglg.jy 2013-12-23 1:11 ` Wanlong Gao 2014-01-07 14:09 ` chrubis 0 siblings, 2 replies; 19+ messages in thread From: zenglg.jy @ 2013-12-18 9:29 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp-list add args with ptid and ctid in ltp_clone(). Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com> --- include/test.h | 2 +- lib/cloner.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/test.h b/include/test.h index 94fc721..ffc1c8c 100644 --- a/include/test.h +++ b/include/test.h @@ -200,7 +200,7 @@ int self_exec(char *argv0, char *fmt, ...); /* Functions from lib/cloner.c */ int ltp_clone(unsigned long clone_flags, int (*fn)(void *arg), void *arg, - size_t stack_size, void *stack); + size_t stack_size, void *stack, ...); int ltp_clone_malloc(unsigned long clone_flags, int (*fn)(void *arg), void *arg, size_t stacksize); int ltp_clone_quick(unsigned long clone_flags, int (*fn)(void *arg), diff --git a/lib/cloner.c b/lib/cloner.c index a68ff1e..93e3f8c 100644 --- a/lib/cloner.c +++ b/lib/cloner.c @@ -27,6 +27,7 @@ #include <string.h> #include <stdlib.h> #include <sched.h> +#include <stdarg.h> #include "test.h" #undef clone /* we want to use clone() */ @@ -50,20 +51,31 @@ extern int __clone2(int (*fn) (void *arg), void *child_stack_base, */ int ltp_clone(unsigned long clone_flags, int (*fn) (void *arg), void *arg, - size_t stack_size, void *stack) + size_t stack_size, void *stack, ...) { int ret; + pid_t *parent_tid, *child_tid; + void *tls; + va_list arg_clone; + + va_start(arg_clone, stack); + parent_tid = va_arg(arg_clone, pid_t *); + tls = va_arg(arg_clone, void *); + child_tid = va_arg(arg_clone, pid_t *); + va_end(arg_clone); #if defined(__hppa__) || defined(__metag__) - ret = clone(fn, stack, clone_flags, arg); + ret = clone(fn, stack, clone_flags, arg, parent_tid, tls, child_tid); #elif defined(__ia64__) - ret = clone2(fn, stack, stack_size, clone_flags, arg, NULL, NULL, NULL); + ret = clone2(fn, stack, stack_size, clone_flags, arg, + parent_tid, tls, child_tid); #else /* * For archs where stack grows downwards, stack points to the topmost * address of the memory space set up for the child stack. */ - ret = clone(fn, (stack ? stack + stack_size : NULL), clone_flags, arg); + ret = clone(fn, (stack ? stack + stack_size : NULL), clone_flags, arg, + parent_tid, tls, child_tid); #endif return ret; -- 1.8.2.1 ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [LTP] [PATCH v5 1/2] lib/cloner.c: add more args 2013-12-18 9:29 [LTP] [PATCH v5 1/2] lib/cloner.c: add more args zenglg.jy @ 2013-12-23 1:11 ` Wanlong Gao 2014-01-07 14:09 ` chrubis 1 sibling, 0 replies; 19+ messages in thread From: Wanlong Gao @ 2013-12-23 1:11 UTC (permalink / raw) To: zenglg.jy, Jan Stancek; +Cc: ltp-list On 12/18/2013 05:29 PM, zenglg.jy wrote: > add args with ptid and ctid in ltp_clone(). > > Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com> Applied, thank you. Wanlong Gao ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [LTP] [PATCH v5 1/2] lib/cloner.c: add more args 2013-12-18 9:29 [LTP] [PATCH v5 1/2] lib/cloner.c: add more args zenglg.jy 2013-12-23 1:11 ` Wanlong Gao @ 2014-01-07 14:09 ` chrubis [not found] ` <1389181297.2879.11.camel@G08JYZSD130126> [not found] ` <1389191490.2879.27.camel@G08JYZSD130126> 1 sibling, 2 replies; 19+ messages in thread From: chrubis @ 2014-01-07 14:09 UTC (permalink / raw) To: zenglg.jy; +Cc: ltp-list Hi! > add args with ptid and ctid in ltp_clone(). > > Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com> > --- > include/test.h | 2 +- > lib/cloner.c | 20 ++++++++++++++++---- > 2 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/include/test.h b/include/test.h > index 94fc721..ffc1c8c 100644 > --- a/include/test.h > +++ b/include/test.h > @@ -200,7 +200,7 @@ int self_exec(char *argv0, char *fmt, ...); > > /* Functions from lib/cloner.c */ > int ltp_clone(unsigned long clone_flags, int (*fn)(void *arg), void *arg, > - size_t stack_size, void *stack); > + size_t stack_size, void *stack, ...); > int ltp_clone_malloc(unsigned long clone_flags, int (*fn)(void *arg), > void *arg, size_t stacksize); > int ltp_clone_quick(unsigned long clone_flags, int (*fn)(void *arg), > diff --git a/lib/cloner.c b/lib/cloner.c > index a68ff1e..93e3f8c 100644 > --- a/lib/cloner.c > +++ b/lib/cloner.c > @@ -27,6 +27,7 @@ > #include <string.h> > #include <stdlib.h> > #include <sched.h> > +#include <stdarg.h> > #include "test.h" > > #undef clone /* we want to use clone() */ > @@ -50,20 +51,31 @@ extern int __clone2(int (*fn) (void *arg), void *child_stack_base, > */ > int > ltp_clone(unsigned long clone_flags, int (*fn) (void *arg), void *arg, > - size_t stack_size, void *stack) > + size_t stack_size, void *stack, ...) > { > int ret; > + pid_t *parent_tid, *child_tid; > + void *tls; > + va_list arg_clone; > + > + va_start(arg_clone, stack); > + parent_tid = va_arg(arg_clone, pid_t *); > + tls = va_arg(arg_clone, void *); > + child_tid = va_arg(arg_clone, pid_t *); > + va_end(arg_clone); > > #if defined(__hppa__) || defined(__metag__) > - ret = clone(fn, stack, clone_flags, arg); > + ret = clone(fn, stack, clone_flags, arg, parent_tid, tls, child_tid); > #elif defined(__ia64__) > - ret = clone2(fn, stack, stack_size, clone_flags, arg, NULL, NULL, NULL); > + ret = clone2(fn, stack, stack_size, clone_flags, arg, > + parent_tid, tls, child_tid); > #else > /* > * For archs where stack grows downwards, stack points to the topmost > * address of the memory space set up for the child stack. > */ > - ret = clone(fn, (stack ? stack + stack_size : NULL), clone_flags, arg); > + ret = clone(fn, (stack ? stack + stack_size : NULL), clone_flags, arg, > + parent_tid, tls, child_tid); > #endif > > return ret; Looks like this patch breaks compilation on older distributions, I've got: "Too many arguments to function 'clone'". Has anybody seen this too? So this needs an autoconf check and few ifdefs. And as we are about to create release this needs to be either fixed ASAP or we will have to revert it for the release. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <1389181297.2879.11.camel@G08JYZSD130126>]
* Re: [LTP] [PATCH v5 1/2] lib/cloner.c: add more args [not found] ` <1389181297.2879.11.camel@G08JYZSD130126> @ 2014-01-08 13:20 ` chrubis 0 siblings, 0 replies; 19+ messages in thread From: chrubis @ 2014-01-08 13:20 UTC (permalink / raw) To: Zeng Linggang; +Cc: ltp-list Hi! > > Looks like this patch breaks compilation on older distributions, I've > > got: "Too many arguments to function 'clone'". Has anybody seen this > > too? > > > > I run it in RHEL5.0GA, RHEL6.0GA, 7.0Beta > and do not find these messages. > Could you tell me which distributions it is. SLES11 on s390 and s390x, SLES10, RHEL4. Generally older distributions and/or exotic architectures. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <1389191490.2879.27.camel@G08JYZSD130126>]
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments [not found] ` <1389191490.2879.27.camel@G08JYZSD130126> @ 2014-01-08 15:15 ` chrubis [not found] ` <1389254938.2025.3.camel@G08JYZSD130126> [not found] ` <201401081447.46449.vapier@gentoo.org> [not found] ` <201401090803.39606.vapier@gentoo.org> 2 siblings, 1 reply; 19+ messages in thread From: chrubis @ 2014-01-08 15:15 UTC (permalink / raw) To: Zeng Linggang; +Cc: ltp-list Hi! > Create m4/ltp-clone7args.m4 to check whether clone support 7 arguments. > When HAVE_CLONE7ARGS is not defined, make clone08 return TCONF > > Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com> > --- > configure.ac | 1 + > include/test.h | 9 +++++++- > lib/cloner.c | 24 +++++++++++++++++++++ > m4/ltp-clone7args.m4 | 36 +++++++++++++++++++++++++++++++ > testcases/kernel/syscalls/clone/clone08.c | 14 ++++++++++++ > 5 files changed, 83 insertions(+), 1 deletion(-) > create mode 100644 m4/ltp-clone7args.m4 > > diff --git a/configure.ac b/configure.ac > index 4af7662..e564ee5 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -171,5 +171,6 @@ LTP_CHECK_FS_IOC_FLAGS > LTP_CHECK_MREMAP_FIXED > LTP_CHECK_KERNEL_DEVEL > LTP_CHECK_XFS_QUOTACTL > +LTP_CHECK_CLONE7ARGS > > AC_OUTPUT > diff --git a/include/test.h b/include/test.h > index ffc1c8c..050dba5 100644 > --- a/include/test.h > +++ b/include/test.h > @@ -46,6 +46,7 @@ > #include "tst_checkpoint.h" > #include "tst_process_state.h" > #include "tst_resource.h" > +#include "config.h" > > /* Use low 6 bits to encode test type */ > #define TTYPE_MASK 0x3f > @@ -199,8 +200,14 @@ void maybe_run_child(void (*child)(), char *fmt, ...); > int self_exec(char *argv0, char *fmt, ...); > > /* Functions from lib/cloner.c */ > -int ltp_clone(unsigned long clone_flags, int (*fn)(void *arg), void *arg, > +#ifdef HAVE_CLONE7ARGS > +int ltp_clone(unsigned long clone_flags, int (*fn) (void *arg), void *arg, > size_t stack_size, void *stack, ...); > +#else > +int ltp_clone(unsigned long clone_flags, int (*fn)(void *arg), void *arg, > + size_t stack_size, void *stack); > +#endif I wonder if having two different definitions is worth the trouble. Because we can easily use the definition with the ... in both cases. The result is not optimal in either case. In the first case there would be compilation failures on older distributions, in the second there is a posibility that some of the arguments are ignored if test is not ifdefed properly. I think I like the second case better. > int ltp_clone_malloc(unsigned long clone_flags, int (*fn)(void *arg), > void *arg, size_t stacksize); > int ltp_clone_quick(unsigned long clone_flags, int (*fn)(void *arg), > diff --git a/lib/cloner.c b/lib/cloner.c > index 93e3f8c..e0c92cc 100644 > --- a/lib/cloner.c > +++ b/lib/cloner.c > @@ -29,6 +29,7 @@ > #include <sched.h> > #include <stdarg.h> > #include "test.h" > +#include "config.h" > > #undef clone /* we want to use clone() */ > > @@ -49,6 +50,7 @@ extern int __clone2(int (*fn) (void *arg), void *child_stack_base, > * 2. __ia64__ takes bottom of stack and uses clone2 > * 3. all others take top of stack (stack grows down) > */ > +#ifdef HAVE_CLONE7ARGS > int > ltp_clone(unsigned long clone_flags, int (*fn) (void *arg), void *arg, > size_t stack_size, void *stack, ...) > @@ -80,6 +82,28 @@ ltp_clone(unsigned long clone_flags, int (*fn) (void *arg), void *arg, > > return ret; > } > +#else > +int > +ltp_clone(unsigned long clone_flags, int (*fn) (void *arg), void *arg, > + size_t stack_size, void *stack) > +{ > + int ret; > + > +#if defined(__hppa__) || defined(__metag__) > + ret = clone(fn, stack, clone_flags, arg); > +#elif defined(__ia64__) > + ret = clone2(fn, stack, stack_size, clone_flags, arg, NULL, NULL, NULL); > +#else > + /* > + * For archs where stack grows downwards, stack points to the topmost > + * address of the memory space set up for the child stack. > + */ > + ret = clone(fn, (stack ? stack + stack_size : NULL), clone_flags, arg); > +#endif > + > + return ret; > +} > +#endif > > /* > * ltp_clone_malloc: also does the memory allocation for clone with a > diff --git a/m4/ltp-clone7args.m4 b/m4/ltp-clone7args.m4 > new file mode 100644 > index 0000000..927c9f8 > --- /dev/null > +++ b/m4/ltp-clone7args.m4 > @@ -0,0 +1,36 @@ > +dnl > +dnl Copyright (c) Linux Test Project, 2013 > +dnl > +dnl This program is free software; you can redistribute it and/or modify > +dnl it under the terms of the GNU General Public License as published by > +dnl the Free Software Foundation; either version 2 of the License, or > +dnl (at your option) any later version. > +dnl > +dnl This program is distributed in the hope that it will be useful, > +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of > +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See > +dnl the GNU General Public License for more details. > +dnl > +dnl You should have received a copy of the GNU General Public License > +dnl along with this program; if not, write to the Free Software > +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > +dnl > + > +dnl > +dnl LTP_CHECK_CLONE7ARGS > +dnl ---------------------------- > +dnl > +AC_DEFUN([LTP_CHECK_CLONE7ARGS],[ > +AH_TEMPLATE(HAVE_CLONE7ARGS, > +[Define to 1 if clone() supports 7 arguments.]) > +AC_MSG_CHECKING([for CLONE7ARGS]) > +AC_TRY_LINK([#define _GNU_SOURCE > + #include <sched.h> > + #include <stdlib.h>], > + [ > + #if !defined(__ia64__) > + clone(NULL, NULL, 0, NULL, NULL, NULL, NULL); > + #endif > + ], > + AC_DEFINE(HAVE_CLONE7ARGS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) > +]) > diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c > index ec559a3..3a70a49 100644 > --- a/testcases/kernel/syscalls/clone/clone08.c > +++ b/testcases/kernel/syscalls/clone/clone08.c > @@ -23,6 +23,9 @@ > #include "clone_platform.h" > #include "safe_macros.h" > #include "linux_syscall_numbers.h" > +#include "config.h" > + > +#ifdef HAVE_CLONE7ARGS > > static pid_t ptid, ctid, tgid; > static void *child_stack; > @@ -305,3 +308,14 @@ static int child_clone_thread(void) > ltp_syscall(__NR_exit, 0); > return 0; > } > + > +#else > + > +char *TCID = "clone08"; > + > +int main(int ac, char **av) > +{ > + tst_brkm(TCONF, NULL, "This test needs clone support " > + "7 args"); Is this string really over 80 chars? Also in this case it should be main(void) to avoid unused warnings. And I would rather see one TCID and TST_TOTAL at the top of the test (before the #ifdef HAVE_CLONE7ARGS). > +} > +#endif > -- > 1.8.4.2 > > > -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <1389254938.2025.3.camel@G08JYZSD130126>]
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments [not found] ` <1389254938.2025.3.camel@G08JYZSD130126> @ 2014-01-09 11:36 ` chrubis [not found] ` <1389269411.2149.8.camel@G08JYZSD130126> 0 siblings, 1 reply; 19+ messages in thread From: chrubis @ 2014-01-09 11:36 UTC (permalink / raw) To: Zeng Linggang; +Cc: ltp-list Hi! > > > +#else > > > +int ltp_clone(unsigned long clone_flags, int (*fn)(void *arg), void *arg, > > > + size_t stack_size, void *stack); > > > +#endif > > > > I wonder if having two different definitions is worth the trouble. > > Because we can easily use the definition with the ... in both cases. > > > > The result is not optimal in either case. In the first case there would > > be compilation failures on older distributions, in the second there is a > > posibility that some of the arguments are ignored if test is not ifdefed > > properly. I think I like the second case better. > > > Hi > What do you think that we create a new ltp_clone7args function when > the HAVE_CLONE7ARGS macro is defined. > If so, the existing clone test cases will not be affected. And test > cases, > like clone08, need 7 arguments, using ltp_clone7args will be ok. Sounds good but I would go just with ltp_clone7() (there is a tradition of adding just the number of arguments to newly added functions with the same name see 'man 2 wait4' for example). > > Is this string really over 80 chars? > > > > Also in this case it should be main(void) to avoid unused warnings. > > > > And I would rather see one TCID and TST_TOTAL at the top of the test > > (before the #ifdef HAVE_CLONE7ARGS). > In clone08, TCID really should be put at the top, sorry. > > But TST_TOTAL is computed by ARRAY_SIZE(test_cases) when macro > HAVE_CLONE7ARGS is defined. When not defined, TST_TOTAL should be 1. > It seems that we couldn't put the TST_TOTAL at the top. I think that even when all the test does it TCONF it should really print how much of test cases it has skipped, so TST_TOTAL should be initialized correctly even in this case, but given the fact that it's complicated in this case settiing it to 1 is also ok. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <1389269411.2149.8.camel@G08JYZSD130126>]
* Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments [not found] ` <1389269411.2149.8.camel@G08JYZSD130126> @ 2014-01-09 13:27 ` chrubis [not found] ` <201401090947.12749.vapier@gentoo.org> 1 sibling, 0 replies; 19+ messages in thread From: chrubis @ 2014-01-09 13:27 UTC (permalink / raw) To: Zeng Linggang; +Cc: ltp-list, Mike Frysinger Hi! > +++ b/m4/ltp-clone7args.m4 > @@ -0,0 +1,36 @@ > +dnl > +dnl Copyright (c) Linux Test Project, 2013 > +dnl This is not that much important but it's 2014 allready... (I can fix that myself once we agree what should go in) -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <201401090947.12749.vapier@gentoo.org>]
* Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments [not found] ` <201401090947.12749.vapier@gentoo.org> @ 2014-01-09 15:04 ` chrubis 2014-01-09 16:37 ` chrubis 1 sibling, 0 replies; 19+ messages in thread From: chrubis @ 2014-01-09 15:04 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list Hi! > > So create m4/ltp-clone7args.m4 to check whether clone support 7 arguments. > > If HAVE_CLONE7ARGS is defined, ltp_clone7 will be defined in lib/cloner.c. > > > > When tests need pass 7 arguments to clone, ltp_clone7 should be used. When > > HAVE_CLONE7ARGS is not defined, make these tests return TCONF, like > > clone08. > > the current clone function is broken. you cannot call va_args on an arg that > doesn't exist. but if the suggestions below are implemented, this shouldn't > be a problem anymore. > > > --- a/include/test.h > > +++ b/include/test.h > > > > /* Functions from lib/cloner.c */ > > int ltp_clone(unsigned long clone_flags, int (*fn)(void *arg), void *arg, > > + size_t stack_size, void *stack); > > +#ifdef HAVE_CLONE7ARGS > > +int ltp_clone7(unsigned long clone_flags, int (*fn)(void *arg), void *arg, > > size_t stack_size, void *stack, ...); > > +#endif > > always define this prototype > > > --- a/lib/cloner.c > > +++ b/lib/cloner.c > > add a helper here like: > > #ifndef CLONE_SUPPORTS_7_ARGS > # define clone(fn, stack, flags, arg, ptid, tls, ctid) clone(fn, stack, flags, arg) > #endif > > rename the existing ltp_clone to a static _ltp_clone > > create a new ltp_clone that just calls _ltp_clone and passes in NULL for the > additional 3 args > > in the new ltp_clone7, have it do: > #ifdef CLONE_SUPPORTS_7_ARGS > ... call _ltp_clone ... > #else > ... call TCONF or TBROK or something ... > #endif > > that should keep all the test logic simple as Cyril suggested. no need for > them to check ifdefs, just call ltp_clone7 instead. I will finish this one, the solution is nearly ready and I have the means to quickly test it on most of the distros/archs. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments [not found] ` <201401090947.12749.vapier@gentoo.org> 2014-01-09 15:04 ` chrubis @ 2014-01-09 16:37 ` chrubis [not found] ` <629935924.13499645.1389289589284.JavaMail.root@redhat.com> 1 sibling, 1 reply; 19+ messages in thread From: chrubis @ 2014-01-09 16:37 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list [-- Attachment #1: Type: text/plain, Size: 131 bytes --] Hi! And here is a patch. (note that it should be applied over the two allready commited patches) -- Cyril Hrubis chrubis@suse.cz [-- Attachment #2: 0001-lib-cloner.c-add-ltp_clone7-and-fix-build.patch --] [-- Type: text/x-diff, Size: 7683 bytes --] From eeb4ae48cb0dfcb3b89d1a368a8870dc5f35aae2 Mon Sep 17 00:00:00 2001 From: Zeng Linggang <zenglg.jy@cn.fujitsu.com> Date: Thu, 9 Jan 2014 20:10:11 +0800 Subject: [PATCH 1/2] lib/cloner.c: add ltp_clone7() and fix build The seven argument clone breaks compilation on older distributions (SLES10, RHEL4, etc.). It was introduced by commit 5f5cb63b7ddb. This commit adds a configure check and ltp_clone7() library function. Now the ltp_clone() is the same old ltp_clone() with five arguments and ltp_clone7() is the new one with eight arguments (but it calls clone with seven arguments, thus the name). Tests that does not need the additional arguments should call the ltp_clone() the rest should call ltp_clone7(). If seven argument clone is not supproted the ltp_clone7() will return -1 and set errno to ENOSYS. Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz> --- configure.ac | 1 + include/test.h | 4 ++- lib/cloner.c | 55 ++++++++++++++++++++++--------- m4/ltp-clone7args.m4 | 38 +++++++++++++++++++++ testcases/kernel/syscalls/clone/clone08.c | 9 +++-- 5 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 m4/ltp-clone7args.m4 diff --git a/configure.ac b/configure.ac index 4af7662..9e3df00 100644 --- a/configure.ac +++ b/configure.ac @@ -171,5 +171,6 @@ LTP_CHECK_FS_IOC_FLAGS LTP_CHECK_MREMAP_FIXED LTP_CHECK_KERNEL_DEVEL LTP_CHECK_XFS_QUOTACTL +LTP_CHECK_CLONE_SUPPORTS_7_ARGS AC_OUTPUT diff --git a/include/test.h b/include/test.h index ffc1c8c..5211aea 100644 --- a/include/test.h +++ b/include/test.h @@ -199,7 +199,9 @@ void maybe_run_child(void (*child)(), char *fmt, ...); int self_exec(char *argv0, char *fmt, ...); /* Functions from lib/cloner.c */ -int ltp_clone(unsigned long clone_flags, int (*fn)(void *arg), void *arg, +int ltp_clone(unsigned long flags, int (*fn)(void *arg), void *arg, + size_t stack_size, void *stack); +int ltp_clone7(unsigned long flags, int (*fn)(void *arg), void *arg, size_t stack_size, void *stack, ...); int ltp_clone_malloc(unsigned long clone_flags, int (*fn)(void *arg), void *arg, size_t stacksize); diff --git a/lib/cloner.c b/lib/cloner.c index cb4dc6e..d6aa428 100644 --- a/lib/cloner.c +++ b/lib/cloner.c @@ -18,7 +18,7 @@ */ #ifndef _GNU_SOURCE -#define _GNU_SOURCE +# define _GNU_SOURCE #endif #include <stdio.h> @@ -29,6 +29,7 @@ #include <sched.h> #include <stdarg.h> #include "test.h" +#include "config.h" #undef clone /* we want to use clone() */ @@ -39,30 +40,25 @@ extern int __clone2(int (*fn) (void *arg), void *child_stack_base, pid_t *parent_tid, void *tls, pid_t *child_tid); #endif +#ifndef CLONE_SUPPORTS_7_ARGS +# define clone(fn, stack, flags, arg, ptid, tls, ctid) \ + clone(fn, stack, flags, arg) +#endif + /* * ltp_clone: wrapper for clone to hide the architecture dependencies. * 1. hppa takes bottom of stack and no stacksize (stack grows up) * 2. __ia64__ takes bottom of stack and uses clone2 * 3. all others take top of stack (stack grows down) */ -int -ltp_clone(unsigned long clone_flags, int (*fn) (void *arg), void *arg, - size_t stack_size, void *stack, ...) +static int +ltp_clone_(unsigned long flags, int (*fn)(void *arg), void *arg, + size_t stack_size, void *stack, pid_t *ptid, void *tls, pid_t *ctid) { int ret; - pid_t *parent_tid, *child_tid; - void *tls; - va_list arg_clone; - - va_start(arg_clone, stack); - parent_tid = va_arg(arg_clone, pid_t *); - tls = va_arg(arg_clone, void *); - child_tid = va_arg(arg_clone, pid_t *); - va_end(arg_clone); #if defined(__ia64__) - ret = clone2(fn, stack, stack_size, clone_flags, arg, - parent_tid, tls, child_tid); + ret = clone2(fn, stack, stack_size, flags, arg, ptid, tls, ctid); #else # if defined(__hppa__) || defined(__metag__) /* @@ -78,12 +74,39 @@ ltp_clone(unsigned long clone_flags, int (*fn) (void *arg), void *arg, stack += stack_size; # endif - ret = clone(fn, stack, clone_flags, arg, parent_tid, tls, child_tid); + ret = clone(fn, stack, flags, arg, ptid, tls, ctid); #endif return ret; } +int ltp_clone(unsigned long flags, int (*fn)(void *arg), void *arg, + size_t stack_size, void *stack) +{ + return ltp_clone_(flags, fn, arg, stack_size, stack, NULL, NULL, NULL); +} + +int ltp_clone7(unsigned long flags, int (*fn)(void *arg), void *arg, + size_t stack_size, void *stack, ...) +{ + pid_t *ptid, *ctid; + void *tls; + va_list arg_clone; + + va_start(arg_clone, stack); + ptid = va_arg(arg_clone, pid_t *); + tls = va_arg(arg_clone, void *); + ctid = va_arg(arg_clone, pid_t *); + va_end(arg_clone); + +#ifdef CLONE_SUPPORTS_7_ARGS + return ltp_clone_(flags, fn, arg, stack_size, stack, ptid, tls, ctid); +#else + errno = ENOSYS; + return -1; +#endif +} + /* * ltp_clone_malloc: also does the memory allocation for clone with a * caller-specified size. diff --git a/m4/ltp-clone7args.m4 b/m4/ltp-clone7args.m4 new file mode 100644 index 0000000..5857575 --- /dev/null +++ b/m4/ltp-clone7args.m4 @@ -0,0 +1,38 @@ +dnl +dnl Copyright (c) Linux Test Project, 2014 +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +dnl the GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +dnl + +dnl +dnl LTP_CHECK_CLONE_SUPPORTS_7_ARGS +dnl ------------------------------- +dnl +AC_DEFUN([LTP_CHECK_CLONE_SUPPORTS_7_ARGS],[ +AH_TEMPLATE(CLONE_SUPPORTS_7_ARGS, +[Define to 1 if clone() supports 7 arguments.]) +AC_MSG_CHECKING([if clone() supports 7 args]) +AC_TRY_LINK([#define _GNU_SOURCE + #include <sched.h> + #include <stdlib.h>], + [ + #ifdef __ia64__ + __clone2(NULL, NULL, 0, 0, NULL, NULL, NULL, NULL); + #else + clone(NULL, NULL, 0, NULL, NULL, NULL, NULL); + #endif + ], + AC_DEFINE(CLONE_SUPPORTS_7_ARGS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) +]) diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c index b098f4a..1258b4e 100644 --- a/testcases/kernel/syscalls/clone/clone08.c +++ b/testcases/kernel/syscalls/clone/clone08.c @@ -24,6 +24,8 @@ #include "safe_macros.h" #include "linux_syscall_numbers.h" +char *TCID = "clone08"; + static pid_t ptid, ctid, tgid; static void *child_stack; @@ -76,7 +78,6 @@ static struct test_case { test_clone_thread, child_clone_thread}, }; -char *TCID = "clone08"; int TST_TOTAL = ARRAY_SIZE(test_cases); int main(int ac, char **av) @@ -122,8 +123,12 @@ static void cleanup(void) static long clone_child(const struct test_case *t, int use_tst) { - TEST(ltp_clone(t->flags, t->do_child, NULL, CHILD_STACK_SIZE, + TEST(ltp_clone7(t->flags, t->do_child, NULL, CHILD_STACK_SIZE, child_stack, &ptid, NULL, &ctid)); + + if (TEST_RETURN == -1 && TTERRNO == ENOSYS) + tst_brmk(TCONF, cleanup, "clone does not support 7 args"); + if (TEST_RETURN == -1) { if (use_tst) { tst_brkm(TBROK | TTERRNO, cleanup, "%s clone() failed", -- 1.8.3.2 [-- Attachment #3: Type: text/plain, Size: 388 bytes --] ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk [-- Attachment #4: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 19+ messages in thread
[parent not found: <629935924.13499645.1389289589284.JavaMail.root@redhat.com>]
* Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments [not found] ` <629935924.13499645.1389289589284.JavaMail.root@redhat.com> @ 2014-01-09 18:08 ` chrubis [not found] ` <201401091417.16506.vapier@gentoo.org> 0 siblings, 1 reply; 19+ messages in thread From: chrubis @ 2014-01-09 18:08 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp-list, Mike Frysinger Hi! > > Hi! > > And here is a patch. (note that it should be applied over the two > > allready commited patches) > > Hi, > > Line 130 contains a typo: > clone08.c: In function ??clone_child??: > clone08.c:130: warning: implicit declaration of function ??tst_brmk?? Aw, I will fix that. > In relation to: > #ifndef CLONE_SUPPORTS_7_ARGS > # define clone(fn, stack, flags, arg, ptid, tls, ctid) \ > clone(fn, stack, flags, arg) #endif > > Shouldn't we have something similar also for clone2()? > For example: > > --- cloner.c 2014-01-09 18:10:27.965074200 +0100 > +++ /tmp/cloner.c 2014-01-09 18:43:28.099822061 +0100 > @@ -34,10 +34,14 @@ > #undef clone /* we want to use clone() */ > > #if defined(__ia64__) > -#define clone2 __clone2 > +# ifndef CLONE_SUPPORTS_7_ARGS > +# define clone2(fn, stack, stack_size, flags, arg, ptid, tls, ctid) \ > + __clone2(fn, stack, stack_size, flags, arg) > +# else > +# define clone2 __clone2 > +# endif > extern int __clone2(int (*fn) (void *arg), void *child_stack_base, > - size_t child_stack_size, int flags, void *arg, > - pid_t *parent_tid, void *tls, pid_t *child_tid); > + size_t child_stack_size, int flags, void *arg, ...); > #endif > > #ifndef CLONE_SUPPORTS_7_ARGS I've been unable to locate ia64 distribution that does not support the additional parameters so I've leaved that out. It may be related to a fact that linux was ported to ia64 after the interface has changed, but that is just my guess. And I guess that we may drop the extern int definition too, at least the configure script with __clone2() function seems to work fine just with the <sched.h> -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <201401091417.16506.vapier@gentoo.org>]
* Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments [not found] ` <201401091417.16506.vapier@gentoo.org> @ 2014-01-13 16:02 ` chrubis 0 siblings, 0 replies; 19+ messages in thread From: chrubis @ 2014-01-13 16:02 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list Hi! > > > extern int __clone2(int (*fn) (void *arg), void *child_stack_base, > > > - size_t child_stack_size, int flags, void *arg, > > > - pid_t *parent_tid, void *tls, pid_t *child_tid); > > > + size_t child_stack_size, int flags, void *arg, ...); > > > #endif > > > #ifndef CLONE_SUPPORTS_7_ARGS > > > > I've been unable to locate ia64 distribution that does not support the > > additional parameters so I've leaved that out. It may be related to a > > fact that linux was ported to ia64 after the interface has changed, but > > that is just my guess. > > > > And I guess that we may drop the extern int definition too, at least the > > configure script with __clone2() function seems to work fine just with > > the <sched.h> > > the ia64 glibc port has never included a prototype for the clone2 func. so > the configure test (which is really just doing a compile time test against the > prototype in the C library's header) would never fail. Ah, you are right, the build has finished fine but there are implicit declaration warnings in the log. I should have checked it. > in terms of the actual code, the clone2 func was updated here to take 7 args: > commit 625f22fc7f8e0d61e3e6cff2c65468b91dbad426 > Author: Ulrich Drepper <drepper@redhat.com> > Date: Mon Mar 3 19:53:27 2003 +0000 > > that commit was first released in glibc-2.3.3. but even if you were using an > older glibc, the configure would pass and the code would compile fine (again, > due to the fact glibc has never included a prototype for __clone2). I've looked at the SLES9 and RHEL4 and they both have glibc at least 2.3.3. So I think that it's safe to assume that __clone2() on ia64 supports eight arguments and simply decleare the prototype in lib/cloner.c. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <201401081447.46449.vapier@gentoo.org>]
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments [not found] ` <201401081447.46449.vapier@gentoo.org> @ 2014-01-09 11:24 ` chrubis 0 siblings, 0 replies; 19+ messages in thread From: chrubis @ 2014-01-09 11:24 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list Hi! > > Create m4/ltp-clone7args.m4 to check whether clone support 7 arguments. > > When HAVE_CLONE7ARGS is not defined, make clone08 return TCONF > > this patch lacks any sort of detail. what system are you on where this > doesn't work ? That was in one of the emails but I guess that this should be part of the commit message as well. These are either old systems SLES10, RHER4 or exotic architectures s390, s390x. The really old systems are not that much important but build failures on reasonably recent systems on exotic hardware should be fixed. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <201401090803.39606.vapier@gentoo.org>]
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments [not found] ` <201401090803.39606.vapier@gentoo.org> @ 2014-01-09 13:09 ` chrubis [not found] ` <201401090900.59568.vapier@gentoo.org> 2014-01-09 13:23 ` Jan Stancek 1 sibling, 1 reply; 19+ messages in thread From: chrubis @ 2014-01-09 13:09 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list Hi! > > +AC_DEFUN([LTP_CHECK_CLONE7ARGS],[ > > +AH_TEMPLATE(HAVE_CLONE7ARGS, > > +[Define to 1 if clone() supports 7 arguments.]) > > +AC_MSG_CHECKING([for CLONE7ARGS]) > > +AC_TRY_LINK([#define _GNU_SOURCE > > + #include <sched.h> > > + #include <stdlib.h>], > > + [ > > + #if !defined(__ia64__) > > + clone(NULL, NULL, 0, NULL, NULL, NULL, NULL); > > + #endif > > + ], > > + AC_DEFINE(HAVE_CLONE7ARGS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) > > +]) > > you aren't really testing for "clone takes 7 args", you're testing for "clone > has varargs support". rename the define (and use _ in its name), and drop the > ia64 check as it isn't needed. I wouldn't call it varargs because there are only three more pointers to pass to clone() and the only reason it's defined as varargs is to be compatible with the previous clone definition... Frankly if they did clone7() in glibc instead it would be much more clear and easier to figure out. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <201401090900.59568.vapier@gentoo.org>]
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments [not found] ` <201401090900.59568.vapier@gentoo.org> @ 2014-01-09 14:34 ` chrubis 0 siblings, 0 replies; 19+ messages in thread From: chrubis @ 2014-01-09 14:34 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list Hi! > > > you aren't really testing for "clone takes 7 args", you're testing for > > > "clone has varargs support". rename the define (and use _ in its name), > > > and drop the ia64 check as it isn't needed. > > > > I wouldn't call it varargs because there are only three more pointers to > > pass to clone() and the only reason it's defined as varargs is to be > > compatible with the previous clone definition... > > fair enough. the define still needs renaming like CLONE_ACCEPTS_7_ARGS. OK. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments [not found] ` <201401090803.39606.vapier@gentoo.org> 2014-01-09 13:09 ` chrubis @ 2014-01-09 13:23 ` Jan Stancek 2014-01-09 13:51 ` Mike Frysinger 1 sibling, 1 reply; 19+ messages in thread From: Jan Stancek @ 2014-01-09 13:23 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list ----- Original Message ----- > From: "Mike Frysinger" <vapier@gentoo.org> > To: ltp-list@lists.sourceforge.net > Sent: Thursday, 9 January, 2014 2:03:38 PM > Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments > > On Wednesday 08 January 2014 09:31:30 Zeng Linggang wrote: > > +AC_DEFUN([LTP_CHECK_CLONE7ARGS],[ > > +AH_TEMPLATE(HAVE_CLONE7ARGS, > > +[Define to 1 if clone() supports 7 arguments.]) > > +AC_MSG_CHECKING([for CLONE7ARGS]) > > +AC_TRY_LINK([#define _GNU_SOURCE > > + #include <sched.h> > > + #include <stdlib.h>], > > + [ > > + #if !defined(__ia64__) > > + clone(NULL, NULL, 0, NULL, NULL, NULL, NULL); > > + #endif > > + ], > > + AC_DEFINE(HAVE_CLONE7ARGS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) > > +]) > > you aren't really testing for "clone takes 7 args", you're testing for "clone > has varargs support". rename the define (and use _ in its name), and drop > the > ia64 check as it isn't needed. Why not? It should matter, according to clone(2) you should be using __clone2() on ia64: ia64 On ia64, a different interface is used: int __clone2(int (*fn)(void *), void *child_stack_base, size_t stack_size, int flags, void *arg, ... /* pid_t *ptid, struct user_desc *tls, pid_t *ctid */ ); # cat a.c #define _GNU_SOURCE #include <sched.h> #include <stdlib.h> int main() { clone(NULL, NULL, 0, NULL, NULL, NULL, NULL); return 0; } # uname -m ia64 # gcc a.c /tmp/cc0QVVOU.o: In function `main': a.c:(.text+0x42): undefined reference to `clone' collect2: ld returned 1 exit status So perhaps we should add #else and test for __clone2 on ia64. Regards, Jan > -mike > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Ltp-list mailing list > Ltp-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ltp-list > ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments 2014-01-09 13:23 ` Jan Stancek @ 2014-01-09 13:51 ` Mike Frysinger 2014-01-09 14:10 ` Jan Stancek 0 siblings, 1 reply; 19+ messages in thread From: Mike Frysinger @ 2014-01-09 13:51 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp-list [-- Attachment #1.1: Type: Text/Plain, Size: 1458 bytes --] On Thursday 09 January 2014 08:23:48 Jan Stancek wrote: > ----- Original Message ----- > > > From: "Mike Frysinger" <vapier@gentoo.org> > > To: ltp-list@lists.sourceforge.net > > Sent: Thursday, 9 January, 2014 2:03:38 PM > > Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports > > 7 arguments > > > > On Wednesday 08 January 2014 09:31:30 Zeng Linggang wrote: > > > +AC_DEFUN([LTP_CHECK_CLONE7ARGS],[ > > > +AH_TEMPLATE(HAVE_CLONE7ARGS, > > > +[Define to 1 if clone() supports 7 arguments.]) > > > +AC_MSG_CHECKING([for CLONE7ARGS]) > > > +AC_TRY_LINK([#define _GNU_SOURCE > > > + #include <sched.h> > > > + #include <stdlib.h>], > > > + [ > > > + #if !defined(__ia64__) > > > + clone(NULL, NULL, 0, NULL, NULL, NULL, NULL); > > > + #endif > > > + ], > > > + AC_DEFINE(HAVE_CLONE7ARGS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) > > > +]) > > > > you aren't really testing for "clone takes 7 args", you're testing for > > "clone has varargs support". rename the define (and use _ in its name), > > and drop the > > ia64 check as it isn't needed. > > Why not? It should matter, according to clone(2) you should be using > __clone2() on ia64: ia64 > On ia64, a different interface is used: exactly. why does a clone() test have any bearing at all on ia64 behavior ? the code that checks the define won't get used in the __ia64__ case, so having a define here is pointless. -mike [-- Attachment #1.2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 bytes --] [-- Attachment #2: Type: text/plain, Size: 388 bytes --] ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk [-- Attachment #3: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments 2014-01-09 13:51 ` Mike Frysinger @ 2014-01-09 14:10 ` Jan Stancek 2014-01-09 14:30 ` Mike Frysinger 0 siblings, 1 reply; 19+ messages in thread From: Jan Stancek @ 2014-01-09 14:10 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list ----- Original Message ----- > From: "Mike Frysinger" <vapier@gentoo.org> > To: "Jan Stancek" <jstancek@redhat.com> > Cc: ltp-list@lists.sourceforge.net > Sent: Thursday, 9 January, 2014 2:51:42 PM > Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments > > On Thursday 09 January 2014 08:23:48 Jan Stancek wrote: > > ----- Original Message ----- > > > > > From: "Mike Frysinger" <vapier@gentoo.org> > > > To: ltp-list@lists.sourceforge.net > > > Sent: Thursday, 9 January, 2014 2:03:38 PM > > > Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports > > > 7 arguments > > > > > > On Wednesday 08 January 2014 09:31:30 Zeng Linggang wrote: > > > > +AC_DEFUN([LTP_CHECK_CLONE7ARGS],[ > > > > +AH_TEMPLATE(HAVE_CLONE7ARGS, > > > > +[Define to 1 if clone() supports 7 arguments.]) > > > > +AC_MSG_CHECKING([for CLONE7ARGS]) > > > > +AC_TRY_LINK([#define _GNU_SOURCE > > > > + #include <sched.h> > > > > + #include <stdlib.h>], > > > > + [ > > > > + #if !defined(__ia64__) > > > > + clone(NULL, NULL, 0, NULL, NULL, NULL, NULL); > > > > + #endif > > > > + ], > > > > + AC_DEFINE(HAVE_CLONE7ARGS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) > > > > +]) > > > > > > you aren't really testing for "clone takes 7 args", you're testing for > > > "clone has varargs support". rename the define (and use _ in its name), > > > and drop the > > > ia64 check as it isn't needed. > > > > Why not? It should matter, according to clone(2) you should be using > > __clone2() on ia64: ia64 > > On ia64, a different interface is used: > > exactly. why does a clone() test have any bearing at all on ia64 behavior ? > the code that checks the define won't get used in the __ia64__ case, so > having > a define here is pointless. I thought the check applies to whole ltp_clone, since that is what is called by testcases checking this define. Regards, Jan ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments 2014-01-09 14:10 ` Jan Stancek @ 2014-01-09 14:30 ` Mike Frysinger 2014-01-09 14:39 ` chrubis 0 siblings, 1 reply; 19+ messages in thread From: Mike Frysinger @ 2014-01-09 14:30 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp-list [-- Attachment #1.1: Type: Text/Plain, Size: 2205 bytes --] On Thursday 09 January 2014 09:10:52 Jan Stancek wrote: > ----- Original Message ----- > > > From: "Mike Frysinger" <vapier@gentoo.org> > > To: "Jan Stancek" <jstancek@redhat.com> > > Cc: ltp-list@lists.sourceforge.net > > Sent: Thursday, 9 January, 2014 2:51:42 PM > > Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports > > 7 arguments > > > > On Thursday 09 January 2014 08:23:48 Jan Stancek wrote: > > > ----- Original Message ----- > > > > > > > From: "Mike Frysinger" <vapier@gentoo.org> > > > > To: ltp-list@lists.sourceforge.net > > > > Sent: Thursday, 9 January, 2014 2:03:38 PM > > > > Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone > > > > supports 7 arguments > > > > > > > > On Wednesday 08 January 2014 09:31:30 Zeng Linggang wrote: > > > > > +AC_DEFUN([LTP_CHECK_CLONE7ARGS],[ > > > > > +AH_TEMPLATE(HAVE_CLONE7ARGS, > > > > > +[Define to 1 if clone() supports 7 arguments.]) > > > > > +AC_MSG_CHECKING([for CLONE7ARGS]) > > > > > +AC_TRY_LINK([#define _GNU_SOURCE > > > > > + #include <sched.h> > > > > > + #include <stdlib.h>], > > > > > + [ > > > > > + #if !defined(__ia64__) > > > > > + clone(NULL, NULL, 0, NULL, NULL, NULL, NULL); > > > > > + #endif > > > > > + ], > > > > > + AC_DEFINE(HAVE_CLONE7ARGS) AC_MSG_RESULT(yes), > > > > > AC_MSG_RESULT(no)) +]) > > > > > > > > you aren't really testing for "clone takes 7 args", you're testing > > > > for "clone has varargs support". rename the define (and use _ in > > > > its name), and drop the > > > > ia64 check as it isn't needed. > > > > > > Why not? It should matter, according to clone(2) you should be using > > > __clone2() on ia64: ia64 > > > > > > On ia64, a different interface is used: > > exactly. why does a clone() test have any bearing at all on ia64 > > behavior ? the code that checks the define won't get used in the > > __ia64__ case, so having > > a define here is pointless. > > I thought the check applies to whole ltp_clone, since that is what is > called by testcases checking this define. there's debate as to whether that's how we want to take things :). we'll sort it out there. -mike [-- Attachment #1.2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 bytes --] [-- Attachment #2: Type: text/plain, Size: 388 bytes --] ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk [-- Attachment #3: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments 2014-01-09 14:30 ` Mike Frysinger @ 2014-01-09 14:39 ` chrubis 0 siblings, 0 replies; 19+ messages in thread From: chrubis @ 2014-01-09 14:39 UTC (permalink / raw) To: Mike Frysinger; +Cc: ltp-list Hi! > > > exactly. why does a clone() test have any bearing at all on ia64 > > > behavior ? the code that checks the define won't get used in the > > > __ia64__ case, so having > > > a define here is pointless. > > > > I thought the check applies to whole ltp_clone, since that is what is > > called by testcases checking this define. > > there's debate as to whether that's how we want to take things :). we'll sort > it out there. I would go with the __clone2() in the #else branch because the same ifdef is used in the clone08 testcase and not having positive result in __ia64__ case would wrongly disable the testcase. It's shame that ia64 has different clone syscall interface but that is price for the way how our system is evolving... -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2014-01-13 16:03 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-18 9:29 [LTP] [PATCH v5 1/2] lib/cloner.c: add more args zenglg.jy
2013-12-23 1:11 ` Wanlong Gao
2014-01-07 14:09 ` chrubis
[not found] ` <1389181297.2879.11.camel@G08JYZSD130126>
2014-01-08 13:20 ` chrubis
[not found] ` <1389191490.2879.27.camel@G08JYZSD130126>
2014-01-08 15:15 ` [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments chrubis
[not found] ` <1389254938.2025.3.camel@G08JYZSD130126>
2014-01-09 11:36 ` chrubis
[not found] ` <1389269411.2149.8.camel@G08JYZSD130126>
2014-01-09 13:27 ` [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments chrubis
[not found] ` <201401090947.12749.vapier@gentoo.org>
2014-01-09 15:04 ` chrubis
2014-01-09 16:37 ` chrubis
[not found] ` <629935924.13499645.1389289589284.JavaMail.root@redhat.com>
2014-01-09 18:08 ` chrubis
[not found] ` <201401091417.16506.vapier@gentoo.org>
2014-01-13 16:02 ` chrubis
[not found] ` <201401081447.46449.vapier@gentoo.org>
2014-01-09 11:24 ` [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments chrubis
[not found] ` <201401090803.39606.vapier@gentoo.org>
2014-01-09 13:09 ` chrubis
[not found] ` <201401090900.59568.vapier@gentoo.org>
2014-01-09 14:34 ` chrubis
2014-01-09 13:23 ` Jan Stancek
2014-01-09 13:51 ` Mike Frysinger
2014-01-09 14:10 ` Jan Stancek
2014-01-09 14:30 ` Mike Frysinger
2014-01-09 14:39 ` chrubis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox