xref: /netbsd-src/usr.bin/systat/extern.h (revision 23c8222edbfb0f0932d88a8351d3a0cf817dfb9e)
1 /*	$NetBSD: extern.h,v 1.34 2004/03/27 00:53:59 martin 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 
40 extern struct	command global_commands[];
41 extern struct	mode *curmode;
42 extern struct	mode modes[];
43 extern struct	text *xtext;
44 extern WINDOW	*wnd;
45 extern char	c, *namp, hostname[];
46 extern double	avenrun[3];
47 extern float	*dk_mspw;
48 extern kvm_t	*kd;
49 extern long	ntext, textp;
50 extern int	CMDLINE;
51 extern int	hz, stathz, maxslp;
52 extern int	naptime, col;
53 extern int	nhosts;
54 extern int	nports;
55 extern int	protos;
56 extern int	verbose;
57 extern int	nflag;
58 extern char	*memf;
59 extern int	allflag;
60 extern int	turns;
61 extern gid_t	egid;
62 
63 struct inpcb;
64 #ifdef INET6
65 struct in6pcb;
66 #endif
67 
68 int	 checkhost(struct inpcb *);
69 int	 checkport(struct inpcb *);
70 #ifdef INET6
71 int	 checkhost6(struct in6pcb *);
72 int	 checkport6(struct in6pcb *);
73 #endif
74 void	 closebufcache(WINDOW *);
75 void	 closeicmp(WINDOW *);
76 void	 closeiostat(WINDOW *);
77 void	 closeip(WINDOW *);
78 void	 closevmstat(WINDOW *);
79 void	 closembufs(WINDOW *);
80 void	 closenetstat(WINDOW *);
81 void	 closepigs(WINDOW *);
82 void	 closeswap(WINDOW *);
83 void	 closetcp(WINDOW *);
84 void	 command(char *);
85 void	 die(int);
86 void	 disks_add(char *);
87 void	 disks_remove(char *);
88 void	 disks_drives(char *);
89 void	 display(int);
90 void	 error(const char *, ...)
91      __attribute__((__format__(__printf__, 1, 2)));
92 void	 fetchbufcache(void);
93 void	 fetchicmp(void);
94 void	 fetchiostat(void);
95 void	 fetchip(void);
96 void	 fetchvmstat(void);
97 void	 fetchmbufs(void);
98 void	 fetchnetstat(void);
99 void	 fetchpigs(void);
100 void	 fetchswap(void);
101 void	 fetchtcp(void);
102 int	 fetch_cptime(u_int64_t *);
103 void	 global_help(char *);
104 void	 global_interval(char *);
105 void	 global_load(char *);
106 void	 global_quit(char *);
107 void	 global_stop(char *);
108 void	 icmp_boot(char *);
109 void	 icmp_run(char *);
110 void	 icmp_time(char *);
111 void	 icmp_zero(char *);
112 int	 initbufcache(void);
113 int	 initicmp(void);
114 int	 initiostat(void);
115 int	 initip(void);
116 int	 initvmstat(void);
117 int	 initmbufs(void);
118 int	 initnetstat(void);
119 int	 initpigs(void);
120 int	 initswap(void);
121 int	 inittcp(void);
122 void	 iostat_bars(char *);
123 void	 iostat_numbers(char *);
124 void	 iostat_secs(char *);
125 void	 iostat_rw(char *);
126 void	 iostat_all(char *);
127 void	 ip_boot(char *);
128 void	 ip_run(char *);
129 void	 ip_time(char *);
130 void	 ip_zero(char *);
131 void	 keyboard(void) __attribute__((__noreturn__));
132 ssize_t	 kvm_ckread(const void *, void *, size_t, const char *);
133 void	 labelbufcache(void);
134 void	 labelicmp(void);
135 void	 labeliostat(void);
136 void	 labelip(void);
137 void	 labelvmstat(void);
138 void	 labelmbufs(void);
139 void	 labelnetstat(void);
140 void	 labelpigs(void);
141 void	 labelps(void);
142 void	 labels(void);
143 void	 labelswap(void);
144 void	 labeltcp(void);
145 void	 labeltcpsyn(void);
146 void	 netstat_all(char *);
147 void	 netstat_display(char *);
148 void	 netstat_ignore(char *);
149 void	 netstat_names(char *);
150 void	 netstat_numbers(char *);
151 void	 netstat_reset(char *);
152 void	 netstat_show(char *);
153 void	 netstat_tcp(char *);
154 void	 netstat_udp(char *);
155 void	 nlisterr(struct nlist []) __attribute__((__noreturn__));
156 WINDOW	*openbufcache(void);
157 WINDOW	*openicmp(void);
158 WINDOW	*openiostat(void);
159 WINDOW	*openip(void);
160 WINDOW	*openvmstat(void);
161 WINDOW	*openmbufs(void);
162 WINDOW	*opennetstat(void);
163 WINDOW	*openpigs(void);
164 WINDOW	*openswap(void);
165 WINDOW	*opentcp(void);
166 void	 ps_user(char *);
167 void	 redraw(int);
168 void	 showbufcache(void);
169 void	 showicmp(void);
170 void	 showiostat(void);
171 void	 showip(void);
172 void	 showvmstat(void);
173 void	 showmbufs(void);
174 void	 shownetstat(void);
175 void	 showpigs(void);
176 void	 showps(void);
177 void	 showswap(void);
178 void	 showtcp(void);
179 void	 showtcpsyn(void);
180 void	 status(void);
181 void	 switch_mode(struct mode *);
182 void	 tcp_boot(char *);
183 void	 tcp_run(char *);
184 void	 tcp_time(char *);
185 void	 tcp_zero(char *);
186 void	 vmstat_boot(char *);
187 void	 vmstat_run(char *);
188 void	 vmstat_time(char *);
189 void	 vmstat_zero(char *);
190 
191 #ifdef INET6
192 void	 closeip6(WINDOW *);
193 void	 fetchip6(void);
194 int	 initip6(void);
195 void	 labelip6(void);
196 WINDOW	*openip6(void);
197 void	 showip6(void);
198 void	 ip6_boot(char *);
199 void	 ip6_run(char *);
200 void	 ip6_time(char *);
201 void	 ip6_zero(char *);
202 #endif
203 
204 #ifdef IPSEC
205 void	 closeipsec(WINDOW *);
206 void	 fetchipsec(void);
207 int	 initipsec(void);
208 void	 labelipsec(void);
209 WINDOW	*openipsec(void);
210 void	 showipsec(void);
211 void	 ipsec_boot(char *);
212 void	 ipsec_run(char *);
213 void	 ipsec_time(char *);
214 void	 ipsec_zero(char *);
215 #endif
216