public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [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

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