Skip to contentSkip to conversation

lib/cloner.c: add more args

PATCH Applied zenglg.jy 5 participants 19 messages Dec 18, 2013 – Jan 13, 2014 10 messages not in the archive Library code

lore
Share & tools
lore

zenglg.jy

author
#0 lore raw

PATCH v5 1/2 lib/cloner.c: add more args

add args with ptid and ctid in ltp_clone().

---
 include/test.h |  2 +-
 lib/cloner.c   | 20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)
include/test.h +1 -1
index 94fc721..ffc1c8c 100644
@@ -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),
lib/cloner.c +16 -4
index a68ff1e..93e3f8c 100644
@@ -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;
Signature · 15 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Applied
#1 lore raw
Quoted 3 lines · zenglg.jy

add args with ptid and ctid in ltp_clone().

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
In reply to zenglg.jy

Hi!

Quoted 59 lines

add args with ptid and ctid in ltp_clone().

---
 include/test.h |  2 +-
 lib/cloner.c   | 20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)
include/test.h +1 -1
index 94fc721..ffc1c8c 100644
@@ -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),
lib/cloner.c +14 -3
index a68ff1e..93e3f8c 100644
@@ -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

lib/cloner.c extern int __clone2(int (*fn) (void *arg), void *child_stack_base, · line 81

Quoted 10 lines
lib/cloner.c +2 -1
 	/*
 	 * 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.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): 1389181297.2879.11.camel@G08JYZSD130126

#4 lore raw

Hi!

Quoted 8 lines
Quoted 4 lines

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.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): 1389191490.2879.27.camel@G08JYZSD130126

#6 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Hi!

Quoted 38 lines

Create m4/ltp-clone7args.m4 to check whether clone support 7 arguments. When HAVE_CLONE7ARGS is not defined, make clone08 return TCONF

---
 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
configure.ac +1 -0
index 4af7662..e564ee5 100644
@@ -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
include/test.h +1 -0
index ffc1c8c..050dba5 100644
@@ -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, ...);

include/test.h void maybe_run_child(void (*child)(), char *fmt, ...); · line 209

Quoted 10 lines
include/test.h +6 -1
 
 /* 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.

Quoted 111 lines
include/test.h +0 -0
 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),
lib/cloner.c +24 -0
index 93e3f8c..e0c92cc 100644
@@ -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
m4/ltp-clone7args.m4 new file +36 -0
new file mode 100644
index 0000000..927c9f8
@@ -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))
+])
testcases/kernel/syscalls/clone/clone08.c +3 -0
index ec559a3..3a70a49 100644
@@ -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;

testcases/kernel/syscalls/clone/clone08.c static int child_clone_thread(void) · line 319

Quoted 10 lines
testcases/kernel/syscalls/clone/clone08.c +9 -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).

Quoted 7 lines
testcases/kernel/syscalls/clone/clone08.c +2 -0
+}
+#endif
Signature · 1 line
1.8.4.2
Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): 1389254938.2025.3.camel@G08JYZSD130126

#8 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Hi!

Quoted 13 lines
Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+#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.

Quoted 5 lines

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.

Quoted 6 lines

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).

Quoted 11 lines
Quoted 6 lines

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.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): 1389269411.2149.8.camel@G08JYZSD130126

#10 lore raw

Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments

Hi!

Review line 3

Quoted 5 lines

+++ b/m4/ltp-clone7args.m4

(quoted diff) +3 -0
@@ -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)

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments

Hi!

Quoted 39 lines
Quoted 6 lines

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.

include/test.h

Quoted 10 lines
include/test.h +4 -0
 
 /* 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

lib/cloner.c

Quoted 2 lines
lib/cloner.c +0 -0

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:

Quoted 8 lines
#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.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#13 lore raw

Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments

In reply to a message not in the archive

Hi!
And here is a patch. (note that it should be applied over the two allready commited patches)

Signature · 2 lines
Cyril Hrubis
[email protected]

From eeb4ae48cb0dfcb3b89d1a368a8870dc5f35aae2 Mon Sep 17 00:00:00 2001
From: Zeng Linggang <[email protected]>
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.

---
 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
configure.ac +1 -0
index 4af7662..9e3df00 100644
@@ -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
include/test.h +3 -1
index ffc1c8c..5211aea 100644
@@ -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);
lib/cloner.c +39 -16

94 lines not on this page · raw message

m4/ltp-clone7args.m4 new file +38 -0
new file mode 100644
index 0000000..5857575
@@ -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))
+])
testcases/kernel/syscalls/clone/clone08.c +7 -2
index b098f4a..1258b4e 100644
@@ -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",
Signature · 1 line
1.8.3.2

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Hi!

Quoted 5 lines
Quoted 2 lines

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.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#17 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Hi!

Quoted 10 lines
Quoted 10 lines
(quoted diff) +10 -0
+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);
Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+		#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.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#19 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Hi!

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

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.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#20 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

In reply to a message not in the archive

----- Original Message -----

Quoted 17 lines

From: "Mike Frysinger" <[email protected]>
To: [email protected]
Sent: Thursday, 9 January, 2014 2:03:38 PM
Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Quoted 11 lines · On Wednesday 08 January 2014 09:31:30 Zeng Linggang wrote:
(quoted diff) +11 -0
+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
Quoted 8 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+		],
+		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

Quoted 13 lines

-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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#21 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Quoted 29 lines · On Thursday 09 January 2014 08:23:48 Jan Stancek wrote:

----- Original Message -----

Quoted 18 lines

From: "Mike Frysinger" <[email protected]>
To: [email protected]
Sent: Thursday, 9 January, 2014 2:03:38 PM
Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports
7 arguments

Quoted 11 lines · On Wednesday 08 January 2014 09:31:30 Zeng Linggang wrote:
(quoted diff) +11 -0
+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
Quoted 8 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+		],
+		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.

Quoted 3 lines

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

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#22 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

----- Original Message -----

Quoted 36 lines

From: "Mike Frysinger" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected]
Sent: Thursday, 9 January, 2014 2:51:42 PM
Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Quoted 29 lines · On Thursday 09 January 2014 08:23:48 Jan Stancek wrote:

----- Original Message -----

Quoted 26 lines

From: "Mike Frysinger" <[email protected]>
To: [email protected]
Sent: Thursday, 9 January, 2014 2:03:38 PM
Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports
7 arguments

Quoted 4 lines · On Wednesday 08 January 2014 09:31:30 Zeng Linggang wrote:
(quoted diff) +4 -0
+AC_DEFUN([LTP_CHECK_CLONE7ARGS],[
+AH_TEMPLATE(HAVE_CLONE7ARGS,
+[Define to 1 if clone() supports 7 arguments.])
+AC_MSG_CHECKING([for CLONE7ARGS])

Review

Quoted 10 lines
(quoted diff) +10 -0
+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.

Quoted 8 lines
Quoted 3 lines

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#23 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Quoted 42 lines · On Thursday 09 January 2014 09:10:52 Jan Stancek wrote:

----- Original Message -----

Quoted 40 lines

From: "Mike Frysinger" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected]
Sent: Thursday, 9 January, 2014 2:51:42 PM
Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Quoted 32 lines · On Thursday 09 January 2014 08:23:48 Jan Stancek wrote:

----- Original Message -----

Quoted 18 lines

From: "Mike Frysinger" <[email protected]>
To: [email protected]
Sent: Thursday, 9 January, 2014 2:03:38 PM
Subject: Re: [LTP] [PATCH] clone/clone08.c: check whether clone
supports 7 arguments

Quoted 11 lines · On Wednesday 08 January 2014 09:31:30 Zeng Linggang wrote:
(quoted diff) +11 -0
+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
Quoted 8 lines
Quoted 3 lines
(quoted diff) +2 -0
+		],
+		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

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#24 lore raw

Re: [LTP] [PATCH] clone/clone08.c: check whether clone supports 7 arguments

Hi!

Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

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...

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#26 lore raw

Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments

Hi!

Quoted 9 lines
Quoted 3 lines

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.

Quoted 18 lines

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:

tmp/cloner.c 2014-01-09 18:43:28.099822061 +0100 renamed from cloner.c 2014-01-09 18:10:27.965074200 +0100 +3 -1
@@ -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)

tmp/cloner.c 2014-01-09 18:43:28.099822061 +0100 line 47

Quoted 10 lines
tmp/cloner.c 2014-01-09 18:43:28.099822061 +0100 renamed from cloner.c 2014-01-09 18:10:27.965074200 +0100 +4 -2
+# 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>

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#28 lore raw

Re: [LTP] [PATCH???v3] lib/cloner.c: add function ltp_clone7 when clone supports???7 arguments

Hi!

Quoted 12 lines
Quoted 12 lines

Review

Quoted 6 lines

extern int __clone2(int (*fn) (void *arg), void *child_stack_base,

(quoted diff) +1 -2
-                   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.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 8 lines

in terms of the actual code, the clone2 func was updated here to take 7 args:
commit 625f22fc7f8e0d61e3e6cff2c65468b91dbad426

Author: Ulrich Drepper <[email protected]>
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.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list