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