1 1.49 ozaki /* $NetBSD: extern.h,v 1.49 2022/10/28 05:24:08 ozaki-r Exp $ */ 2 1.2 jtc 3 1.1 jtc /*- 4 1.1 jtc * Copyright (c) 1991, 1993 5 1.1 jtc * The Regents of the University of California. All rights reserved. 6 1.1 jtc * 7 1.1 jtc * Redistribution and use in source and binary forms, with or without 8 1.1 jtc * modification, are permitted provided that the following conditions 9 1.1 jtc * are met: 10 1.1 jtc * 1. Redistributions of source code must retain the above copyright 11 1.1 jtc * notice, this list of conditions and the following disclaimer. 12 1.1 jtc * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 jtc * notice, this list of conditions and the following disclaimer in the 14 1.1 jtc * documentation and/or other materials provided with the distribution. 15 1.31 agc * 3. Neither the name of the University nor the names of its contributors 16 1.1 jtc * may be used to endorse or promote products derived from this software 17 1.1 jtc * without specific prior written permission. 18 1.1 jtc * 19 1.1 jtc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20 1.1 jtc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 1.1 jtc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 1.1 jtc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23 1.1 jtc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 1.1 jtc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 1.1 jtc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 1.1 jtc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 1.1 jtc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 1.1 jtc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 1.1 jtc * SUCH DAMAGE. 30 1.1 jtc * 31 1.1 jtc * @(#)extern.h 8.1 (Berkeley) 6/6/93 32 1.1 jtc */ 33 1.1 jtc 34 1.1 jtc #include <sys/cdefs.h> 35 1.1 jtc #include <fcntl.h> 36 1.47 christos #include <stdbool.h> 37 1.1 jtc #include <kvm.h> 38 1.1 jtc 39 1.23 ad #define ADJINETCTR(c, o, n, e) (c.e = n.e - o.e) 40 1.39 thorpej #define xADJINETCTR(c, o, n, e) (c[e] = n[e] - o[e]) 41 1.47 christos #define MAXFAIL 5 42 1.23 ad 43 1.12 jwise extern struct command global_commands[]; 44 1.12 jwise extern struct mode *curmode; 45 1.12 jwise extern struct mode modes[]; 46 1.1 jtc extern struct text *xtext; 47 1.1 jtc extern WINDOW *wnd; 48 1.36 dsl extern char *namp, hostname[]; 49 1.1 jtc extern double avenrun[3]; 50 1.1 jtc extern float *dk_mspw; 51 1.1 jtc extern kvm_t *kd; 52 1.1 jtc extern long ntext, textp; 53 1.1 jtc extern int CMDLINE; 54 1.27 matt extern int hz, stathz, maxslp; 55 1.46 christos extern double naptime; 56 1.1 jtc extern int nhosts; 57 1.1 jtc extern int nports; 58 1.1 jtc extern int protos; 59 1.1 jtc extern int verbose; 60 1.20 itojun extern int nflag; 61 1.22 thorpej extern char *memf; 62 1.24 hubertf extern int allflag; 63 1.24 hubertf extern int turns; 64 1.26 simonb extern gid_t egid; 65 1.47 christos extern float hertz; 66 1.47 christos extern double etime; 67 1.48 christos extern bool showzero; 68 1.1 jtc 69 1.1 jtc struct inpcb; 70 1.1 jtc 71 1.23 ad int checkhost(struct inpcb *); 72 1.23 ad int checkport(struct inpcb *); 73 1.19 itojun #ifdef INET6 74 1.49 ozaki int checkhost6(struct inpcb *); 75 1.19 itojun #endif 76 1.23 ad void closebufcache(WINDOW *); 77 1.35 hubertf void closedf(WINDOW *); 78 1.23 ad void closeicmp(WINDOW *); 79 1.45 scole void closeifstat(WINDOW *); 80 1.23 ad void closeiostat(WINDOW *); 81 1.23 ad void closeip(WINDOW *); 82 1.23 ad void closevmstat(WINDOW *); 83 1.37 dsl void closesyscall(WINDOW *); 84 1.23 ad void closembufs(WINDOW *); 85 1.23 ad void closenetstat(WINDOW *); 86 1.23 ad void closepigs(WINDOW *); 87 1.23 ad void closeswap(WINDOW *); 88 1.23 ad void closetcp(WINDOW *); 89 1.45 scole int cmdifstat(const char *, const char *); 90 1.23 ad void command(char *); 91 1.35 hubertf void df_all(char *); 92 1.35 hubertf void df_some(char *); 93 1.41 joerg void die(int) __dead; 94 1.23 ad void disks_add(char *); 95 1.32 mycroft void disks_remove(char *); 96 1.23 ad void disks_drives(char *); 97 1.23 ad void display(int); 98 1.41 joerg void error(const char *, ...) __printflike(1, 2); 99 1.44 mrg void clearerror(void); 100 1.23 ad void fetchbufcache(void); 101 1.35 hubertf void fetchdf(void); 102 1.23 ad void fetchicmp(void); 103 1.45 scole void fetchifstat(void); 104 1.23 ad void fetchiostat(void); 105 1.23 ad void fetchip(void); 106 1.23 ad void fetchvmstat(void); 107 1.37 dsl void fetchsyscall(void); 108 1.23 ad void fetchmbufs(void); 109 1.23 ad void fetchnetstat(void); 110 1.23 ad void fetchpigs(void); 111 1.23 ad void fetchswap(void); 112 1.23 ad void fetchtcp(void); 113 1.23 ad int fetch_cptime(u_int64_t *); 114 1.23 ad void global_help(char *); 115 1.23 ad void global_interval(char *); 116 1.23 ad void global_load(char *); 117 1.41 joerg void global_quit(char *) __dead; 118 1.23 ad void global_stop(char *); 119 1.23 ad void icmp_boot(char *); 120 1.23 ad void icmp_run(char *); 121 1.23 ad void icmp_time(char *); 122 1.23 ad void icmp_zero(char *); 123 1.45 scole int ifcmd(const char *cmd, const char *args); 124 1.45 scole void ifstat_match(char*); 125 1.45 scole void ifstat_pps(char*); 126 1.45 scole void ifstat_scale(char*); 127 1.23 ad int initbufcache(void); 128 1.35 hubertf int initdf(void); 129 1.23 ad int initicmp(void); 130 1.45 scole int initifstat(void); 131 1.23 ad int initiostat(void); 132 1.23 ad int initip(void); 133 1.23 ad int initvmstat(void); 134 1.37 dsl int initsyscall(void); 135 1.23 ad int initmbufs(void); 136 1.23 ad int initnetstat(void); 137 1.23 ad int initpigs(void); 138 1.23 ad int initswap(void); 139 1.23 ad int inittcp(void); 140 1.23 ad void iostat_bars(char *); 141 1.23 ad void iostat_numbers(char *); 142 1.23 ad void iostat_secs(char *); 143 1.28 mrg void iostat_rw(char *); 144 1.28 mrg void iostat_all(char *); 145 1.23 ad void ip_boot(char *); 146 1.23 ad void ip_run(char *); 147 1.23 ad void ip_time(char *); 148 1.23 ad void ip_zero(char *); 149 1.41 joerg void keyboard(void) __dead; 150 1.33 christos ssize_t kvm_ckread(const void *, void *, size_t, const char *); 151 1.23 ad void labelbufcache(void); 152 1.35 hubertf void labeldf(void); 153 1.23 ad void labelicmp(void); 154 1.45 scole void labelifstat(void); 155 1.23 ad void labeliostat(void); 156 1.23 ad void labelip(void); 157 1.23 ad void labelvmstat(void); 158 1.37 dsl void labelsyscall(void); 159 1.23 ad void labelmbufs(void); 160 1.23 ad void labelnetstat(void); 161 1.23 ad void labelpigs(void); 162 1.23 ad void labelps(void); 163 1.23 ad void labels(void); 164 1.23 ad void labelswap(void); 165 1.23 ad void labeltcp(void); 166 1.23 ad void labeltcpsyn(void); 167 1.23 ad void netstat_all(char *); 168 1.23 ad void netstat_display(char *); 169 1.23 ad void netstat_ignore(char *); 170 1.23 ad void netstat_names(char *); 171 1.23 ad void netstat_numbers(char *); 172 1.23 ad void netstat_reset(char *); 173 1.23 ad void netstat_show(char *); 174 1.23 ad void netstat_tcp(char *); 175 1.23 ad void netstat_udp(char *); 176 1.41 joerg void nlisterr(struct nlist []) __dead; 177 1.23 ad WINDOW *openbufcache(void); 178 1.35 hubertf WINDOW *opendf(void); 179 1.23 ad WINDOW *openicmp(void); 180 1.45 scole WINDOW *openifstat(void); 181 1.23 ad WINDOW *openiostat(void); 182 1.23 ad WINDOW *openip(void); 183 1.23 ad WINDOW *openvmstat(void); 184 1.37 dsl WINDOW *opensyscall(void); 185 1.23 ad WINDOW *openmbufs(void); 186 1.23 ad WINDOW *opennetstat(void); 187 1.23 ad WINDOW *openpigs(void); 188 1.23 ad WINDOW *openswap(void); 189 1.23 ad WINDOW *opentcp(void); 190 1.45 scole int prefix(const char *, const char *); 191 1.23 ad void ps_user(char *); 192 1.38 christos void redraw(void); 193 1.23 ad void showbufcache(void); 194 1.35 hubertf void showdf(void); 195 1.23 ad void showicmp(void); 196 1.45 scole void showifstat(void); 197 1.23 ad void showiostat(void); 198 1.23 ad void showip(void); 199 1.23 ad void showvmstat(void); 200 1.37 dsl void showsyscall(void); 201 1.23 ad void showmbufs(void); 202 1.23 ad void shownetstat(void); 203 1.23 ad void showpigs(void); 204 1.23 ad void showps(void); 205 1.23 ad void showswap(void); 206 1.23 ad void showtcp(void); 207 1.23 ad void showtcpsyn(void); 208 1.23 ad void status(void); 209 1.24 hubertf void switch_mode(struct mode *); 210 1.23 ad void tcp_boot(char *); 211 1.23 ad void tcp_run(char *); 212 1.23 ad void tcp_time(char *); 213 1.23 ad void tcp_zero(char *); 214 1.47 christos bool toofast(int *); 215 1.23 ad void vmstat_boot(char *); 216 1.23 ad void vmstat_run(char *); 217 1.23 ad void vmstat_time(char *); 218 1.23 ad void vmstat_zero(char *); 219 1.37 dsl void syscall_boot(char *); 220 1.37 dsl void syscall_run(char *); 221 1.37 dsl void syscall_time(char *); 222 1.37 dsl void syscall_zero(char *); 223 1.37 dsl void syscall_order(char *); 224 1.37 dsl void syscall_show(char *); 225 1.23 ad 226 1.21 itojun #ifdef INET6 227 1.23 ad void closeip6(WINDOW *); 228 1.23 ad void fetchip6(void); 229 1.23 ad int initip6(void); 230 1.23 ad void labelip6(void); 231 1.23 ad WINDOW *openip6(void); 232 1.23 ad void showip6(void); 233 1.23 ad void ip6_boot(char *); 234 1.23 ad void ip6_run(char *); 235 1.23 ad void ip6_time(char *); 236 1.23 ad void ip6_zero(char *); 237 1.21 itojun #endif 238