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