From d71f6e87ae96d1ce8baedaaa3a6ed8d8536d585b Mon Sep 17 00:00:00 2001 From: mrg Date: Sat, 18 Oct 1997 17:31:35 +0000 Subject: [PATCH] clean up, WARNS. --- usr.sbin/kgmon/Makefile | 3 +-- usr.sbin/kgmon/kgmon.8 | 3 ++- usr.sbin/kgmon/kgmon.c | 46 ++++++++++++++++++++++++++--------------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/usr.sbin/kgmon/Makefile b/usr.sbin/kgmon/Makefile index dcea299a9158..901b1f702d15 100644 --- a/usr.sbin/kgmon/Makefile +++ b/usr.sbin/kgmon/Makefile @@ -1,7 +1,6 @@ +# $NetBSD: Makefile,v 1.8 1997/10/18 17:31:35 mrg Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 -# $NetBSD: Makefile,v 1.7 1997/10/18 04:37:31 lukem Exp $ -WARNS?= 0 PROG= kgmon MAN= kgmon.8 DPADD= ${LIBKVM} diff --git a/usr.sbin/kgmon/kgmon.8 b/usr.sbin/kgmon/kgmon.8 index 5c91cf255df6..fd4e68be93b3 100644 --- a/usr.sbin/kgmon/kgmon.8 +++ b/usr.sbin/kgmon/kgmon.8 @@ -1,3 +1,5 @@ +.\" $NetBSD: kgmon.8,v 1.8 1997/10/18 17:31:37 mrg Exp $ +.\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -30,7 +32,6 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)kgmon.8 8.1 (Berkeley) 6/6/93 -.\" $NetBSD: kgmon.8,v 1.7 1997/10/18 04:37:32 lukem Exp $ .\" .Dd June 6, 1993 .Dt KGMON 8 diff --git a/usr.sbin/kgmon/kgmon.c b/usr.sbin/kgmon/kgmon.c index b413ec051265..81283c75fbc3 100644 --- a/usr.sbin/kgmon/kgmon.c +++ b/usr.sbin/kgmon/kgmon.c @@ -1,3 +1,5 @@ +/* $NetBSD: kgmon.c,v 1.8 1997/10/18 17:31:38 mrg Exp $ */ + /* * Copyright (c) 1983, 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -31,37 +33,42 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1983, 1992, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1983, 1992, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint -/*static char sccsid[] = "from: @(#)kgmon.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$NetBSD: kgmon.c,v 1.7 1997/10/18 04:37:34 lukem Exp $"; +#if 0 +static char sccsid[] = "from: @(#)kgmon.c 8.1 (Berkeley) 6/6/93"; +#else +__RCSID("$NetBSD: kgmon.c,v 1.8 1997/10/18 17:31:38 mrg Exp $"); +#endif #endif /* not lint */ #include #include #include #include + +#include #include #include #include +#include +#include #include #include #include -#include -#include -#include +#include struct nlist nl[] = { #define N_GMONPARAM 0 { "__gmonparam" }, #define N_PROFHZ 1 { "_profhz" }, - 0, + { 0, } }; struct kvmvars { @@ -74,12 +81,14 @@ int debug = 0; void setprof __P((struct kvmvars *kvp, int state)); void dumpstate __P((struct kvmvars *kvp)); void reset __P((struct kvmvars *kvp)); +int openfiles __P((char *, char *, struct kvmvars *)); +int getprof __P((struct kvmvars *)); +void kern_readonly __P((int)); +int getprofhz __P(( struct kvmvars *)); int main(int argc, char **argv) { - extern char *optarg; - extern int optind; int ch, mode, disp, accessmode; struct kvmvars kvmvars; char *system, *kmemf; @@ -158,6 +167,7 @@ main(int argc, char **argv) /* * Check that profiling is enabled and open any ncessary files. */ +int openfiles(system, kmemf, kvp) char *system; char *kmemf; @@ -217,6 +227,7 @@ openfiles(system, kmemf, kvp) /* * Suppress options that require a writable kernel. */ +void kern_readonly(mode) int mode; { @@ -236,6 +247,7 @@ kern_readonly(mode) /* * Get the state of kernel profiling. */ +int getprof(kvp) struct kvmvars *kvp; { @@ -306,7 +318,7 @@ dumpstate(kvp) register FILE *fp; struct rawarc rawarc; struct tostruct *tos; - u_long frompc, addr; + u_long frompc; u_short *froms, *tickbuf; int mib[3]; size_t i; @@ -350,7 +362,7 @@ dumpstate(kvp) i = 0; } if (i != kvp->gpm.kcountsize) { - (void)fprintf(stderr, "kgmon: read ticks: read %u, got %d: %s", + (void)fprintf(stderr, "kgmon: read ticks: read %lu, got %d: %s", kvp->gpm.kcountsize, i, kflag ? kvm_geterr(kvp->kd) : strerror(errno)); exit(6); @@ -378,7 +390,7 @@ dumpstate(kvp) i = 0; } if (i != kvp->gpm.fromssize) { - (void)fprintf(stderr, "kgmon: read froms: read %u, got %d: %s", + (void)fprintf(stderr, "kgmon: read froms: read %lu, got %d: %s", kvp->gpm.fromssize, i, kflag ? kvm_geterr(kvp->kd) : strerror(errno)); exit(9); @@ -397,13 +409,13 @@ dumpstate(kvp) i = 0; } if (i != kvp->gpm.tossize) { - (void)fprintf(stderr, "kgmon: read tos: read %u, got %d: %s", + (void)fprintf(stderr, "kgmon: read tos: read %lu, got %d: %s", kvp->gpm.tossize, i, kflag ? kvm_geterr(kvp->kd) : strerror(errno)); exit(11); } if (debug) - (void)fprintf(stderr, "kgmon: lowpc 0x%x, textsize 0x%x\n", + (void)fprintf(stderr, "kgmon: lowpc 0x%lx, textsize 0x%lx\n", kvp->gpm.lowpc, kvp->gpm.textsize); endfrom = kvp->gpm.fromssize / sizeof(*froms); for (fromindex = 0; fromindex < endfrom; ++fromindex) { @@ -415,7 +427,7 @@ dumpstate(kvp) toindex = tos[toindex].link) { if (debug) (void)fprintf(stderr, - "%s: [mcleanup] frompc 0x%x selfpc 0x%x count %d\n", + "%s: [mcleanup] frompc 0x%lx selfpc 0x%lx count %ld\n", "kgmon", frompc, tos[toindex].selfpc, tos[toindex].count); rawarc.raw_frompc = frompc;