19b50d902SRodney W. Grimes /*- 29b50d902SRodney W. Grimes * Copyright (c) 1991, 1993 39b50d902SRodney W. Grimes * The Regents of the University of California. All rights reserved. 49b50d902SRodney W. Grimes * 59b50d902SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 69b50d902SRodney W. Grimes * modification, are permitted provided that the following conditions 79b50d902SRodney W. Grimes * are met: 89b50d902SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 99b50d902SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 109b50d902SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 119b50d902SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 129b50d902SRodney W. Grimes * documentation and/or other materials provided with the distribution. 13fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 149b50d902SRodney W. Grimes * may be used to endorse or promote products derived from this software 159b50d902SRodney W. Grimes * without specific prior written permission. 169b50d902SRodney W. Grimes * 179b50d902SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 189b50d902SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 199b50d902SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 209b50d902SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 219b50d902SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 229b50d902SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 239b50d902SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 249b50d902SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 259b50d902SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 269b50d902SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 279b50d902SRodney W. Grimes * SUCH DAMAGE. 289b50d902SRodney W. Grimes * 299b50d902SRodney W. Grimes * @(#)extern.h 8.1 (Berkeley) 6/6/93 30342e2faaSThomas Moestl * $FreeBSD$ 319b50d902SRodney W. Grimes */ 329b50d902SRodney W. Grimes 339b50d902SRodney W. Grimes #include <sys/cdefs.h> 349b50d902SRodney W. Grimes #include <fcntl.h> 359b50d902SRodney W. Grimes #include <kvm.h> 369b50d902SRodney W. Grimes 379b50d902SRodney W. Grimes extern struct cmdtab *curcmd; 389b50d902SRodney W. Grimes extern struct cmdtab cmdtab[]; 399b50d902SRodney W. Grimes extern struct text *xtext; 409b50d902SRodney W. Grimes extern WINDOW *wnd; 419b50d902SRodney W. Grimes extern char **dr_name; 429b50d902SRodney W. Grimes extern char c, *namp, hostname[]; 439b50d902SRodney W. Grimes extern double avenrun[3]; 449b50d902SRodney W. Grimes extern float *dk_mspw; 459b50d902SRodney W. Grimes extern kvm_t *kd; 469b50d902SRodney W. Grimes extern long ntext, textp; 479b50d902SRodney W. Grimes extern int *dk_select; 489b50d902SRodney W. Grimes extern int CMDLINE; 499b50d902SRodney W. Grimes extern int dk_ndrive; 509b50d902SRodney W. Grimes extern int hz, stathz; 513544ae54SBruce Evans extern double hertz; /* sampling frequency for cp_time and dk_time */ 528b3daf89SAlexander V. Chernikov extern int col; 539b50d902SRodney W. Grimes extern int nhosts; 549b50d902SRodney W. Grimes extern int nports; 559b50d902SRodney W. Grimes extern int protos; 569b50d902SRodney W. Grimes extern int verbose; 578b3daf89SAlexander V. Chernikov extern unsigned int delay; 589b50d902SRodney W. Grimes 59*cc65eb4eSGleb Smirnoff struct in_conninfo; 609b50d902SRodney W. Grimes 618d2fbde5SJustin T. Gibbs extern struct device_selection *dev_select; 62bcc6a3daSKenneth D. Merry extern long generation; 638d2fbde5SJustin T. Gibbs extern int num_devices; 648d2fbde5SJustin T. Gibbs extern int num_selected; 658d2fbde5SJustin T. Gibbs extern int num_selections; 66bcc6a3daSKenneth D. Merry extern long select_generation; 678d2fbde5SJustin T. Gibbs 68342e2faaSThomas Moestl extern struct nlist namelist[]; 69342e2faaSThomas Moestl 70*cc65eb4eSGleb Smirnoff int checkhost(struct in_conninfo *); 71*cc65eb4eSGleb Smirnoff int checkport(struct in_conninfo *); 723f330d7dSWarner Losh void closeicmp(WINDOW *); 73f29d8c1aSDavid Malone void closeicmp6(WINDOW *); 74b59ba7dfSPoul-Henning Kamp void closeifstat(WINDOW *); 75b59ba7dfSPoul-Henning Kamp void closeiostat(WINDOW *); 763f330d7dSWarner Losh void closeip(WINDOW *); 77f29d8c1aSDavid Malone void closeip6(WINDOW *); 783f330d7dSWarner Losh void closekre(WINDOW *); 793f330d7dSWarner Losh void closenetstat(WINDOW *); 803f330d7dSWarner Losh void closepigs(WINDOW *); 813f330d7dSWarner Losh void closeswap(WINDOW *); 823f330d7dSWarner Losh void closetcp(WINDOW *); 83b59ba7dfSPoul-Henning Kamp int cmdifstat(const char *, const char *); 843f330d7dSWarner Losh int cmdiostat(const char *, const char *); 853f330d7dSWarner Losh int cmdkre(const char *, const char *); 863f330d7dSWarner Losh int cmdnetstat(const char *, const char *); 873f330d7dSWarner Losh struct cmdtab *lookup(const char *); 883f330d7dSWarner Losh void command(const char *); 893f330d7dSWarner Losh void die(int); 908b3daf89SAlexander V. Chernikov void display(void); 913f330d7dSWarner Losh int dkinit(void); 923f330d7dSWarner Losh int dkcmd(char *, char *); 933f330d7dSWarner Losh void error(const char *fmt, ...) __printflike(1, 2); 943f330d7dSWarner Losh void fetchicmp(void); 95f29d8c1aSDavid Malone void fetchicmp6(void); 96b59ba7dfSPoul-Henning Kamp void fetchifstat(void); 973f330d7dSWarner Losh void fetchip(void); 98f29d8c1aSDavid Malone void fetchip6(void); 993f330d7dSWarner Losh void fetchiostat(void); 1003f330d7dSWarner Losh void fetchkre(void); 1013f330d7dSWarner Losh void fetchnetstat(void); 1023f330d7dSWarner Losh void fetchpigs(void); 1033f330d7dSWarner Losh void fetchswap(void); 1043f330d7dSWarner Losh void fetchtcp(void); 1053f330d7dSWarner Losh void getsysctl(const char *, void *, size_t); 10633dc5491SDavid Malone int ifcmd(const char *cmd, const char *args); 1073f330d7dSWarner Losh int initicmp(void); 108f29d8c1aSDavid Malone int initicmp6(void); 109b59ba7dfSPoul-Henning Kamp int initifstat(void); 1103f330d7dSWarner Losh int initip(void); 111f29d8c1aSDavid Malone int initip6(void); 1123f330d7dSWarner Losh int initiostat(void); 1133f330d7dSWarner Losh int initkre(void); 1143f330d7dSWarner Losh int initnetstat(void); 1153f330d7dSWarner Losh int initpigs(void); 1163f330d7dSWarner Losh int initswap(void); 1173f330d7dSWarner Losh int inittcp(void); 1183f330d7dSWarner Losh int keyboard(void); 1193f330d7dSWarner Losh int kvm_ckread(void *, void *, int); 1203f330d7dSWarner Losh void labelicmp(void); 121f29d8c1aSDavid Malone void labelicmp6(void); 122b59ba7dfSPoul-Henning Kamp void labelifstat(void); 1233f330d7dSWarner Losh void labelip(void); 124f29d8c1aSDavid Malone void labelip6(void); 1253f330d7dSWarner Losh void labeliostat(void); 1263f330d7dSWarner Losh void labelkre(void); 1273f330d7dSWarner Losh void labelnetstat(void); 1283f330d7dSWarner Losh void labelpigs(void); 1293f330d7dSWarner Losh void labels(void); 1303f330d7dSWarner Losh void labelswap(void); 1313f330d7dSWarner Losh void labeltcp(void); 1323f330d7dSWarner Losh void load(void); 1333f330d7dSWarner Losh int netcmd(const char *, const char *); 1343f330d7dSWarner Losh void nlisterr(struct nlist []); 1353f330d7dSWarner Losh WINDOW *openicmp(void); 136f29d8c1aSDavid Malone WINDOW *openicmp6(void); 137b59ba7dfSPoul-Henning Kamp WINDOW *openifstat(void); 1383f330d7dSWarner Losh WINDOW *openip(void); 139f29d8c1aSDavid Malone WINDOW *openip6(void); 1403f330d7dSWarner Losh WINDOW *openiostat(void); 1413f330d7dSWarner Losh WINDOW *openkre(void); 1423f330d7dSWarner Losh WINDOW *opennetstat(void); 1433f330d7dSWarner Losh WINDOW *openpigs(void); 1443f330d7dSWarner Losh WINDOW *openswap(void); 1453f330d7dSWarner Losh WINDOW *opentcp(void); 1463f330d7dSWarner Losh int prefix(const char *, const char *); 1473f330d7dSWarner Losh void reseticmp(void); 148f29d8c1aSDavid Malone void reseticmp6(void); 1493f330d7dSWarner Losh void resetip(void); 150f29d8c1aSDavid Malone void resetip6(void); 1513f330d7dSWarner Losh void resettcp(void); 1523f330d7dSWarner Losh void showicmp(void); 153f29d8c1aSDavid Malone void showicmp6(void); 154b59ba7dfSPoul-Henning Kamp void showifstat(void); 1553f330d7dSWarner Losh void showip(void); 156f29d8c1aSDavid Malone void showip6(void); 1573f330d7dSWarner Losh void showiostat(void); 1583f330d7dSWarner Losh void showkre(void); 1593f330d7dSWarner Losh void shownetstat(void); 1603f330d7dSWarner Losh void showpigs(void); 1613f330d7dSWarner Losh void showswap(void); 1623f330d7dSWarner Losh void showtcp(void); 1633f330d7dSWarner Losh void status(void); 1643f330d7dSWarner Losh void suspend(int); 1653f330d7dSWarner Losh char *sysctl_dynread(const char *, size_t *); 16627aa4769SMichael Reifenberger 16727aa4769SMichael Reifenberger #define SYSTAT_CMD(name) \ 16827aa4769SMichael Reifenberger void close ## name(WINDOW *); \ 16927aa4769SMichael Reifenberger void fetch ## name(void); \ 17027aa4769SMichael Reifenberger int init ## name(void); \ 17127aa4769SMichael Reifenberger void label ## name(void); \ 17227aa4769SMichael Reifenberger WINDOW *open ## name(void); \ 17327aa4769SMichael Reifenberger void reset ## name(void); \ 17427aa4769SMichael Reifenberger void show ## name(void) 17527aa4769SMichael Reifenberger 17627aa4769SMichael Reifenberger SYSTAT_CMD( zarc ); 1771eaa5682SMichael Tuexen SYSTAT_CMD ( sctp ); 178