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