xref: /netbsd/usr.bin/systat/extern.h (revision c4a72b64)
1 /*	$NetBSD: extern.h,v 1.28 2002/11/01 12:47:57 mrg 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. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by the University of
18  *	California, Berkeley and its contributors.
19  * 4. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *      @(#)extern.h	8.1 (Berkeley) 6/6/93
36  */
37 
38 #include <sys/cdefs.h>
39 #include <fcntl.h>
40 #include <kvm.h>
41 
42 #define ADJINETCTR(c, o, n, e)	(c.e = n.e - o.e)
43 
44 extern struct	command global_commands[];
45 extern struct	mode *curmode;
46 extern struct	mode modes[];
47 extern struct	text *xtext;
48 extern WINDOW	*wnd;
49 extern char	c, *namp, hostname[];
50 extern double	avenrun[3];
51 extern float	*dk_mspw;
52 extern kvm_t	*kd;
53 extern long	ntext, textp;
54 extern int	CMDLINE;
55 extern int	hz, stathz, maxslp;
56 extern int	naptime, col;
57 extern int	nhosts;
58 extern int	nports;
59 extern int	protos;
60 extern int	verbose;
61 extern int	nflag;
62 extern char	*memf;
63 extern int	allflag;
64 extern int	turns;
65 extern gid_t	egid;
66 
67 struct inpcb;
68 #ifdef INET6
69 struct in6pcb;
70 #endif
71 
72 int	 checkhost(struct inpcb *);
73 int	 checkport(struct inpcb *);
74 #ifdef INET6
75 int	 checkhost6(struct in6pcb *);
76 int	 checkport6(struct in6pcb *);
77 #endif
78 void	 closebufcache(WINDOW *);
79 void	 closeicmp(WINDOW *);
80 void	 closeiostat(WINDOW *);
81 void	 closeip(WINDOW *);
82 void	 closevmstat(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	 die(int);
90 void	 disks_add(char *);
91 void	 disks_delete(char *);
92 void	 disks_drives(char *);
93 void	 display(int);
94 void	 error(const char *, ...)
95      __attribute__((__format__(__printf__, 1, 2)));
96 void	 fetchbufcache(void);
97 void	 fetchicmp(void);
98 void	 fetchiostat(void);
99 void	 fetchip(void);
100 void	 fetchvmstat(void);
101 void	 fetchmbufs(void);
102 void	 fetchnetstat(void);
103 void	 fetchpigs(void);
104 void	 fetchswap(void);
105 void	 fetchtcp(void);
106 int	 fetch_cptime(u_int64_t *);
107 void	 global_help(char *);
108 void	 global_interval(char *);
109 void	 global_load(char *);
110 void	 global_quit(char *);
111 void	 global_stop(char *);
112 void	 icmp_boot(char *);
113 void	 icmp_run(char *);
114 void	 icmp_time(char *);
115 void	 icmp_zero(char *);
116 int	 initbufcache(void);
117 int	 initicmp(void);
118 int	 initiostat(void);
119 int	 initip(void);
120 int	 initvmstat(void);
121 int	 initmbufs(void);
122 int	 initnetstat(void);
123 int	 initpigs(void);
124 int	 initswap(void);
125 int	 inittcp(void);
126 void	 iostat_bars(char *);
127 void	 iostat_numbers(char *);
128 void	 iostat_secs(char *);
129 void	 iostat_rw(char *);
130 void	 iostat_all(char *);
131 void	 ip_boot(char *);
132 void	 ip_run(char *);
133 void	 ip_time(char *);
134 void	 ip_zero(char *);
135 int	 keyboard(void) __attribute__((__noreturn__));
136 ssize_t	 kvm_ckread(void *, void *, size_t);
137 void	 labelbufcache(void);
138 void	 labelicmp(void);
139 void	 labeliostat(void);
140 void	 labelip(void);
141 void	 labelvmstat(void);
142 void	 labelmbufs(void);
143 void	 labelnetstat(void);
144 void	 labelpigs(void);
145 void	 labelps(void);
146 void	 labels(void);
147 void	 labelswap(void);
148 void	 labeltcp(void);
149 void	 labeltcpsyn(void);
150 void	 netstat_all(char *);
151 void	 netstat_display(char *);
152 void	 netstat_ignore(char *);
153 void	 netstat_names(char *);
154 void	 netstat_numbers(char *);
155 void	 netstat_reset(char *);
156 void	 netstat_show(char *);
157 void	 netstat_tcp(char *);
158 void	 netstat_udp(char *);
159 void	 nlisterr(struct nlist []);
160 WINDOW	*openbufcache(void);
161 WINDOW	*openicmp(void);
162 WINDOW	*openiostat(void);
163 WINDOW	*openip(void);
164 WINDOW	*openvmstat(void);
165 WINDOW	*openmbufs(void);
166 WINDOW	*opennetstat(void);
167 WINDOW	*openpigs(void);
168 WINDOW	*openswap(void);
169 WINDOW	*opentcp(void);
170 void	 ps_user(char *);
171 void	 redraw(int);
172 void	 showbufcache(void);
173 void	 showicmp(void);
174 void	 showiostat(void);
175 void	 showip(void);
176 void	 showvmstat(void);
177 void	 showmbufs(void);
178 void	 shownetstat(void);
179 void	 showpigs(void);
180 void	 showps(void);
181 void	 showswap(void);
182 void	 showtcp(void);
183 void	 showtcpsyn(void);
184 void	 status(void);
185 void	 switch_mode(struct mode *);
186 void	 tcp_boot(char *);
187 void	 tcp_run(char *);
188 void	 tcp_time(char *);
189 void	 tcp_zero(char *);
190 void	 vmstat_boot(char *);
191 void	 vmstat_run(char *);
192 void	 vmstat_time(char *);
193 void	 vmstat_zero(char *);
194 
195 #ifdef INET6
196 void	 closeip6(WINDOW *);
197 void	 fetchip6(void);
198 int	 initip6(void);
199 void	 labelip6(void);
200 WINDOW	*openip6(void);
201 void	 showip6(void);
202 void	 ip6_boot(char *);
203 void	 ip6_run(char *);
204 void	 ip6_time(char *);
205 void	 ip6_zero(char *);
206 #endif
207 
208 #ifdef IPSEC
209 void	 closeipsec(WINDOW *);
210 void	 fetchipsec(void);
211 int	 initipsec(void);
212 void	 labelipsec(void);
213 WINDOW	*openipsec(void);
214 void	 showipsec(void);
215 void	 ipsec_boot(char *);
216 void	 ipsec_run(char *);
217 void	 ipsec_time(char *);
218 void	 ipsec_zero(char *);
219 #endif
220