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