xref: /freebsd/usr.bin/systat/extern.h (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
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 
32 #include <sys/cdefs.h>
33 #include <fcntl.h>
34 #include <kvm.h>
35 
36 extern struct	cmdtab *curcmd;
37 extern struct	cmdtab cmdtab[];
38 extern struct	text *xtext;
39 extern WINDOW	*wnd;
40 extern char	**dr_name;
41 extern char	c, *namp, hostname[];
42 extern double	avenrun[3];
43 extern float	*dk_mspw;
44 extern kvm_t	*kd;
45 extern long	ntext, textp;
46 extern int	*dk_select;
47 extern int	CMDLINE;
48 extern int	dk_ndrive;
49 extern int	hz, stathz;
50 extern double	hertz;		/* sampling frequency for cp_time and dk_time */
51 extern int	col;
52 extern int	nhosts;
53 extern int	nports;
54 extern int	protos;
55 extern int	verbose;
56 extern unsigned int	delay;
57 
58 extern int	curscale;
59 extern char	*matchline;
60 extern int	showpps;
61 extern int	needsort;
62 
63 struct in_conninfo;
64 
65 extern struct device_selection *dev_select;
66 extern long			generation;
67 extern int			num_devices;
68 extern int			num_selected;
69 extern int			num_selections;
70 extern long			select_generation;
71 
72 extern struct nlist		namelist[];
73 
74 int	 checkhost(struct in_conninfo *);
75 int	 checkport(struct in_conninfo *);
76 void	 closeicmp(WINDOW *);
77 void	 closeicmp6(WINDOW *);
78 void	 closeifstat(WINDOW *);
79 void	 closeiostat(WINDOW *);
80 void	 closeip(WINDOW *);
81 void	 closeip6(WINDOW *);
82 void	 closekre(WINDOW *);
83 void	 closenetstat(WINDOW *);
84 void	 closepigs(WINDOW *);
85 void	 closeswap(WINDOW *);
86 void	 closetcp(WINDOW *);
87 int	 cmdifstat(const char *, const char *);
88 int	 cmdiolat(const char *, const char *);
89 int	 cmdiostat(const char *, const char *);
90 int	 cmdkre(const char *, const char *);
91 int	 cmdnetstat(const char *, const char *);
92 struct	 cmdtab *lookup(const char *);
93 void	 command(const char *);
94 void	 die(int);
95 void	 display(void);
96 int	 dkinit(void);
97 int	 dkcmd(char *, char *);
98 void	 error(const char *fmt, ...) __printflike(1, 2);
99 void	 fetchicmp(void);
100 void	 fetchicmp6(void);
101 void	 fetchifstat(void);
102 void	 fetchip(void);
103 void	 fetchip6(void);
104 void	 fetchiostat(void);
105 void	 fetchkre(void);
106 void	 fetchnetstat(void);
107 void	 fetchpigs(void);
108 void	 fetchswap(void);
109 void	 fetchtcp(void);
110 void	 getsysctl(const char *, void *, size_t);
111 int	 ifcmd(const char *cmd, const char *args);
112 int	 initicmp(void);
113 int	 initicmp6(void);
114 int	 initifstat(void);
115 int	 initip(void);
116 int	 initip6(void);
117 int	 initiostat(void);
118 int	 initkre(void);
119 int	 initnetstat(void);
120 int	 initpigs(void);
121 int	 initswap(void);
122 int	 inittcp(void);
123 int	 keyboard(void);
124 int	 kvm_ckread(void *, void *, int);
125 void	 labelicmp(void);
126 void	 labelicmp6(void);
127 void	 labelifstat(void);
128 void	 labelip(void);
129 void	 labelip6(void);
130 void	 labeliostat(void);
131 void	 labelkre(void);
132 void	 labelnetstat(void);
133 void	 labelpigs(void);
134 void	 labels(void);
135 void	 labelswap(void);
136 void	 labeltcp(void);
137 void	 load(void);
138 int	 netcmd(const char *, const char *);
139 void	 nlisterr(struct nlist []);
140 WINDOW	*openicmp(void);
141 WINDOW	*openicmp6(void);
142 WINDOW	*openifstat(void);
143 WINDOW	*openip(void);
144 WINDOW	*openip6(void);
145 WINDOW	*openiostat(void);
146 WINDOW	*openkre(void);
147 WINDOW	*opennetstat(void);
148 WINDOW	*openpigs(void);
149 WINDOW	*openswap(void);
150 WINDOW	*opentcp(void);
151 int	 prefix(const char *, const char *);
152 void	 reseticmp(void);
153 void	 reseticmp6(void);
154 void	 resetip(void);
155 void	 resetip6(void);
156 void	 resettcp(void);
157 void	 showicmp(void);
158 void	 showicmp6(void);
159 void	 showifstat(void);
160 void	 showip(void);
161 void	 showip6(void);
162 void	 showiostat(void);
163 void	 showkre(void);
164 void	 shownetstat(void);
165 void	 showpigs(void);
166 void	 showswap(void);
167 void	 showtcp(void);
168 void	 status(void);
169 void	 suspend(int);
170 char	*sysctl_dynread(const char *, size_t *);
171 void	 sysputpage(WINDOW* , int, int, int, uint64_t, int);
172 void	 sysputspaces(WINDOW* , int, int, int);
173 void	 sysputstrs(WINDOW* , int, int, int);
174 void	 sysputXs(WINDOW* , int, int, int);
175 void	 sysputuint64(WINDOW* , int, int, int, uint64_t, int);
176 void	 sysputwuint64(WINDOW* , int, int, int, uint64_t, int);
177 
178 #define SYSTAT_CMD(name)	\
179 	void	 close ## name(WINDOW *); \
180 	void	 fetch ## name(void); \
181 	int	 init ## name(void); \
182 	void	 label ## name(void); \
183 	WINDOW	*open ## name(void); \
184 	void	 reset ## name(void); \
185 	void	 show ## name(void)
186 
187 SYSTAT_CMD( zarc );
188 SYSTAT_CMD( sctp );
189 SYSTAT_CMD( iolat );
190