xref: /freebsd/usr.bin/systat/extern.h (revision 9a8fc6bba3de1d06e3da2e11f85f496ee642d5bc)
19b50d902SRodney W. Grimes /*-
28a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
38a16b7a1SPedro F. Giffuni  *
49b50d902SRodney W. Grimes  * Copyright (c) 1991, 1993
59b50d902SRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
69b50d902SRodney W. Grimes  *
79b50d902SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
89b50d902SRodney W. Grimes  * modification, are permitted provided that the following conditions
99b50d902SRodney W. Grimes  * are met:
109b50d902SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
119b50d902SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
129b50d902SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
139b50d902SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
149b50d902SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
15fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
169b50d902SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
179b50d902SRodney W. Grimes  *    without specific prior written permission.
189b50d902SRodney W. Grimes  *
199b50d902SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
209b50d902SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
219b50d902SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229b50d902SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
239b50d902SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
249b50d902SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
259b50d902SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
269b50d902SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
279b50d902SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
289b50d902SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
299b50d902SRodney W. Grimes  * SUCH DAMAGE.
309b50d902SRodney W. Grimes  *
319b50d902SRodney W. Grimes  *      @(#)extern.h	8.1 (Berkeley) 6/6/93
32342e2faaSThomas Moestl  * $FreeBSD$
339b50d902SRodney W. Grimes  */
349b50d902SRodney W. Grimes 
359b50d902SRodney W. Grimes #include <sys/cdefs.h>
369b50d902SRodney W. Grimes #include <fcntl.h>
379b50d902SRodney W. Grimes #include <kvm.h>
389b50d902SRodney W. Grimes 
399b50d902SRodney W. Grimes extern struct	cmdtab *curcmd;
409b50d902SRodney W. Grimes extern struct	cmdtab cmdtab[];
419b50d902SRodney W. Grimes extern struct	text *xtext;
429b50d902SRodney W. Grimes extern WINDOW	*wnd;
439b50d902SRodney W. Grimes extern char	**dr_name;
449b50d902SRodney W. Grimes extern char	c, *namp, hostname[];
459b50d902SRodney W. Grimes extern double	avenrun[3];
469b50d902SRodney W. Grimes extern float	*dk_mspw;
479b50d902SRodney W. Grimes extern kvm_t	*kd;
489b50d902SRodney W. Grimes extern long	ntext, textp;
499b50d902SRodney W. Grimes extern int	*dk_select;
509b50d902SRodney W. Grimes extern int	CMDLINE;
519b50d902SRodney W. Grimes extern int	dk_ndrive;
529b50d902SRodney W. Grimes extern int	hz, stathz;
533544ae54SBruce Evans extern double	hertz;		/* sampling frequency for cp_time and dk_time */
548b3daf89SAlexander V. Chernikov extern int	col;
559b50d902SRodney W. Grimes extern int	nhosts;
569b50d902SRodney W. Grimes extern int	nports;
579b50d902SRodney W. Grimes extern int	protos;
589b50d902SRodney W. Grimes extern int	verbose;
598b3daf89SAlexander V. Chernikov extern unsigned int	delay;
609b50d902SRodney W. Grimes 
61cc65eb4eSGleb Smirnoff struct in_conninfo;
629b50d902SRodney W. Grimes 
638d2fbde5SJustin T. Gibbs extern struct device_selection *dev_select;
64bcc6a3daSKenneth D. Merry extern long			generation;
658d2fbde5SJustin T. Gibbs extern int			num_devices;
668d2fbde5SJustin T. Gibbs extern int			num_selected;
678d2fbde5SJustin T. Gibbs extern int			num_selections;
68bcc6a3daSKenneth D. Merry extern long			select_generation;
698d2fbde5SJustin T. Gibbs 
70342e2faaSThomas Moestl extern struct nlist		namelist[];
71342e2faaSThomas Moestl 
72cc65eb4eSGleb Smirnoff int	 checkhost(struct in_conninfo *);
73cc65eb4eSGleb Smirnoff int	 checkport(struct in_conninfo *);
743f330d7dSWarner Losh void	 closeicmp(WINDOW *);
75f29d8c1aSDavid Malone void	 closeicmp6(WINDOW *);
76b59ba7dfSPoul-Henning Kamp void	 closeifstat(WINDOW *);
77b59ba7dfSPoul-Henning Kamp void	 closeiostat(WINDOW *);
783f330d7dSWarner Losh void	 closeip(WINDOW *);
79f29d8c1aSDavid Malone void	 closeip6(WINDOW *);
803f330d7dSWarner Losh void	 closekre(WINDOW *);
813f330d7dSWarner Losh void	 closenetstat(WINDOW *);
823f330d7dSWarner Losh void	 closepigs(WINDOW *);
833f330d7dSWarner Losh void	 closeswap(WINDOW *);
843f330d7dSWarner Losh void	 closetcp(WINDOW *);
85b59ba7dfSPoul-Henning Kamp int	 cmdifstat(const char *, const char *);
863f330d7dSWarner Losh int	 cmdiostat(const char *, const char *);
873f330d7dSWarner Losh int	 cmdkre(const char *, const char *);
883f330d7dSWarner Losh int	 cmdnetstat(const char *, const char *);
893f330d7dSWarner Losh struct	 cmdtab *lookup(const char *);
903f330d7dSWarner Losh void	 command(const char *);
913f330d7dSWarner Losh void	 die(int);
928b3daf89SAlexander V. Chernikov void	 display(void);
933f330d7dSWarner Losh int	 dkinit(void);
943f330d7dSWarner Losh int	 dkcmd(char *, char *);
953f330d7dSWarner Losh void	 error(const char *fmt, ...) __printflike(1, 2);
963f330d7dSWarner Losh void	 fetchicmp(void);
97f29d8c1aSDavid Malone void	 fetchicmp6(void);
98b59ba7dfSPoul-Henning Kamp void	 fetchifstat(void);
993f330d7dSWarner Losh void	 fetchip(void);
100f29d8c1aSDavid Malone void	 fetchip6(void);
1013f330d7dSWarner Losh void	 fetchiostat(void);
1023f330d7dSWarner Losh void	 fetchkre(void);
1033f330d7dSWarner Losh void	 fetchnetstat(void);
1043f330d7dSWarner Losh void	 fetchpigs(void);
1053f330d7dSWarner Losh void	 fetchswap(void);
1063f330d7dSWarner Losh void	 fetchtcp(void);
1073f330d7dSWarner Losh void	 getsysctl(const char *, void *, size_t);
10833dc5491SDavid Malone int	 ifcmd(const char *cmd, const char *args);
1093f330d7dSWarner Losh int	 initicmp(void);
110f29d8c1aSDavid Malone int	 initicmp6(void);
111b59ba7dfSPoul-Henning Kamp int	 initifstat(void);
1123f330d7dSWarner Losh int	 initip(void);
113f29d8c1aSDavid Malone int	 initip6(void);
1143f330d7dSWarner Losh int	 initiostat(void);
1153f330d7dSWarner Losh int	 initkre(void);
1163f330d7dSWarner Losh int	 initnetstat(void);
1173f330d7dSWarner Losh int	 initpigs(void);
1183f330d7dSWarner Losh int	 initswap(void);
1193f330d7dSWarner Losh int	 inittcp(void);
1203f330d7dSWarner Losh int	 keyboard(void);
1213f330d7dSWarner Losh int	 kvm_ckread(void *, void *, int);
1223f330d7dSWarner Losh void	 labelicmp(void);
123f29d8c1aSDavid Malone void	 labelicmp6(void);
124b59ba7dfSPoul-Henning Kamp void	 labelifstat(void);
1253f330d7dSWarner Losh void	 labelip(void);
126f29d8c1aSDavid Malone void	 labelip6(void);
1273f330d7dSWarner Losh void	 labeliostat(void);
1283f330d7dSWarner Losh void	 labelkre(void);
1293f330d7dSWarner Losh void	 labelnetstat(void);
1303f330d7dSWarner Losh void	 labelpigs(void);
1313f330d7dSWarner Losh void	 labels(void);
1323f330d7dSWarner Losh void	 labelswap(void);
1333f330d7dSWarner Losh void	 labeltcp(void);
1343f330d7dSWarner Losh void	 load(void);
1353f330d7dSWarner Losh int	 netcmd(const char *, const char *);
1363f330d7dSWarner Losh void	 nlisterr(struct nlist []);
1373f330d7dSWarner Losh WINDOW	*openicmp(void);
138f29d8c1aSDavid Malone WINDOW	*openicmp6(void);
139b59ba7dfSPoul-Henning Kamp WINDOW	*openifstat(void);
1403f330d7dSWarner Losh WINDOW	*openip(void);
141f29d8c1aSDavid Malone WINDOW	*openip6(void);
1423f330d7dSWarner Losh WINDOW	*openiostat(void);
1433f330d7dSWarner Losh WINDOW	*openkre(void);
1443f330d7dSWarner Losh WINDOW	*opennetstat(void);
1453f330d7dSWarner Losh WINDOW	*openpigs(void);
1463f330d7dSWarner Losh WINDOW	*openswap(void);
1473f330d7dSWarner Losh WINDOW	*opentcp(void);
1483f330d7dSWarner Losh int	 prefix(const char *, const char *);
1493f330d7dSWarner Losh void	 reseticmp(void);
150f29d8c1aSDavid Malone void	 reseticmp6(void);
1513f330d7dSWarner Losh void	 resetip(void);
152f29d8c1aSDavid Malone void	 resetip6(void);
1533f330d7dSWarner Losh void	 resettcp(void);
1543f330d7dSWarner Losh void	 showicmp(void);
155f29d8c1aSDavid Malone void	 showicmp6(void);
156b59ba7dfSPoul-Henning Kamp void	 showifstat(void);
1573f330d7dSWarner Losh void	 showip(void);
158f29d8c1aSDavid Malone void	 showip6(void);
1593f330d7dSWarner Losh void	 showiostat(void);
1603f330d7dSWarner Losh void	 showkre(void);
1613f330d7dSWarner Losh void	 shownetstat(void);
1623f330d7dSWarner Losh void	 showpigs(void);
1633f330d7dSWarner Losh void	 showswap(void);
1643f330d7dSWarner Losh void	 showtcp(void);
1653f330d7dSWarner Losh void	 status(void);
1663f330d7dSWarner Losh void	 suspend(int);
1673f330d7dSWarner Losh char	*sysctl_dynread(const char *, size_t *);
168*9a8fc6bbSMichael Reifenberger void	 sysputpage(WINDOW* , int, int, int, uint64_t, int);
169*9a8fc6bbSMichael Reifenberger void	 sysputspaces(WINDOW* , int, int, int);
1704bde6353SMichael Reifenberger void	 sysputstrs(WINDOW* , int, int, int);
1714bde6353SMichael Reifenberger void	 sysputuint64(WINDOW* , int, int, int, uint64_t, int);
172*9a8fc6bbSMichael Reifenberger void	 sysputwuint64(WINDOW* , int, int, int, uint64_t, int);
17327aa4769SMichael Reifenberger 
17427aa4769SMichael Reifenberger #define SYSTAT_CMD(name)	\
17527aa4769SMichael Reifenberger 	void	 close ## name(WINDOW *); \
17627aa4769SMichael Reifenberger 	void	 fetch ## name(void); \
17727aa4769SMichael Reifenberger 	int	 init ## name(void); \
17827aa4769SMichael Reifenberger 	void	 label ## name(void); \
17927aa4769SMichael Reifenberger 	WINDOW	*open ## name(void); \
18027aa4769SMichael Reifenberger 	void	 reset ## name(void); \
18127aa4769SMichael Reifenberger 	void	 show ## name(void)
18227aa4769SMichael Reifenberger 
18327aa4769SMichael Reifenberger SYSTAT_CMD( zarc );
1841eaa5682SMichael Tuexen SYSTAT_CMD( sctp );
185