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