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