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