Home | History | Annotate | Line # | Download | only in systat
      1 /*	$NetBSD: extern.h,v 1.49 2022/10/28 05:24:08 ozaki-r Exp $	*/
      2 
      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  */
     33 
     34 #include <sys/cdefs.h>
     35 #include <fcntl.h>
     36 #include <stdbool.h>
     37 #include <kvm.h>
     38 
     39 #define ADJINETCTR(c, o, n, e)	(c.e = n.e - o.e)
     40 #define xADJINETCTR(c, o, n, e)	(c[e] = n[e] - o[e])
     41 #define MAXFAIL	5
     42 
     43 extern struct	command global_commands[];
     44 extern struct	mode *curmode;
     45 extern struct	mode modes[];
     46 extern struct	text *xtext;
     47 extern WINDOW	*wnd;
     48 extern char	*namp, hostname[];
     49 extern double	avenrun[3];
     50 extern float	*dk_mspw;
     51 extern kvm_t	*kd;
     52 extern long	ntext, textp;
     53 extern int	CMDLINE;
     54 extern int	hz, stathz, maxslp;
     55 extern double	naptime;
     56 extern int	nhosts;
     57 extern int	nports;
     58 extern int	protos;
     59 extern int	verbose;
     60 extern int	nflag;
     61 extern char	*memf;
     62 extern int	allflag;
     63 extern int	turns;
     64 extern gid_t	egid;
     65 extern float	hertz;
     66 extern double	etime;
     67 extern bool 	showzero;
     68 
     69 struct inpcb;
     70 
     71 int	 checkhost(struct inpcb *);
     72 int	 checkport(struct inpcb *);
     73 #ifdef INET6
     74 int	 checkhost6(struct inpcb *);
     75 #endif
     76 void	 closebufcache(WINDOW *);
     77 void	 closedf(WINDOW *);
     78 void	 closeicmp(WINDOW *);
     79 void	 closeifstat(WINDOW *);
     80 void	 closeiostat(WINDOW *);
     81 void	 closeip(WINDOW *);
     82 void	 closevmstat(WINDOW *);
     83 void	 closesyscall(WINDOW *);
     84 void	 closembufs(WINDOW *);
     85 void	 closenetstat(WINDOW *);
     86 void	 closepigs(WINDOW *);
     87 void	 closeswap(WINDOW *);
     88 void	 closetcp(WINDOW *);
     89 int	 cmdifstat(const char *, const char *);
     90 void	 command(char *);
     91 void	 df_all(char *);
     92 void	 df_some(char *);
     93 void	 die(int) __dead;
     94 void	 disks_add(char *);
     95 void	 disks_remove(char *);
     96 void	 disks_drives(char *);
     97 void	 display(int);
     98 void	 error(const char *, ...) __printflike(1, 2);
     99 void	 clearerror(void);
    100 void	 fetchbufcache(void);
    101 void	 fetchdf(void);
    102 void	 fetchicmp(void);
    103 void	 fetchifstat(void);
    104 void	 fetchiostat(void);
    105 void	 fetchip(void);
    106 void	 fetchvmstat(void);
    107 void	 fetchsyscall(void);
    108 void	 fetchmbufs(void);
    109 void	 fetchnetstat(void);
    110 void	 fetchpigs(void);
    111 void	 fetchswap(void);
    112 void	 fetchtcp(void);
    113 int	 fetch_cptime(u_int64_t *);
    114 void	 global_help(char *);
    115 void	 global_interval(char *);
    116 void	 global_load(char *);
    117 void	 global_quit(char *) __dead;
    118 void	 global_stop(char *);
    119 void	 icmp_boot(char *);
    120 void	 icmp_run(char *);
    121 void	 icmp_time(char *);
    122 void	 icmp_zero(char *);
    123 int	 ifcmd(const char *cmd, const char *args);
    124 void	 ifstat_match(char*);
    125 void	 ifstat_pps(char*);
    126 void	 ifstat_scale(char*);
    127 int	 initbufcache(void);
    128 int	 initdf(void);
    129 int	 initicmp(void);
    130 int	 initifstat(void);
    131 int	 initiostat(void);
    132 int	 initip(void);
    133 int	 initvmstat(void);
    134 int	 initsyscall(void);
    135 int	 initmbufs(void);
    136 int	 initnetstat(void);
    137 int	 initpigs(void);
    138 int	 initswap(void);
    139 int	 inittcp(void);
    140 void	 iostat_bars(char *);
    141 void	 iostat_numbers(char *);
    142 void	 iostat_secs(char *);
    143 void	 iostat_rw(char *);
    144 void	 iostat_all(char *);
    145 void	 ip_boot(char *);
    146 void	 ip_run(char *);
    147 void	 ip_time(char *);
    148 void	 ip_zero(char *);
    149 void	 keyboard(void) __dead;
    150 ssize_t	 kvm_ckread(const void *, void *, size_t, const char *);
    151 void	 labelbufcache(void);
    152 void	 labeldf(void);
    153 void	 labelicmp(void);
    154 void	 labelifstat(void);
    155 void	 labeliostat(void);
    156 void	 labelip(void);
    157 void	 labelvmstat(void);
    158 void	 labelsyscall(void);
    159 void	 labelmbufs(void);
    160 void	 labelnetstat(void);
    161 void	 labelpigs(void);
    162 void	 labelps(void);
    163 void	 labels(void);
    164 void	 labelswap(void);
    165 void	 labeltcp(void);
    166 void	 labeltcpsyn(void);
    167 void	 netstat_all(char *);
    168 void	 netstat_display(char *);
    169 void	 netstat_ignore(char *);
    170 void	 netstat_names(char *);
    171 void	 netstat_numbers(char *);
    172 void	 netstat_reset(char *);
    173 void	 netstat_show(char *);
    174 void	 netstat_tcp(char *);
    175 void	 netstat_udp(char *);
    176 void	 nlisterr(struct nlist []) __dead;
    177 WINDOW	*openbufcache(void);
    178 WINDOW	*opendf(void);
    179 WINDOW	*openicmp(void);
    180 WINDOW	*openifstat(void);
    181 WINDOW	*openiostat(void);
    182 WINDOW	*openip(void);
    183 WINDOW	*openvmstat(void);
    184 WINDOW	*opensyscall(void);
    185 WINDOW	*openmbufs(void);
    186 WINDOW	*opennetstat(void);
    187 WINDOW	*openpigs(void);
    188 WINDOW	*openswap(void);
    189 WINDOW	*opentcp(void);
    190 int	 prefix(const char *, const char *);
    191 void	 ps_user(char *);
    192 void	 redraw(void);
    193 void	 showbufcache(void);
    194 void	 showdf(void);
    195 void	 showicmp(void);
    196 void	 showifstat(void);
    197 void	 showiostat(void);
    198 void	 showip(void);
    199 void	 showvmstat(void);
    200 void	 showsyscall(void);
    201 void	 showmbufs(void);
    202 void	 shownetstat(void);
    203 void	 showpigs(void);
    204 void	 showps(void);
    205 void	 showswap(void);
    206 void	 showtcp(void);
    207 void	 showtcpsyn(void);
    208 void	 status(void);
    209 void	 switch_mode(struct mode *);
    210 void	 tcp_boot(char *);
    211 void	 tcp_run(char *);
    212 void	 tcp_time(char *);
    213 void	 tcp_zero(char *);
    214 bool	 toofast(int *);
    215 void	 vmstat_boot(char *);
    216 void	 vmstat_run(char *);
    217 void	 vmstat_time(char *);
    218 void	 vmstat_zero(char *);
    219 void	 syscall_boot(char *);
    220 void	 syscall_run(char *);
    221 void	 syscall_time(char *);
    222 void	 syscall_zero(char *);
    223 void	 syscall_order(char *);
    224 void	 syscall_show(char *);
    225 
    226 #ifdef INET6
    227 void	 closeip6(WINDOW *);
    228 void	 fetchip6(void);
    229 int	 initip6(void);
    230 void	 labelip6(void);
    231 WINDOW	*openip6(void);
    232 void	 showip6(void);
    233 void	 ip6_boot(char *);
    234 void	 ip6_run(char *);
    235 void	 ip6_time(char *);
    236 void	 ip6_zero(char *);
    237 #endif
    238