* (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 <sys/param.h> /* MAXCOMLEN */
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 */
-/* $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.
#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 *);
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);
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:
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));
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));
-/* $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.
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;
} else
uflow = 0;
- printf("%8qu ", cip->ci_calls);
+ printf("%8llu ", cip->ci_calls);
if (cflag) {
if (cip != totalcip)
printf(" %4.2f%% ",
}
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);
-/* $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.
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) /
/* 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");