1*86d7f5d3SJohn Marino /* 2*86d7f5d3SJohn Marino * Copyright (c) 1994 Christopher G. Demetriou 3*86d7f5d3SJohn Marino * All rights reserved. 4*86d7f5d3SJohn Marino * 5*86d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without 6*86d7f5d3SJohn Marino * modification, are permitted provided that the following conditions 7*86d7f5d3SJohn Marino * are met: 8*86d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright 9*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer. 10*86d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 11*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the 12*86d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution. 13*86d7f5d3SJohn Marino * 3. All advertising materials mentioning features or use of this software 14*86d7f5d3SJohn Marino * must display the following acknowledgement: 15*86d7f5d3SJohn Marino * This product includes software developed by Christopher G. Demetriou. 16*86d7f5d3SJohn Marino * 4. The name of the author may not be used to endorse or promote products 17*86d7f5d3SJohn Marino * derived from this software without specific prior written permission 18*86d7f5d3SJohn Marino * 19*86d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20*86d7f5d3SJohn Marino * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21*86d7f5d3SJohn Marino * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22*86d7f5d3SJohn Marino * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23*86d7f5d3SJohn Marino * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24*86d7f5d3SJohn Marino * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25*86d7f5d3SJohn Marino * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26*86d7f5d3SJohn Marino * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27*86d7f5d3SJohn Marino * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28*86d7f5d3SJohn Marino * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29*86d7f5d3SJohn Marino * 30*86d7f5d3SJohn Marino * $FreeBSD: src/usr.sbin/sa/extern.h,v 1.4 1999/08/28 01:19:52 peter Exp $ 31*86d7f5d3SJohn Marino */ 32*86d7f5d3SJohn Marino 33*86d7f5d3SJohn Marino #include <sys/types.h> 34*86d7f5d3SJohn Marino #include <sys/param.h> 35*86d7f5d3SJohn Marino #include <db.h> 36*86d7f5d3SJohn Marino 37*86d7f5d3SJohn Marino /* structures */ 38*86d7f5d3SJohn Marino 39*86d7f5d3SJohn Marino struct cmdinfo { 40*86d7f5d3SJohn Marino char ci_comm[MAXCOMLEN+2]; /* command name (+ '*') */ 41*86d7f5d3SJohn Marino u_long ci_uid; /* user id */ 42*86d7f5d3SJohn Marino u_quad_t ci_calls; /* number of calls */ 43*86d7f5d3SJohn Marino u_quad_t ci_etime; /* elapsed time */ 44*86d7f5d3SJohn Marino u_quad_t ci_utime; /* user time */ 45*86d7f5d3SJohn Marino u_quad_t ci_stime; /* system time */ 46*86d7f5d3SJohn Marino u_quad_t ci_mem; /* memory use */ 47*86d7f5d3SJohn Marino u_quad_t ci_io; /* number of disk i/o ops */ 48*86d7f5d3SJohn Marino u_int ci_flags; /* flags; see below */ 49*86d7f5d3SJohn Marino }; 50*86d7f5d3SJohn Marino #define CI_UNPRINTABLE 0x0001 /* unprintable chars in name */ 51*86d7f5d3SJohn Marino 52*86d7f5d3SJohn Marino struct userinfo { 53*86d7f5d3SJohn Marino u_long ui_uid; /* user id; for consistency */ 54*86d7f5d3SJohn Marino u_quad_t ui_calls; /* number of invocations */ 55*86d7f5d3SJohn Marino u_quad_t ui_utime; /* user time */ 56*86d7f5d3SJohn Marino u_quad_t ui_stime; /* system time */ 57*86d7f5d3SJohn Marino u_quad_t ui_mem; /* memory use */ 58*86d7f5d3SJohn Marino u_quad_t ui_io; /* number of disk i/o ops */ 59*86d7f5d3SJohn Marino }; 60*86d7f5d3SJohn Marino 61*86d7f5d3SJohn Marino /* typedefs */ 62*86d7f5d3SJohn Marino 63*86d7f5d3SJohn Marino typedef int (*cmpf_t)(const DBT *, const DBT *); 64*86d7f5d3SJohn Marino 65*86d7f5d3SJohn Marino /* external functions in sa.c */ 66*86d7f5d3SJohn Marino int main (int, char **); 67*86d7f5d3SJohn Marino 68*86d7f5d3SJohn Marino /* external functions in pdb.c */ 69*86d7f5d3SJohn Marino int pacct_init(void); 70*86d7f5d3SJohn Marino void pacct_destroy(void); 71*86d7f5d3SJohn Marino int pacct_add(const struct cmdinfo *); 72*86d7f5d3SJohn Marino int pacct_update(void); 73*86d7f5d3SJohn Marino void pacct_print(void); 74*86d7f5d3SJohn Marino 75*86d7f5d3SJohn Marino /* external functions in usrdb.c */ 76*86d7f5d3SJohn Marino int usracct_init(void); 77*86d7f5d3SJohn Marino void usracct_destroy(void); 78*86d7f5d3SJohn Marino int usracct_add(const struct cmdinfo *); 79*86d7f5d3SJohn Marino int usracct_update(void); 80*86d7f5d3SJohn Marino void usracct_print(void); 81*86d7f5d3SJohn Marino 82*86d7f5d3SJohn Marino /* variables */ 83*86d7f5d3SJohn Marino 84*86d7f5d3SJohn Marino extern int aflag, bflag, cflag, dflag, Dflag, fflag, iflag, jflag, kflag; 85*86d7f5d3SJohn Marino extern int Kflag, lflag, mflag, qflag, rflag, sflag, tflag, uflag, vflag; 86*86d7f5d3SJohn Marino extern u_quad_t cutoff; 87*86d7f5d3SJohn Marino extern cmpf_t sa_cmp; 88*86d7f5d3SJohn Marino 89*86d7f5d3SJohn Marino /* some #defines to help with db's stupidity */ 90*86d7f5d3SJohn Marino 91*86d7f5d3SJohn Marino #define DB_CLOSE(db) \ 92*86d7f5d3SJohn Marino ((*(db)->close)(db)) 93*86d7f5d3SJohn Marino #define DB_GET(db, key, data, flags) \ 94*86d7f5d3SJohn Marino ((*(db)->get)((db), (key), (data), (flags))) 95*86d7f5d3SJohn Marino #define DB_PUT(db, key, data, flags) \ 96*86d7f5d3SJohn Marino ((*(db)->put)((db), (key), (data), (flags))) 97*86d7f5d3SJohn Marino #define DB_SYNC(db, flags) \ 98*86d7f5d3SJohn Marino ((*(db)->sync)((db), (flags))) 99*86d7f5d3SJohn Marino #define DB_SEQ(db, key, data, flags) \ 100*86d7f5d3SJohn Marino ((*(db)->seq)((db), (key), (data), (flags))) 101