lib/cloner.c: add more args
PATCH 1/1 lib/cloner.c: add more args
add args with ptid and ctid in ltp_clone().
Signed-off-by Zeng Linggang <[email protected]>
--- include/test.h | 2 +- lib/cloner.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-)
include/test.h +1 -1
@@ -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
@@ -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 ------------------------------------------------------------------------------ DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list