xref: /freebsd/usr.bin/systat/extern.h (revision b0b1dbdd)
1 /*-
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *      @(#)extern.h	8.1 (Berkeley) 6/6/93
30  * $FreeBSD$
31  */
32 
33 #include <sys/cdefs.h>
34 #include <fcntl.h>
35 #include <kvm.h>
36 
37 extern struct	cmdtab *curcmd;
38 extern struct	cmdtab cmdtab[];
39 extern struct	text *xtext;
40 extern WINDOW	*wnd;
41 extern char	**dr_name;
42 extern char	c, *namp, hostname[];
43 extern double	avenrun[3];
44 extern float	*dk_mspw;
45 extern kvm_t	*kd;
46 extern long	ntext, textp;
47 extern int	*dk_select;
48 extern int	CMDLINE;
49 extern int	dk_ndrive;
50 extern int	hz, stathz;
51 extern double	hertz;		/* sampling frequency for cp_time and dk_time */
52 extern int	col;
53 extern int	nhosts;
54 extern int	nports;
55 extern int	protos;
56 extern int	verbose;
57 extern unsigned int	delay;
58 
59 struct inpcb;
60 
61 extern struct device_selection *dev_select;
62 extern long			generation;
63 extern int			num_devices;
64 extern int			num_selected;
65 extern int			num_selections;
66 extern long			select_generation;
67 
68 extern struct nlist		namelist[];
69 
70 int	 checkhost(struct inpcb *);
71 int	 checkport(struct inpcb *);
72 void	 closeicmp(WINDOW *);
73 void	 closeicmp6(WINDOW *);
74 void	 closeifstat(WINDOW *);
75 void	 closeiostat(WINDOW *);
76 void	 closeip(WINDOW *);
77 void	 closeip6(WINDOW *);
78 void	 closekre(WINDOW *);
79 void	 closenetstat(WINDOW *);
80 void	 closepigs(WINDOW *);
81 void	 closeswap(WINDOW *);
82 void	 closetcp(WINDOW *);
83 int	 cmdifstat(const char *, const char *);
84 int	 cmdiostat(const char *, const char *);
85 int	 cmdkre(const char *, const char *);
86 int	 cmdnetstat(const char *, const char *);
87 struct	 cmdtab *lookup(const char *);
88 void	 command(const char *);
89 void	 die(int);
90 void	 display(void);
91 int	 dkinit(void);
92 int	 dkcmd(char *, char *);
93 void	 error(const char *fmt, ...) __printflike(1, 2);
94 void	 fetchicmp(void);
95 void	 fetchicmp6(void);
96 void	 fetchifstat(void);
97 void	 fetchip(void);
98 void	 fetchip6(void);
99 void	 fetchiostat(void);
100 void	 fetchkre(void);
101 void	 fetchnetstat(void);
102 void	 fetchpigs(void);
103 void	 fetchswap(void);
104 void	 fetchtcp(void);
105 void	 getsysctl(const char *, void *, size_t);
106 int	 ifcmd(const char *cmd, const char *args);
107 int	 initicmp(void);
108 int	 initicmp6(void);
109 int	 initifstat(void);
110 int	 initip(void);
111 int	 initip6(void);
112 int	 initiostat(void);
113 int	 initkre(void);
114 int	 initnetstat(void);
115 int	 initpigs(void);
116 int	 initswap(void);
117 int	 inittcp(void);
118 int	 keyboard(void);
119 int	 kvm_ckread(void *, void *, int);
120 void	 labelicmp(void);
121 void	 labelicmp6(void);
122 void	 labelifstat(void);
123 void	 labelip(void);
124 void	 labelip6(void);
125 void	 labeliostat(void);
126 void	 labelkre(void);
127 void	 labelnetstat(void);
128 void	 labelpigs(void);
129 void	 labels(void);
130 void	 labelswap(void);
131 void	 labeltcp(void);
132 void	 load(void);
133 int	 netcmd(const char *, const char *);
134 void	 nlisterr(struct nlist []);
135 WINDOW	*openicmp(void);
136 WINDOW	*openicmp6(void);
137 WINDOW	*openifstat(void);
138 WINDOW	*openip(void);
139 WINDOW	*openip6(void);
140 WINDOW	*openiostat(void);
141 WINDOW	*openkre(void);
142 WINDOW	*opennetstat(void);
143 WINDOW	*openpigs(void);
144 WINDOW	*openswap(void);
145 WINDOW	*opentcp(void);
146 int	 prefix(const char *, const char *);
147 void	 reseticmp(void);
148 void	 reseticmp6(void);
149 void	 resetip(void);
150 void	 resetip6(void);
151 void	 resettcp(void);
152 void	 showicmp(void);
153 void	 showicmp6(void);
154 void	 showifstat(void);
155 void	 showip(void);
156 void	 showip6(void);
157 void	 showiostat(void);
158 void	 showkre(void);
159 void	 shownetstat(void);
160 void	 showpigs(void);
161 void	 showswap(void);
162 void	 showtcp(void);
163 void	 status(void);
164 void	 suspend(int);
165 char	*sysctl_dynread(const char *, size_t *);
166 
167 #define SYSTAT_CMD(name)	\
168 	void	 close ## name(WINDOW *); \
169 	void	 fetch ## name(void); \
170 	int	 init ## name(void); \
171 	void	 label ## name(void); \
172 	WINDOW	*open ## name(void); \
173 	void	 reset ## name(void); \
174 	void	 show ## name(void)
175 
176 SYSTAT_CMD( zarc );
177 SYSTAT_CMD ( sctp );
178