[PATCH 2009-01-24] warning fixes; reducing #ifdef forest

Denys Vlasenko dvlasenk at redhat.com
Mon Feb 23 13:50:09 UTC 2009


diff -x CVS -urpN 2009-01-23/ChangeLog 2009-01-24/ChangeLog
--- 2009-01-23/ChangeLog	2009-01-21 20:05:43.000000000 +0100
+++ 2009-01-24/ChangeLog	2009-01-23 17:30:26.000000000 +0100
@@ -1,3 +1,13 @@
+2009-01-23  Michal Nowak  <mnowak at redhat.com>
+
+	* syscall.c (get_scno): Fix warnings about unused variable 'pid'.
+
+2009-01-23  Michal Nowak  <mnowak at redhat.com>
+
+	* mem.c (print_ldt_entry): Fix warning:
+	Format '%#08lx' expects type 'long unsigned int', but
+	argument 2 was type 'unsigned int'.
+
 2009-01-21  Denys Vlasenko  <dvlasenk at redhat.com>
 
 	* strace.c (collect_stopped_tcbs): Do not return NULL when ECHILD
diff -x CVS -urpN 2009-01-23/mem.c 2009-01-24/mem.c
--- 2009-01-23/mem.c	2008-12-30 19:47:56.000000000 +0100
+++ 2009-01-24/mem.c	2009-01-23 17:10:22.000000000 +0100
@@ -29,7 +29,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: mem.c,v 1.46 2008/12/30 18:47:56 vda_linux Exp $
+ *	$Id: mem.c,v 1.47 2009/01/23 16:10:22 vda_linux Exp $
  */
 
 #include "defs.h"
@@ -565,8 +565,7 @@ struct tcb *tcp;
 
 #if defined(LINUX) && defined(__i386__)
 void
-print_ldt_entry (ldt_entry)
-struct modify_ldt_ldt_s *ldt_entry;
+print_ldt_entry(struct modify_ldt_ldt_s *ldt_entry)
 {
 	tprintf("base_addr:%#08lx, "
 		"limit:%d, "
@@ -576,7 +575,7 @@ struct modify_ldt_ldt_s *ldt_entry;
 		"limit_in_pages:%d, "
 		"seg_not_present:%d, "
 		"useable:%d}",
-		ldt_entry->base_addr,
+		(long) ldt_entry->base_addr,
 		ldt_entry->limit,
 		ldt_entry->seg_32bit,
 		ldt_entry->contents,
diff -x CVS -urpN 2009-01-23/syscall.c 2009-01-24/syscall.c
--- 2009-01-23/syscall.c	2009-01-17 02:06:18.000000000 +0100
+++ 2009-01-24/syscall.c	2009-01-23 17:30:26.000000000 +0100
@@ -30,7 +30,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: syscall.c,v 1.107 2009/01/17 01:06:18 vda_linux Exp $
+ *	$Id: syscall.c,v 1.108 2009/01/23 16:30:26 vda_linux Exp $
  */
 
 #include "defs.h"
@@ -780,13 +780,9 @@ internal_syscall(struct tcb *tcp)
 #endif /* FREEBSD */
 
 int
-get_scno(tcp)
-struct tcb *tcp;
+get_scno(struct tcb *tcp)
 {
 	long scno = 0;
-#ifndef USE_PROCFS
-	int pid = tcp->pid;
-#endif /* !PROCFS */
 
 #ifdef LINUX
 #if defined(S390) || defined(S390X)
@@ -833,7 +829,7 @@ struct tcb *tcp;
 		if (upeek(tcp, PT_PSWADDR, &pc) < 0)
 			return -1;
 		errno = 0;
-		opcode = ptrace(PTRACE_PEEKTEXT, pid, (char *)(pc-sizeof(long)), 0);
+		opcode = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)(pc-sizeof(long)), 0);
 		if (errno) {
 			perror("peektext(pc-oneword)");
 			return -1;
@@ -874,7 +870,7 @@ struct tcb *tcp;
 				return -1;
 			svc_addr += tmp;
 
-			scno = ptrace(PTRACE_PEEKTEXT, pid, svc_addr, 0);
+			scno = ptrace(PTRACE_PEEKTEXT, tcp->pid, svc_addr, 0);
 			if (errno)
 				return -1;
 #if defined(S390X)
@@ -916,6 +912,7 @@ struct tcb *tcp;
 	if (!(tcp->flags & TCB_INSYSCALL)) {
 	  	static int currpers = -1;
 		long val;
+		int pid = tcp->pid;
 
 		/* Check CS register value. On x86-64 linux it is:
 		 * 	0x33	for long mode (64 bit)
@@ -1004,7 +1001,7 @@ struct tcb *tcp;
 			 * magic SIGTRAP. Moot anyway, PTRACE_GETSIGINFO
 			 * doesn't fail.
 			 */
-			ptrace(PTRACE_GETSIGINFO, pid, (void*) 0, (void*) &si);
+			ptrace(PTRACE_GETSIGINFO, tcp->pid, (void*) 0, (void*) &si);
 			if (si.si_code == SI_USER)
 				return 0;
 #else
@@ -1023,7 +1020,7 @@ struct tcb *tcp;
 	/*
 	 * Read complete register set in one go.
 	 */
-	if (ptrace(PTRACE_GETREGS, pid, NULL, (void *)&regs) == -1)
+	if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (void *)&regs) == -1)
 		return -1;
 
 	/*
@@ -1051,7 +1048,7 @@ struct tcb *tcp;
 			 * Get the ARM-mode system call number
 			 */
 			errno = 0;
-			scno = ptrace(PTRACE_PEEKTEXT, pid, (void *)(regs.ARM_pc - 4), NULL);
+			scno = ptrace(PTRACE_PEEKTEXT, tcp->pid, (void *)(regs.ARM_pc - 4), NULL);
 			if (errno)
 				return -1;
 
@@ -1105,7 +1102,7 @@ struct tcb *tcp;
 #elif defined (LINUX_MIPSN32)
 	unsigned long long regs[38];
 
-	if (ptrace (PTRACE_GETREGS, pid, NULL, (long) &regs) < 0)
+	if (ptrace (PTRACE_GETREGS, tcp->pid, NULL, (long) &regs) < 0)
 		return -1;
 	a3 = regs[REG_A3];
 	r2 = regs[REG_V0];
@@ -1183,14 +1180,14 @@ struct tcb *tcp;
 	}
 #elif defined (SPARC) || defined (SPARC64)
 	/* Everything we need is in the current register set. */
-	if (ptrace(PTRACE_GETREGS,pid,(char *)&regs,0) < 0)
+	if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0)
 		return -1;
 
 	/* If we are entering, then disassemble the syscall trap. */
 	if (!(tcp->flags & TCB_INSYSCALL)) {
 		/* Retrieve the syscall trap instruction. */
 		errno = 0;
-		trap = ptrace(PTRACE_PEEKTEXT,pid,(char *)regs.r_pc,0);
+		trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)regs.r_pc, 0);
 #if defined(SPARC64)
 		trap >>= 32;
 #endif






More information about the Strace-devel mailing list