diff options
author | dchagin <dchagin@FreeBSD.org> | 2015-01-13 06:23:38 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2015-01-13 06:23:38 +0000 |
commit | 427a8ba83f241577a9e223bd52933ab18aed2c77 (patch) | |
tree | 231f2b5b92a4440ded8fd4aa423fd6cc48e32f7b /usr.bin/kdump/kdump.c | |
parent | 64d1cbe697989eb11e15c2dd392aa8f1f9998f1b (diff) | |
download | FreeBSD-src-427a8ba83f241577a9e223bd52933ab18aed2c77.zip FreeBSD-src-427a8ba83f241577a9e223bd52933ab18aed2c77.tar.gz |
MFC r273048 by jhb:
Fix most of the warnings in kdump(1).
r276758:
Eliminate new clang warnings.
Diffstat (limited to 'usr.bin/kdump/kdump.c')
-rw-r--r-- | usr.bin/kdump/kdump.c | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 673db53..d4ecfb3 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -102,9 +102,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 *); @@ -116,10 +116,13 @@ void limitfd(int fd); void usage(void); void ioctlname(unsigned long, int); -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) @@ -138,8 +141,11 @@ struct ktr_header ktr_header; void linux_ktrsyscall(struct ktr_syscall *); void linux_ktrsysret(struct ktr_sysret *); -extern char *linux_syscallnames[]; -extern int nlinux_syscalls; +extern const char *linux_syscallnames[]; + +#include <linux_syscalls.c> +static int nlinux_syscalls = sizeof(linux_syscallnames) / \ + sizeof(linux_syscallnames[0]); /* * from linux.h @@ -166,7 +172,7 @@ struct proc_info pid_t pid; }; -TAILQ_HEAD(trace_procs, proc_info) trace_procs; +static TAILQ_HEAD(trace_procs, proc_info) trace_procs; static void strerror_init(void) @@ -386,7 +392,7 @@ limitfd(int fd) unsigned long cmd; cap_rights_init(&rights, CAP_FSTAT); - cmd = -1; + cmd = 0; switch (fd) { case STDIN_FILENO: @@ -409,7 +415,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); } @@ -1016,7 +1022,7 @@ ktrsyscall(struct ktr_syscall *ktr, u_int flags) 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; @@ -1458,9 +1464,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; @@ -1525,14 +1532,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"); } } @@ -1544,9 +1552,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"); @@ -1559,8 +1567,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); @@ -1573,11 +1582,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"); } @@ -1857,7 +1867,7 @@ void ktrfault(struct ktr_fault *ktr) { - printf("0x%jx ", ktr->vaddr); + printf("0x%jx ", (uintmax_t)ktr->vaddr); vmprotname(ktr->type); printf("\n"); } |