Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2014 16:17:43 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273048 - head/usr.bin/kdump
Message-ID:  <201410131617.s9DGHh25027583@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon Oct 13 16:17:42 2014
New Revision: 273048
URL: https://svnweb.freebsd.org/changeset/base/273048

Log:
  Fix most of the warnings in kdump(1).
  
  Sponsored by:	Norse

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==============================================================================
--- head/usr.bin/kdump/kdump.c	Mon Oct 13 16:16:32 2014	(r273047)
+++ head/usr.bin/kdump/kdump.c	Mon Oct 13 16:17:42 2014	(r273048)
@@ -103,9 +103,9 @@ void ktrgenio(struct ktr_genio *, int);
 void ktrpsig(struct ktr_psig *);
 void ktrcsw(struct ktr_csw *);
 void ktrcsw_old(struct ktr_csw_old *);
-void ktruser_malloc(unsigned char *);
-void ktruser_rtld(int, unsigned char *);
-void ktruser(int, unsigned char *);
+void ktruser_malloc(void *);
+void ktruser_rtld(int, void *);
+void ktruser(int, void *);
 void ktrcaprights(cap_rights_t *);
 void ktrsockaddr(struct sockaddr *);
 void ktrstat(struct stat *);
@@ -122,10 +122,13 @@ void ioctlname(unsigned long, int);
 #define	TIMESTAMP_ELAPSED	0x2
 #define	TIMESTAMP_RELATIVE	0x4
 
-int timestamp, decimal, fancy = 1, suppressdata, tail, threads, maxdata,
+extern const char *signames[], *syscallnames[];
+extern int nsyscalls;
+
+static int timestamp, decimal, fancy = 1, suppressdata, tail, threads, maxdata,
     resolv = 0, abiflag = 0, syscallno = 0;
-const char *tracefile = DEF_TRACEFILE;
-struct ktr_header ktr_header;
+static const char *tracefile = DEF_TRACEFILE;
+static struct ktr_header ktr_header;
 
 #define TIME_FORMAT	"%b %e %T %Y"
 #define eqs(s1, s2)	(strcmp((s1), (s2)) == 0)
@@ -172,7 +175,7 @@ struct proc_info
 	pid_t			pid;
 };
 
-TAILQ_HEAD(trace_procs, proc_info) trace_procs;
+static TAILQ_HEAD(trace_procs, proc_info) trace_procs;
 
 #ifdef HAVE_LIBCAPSICUM
 static cap_channel_t *cappwd, *capgrp;
@@ -456,7 +459,7 @@ limitfd(int fd)
 	unsigned long cmd;
 
 	cap_rights_init(&rights, CAP_FSTAT);
-	cmd = -1;
+	cmd = 0;
 
 	switch (fd) {
 	case STDIN_FILENO:
@@ -479,7 +482,7 @@ limitfd(int fd)
 
 	if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS)
 		err(1, "unable to limit rights for descriptor %d", fd);
-	if (cmd != -1 && cap_ioctls_limit(fd, &cmd, 1) < 0 && errno != ENOSYS)
+	if (cmd != 0 && cap_ioctls_limit(fd, &cmd, 1) < 0 && errno != ENOSYS)
 		err(1, "unable to limit ioctls for descriptor %d", fd);
 }
 
@@ -1093,7 +1096,7 @@ ktrsyscall(struct ktr_syscall *ktr, u_in
 				print_number(ip, narg, c);
 				putchar(',');
 				flagsname(ip[0]);
-				printf(",0%o", ip[1]);
+				printf(",0%o", (unsigned int)ip[1]);
 				ip += 3;
 				narg -= 3;
 				break;
@@ -1515,9 +1518,10 @@ struct utrace_rtld {
 };
 
 void
-ktruser_rtld(int len, unsigned char *p)
+ktruser_rtld(int len, void *p)
 {
-	struct utrace_rtld *ut = (struct utrace_rtld *)p;
+	struct utrace_rtld *ut = p;
+	unsigned char *cp;
 	void *parent;
 	int mode;
 
@@ -1582,14 +1586,15 @@ ktruser_rtld(int len, unsigned char *p)
 		    ut->name);
 		break;
 	default:
-		p += 4;
+		cp = p;
+		cp += 4;
 		len -= 4;
 		printf("RTLD: %d ", len);
 		while (len--)
 			if (decimal)
-				printf(" %d", *p++);
+				printf(" %d", *cp++);
 			else
-				printf(" %02x", *p++);
+				printf(" %02x", *cp++);
 		printf("\n");
 	}
 }
@@ -1601,9 +1606,9 @@ struct utrace_malloc {
 };
 
 void
-ktruser_malloc(unsigned char *p)
+ktruser_malloc(void *p)
 {
-	struct utrace_malloc *ut = (struct utrace_malloc *)p;
+	struct utrace_malloc *ut = p;
 
 	if (ut->p == (void *)(intptr_t)(-1))
 		printf("malloc_init()\n");
@@ -1616,8 +1621,9 @@ ktruser_malloc(unsigned char *p)
 }
 
 void
-ktruser(int len, unsigned char *p)
+ktruser(int len, void *p)
 {
+	unsigned char *cp;
 
 	if (len >= 8 && bcmp(p, "RTLD", 4) == 0) {
 		ktruser_rtld(len, p);
@@ -1630,11 +1636,12 @@ ktruser(int len, unsigned char *p)
 	}
 
 	printf("%d ", len);
+	cp = p;
 	while (len--)
 		if (decimal)
-			printf(" %d", *p++);
+			printf(" %d", *cp++);
 		else
-			printf(" %02x", *p++);
+			printf(" %02x", *cp++);
 	printf("\n");
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410131617.s9DGHh25027583>