diff options
author | alfred <alfred@FreeBSD.org> | 2002-07-11 22:11:20 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-07-11 22:11:20 +0000 |
commit | 088603aa7d4a2d4e79919c149f6325bfd66289a8 (patch) | |
tree | 9293ed7dca4da28dc89bfde083cb599b0173fac5 | |
parent | 26953c640bfb7e8c56a96bccebe8040483775089 (diff) | |
download | FreeBSD-src-088603aa7d4a2d4e79919c149f6325bfd66289a8.zip FreeBSD-src-088603aa7d4a2d4e79919c149f6325bfd66289a8.tar.gz |
WARNS=4, de-__P()
-rw-r--r-- | usr.sbin/sa/Makefile | 1 | ||||
-rw-r--r-- | usr.sbin/sa/extern.h | 27 | ||||
-rw-r--r-- | usr.sbin/sa/main.c | 41 | ||||
-rw-r--r-- | usr.sbin/sa/pdb.c | 7 |
4 files changed, 39 insertions, 37 deletions
diff --git a/usr.sbin/sa/Makefile b/usr.sbin/sa/Makefile index c6868b5..d024389 100644 --- a/usr.sbin/sa/Makefile +++ b/usr.sbin/sa/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ PROG= sa +WARNS?= 4 MAN= sa.8 SRCS= main.c pdb.c usrdb.c diff --git a/usr.sbin/sa/extern.h b/usr.sbin/sa/extern.h index 5804aa2..bc5f199 100644 --- a/usr.sbin/sa/extern.h +++ b/usr.sbin/sa/extern.h @@ -60,30 +60,27 @@ struct userinfo { /* typedefs */ -typedef int (*cmpf_t) __P((const DBT *, const DBT *)); - -/* external functions in sa.c */ -int main __P((int, char **)); +typedef int (*cmpf_t)(const DBT *, const DBT *); /* external functions in pdb.c */ -int pacct_init __P((void)); -void pacct_destroy __P((void)); -int pacct_add __P((const struct cmdinfo *)); -int pacct_update __P((void)); -void pacct_print __P((void)); +int pacct_init(void); +void pacct_destroy(void); +int pacct_add(const struct cmdinfo *); +int pacct_update(void); +void pacct_print(void); /* external functions in usrdb.c */ -int usracct_init __P((void)); -void usracct_destroy __P((void)); -int usracct_add __P((const struct cmdinfo *)); -int usracct_update __P((void)); -void usracct_print __P((void)); +int usracct_init(void); +void usracct_destroy(void); +int usracct_add(const struct cmdinfo *); +int usracct_update(void); +void usracct_print(void); /* variables */ extern int aflag, bflag, cflag, dflag, Dflag, fflag, iflag, jflag, kflag; extern int Kflag, lflag, mflag, qflag, rflag, sflag, tflag, uflag, vflag; -extern int cutoff; +extern u_quad_t cutoff; extern cmpf_t sa_cmp; /* some #defines to help with db's stupidity */ diff --git a/usr.sbin/sa/main.c b/usr.sbin/sa/main.c index 3686c62..684d951 100644 --- a/usr.sbin/sa/main.c +++ b/usr.sbin/sa/main.c @@ -56,36 +56,37 @@ static const char rcsid[] = #include "extern.h" #include "pathnames.h" -static int acct_load __P((char *, int)); -static u_quad_t decode_comp_t __P((comp_t)); -static int cmp_comm __P((const char *, const char *)); -static int cmp_usrsys __P((const DBT *, const DBT *)); -static int cmp_avgusrsys __P((const DBT *, const DBT *)); -static int cmp_dkio __P((const DBT *, const DBT *)); -static int cmp_avgdkio __P((const DBT *, const DBT *)); -static int cmp_cpumem __P((const DBT *, const DBT *)); -static int cmp_avgcpumem __P((const DBT *, const DBT *)); -static int cmp_calls __P((const DBT *, const DBT *)); -static void usage __P((void)); +static int acct_load(char *, int); +static u_quad_t decode_comp_t(comp_t); +static int cmp_comm(const char *, const char *); +static int cmp_usrsys(const DBT *, const DBT *); +static int cmp_avgusrsys(const DBT *, const DBT *); +static int cmp_dkio(const DBT *, const DBT *); +static int cmp_avgdkio(const DBT *, const DBT *); +static int cmp_cpumem(const DBT *, const DBT *); +static int cmp_avgcpumem(const DBT *, const DBT *); +static int cmp_calls(const DBT *, const DBT *); +static void usage(void); int aflag, bflag, cflag, dflag, Dflag, fflag, iflag, jflag, kflag; int Kflag, lflag, mflag, qflag, rflag, sflag, tflag, uflag, vflag; -int cutoff = 1; +u_quad_t cutoff = 1; -static char *dfltargv[] = { _PATH_ACCT }; +static char *dfltargv[] = { NULL }; static int dfltargc = (sizeof dfltargv/sizeof(char *)); /* default to comparing by sum of user + system time */ cmpf_t sa_cmp = cmp_usrsys; int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char ch; + char pathacct[] = _PATH_ACCT; int error = 0; + dfltargv[0] = pathacct; + while ((ch = getopt(argc, argv, "abcdDfijkKlmnqrstuv:")) != -1) switch (ch) { case 'a': @@ -239,7 +240,7 @@ main(argc, argv) * but we want every accounting record intact. */ if (ftruncate(fd, 0) == -1) { - warn("couldn't truncate %s", argv); + warn("couldn't truncate %s", *argv); error = 1; } @@ -266,7 +267,7 @@ main(argc, argv) * close the opened accounting file */ if (close(fd) == -1) { - warn("close %s", argv); + warn("close %s", *argv); error = 1; } } @@ -326,14 +327,14 @@ acct_load(pn, wr) rv = read(fd, &ac, sizeof(struct acct)); if (rv == -1) warn("error reading %s", pn); - else if (rv > 0 && rv < sizeof(struct acct)) + else if (rv > 0 && rv < (int)sizeof(struct acct)) warnx("short read of accounting data in %s", pn); if (rv != sizeof(struct acct)) break; /* decode it */ ci.ci_calls = 1; - for (i = 0; i < sizeof ac.ac_comm && ac.ac_comm[i] != '\0'; + for (i = 0; i < (int)sizeof ac.ac_comm && ac.ac_comm[i] != '\0'; i++) { char c = ac.ac_comm[i]; diff --git a/usr.sbin/sa/pdb.c b/usr.sbin/sa/pdb.c index eafdf59..87347b0 100644 --- a/usr.sbin/sa/pdb.c +++ b/usr.sbin/sa/pdb.c @@ -400,11 +400,14 @@ print_ci(cip, totalcip) } } - if (tflag) + if (tflag) { if (!uflow) - printf("%8.2fre/cp ", cip->ci_etime / (double) (cip->ci_utime + cip->ci_stime)); + printf("%8.2fre/cp ", + cip->ci_etime / + (double) (cip->ci_utime + cip->ci_stime)); else printf("*ignore* "); + } if (Dflag) printf("%10qutio ", cip->ci_io); |