1 /* $NetBSD: extern.h,v 1.46 2016/10/22 22:02:55 christos Exp $ */ 2 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 #define ADJINETCTR(c, o, n, e) (c.e = n.e - o.e) 39 #define xADJINETCTR(c, o, n, e) (c[e] = n[e] - o[e]) 40 41 extern struct command global_commands[]; 42 extern struct mode *curmode; 43 extern struct mode modes[]; 44 extern struct text *xtext; 45 extern WINDOW *wnd; 46 extern char *namp, hostname[]; 47 extern double avenrun[3]; 48 extern float *dk_mspw; 49 extern kvm_t *kd; 50 extern long ntext, textp; 51 extern int CMDLINE; 52 extern int hz, stathz, maxslp; 53 extern double naptime; 54 extern int nhosts; 55 extern int nports; 56 extern int protos; 57 extern int verbose; 58 extern int nflag; 59 extern char *memf; 60 extern int allflag; 61 extern int turns; 62 extern gid_t egid; 63 64 struct inpcb; 65 #ifdef INET6 66 struct in6pcb; 67 #endif 68 69 int checkhost(struct inpcb *); 70 int checkport(struct inpcb *); 71 #ifdef INET6 72 int checkhost6(struct in6pcb *); 73 int checkport6(struct in6pcb *); 74 #endif 75 void closebufcache(WINDOW *); 76 void closedf(WINDOW *); 77 void closeicmp(WINDOW *); 78 void closeifstat(WINDOW *); 79 void closeiostat(WINDOW *); 80 void closeip(WINDOW *); 81 void closevmstat(WINDOW *); 82 void closesyscall(WINDOW *); 83 void closembufs(WINDOW *); 84 void closenetstat(WINDOW *); 85 void closepigs(WINDOW *); 86 void closeswap(WINDOW *); 87 void closetcp(WINDOW *); 88 int cmdifstat(const char *, const char *); 89 void command(char *); 90 void df_all(char *); 91 void df_some(char *); 92 void die(int) __dead; 93 void disks_add(char *); 94 void disks_remove(char *); 95 void disks_drives(char *); 96 void display(int); 97 void error(const char *, ...) __printflike(1, 2); 98 void clearerror(void); 99 void fetchbufcache(void); 100 void fetchdf(void); 101 void fetchicmp(void); 102 void fetchifstat(void); 103 void fetchiostat(void); 104 void fetchip(void); 105 void fetchvmstat(void); 106 void fetchsyscall(void); 107 void fetchmbufs(void); 108 void fetchnetstat(void); 109 void fetchpigs(void); 110 void fetchswap(void); 111 void fetchtcp(void); 112 int fetch_cptime(u_int64_t *); 113 void global_help(char *); 114 void global_interval(char *); 115 void global_load(char *); 116 void global_quit(char *) __dead; 117 void global_stop(char *); 118 void icmp_boot(char *); 119 void icmp_run(char *); 120 void icmp_time(char *); 121 void icmp_zero(char *); 122 int ifcmd(const char *cmd, const char *args); 123 void ifstat_match(char*); 124 void ifstat_pps(char*); 125 void ifstat_scale(char*); 126 int initbufcache(void); 127 int initdf(void); 128 int initicmp(void); 129 int initifstat(void); 130 int initiostat(void); 131 int initip(void); 132 int initvmstat(void); 133 int initsyscall(void); 134 int initmbufs(void); 135 int initnetstat(void); 136 int initpigs(void); 137 int initswap(void); 138 int inittcp(void); 139 void iostat_bars(char *); 140 void iostat_numbers(char *); 141 void iostat_secs(char *); 142 void iostat_rw(char *); 143 void iostat_all(char *); 144 void ip_boot(char *); 145 void ip_run(char *); 146 void ip_time(char *); 147 void ip_zero(char *); 148 void keyboard(void) __dead; 149 ssize_t kvm_ckread(const void *, void *, size_t, const char *); 150 void labelbufcache(void); 151 void labeldf(void); 152 void labelicmp(void); 153 void labelifstat(void); 154 void labeliostat(void); 155 void labelip(void); 156 void labelvmstat(void); 157 void labelsyscall(void); 158 void labelmbufs(void); 159 void labelnetstat(void); 160 void labelpigs(void); 161 void labelps(void); 162 void labels(void); 163 void labelswap(void); 164 void labeltcp(void); 165 void labeltcpsyn(void); 166 void netstat_all(char *); 167 void netstat_display(char *); 168 void netstat_ignore(char *); 169 void netstat_names(char *); 170 void netstat_numbers(char *); 171 void netstat_reset(char *); 172 void netstat_show(char *); 173 void netstat_tcp(char *); 174 void netstat_udp(char *); 175 void nlisterr(struct nlist []) __dead; 176 WINDOW *openbufcache(void); 177 WINDOW *opendf(void); 178 WINDOW *openicmp(void); 179 WINDOW *openifstat(void); 180 WINDOW *openiostat(void); 181 WINDOW *openip(void); 182 WINDOW *openvmstat(void); 183 WINDOW *opensyscall(void); 184 WINDOW *openmbufs(void); 185 WINDOW *opennetstat(void); 186 WINDOW *openpigs(void); 187 WINDOW *openswap(void); 188 WINDOW *opentcp(void); 189 int prefix(const char *, const char *); 190 void ps_user(char *); 191 void redraw(void); 192 void showbufcache(void); 193 void showdf(void); 194 void showicmp(void); 195 void showifstat(void); 196 void showiostat(void); 197 void showip(void); 198 void showvmstat(void); 199 void showsyscall(void); 200 void showmbufs(void); 201 void shownetstat(void); 202 void showpigs(void); 203 void showps(void); 204 void showswap(void); 205 void showtcp(void); 206 void showtcpsyn(void); 207 void status(void); 208 void switch_mode(struct mode *); 209 void tcp_boot(char *); 210 void tcp_run(char *); 211 void tcp_time(char *); 212 void tcp_zero(char *); 213 void vmstat_boot(char *); 214 void vmstat_run(char *); 215 void vmstat_time(char *); 216 void vmstat_zero(char *); 217 void syscall_boot(char *); 218 void syscall_run(char *); 219 void syscall_time(char *); 220 void syscall_zero(char *); 221 void syscall_order(char *); 222 void syscall_show(char *); 223 224 #ifdef INET6 225 void closeip6(WINDOW *); 226 void fetchip6(void); 227 int initip6(void); 228 void labelip6(void); 229 WINDOW *openip6(void); 230 void showip6(void); 231 void ip6_boot(char *); 232 void ip6_run(char *); 233 void ip6_time(char *); 234 void ip6_zero(char *); 235 #endif 236