From 9ef74196facb1720ddd4524348af36c52e4acf73 Mon Sep 17 00:00:00 2001 From: krw Date: Sun, 14 Aug 2016 22:29:01 +0000 Subject: [PATCH] Flip 'u_quad_t' fields & variables to uint64_t, and %qu to %llu. ok guenther@ --- usr.sbin/sa/extern.h | 24 ++++++++++++------------ usr.sbin/sa/main.c | 13 ++++++------- usr.sbin/sa/pdb.c | 10 +++++----- usr.sbin/sa/usrdb.c | 10 +++++----- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/usr.sbin/sa/extern.h b/usr.sbin/sa/extern.h index 722043c2f4d..b380b20e7ca 100644 --- a/usr.sbin/sa/extern.h +++ b/usr.sbin/sa/extern.h @@ -27,7 +27,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: extern.h,v 1.4 2015/01/16 06:40:20 deraadt Exp $ + * $Id: extern.h,v 1.5 2016/08/14 22:29:01 krw Exp $ */ #include /* MAXCOMLEN */ @@ -38,23 +38,23 @@ struct cmdinfo { char ci_comm[MAXCOMLEN+2]; /* command name (+ '*') */ uid_t ci_uid; /* user id */ - u_quad_t ci_calls; /* number of calls */ - u_quad_t ci_etime; /* elapsed time */ - u_quad_t ci_utime; /* user time */ - u_quad_t ci_stime; /* system time */ - u_quad_t ci_mem; /* memory use */ - u_quad_t ci_io; /* number of disk i/o ops */ + uint64_t ci_calls; /* number of calls */ + uint64_t ci_etime; /* elapsed time */ + uint64_t ci_utime; /* user time */ + uint64_t ci_stime; /* system time */ + uint64_t ci_mem; /* memory use */ + uint64_t ci_io; /* number of disk i/o ops */ u_int ci_flags; /* flags; see below */ }; #define CI_UNPRINTABLE 0x0001 /* unprintable chars in name */ struct userinfo { uid_t ui_uid; /* user id; for consistency */ - u_quad_t ui_calls; /* number of invocations */ - u_quad_t ui_utime; /* user time */ - u_quad_t ui_stime; /* system time */ - u_quad_t ui_mem; /* memory use */ - u_quad_t ui_io; /* number of disk i/o ops */ + uint64_t ui_calls; /* number of invocations */ + uint64_t ui_utime; /* user time */ + uint64_t ui_stime; /* system time */ + uint64_t ui_mem; /* memory use */ + uint64_t ui_io; /* number of disk i/o ops */ }; /* typedefs */ diff --git a/usr.sbin/sa/main.c b/usr.sbin/sa/main.c index f8a9a379d60..bba39ecfe65 100644 --- a/usr.sbin/sa/main.c +++ b/usr.sbin/sa/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.15 2015/11/17 17:15:33 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.16 2016/08/14 22:29:01 krw Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou * All rights reserved. @@ -47,7 +47,7 @@ #include "pathnames.h" static int acct_load(char *, int); -static u_quad_t decode_comp_t(comp_t); +static uint64_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 *); @@ -160,7 +160,6 @@ main(int argc, char **argv) case 'v': /* cull junk */ vflag = 1; - /* XXX cutoff could be converted to quad_t? */ cutoff = strtonum(optarg, 1, INT_MAX, &errstr); if (errstr) errx(1, "-v %s: %s", optarg, errstr); @@ -358,10 +357,10 @@ acct_load(char *pn, int wr) return (fd); } -static u_quad_t +static uint64_t decode_comp_t(comp_t comp) { - u_quad_t rv; + uint64_t rv; /* * for more info on the comp_t format, see: @@ -394,7 +393,7 @@ static int cmp_usrsys(const DBT *d1, const DBT *d2) { struct cmdinfo c1, c2; - u_quad_t t1, t2; + uint64_t t1, t2; memcpy(&c1, d1->data, sizeof(c1)); memcpy(&c2, d2->data, sizeof(c2)); @@ -494,7 +493,7 @@ static int cmp_avgcpumem(const DBT *d1, const DBT *d2) { struct cmdinfo c1, c2; - u_quad_t t1, t2; + uint64_t t1, t2; double n1, n2; memcpy(&c1, d1->data, sizeof(c1)); diff --git a/usr.sbin/sa/pdb.c b/usr.sbin/sa/pdb.c index c8e82aed26b..3bf21994b8b 100644 --- a/usr.sbin/sa/pdb.c +++ b/usr.sbin/sa/pdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdb.c,v 1.8 2009/10/27 23:59:54 deraadt Exp $ */ +/* $OpenBSD: pdb.c,v 1.9 2016/08/14 22:29:01 krw Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou * All rights reserved. @@ -301,7 +301,7 @@ check_junk(struct cmdinfo *cip) char *cp; size_t len; - fprintf(stderr, "%s (%qu) -- ", cip->ci_comm, cip->ci_calls); + fprintf(stderr, "%s (%llu) -- ", cip->ci_comm, cip->ci_calls); cp = fgetln(stdin, &len); return (cp && (cp[0] == 'y' || cp[0] == 'Y')) ? 1 : 0; @@ -332,7 +332,7 @@ print_ci(const struct cmdinfo *cip, const struct cmdinfo *totalcip) } else uflow = 0; - printf("%8qu ", cip->ci_calls); + printf("%8llu ", cip->ci_calls); if (cflag) { if (cip != totalcip) printf(" %4.2f%% ", @@ -397,12 +397,12 @@ print_ci(const struct cmdinfo *cip, const struct cmdinfo *totalcip) } if (Dflag) - printf("%10qutio ", cip->ci_io); + printf("%10llutio ", cip->ci_io); else printf("%8.0favio ", cip->ci_io / c); if (Kflag) - printf("%10quk*sec ", cip->ci_mem); + printf("%10lluk*sec ", cip->ci_mem); else printf("%8.0fk ", cip->ci_mem / t); diff --git a/usr.sbin/sa/usrdb.c b/usr.sbin/sa/usrdb.c index f597263461b..89826e0812a 100644 --- a/usr.sbin/sa/usrdb.c +++ b/usr.sbin/sa/usrdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usrdb.c,v 1.9 2010/08/30 16:14:36 matthew Exp $ */ +/* $OpenBSD: usrdb.c,v 1.10 2016/08/14 22:29:01 krw Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou * All rights reserved. @@ -231,7 +231,7 @@ usracct_print(void) while (rv == 0) { memcpy(ui, data.data, sizeof(struct userinfo)); - printf("%-8s %9qu ", + printf("%-8s %9llu ", user_from_uid(ui->ui_uid, 0), ui->ui_calls); t = (double) (ui->ui_utime + ui->ui_stime) / @@ -243,15 +243,15 @@ usracct_print(void) /* ui->ui_calls is always != 0 */ if (dflag) - printf("%12qu%s", ui->ui_io / ui->ui_calls, "avio"); + printf("%12llu%s", ui->ui_io / ui->ui_calls, "avio"); else - printf("%12qu%s", ui->ui_io, "tio"); + printf("%12llu%s", ui->ui_io, "tio"); /* t is always >= 0.0001; see above */ if (kflag) printf("%12.0f%s", ui->ui_mem / t, "k"); else - printf("%12qu%s", ui->ui_mem, "k*sec"); + printf("%12llu%s", ui->ui_mem, "k*sec"); printf("\n"); -- 2.20.1