[PATCH 2009-01-27] fix fallout from tcb table expansion simplification

Denys Vlasenko dvlasenk at redhat.com
Mon Feb 23 13:48:45 UTC 2009


diff -x CVS -urpN 2009-01-26/ChangeLog 2009-01-27/ChangeLog
--- 2009-01-26/ChangeLog	2009-01-23 17:30:26.000000000 +0100
+++ 2009-01-27/ChangeLog	2009-01-26 20:09:35.000000000 +0100
@@ -1,3 +1,17 @@
+2009-01-26  Denys Vlasenko  <dvlasenk at redhat.com>
+
+	* process.c (printwaitn): Add comment about wait4() pid expansion.
+	Use #ifdef ALPHA instead of LINUX_64BIT, it was misleading
+	(by implying "any 64-bit platform").
+	* defs.h: Remove now-unused LINUX_64BIT define.
+	* resource.c (sys_osf_getrusage): Fix indentation.
+
+2009-01-26  Denys Vlasenko  <dvlasenk at redhat.com>
+
+	* process.c (internal_clone): Fix fallout from tcb table expansion
+	simplification. Due to overlooked else, I forgot to group
+	fork_tcb(tcp) and alloctcb(pid) in a block.
+
 2009-01-23  Michal Nowak  <mnowak at redhat.com>
 
 	* syscall.c (get_scno): Fix warnings about unused variable 'pid'.
diff -x CVS -urpN 2009-01-26/defs.h 2009-01-27/defs.h
--- 2009-01-26/defs.h	2009-01-17 02:52:54.000000000 +0100
+++ 2009-01-27/defs.h	2009-01-26 20:09:38.000000000 +0100
@@ -26,7 +26,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *	$Id: defs.h,v 1.96 2009/01/17 01:52:54 vda_linux Exp $
+ *	$Id: defs.h,v 1.97 2009/01/26 19:09:38 vda_linux Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -96,9 +96,6 @@
 #  if defined(SPARC) || defined(SPARC64)
 #     define LINUXSPARC
 #  endif
-#  if defined(ALPHA)
-#     define LINUX_64BIT
-#  endif
 #  if defined(X86_64)
 #     define LINUX_X86_64
 #  endif
diff -x CVS -urpN 2009-01-26/process.c 2009-01-27/process.c
--- 2009-01-26/process.c	2009-01-17 02:52:54.000000000 +0100
+++ 2009-01-27/process.c	2009-01-26 20:09:38.000000000 +0100
@@ -34,7 +34,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *	$Id: process.c,v 1.125 2009/01/17 01:52:54 vda_linux Exp $
+ *	$Id: process.c,v 1.127 2009/01/26 19:09:38 vda_linux Exp $
  */
 
 #include "defs.h"
@@ -916,8 +916,10 @@ struct tcb *tcp;
 		}
 		else
 #endif
-		fork_tcb(tcp);
-		tcpchild = alloctcb(pid);
+		{
+			fork_tcb(tcp);
+			tcpchild = alloctcb(pid);
+		}
 
 #ifndef CLONE_PTRACE
 		/* Attach to the new child */
@@ -1969,10 +1971,7 @@ int status;
 }
 
 static int
-printwaitn(tcp, n, bitness)
-struct tcb *tcp;
-int n;
-int bitness;
+printwaitn(struct tcb *tcp, int n, int bitness)
 {
 	int status;
 	int exited = 0;
@@ -1980,6 +1979,14 @@ int bitness;
 	if (entering(tcp)) {
 		/*
 		 * Sign-extend a 32-bit value when that's what it is.
+		 *
+		 * NB: On Linux, kernel-side pid_t is typedef'ed to int
+		 * on all arches; also, glibc-2.8 truncates wait3 and wait4
+		 * pid argument to int on 64bit arches, producing,
+		 * for example, wait4(4294967295, ...) instead of -1
+		 * in strace.
+		 * Therefore, maybe it makes sense to *unconditionally*
+		 * widen int to long here...
 		 */
 		long pid = tcp->u_arg[0];
 		if (personality_wordsize[current_personality] < sizeof pid)
@@ -2005,7 +2012,7 @@ int bitness;
 				tprintf("NULL");
 #ifdef LINUX
 			else if (tcp->u_rval > 0) {
-#ifdef LINUX_64BIT
+#ifdef ALPHA
 				if (bitness)
 					printrusage32(tcp, tcp->u_arg[3]);
 				else
diff -x CVS -urpN 2009-01-26/resource.c 2009-01-27/resource.c
--- 2009-01-26/resource.c	2006-10-16 02:26:47.000000000 +0200
+++ 2009-01-27/resource.c	2009-01-26 20:09:39.000000000 +0100
@@ -27,7 +27,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *	$Id: resource.c,v 1.17 2006/10/16 00:26:47 ldv Exp $
+ *	$Id: resource.c,v 1.18 2009/01/26 19:09:39 vda_linux Exp $
  */
 
 #include "defs.h"
@@ -357,13 +357,13 @@ int
 sys_osf_getrusage(tcp)
 struct tcb *tcp;
 {
-    if (entering(tcp)) {
-	printxval(usagewho, tcp->u_arg[0], "RUSAGE_???");
-	tprintf(", ");
-    }
-    else
-	printrusage32(tcp, tcp->u_arg[1]);
-    return 0;
+	if (entering(tcp)) {
+		printxval(usagewho, tcp->u_arg[0], "RUSAGE_???");
+		tprintf(", ");
+	}
+	else
+		printrusage32(tcp, tcp->u_arg[1]);
+	return 0;
 }
 #endif /* ALPHA */
 






More information about the Strace-devel mailing list