1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1991, 1993 5 * The Regents of the University of California. 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. Neither the name of the University nor the names of its contributors 16 * may be used to endorse or promote products derived from this software 17 * without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * @(#)extern.h 8.1 (Berkeley) 6/6/93 32 */ 33 34 #include <sys/cdefs.h> 35 #include <fcntl.h> 36 #include <kvm.h> 37 38 extern struct cmdtab *curcmd; 39 extern struct cmdtab cmdtab[]; 40 extern struct text *xtext; 41 extern WINDOW *wnd; 42 extern char **dr_name; 43 extern char c, *namp, hostname[]; 44 extern double avenrun[3]; 45 extern float *dk_mspw; 46 extern kvm_t *kd; 47 extern long ntext, textp; 48 extern int *dk_select; 49 extern int CMDLINE; 50 extern int dk_ndrive; 51 extern int hz, stathz; 52 extern double hertz; /* sampling frequency for cp_time and dk_time */ 53 extern int col; 54 extern int nhosts; 55 extern int nports; 56 extern int protos; 57 extern int verbose; 58 extern unsigned int delay; 59 60 extern int curscale; 61 extern char *matchline; 62 extern int showpps; 63 extern int needsort; 64 65 struct in_conninfo; 66 67 extern struct device_selection *dev_select; 68 extern long generation; 69 extern int num_devices; 70 extern int num_selected; 71 extern int num_selections; 72 extern long select_generation; 73 74 extern struct nlist namelist[]; 75 76 int checkhost(struct in_conninfo *); 77 int checkport(struct in_conninfo *); 78 void closeicmp(WINDOW *); 79 void closeicmp6(WINDOW *); 80 void closeifstat(WINDOW *); 81 void closeiostat(WINDOW *); 82 void closeip(WINDOW *); 83 void closeip6(WINDOW *); 84 void closekre(WINDOW *); 85 void closenetstat(WINDOW *); 86 void closepigs(WINDOW *); 87 void closeswap(WINDOW *); 88 void closetcp(WINDOW *); 89 int cmdifstat(const char *, const char *); 90 int cmdiolat(const char *, const char *); 91 int cmdiostat(const char *, const char *); 92 int cmdkre(const char *, const char *); 93 int cmdnetstat(const char *, const char *); 94 struct cmdtab *lookup(const char *); 95 void command(const char *); 96 void die(int); 97 void display(void); 98 int dkinit(void); 99 int dkcmd(char *, char *); 100 void error(const char *fmt, ...) __printflike(1, 2); 101 void fetchicmp(void); 102 void fetchicmp6(void); 103 void fetchifstat(void); 104 void fetchip(void); 105 void fetchip6(void); 106 void fetchiostat(void); 107 void fetchkre(void); 108 void fetchnetstat(void); 109 void fetchpigs(void); 110 void fetchswap(void); 111 void fetchtcp(void); 112 void getsysctl(const char *, void *, size_t); 113 int ifcmd(const char *cmd, const char *args); 114 int initicmp(void); 115 int initicmp6(void); 116 int initifstat(void); 117 int initip(void); 118 int initip6(void); 119 int initiostat(void); 120 int initkre(void); 121 int initnetstat(void); 122 int initpigs(void); 123 int initswap(void); 124 int inittcp(void); 125 int keyboard(void); 126 int kvm_ckread(void *, void *, int); 127 void labelicmp(void); 128 void labelicmp6(void); 129 void labelifstat(void); 130 void labelip(void); 131 void labelip6(void); 132 void labeliostat(void); 133 void labelkre(void); 134 void labelnetstat(void); 135 void labelpigs(void); 136 void labels(void); 137 void labelswap(void); 138 void labeltcp(void); 139 void load(void); 140 int netcmd(const char *, const char *); 141 void nlisterr(struct nlist []); 142 WINDOW *openicmp(void); 143 WINDOW *openicmp6(void); 144 WINDOW *openifstat(void); 145 WINDOW *openip(void); 146 WINDOW *openip6(void); 147 WINDOW *openiostat(void); 148 WINDOW *openkre(void); 149 WINDOW *opennetstat(void); 150 WINDOW *openpigs(void); 151 WINDOW *openswap(void); 152 WINDOW *opentcp(void); 153 int prefix(const char *, const char *); 154 void reseticmp(void); 155 void reseticmp6(void); 156 void resetip(void); 157 void resetip6(void); 158 void resettcp(void); 159 void showicmp(void); 160 void showicmp6(void); 161 void showifstat(void); 162 void showip(void); 163 void showip6(void); 164 void showiostat(void); 165 void showkre(void); 166 void shownetstat(void); 167 void showpigs(void); 168 void showswap(void); 169 void showtcp(void); 170 void status(void); 171 void suspend(int); 172 char *sysctl_dynread(const char *, size_t *); 173 void sysputpage(WINDOW* , int, int, int, uint64_t, int); 174 void sysputspaces(WINDOW* , int, int, int); 175 void sysputstrs(WINDOW* , int, int, int); 176 void sysputXs(WINDOW* , int, int, int); 177 void sysputuint64(WINDOW* , int, int, int, uint64_t, int); 178 void sysputwuint64(WINDOW* , int, int, int, uint64_t, int); 179 180 #define SYSTAT_CMD(name) \ 181 void close ## name(WINDOW *); \ 182 void fetch ## name(void); \ 183 int init ## name(void); \ 184 void label ## name(void); \ 185 WINDOW *open ## name(void); \ 186 void reset ## name(void); \ 187 void show ## name(void) 188 189 SYSTAT_CMD( zarc ); 190 SYSTAT_CMD( sctp ); 191 SYSTAT_CMD( iolat ); 192