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. 139b50d902SRodney W. Grimes * 4. 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 */ 52*8b3daf89SAlexander 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; 57*8b3daf89SAlexander V. Chernikov extern unsigned int delay; 589b50d902SRodney W. Grimes 599b50d902SRodney W. Grimes struct inpcb; 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 703f330d7dSWarner Losh int checkhost(struct inpcb *); 713f330d7dSWarner Losh int checkport(struct inpcb *); 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 closembufs(WINDOW *); 803f330d7dSWarner Losh void closenetstat(WINDOW *); 813f330d7dSWarner Losh void closepigs(WINDOW *); 823f330d7dSWarner Losh void closeswap(WINDOW *); 833f330d7dSWarner Losh void closetcp(WINDOW *); 84b59ba7dfSPoul-Henning Kamp int cmdifstat(const char *, const char *); 853f330d7dSWarner Losh int cmdiostat(const char *, const char *); 863f330d7dSWarner Losh int cmdkre(const char *, const char *); 873f330d7dSWarner Losh int cmdnetstat(const char *, const char *); 883f330d7dSWarner Losh struct cmdtab *lookup(const char *); 893f330d7dSWarner Losh void command(const char *); 903f330d7dSWarner Losh void die(int); 91*8b3daf89SAlexander V. Chernikov void display(void); 923f330d7dSWarner Losh int dkinit(void); 933f330d7dSWarner Losh int dkcmd(char *, char *); 943f330d7dSWarner Losh void error(const char *fmt, ...) __printflike(1, 2); 953f330d7dSWarner Losh void fetchicmp(void); 96f29d8c1aSDavid Malone void fetchicmp6(void); 97b59ba7dfSPoul-Henning Kamp void fetchifstat(void); 983f330d7dSWarner Losh void fetchip(void); 99f29d8c1aSDavid Malone void fetchip6(void); 1003f330d7dSWarner Losh void fetchiostat(void); 1013f330d7dSWarner Losh void fetchkre(void); 1023f330d7dSWarner Losh void fetchmbufs(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 initmbufs(void); 1173f330d7dSWarner Losh int initnetstat(void); 1183f330d7dSWarner Losh int initpigs(void); 1193f330d7dSWarner Losh int initswap(void); 1203f330d7dSWarner Losh int inittcp(void); 1213f330d7dSWarner Losh int keyboard(void); 1223f330d7dSWarner Losh int kvm_ckread(void *, void *, int); 1233f330d7dSWarner Losh void labelicmp(void); 124f29d8c1aSDavid Malone void labelicmp6(void); 125b59ba7dfSPoul-Henning Kamp void labelifstat(void); 1263f330d7dSWarner Losh void labelip(void); 127f29d8c1aSDavid Malone void labelip6(void); 1283f330d7dSWarner Losh void labeliostat(void); 1293f330d7dSWarner Losh void labelkre(void); 1303f330d7dSWarner Losh void labelmbufs(void); 1313f330d7dSWarner Losh void labelnetstat(void); 1323f330d7dSWarner Losh void labelpigs(void); 1333f330d7dSWarner Losh void labels(void); 1343f330d7dSWarner Losh void labelswap(void); 1353f330d7dSWarner Losh void labeltcp(void); 1363f330d7dSWarner Losh void load(void); 1373f330d7dSWarner Losh int netcmd(const char *, const char *); 1383f330d7dSWarner Losh void nlisterr(struct nlist []); 1393f330d7dSWarner Losh WINDOW *openicmp(void); 140f29d8c1aSDavid Malone WINDOW *openicmp6(void); 141b59ba7dfSPoul-Henning Kamp WINDOW *openifstat(void); 1423f330d7dSWarner Losh WINDOW *openip(void); 143f29d8c1aSDavid Malone WINDOW *openip6(void); 1443f330d7dSWarner Losh WINDOW *openiostat(void); 1453f330d7dSWarner Losh WINDOW *openkre(void); 1463f330d7dSWarner Losh WINDOW *openmbufs(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 showmbufs(void); 1653f330d7dSWarner Losh void shownetstat(void); 1663f330d7dSWarner Losh void showpigs(void); 1673f330d7dSWarner Losh void showswap(void); 1683f330d7dSWarner Losh void showtcp(void); 1693f330d7dSWarner Losh void status(void); 1703f330d7dSWarner Losh void suspend(int); 1713f330d7dSWarner Losh char *sysctl_dynread(const char *, size_t *); 172