xref: /freebsd/usr.bin/systat/extern.h (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
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 
329b50d902SRodney W. Grimes #include <sys/cdefs.h>
339b50d902SRodney W. Grimes #include <fcntl.h>
349b50d902SRodney W. Grimes #include <kvm.h>
359b50d902SRodney W. Grimes 
369b50d902SRodney W. Grimes extern struct	cmdtab *curcmd;
379b50d902SRodney W. Grimes extern struct	cmdtab cmdtab[];
389b50d902SRodney W. Grimes extern struct	text *xtext;
399b50d902SRodney W. Grimes extern WINDOW	*wnd;
409b50d902SRodney W. Grimes extern char	**dr_name;
419b50d902SRodney W. Grimes extern char	c, *namp, hostname[];
429b50d902SRodney W. Grimes extern double	avenrun[3];
439b50d902SRodney W. Grimes extern float	*dk_mspw;
449b50d902SRodney W. Grimes extern kvm_t	*kd;
459b50d902SRodney W. Grimes extern long	ntext, textp;
469b50d902SRodney W. Grimes extern int	*dk_select;
479b50d902SRodney W. Grimes extern int	CMDLINE;
489b50d902SRodney W. Grimes extern int	dk_ndrive;
499b50d902SRodney W. Grimes extern int	hz, stathz;
503544ae54SBruce Evans extern double	hertz;		/* sampling frequency for cp_time and dk_time */
518b3daf89SAlexander V. Chernikov extern int	col;
529b50d902SRodney W. Grimes extern int	nhosts;
539b50d902SRodney W. Grimes extern int	nports;
549b50d902SRodney W. Grimes extern int	protos;
559b50d902SRodney W. Grimes extern int	verbose;
568b3daf89SAlexander V. Chernikov extern unsigned int	delay;
579b50d902SRodney W. Grimes 
586d88f9feSMateusz Guzik extern int	curscale;
596d88f9feSMateusz Guzik extern char	*matchline;
606d88f9feSMateusz Guzik extern int	showpps;
616d88f9feSMateusz Guzik extern int	needsort;
626d88f9feSMateusz Guzik 
63cc65eb4eSGleb Smirnoff struct in_conninfo;
649b50d902SRodney W. Grimes 
658d2fbde5SJustin T. Gibbs extern struct device_selection *dev_select;
66bcc6a3daSKenneth D. Merry extern long			generation;
678d2fbde5SJustin T. Gibbs extern int			num_devices;
688d2fbde5SJustin T. Gibbs extern int			num_selected;
698d2fbde5SJustin T. Gibbs extern int			num_selections;
70bcc6a3daSKenneth D. Merry extern long			select_generation;
718d2fbde5SJustin T. Gibbs 
72342e2faaSThomas Moestl extern struct nlist		namelist[];
73342e2faaSThomas Moestl 
74cc65eb4eSGleb Smirnoff int	 checkhost(struct in_conninfo *);
75cc65eb4eSGleb Smirnoff int	 checkport(struct in_conninfo *);
763f330d7dSWarner Losh void	 closeicmp(WINDOW *);
77f29d8c1aSDavid Malone void	 closeicmp6(WINDOW *);
78b59ba7dfSPoul-Henning Kamp void	 closeifstat(WINDOW *);
79b59ba7dfSPoul-Henning Kamp void	 closeiostat(WINDOW *);
803f330d7dSWarner Losh void	 closeip(WINDOW *);
81f29d8c1aSDavid Malone void	 closeip6(WINDOW *);
823f330d7dSWarner Losh void	 closekre(WINDOW *);
833f330d7dSWarner Losh void	 closenetstat(WINDOW *);
843f330d7dSWarner Losh void	 closepigs(WINDOW *);
853f330d7dSWarner Losh void	 closeswap(WINDOW *);
863f330d7dSWarner Losh void	 closetcp(WINDOW *);
87b59ba7dfSPoul-Henning Kamp int	 cmdifstat(const char *, const char *);
88*22054f88SWarner Losh int	 cmdiolat(const char *, const char *);
893f330d7dSWarner Losh int	 cmdiostat(const char *, const char *);
903f330d7dSWarner Losh int	 cmdkre(const char *, const char *);
913f330d7dSWarner Losh int	 cmdnetstat(const char *, const char *);
923f330d7dSWarner Losh struct	 cmdtab *lookup(const char *);
933f330d7dSWarner Losh void	 command(const char *);
943f330d7dSWarner Losh void	 die(int);
958b3daf89SAlexander V. Chernikov void	 display(void);
963f330d7dSWarner Losh int	 dkinit(void);
973f330d7dSWarner Losh int	 dkcmd(char *, char *);
983f330d7dSWarner Losh void	 error(const char *fmt, ...) __printflike(1, 2);
993f330d7dSWarner Losh void	 fetchicmp(void);
100f29d8c1aSDavid Malone void	 fetchicmp6(void);
101b59ba7dfSPoul-Henning Kamp void	 fetchifstat(void);
1023f330d7dSWarner Losh void	 fetchip(void);
103f29d8c1aSDavid Malone void	 fetchip6(void);
1043f330d7dSWarner Losh void	 fetchiostat(void);
1053f330d7dSWarner Losh void	 fetchkre(void);
1063f330d7dSWarner Losh void	 fetchnetstat(void);
1073f330d7dSWarner Losh void	 fetchpigs(void);
1083f330d7dSWarner Losh void	 fetchswap(void);
1093f330d7dSWarner Losh void	 fetchtcp(void);
1103f330d7dSWarner Losh void	 getsysctl(const char *, void *, size_t);
11133dc5491SDavid Malone int	 ifcmd(const char *cmd, const char *args);
1123f330d7dSWarner Losh int	 initicmp(void);
113f29d8c1aSDavid Malone int	 initicmp6(void);
114b59ba7dfSPoul-Henning Kamp int	 initifstat(void);
1153f330d7dSWarner Losh int	 initip(void);
116f29d8c1aSDavid Malone int	 initip6(void);
1173f330d7dSWarner Losh int	 initiostat(void);
1183f330d7dSWarner Losh int	 initkre(void);
1193f330d7dSWarner Losh int	 initnetstat(void);
1203f330d7dSWarner Losh int	 initpigs(void);
1213f330d7dSWarner Losh int	 initswap(void);
1223f330d7dSWarner Losh int	 inittcp(void);
1233f330d7dSWarner Losh int	 keyboard(void);
1243f330d7dSWarner Losh int	 kvm_ckread(void *, void *, int);
1253f330d7dSWarner Losh void	 labelicmp(void);
126f29d8c1aSDavid Malone void	 labelicmp6(void);
127b59ba7dfSPoul-Henning Kamp void	 labelifstat(void);
1283f330d7dSWarner Losh void	 labelip(void);
129f29d8c1aSDavid Malone void	 labelip6(void);
1303f330d7dSWarner Losh void	 labeliostat(void);
1313f330d7dSWarner Losh void	 labelkre(void);
1323f330d7dSWarner Losh void	 labelnetstat(void);
1333f330d7dSWarner Losh void	 labelpigs(void);
1343f330d7dSWarner Losh void	 labels(void);
1353f330d7dSWarner Losh void	 labelswap(void);
1363f330d7dSWarner Losh void	 labeltcp(void);
1373f330d7dSWarner Losh void	 load(void);
1383f330d7dSWarner Losh int	 netcmd(const char *, const char *);
1393f330d7dSWarner Losh void	 nlisterr(struct nlist []);
1403f330d7dSWarner Losh WINDOW	*openicmp(void);
141f29d8c1aSDavid Malone WINDOW	*openicmp6(void);
142b59ba7dfSPoul-Henning Kamp WINDOW	*openifstat(void);
1433f330d7dSWarner Losh WINDOW	*openip(void);
144f29d8c1aSDavid Malone WINDOW	*openip6(void);
1453f330d7dSWarner Losh WINDOW	*openiostat(void);
1463f330d7dSWarner Losh WINDOW	*openkre(void);
1473f330d7dSWarner Losh WINDOW	*opennetstat(void);
1483f330d7dSWarner Losh WINDOW	*openpigs(void);
1493f330d7dSWarner Losh WINDOW	*openswap(void);
1503f330d7dSWarner Losh WINDOW	*opentcp(void);
1513f330d7dSWarner Losh int	 prefix(const char *, const char *);
1523f330d7dSWarner Losh void	 reseticmp(void);
153f29d8c1aSDavid Malone void	 reseticmp6(void);
1543f330d7dSWarner Losh void	 resetip(void);
155f29d8c1aSDavid Malone void	 resetip6(void);
1563f330d7dSWarner Losh void	 resettcp(void);
1573f330d7dSWarner Losh void	 showicmp(void);
158f29d8c1aSDavid Malone void	 showicmp6(void);
159b59ba7dfSPoul-Henning Kamp void	 showifstat(void);
1603f330d7dSWarner Losh void	 showip(void);
161f29d8c1aSDavid Malone void	 showip6(void);
1623f330d7dSWarner Losh void	 showiostat(void);
1633f330d7dSWarner Losh void	 showkre(void);
1643f330d7dSWarner Losh void	 shownetstat(void);
1653f330d7dSWarner Losh void	 showpigs(void);
1663f330d7dSWarner Losh void	 showswap(void);
1673f330d7dSWarner Losh void	 showtcp(void);
1683f330d7dSWarner Losh void	 status(void);
1693f330d7dSWarner Losh void	 suspend(int);
1703f330d7dSWarner Losh char	*sysctl_dynread(const char *, size_t *);
1719a8fc6bbSMichael Reifenberger void	 sysputpage(WINDOW* , int, int, int, uint64_t, int);
1729a8fc6bbSMichael Reifenberger void	 sysputspaces(WINDOW* , int, int, int);
1734bde6353SMichael Reifenberger void	 sysputstrs(WINDOW* , int, int, int);
1748d06c3e7SMichael Reifenberger void	 sysputXs(WINDOW* , int, int, int);
1754bde6353SMichael Reifenberger void	 sysputuint64(WINDOW* , int, int, int, uint64_t, int);
1769a8fc6bbSMichael Reifenberger void	 sysputwuint64(WINDOW* , int, int, int, uint64_t, int);
17727aa4769SMichael Reifenberger 
17827aa4769SMichael Reifenberger #define SYSTAT_CMD(name)	\
17927aa4769SMichael Reifenberger 	void	 close ## name(WINDOW *); \
18027aa4769SMichael Reifenberger 	void	 fetch ## name(void); \
18127aa4769SMichael Reifenberger 	int	 init ## name(void); \
18227aa4769SMichael Reifenberger 	void	 label ## name(void); \
18327aa4769SMichael Reifenberger 	WINDOW	*open ## name(void); \
18427aa4769SMichael Reifenberger 	void	 reset ## name(void); \
18527aa4769SMichael Reifenberger 	void	 show ## name(void)
18627aa4769SMichael Reifenberger 
18727aa4769SMichael Reifenberger SYSTAT_CMD( zarc );
1881eaa5682SMichael Tuexen SYSTAT_CMD( sctp );
189*22054f88SWarner Losh SYSTAT_CMD( iolat );
190