[PATCH] small update for clone2 & futex syscall on ia64

Ian Wienand ianw at gelato.unsw.edu.au
Thu Mar 6 16:43:03 UTC 2003


Hello,

Please find attached a small update to show the new arguments of
clone2.  I belive this also fixes a minor bug in that the number of
arguments to clone2 was incorrectly specified so the stack size wasn't
being shown correctly.

I also added a line for the futex call.

-i
ianw at gelato.unsw.edu.au
http://www.gelato.unsw.edu.au
-------------- next part --------------
diff -ru ../strace-4.4.94.orig/linux/ia64/syscallent.h ./linux/ia64/syscallent.h
--- ../strace-4.4.94.orig/linux/ia64/syscallent.h	2003-01-14 22:25:29.000000000 +1100
+++ ./linux/ia64/syscallent.h	2003-03-07 10:42:11.000000000 +1100
@@ -1116,7 +1116,7 @@
 	{ 2,	TF,	sys_stat,		"stat"		}, /* 1210 */
 	{ 2,	0,	sys_lstat,		"lstat"		}, /* 1211 */
 	{ 2,	TF,	sys_fstat,		"fstat"		}, /* 1212 */
-	{ 2,	TP,	sys_clone2,		"clone2"	}, /* 1213 */
+	{ 6,	TP,	sys_clone2,		"clone2"	}, /* 1213 */
 	{ 3,	0,	printargs,		"getdents64"	}, /* 1214 */
 	{ 2,	0,	printargs,		"getunwind"	}, /* 1215 */
 	{ 8,	0,	printargs,		"SYS_1216"	}, /* 1216 */
@@ -1133,7 +1133,7 @@
 	{ 8,	0,	printargs,		"SYS_1227"	}, /* 1227 */
 	{ 8,	0,	printargs,		"SYS_1228"	}, /* 1228 */
 	{ 8,	0,	printargs,		"SYS_1229"	}, /* 1229 */
-	{ 8,	0,	printargs,		"SYS_1230"	}, /* 1230 */
+	{ 4,	0,	sys_futex,		"futex"		}, /* 1230 */
 	{ 8,	0,	printargs,		"SYS_1231"	}, /* 1231 */
 	{ 8,	0,	printargs,		"SYS_1232"	}, /* 1232 */
 	{ 8,	0,	printargs,		"SYS_1233"	}, /* 1233 */
diff -ru ../strace-4.4.94.orig/process.c ./process.c
--- ../strace-4.4.94.orig/process.c	2003-02-20 13:45:23.000000000 +1100
+++ ./process.c	2003-03-07 11:21:10.000000000 +1100
@@ -585,13 +585,41 @@
 sys_clone2(tcp)
 struct tcb *tcp;
 {
-       if (exiting(tcp)) {
-               tprintf("child_stack=%#lx, stack_size=%#lx, flags=",
-                       tcp->u_arg[1], tcp->u_arg[2]);
-               if (printflags(clone_flags, tcp->u_arg[0]) == 0)
-                       tprintf("0");
-       }
-       return 0;
+     if (exiting(tcp)) {
+	  long flags = tcp->u_arg[0];
+	  
+	  tprintf("child_stack=%#lx, stack_size=%#lx, flags=",
+		  tcp->u_arg[1], tcp->u_arg[2]);
+	  if (printflags(clone_flags, tcp->u_arg[0]) == 0)
+	       tprintf("0");
+	  
+	  if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID
+			|CLONE_SETTLS)) == 0)
+	       return 0;
+	  
+	  /* these flags use the same paramter -- the child_tidptr */
+	  if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) 
+	       tprintf(", child_tid=%#lx", tcp->u_arg[3]);
+	  else
+	       tprintf(", <ignored>");
+	  
+	  
+	  if (flags & CLONE_PARENT_SETTID) {
+	       pid_t pid;
+	       if (umove(tcp, tcp->u_arg[4], &pid)  == 0)
+		    tprintf(", parent_tid=%#lx [%d]", tcp->u_arg[4], pid);
+	       else
+		    tprintf(", parent_tid=%#lx", tcp->u_arg[4]);
+	  }
+	  else
+	       tprintf(", <ignored>");
+	  
+	  if (flags & CLONE_SETTLS) 
+	       tprintf(", tls=%#lx", tcp->u_arg[5]);
+	  else
+	       tprintf(", <ignored>");
+     }
+     return 0;
 }
 
 #endif


More information about the Strace-devel mailing list