/*	@(#)sysinfo.h	13.3 (RC International) 91/06/10	*/

/**
 **  Sysinfo's request class is encoded in the high order
 **  word and the request type within the class in the
 **  low order word.
 **/

#include <sys/device.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/subpu.h>
#include <tsen/en.h>
#include <netinet/in.h>
#include <imc/imcrpu.h>
#include <rte/board_conf.h>
#include <rte/lan.h>

#define	_SI(x,y)	(('x'<<16)|y)

#define	SID_DISK	_SI(d, 0)	/* disk device/controller info */
#define	SID_TAPE	_SI(d, 1)	/* tape device/controller info */
#define	SID_SUBPU	_SI(d, 2)	/* subpu info */

#define	SIF_MOUNT	_SI(f, 0)	/* filesystem mount info */
#define	SIF_SPACE	_SI(f, 1)	/* filesystem space used/free */

#define SIL_CONFIG	_SI(l, 0)	/* LAN configuration */
#define SIL_IMCPORT	_SI(l, 1)	/* open IMC ports on the LAN's */
#define SIL_LANNAME	_SI(l, 2)	/* Map LAN names to contoller name */

#define	SIN_VERSION	_SI(n, 0)	/* node kernel version */
#define	SIN_STATUS	_SI(n, 1)	/* node status */
#define	SIN_TXINFO	_SI(n, 2)	/* tx information */
#define	SIN_BRDCONF	_SI(n, 3)	/* node board configuration */
#define	SIN_CONFIG	_SI(n, 4)	/* PU configuration */

#define	SIP_LONGP	_SI(p, 0)	/* process status - long args */
#define	SIP_SHORTP	_SI(p, 1)	/* process status - short args */
#define	SIP_RPU		_SI(p, 2)	/* RPU process status */

#define	SIS_LOADAV	_SI(s, 0)	/* rpu and upu load averages */
#define	SIS_CHAN	_SI(s, 1)	/* channel configuration */
#define	SIS_RTE		_SI(s, 2)	/* rpu rte global process statistics */
#define	SIS_DISK	_SI(s, 3)	/* disk statistics */
#define	SIS_VMSTAT	_SI(s, 4)	/* vmstat miscellaneous stats */
#define	SIS_VMTOTAL	_SI(s, 5)	/* pu totals for vm (current state) */
#define	SIS_VMMETER	_SI(s, 6)	/* pu counts for vm (recent+total) */
#define	SIS_FORK	_SI(s, 7)	/* fork statistics */
#define	SIS_MISCMEM	_SI(s, 8)	/* physical memory usage statistics */
#define	SIS_SWAPIO	_SI(s, 9)	/* swapping statistics */
#define	SIS_IP		_SI(s, 10)	/* IP transport statistics */
#define	SIS_INPCB	_SI(s, 11)	/* Internet protocol statistics */
#define	SIS_TCP		_SI(s, 12)	/* TCP statistics */
#define	SIS_UDP		_SI(s, 13)	/* UDP statistics */
#define	SIS_ICMP	_SI(s, 14)	/* ICMP statistics */
#define	SIS_RTINFO	_SI(s, 15)	/* Route table info */
#define	SIS_ROUTE	_SI(s, 16)	/* Route table statistics */
#define	SIS_INIFADDR	_SI(s, 17)	/* Network interfaces description */
#define	SIS_INTRQ	_SI(s, 18)	/* Intrq description */
#define	SIS_ARPTAB	_SI(s, 19)	/* Local ethernet devices description */
#define	SIS_RDWR	_SI(s, 20)	/* Read/Write call statistics */
#define	SIS_ETHER	_SI(s, 21)	/* Ethernet statistics */
#define	SIS_IOP		_SI(s, 22)	/* IOP statistics */
#define	SIS_TXQ		_SI(s, 23)	/* Txqueue statistics */
#define	SIS_SEM		_SI(s, 24)	/* Semaphore statistics */
#define	SIS_CMEM	_SI(s, 25)	/* Cmem usage statistics */
#define	SIS_HEAP	_SI(s, 26)	/* Heap table statistics */
#define	SIS_TRANS	_SI(s, 27)	/* Transaction statistics */
#define	SIS_BUFFER	_SI(s, 28)	/* Buffer cache statistics */
#define	SIS_RPULA	_SI(s, 29)	/* RPU-specific load statistics */
#define	SIS_TOTALS	_SI(s, 30)	/* Table usage summaries for pstat */

#define SII_DOMAINS	_SI(i,  0)	/* currently active domains */
#define SII_IP_STAT	_SI(i,  1)	/* IP protocol stats */
#define SII_TCP_PCB	_SI(i,  2)	/* TCP protocol control blocks */
#define SII_TCP_STAT	_SI(i,  3)	/* TCP protocol stats */
#define SII_UDP_PCB	_SI(i,  4)	/* UDP protocol control blocks */
#define SII_UDP_STAT	_SI(i,  5)	/* UDP protocol stats */
#define SII_ICMP_STAT	_SI(i,  6)	/* ICMP protocol stats */
#define SII_IDP_PCB	_SI(i,  7)	/* XNS IDP protocol control blocks */
#define SII_IDP_STAT	_SI(i,  8)	/* XNS IDP protocol stats */
#define SII_ERR_STAT	_SI(i,  9)	/* XNS Error protocol stats */
#define SII_SPP_STAT	_SI(i, 10)	/* XNS SPP protocol stats */
#define SII_RAW_PCB	_SI(i, 11)	/* raw protocol control blocks */
#define SII_ARPTAB	_SI(i, 12)	/* ARP protocol tables */
#define SII_IFADDR	_SI(i, 13)	/* IP/XNS interface/address pairs */
#define SII_ROUTE	_SI(i, 14)	/* active routes */
#define SII_ROUTE_STAT	_SI(i, 15)	/* routing table stats */
#define SII_INTRQ	_SI(i, 16)	/* packet input queues */
#define SII_DEBUG_INFO	_SI(i, 17)	/* TCP/SPP debugging info */

#define	SIV_LOGVOL	_SI(v, 0)	/* LV status */
#define	SIV_SUBDISK	_SI(v, 1)	/* Subdisk status */
#define	SIV_PHYSDISK	_SI(v, 2)	/* Physical disk status */
#define	SIV_LVGROUP	_SI(v, 3)	/* LV group status */

/*
 * Common field types and values
 */
#define	SI_ANY		-1

/* cr_nodeid fields */
#define	SI_ANY_PU	-1
#define	SI_THIS_PU	0

/* online/offline fields */
enum	SI_ONOFF	{ SI_ONOFF_ANY, SI_ONOFF_ON, SI_ONOFF_OFF };
typedef	enum SI_ONOFF	si_onoff;

/* volmgr uid tags */
enum	SI_VOLUID
{
    SI_VOLUID_NONE,		/* cr_uid */
    SI_VOLUID_LV,		/* lv uid */
    SI_VOLUID_FS,		/* default fs uid for lv */
    SI_VOLUID_SD,		/* subdisk uid */
    SI_VOLUID_PD,		/* phys disk uid */
    SI_VOLUID_MFS		/* mounted fs uid */
};
typedef	enum SI_VOLUID	si_voluid;

/* file system types */
enum	SI_FST
{
	SI_FST_BSD,		/* BSD file system */
	SI_FST_SYSV		/* SYSV file system */
};
typedef	enum SI_FST	si_fst;

/* subpu uid tags */
enum	SI_SUBPUUID	{ SI_NOSUBPUUID, SI_SUBPUUID };
typedef	enum SI_SUBPUUID	si_subpuuid;

/*
 * name lengths
 */
#define	SI_LV_LABEL	32
#define	SI_FS_LABEL	48
#define	SI_NODE_NAME	32
#define	SI_HOST_NAME	64

/*
 * device requests
 */

/* SID_DISK request */
/* Search criteria for disk controller/device info */
struct cr_dsk
{
    short	cr_nodeid;		/* PU node id, SI_ANY, 0 mine */
};

/* disk controller/device info */
struct si_dsk
{
    char	si_name[SI_LV_LABEL];	/* logical volume label */
};

/* cursor for disk controller/device search */
struct cur_dsk		
{
    struct cr_dsk	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
};
#define	CURSZ_DISK	sizeof(struct cur_dsk)

/* SID_TAPE request */
/* Search criteria for magnetic tape controller/device info */
struct cr_mt
{
    short	cr_nodeid;		/* PU node id, SI_ANY, 0 mine */
};

/* magnetic tape controller/device info */
struct si_mt
{
    char	si_name[SI_LV_LABEL];	/* logical volume label */
};

/* cursor for magnetic tape controller/device search */
struct cur_mt		
{
    struct cr_mt	cri;		/* search criteria */
    short		pu_nth;	/* nth PU */
};
#define	CURSZ_MT	sizeof(struct cur_mt)

/* SID_SUBPU request */
/* Search criteria for subpu info */
struct cr_subpu
{
    UID_T		cr_subpuuid;	/* subpu uid */
    si_subpuuid		cr_uidident:8;	/* cr_uid tag: none or subpu */
    short		cr_nodeid;	/* PU node id, SI_ANY, 0 mine */
};

/* subpu info */
struct si_subpu
{
    UID_T		si_uid;		/* stamp unique to this query */
    UID_T		si_subpuuid;	/* subpuuid uid */
    short 		si_nclasses;	/* # of actual classes */
    short		si_nodeid;	/* PU node id */
    bool_t		si_ft;		/* may the subpu survive PU failover? */
    struct
    {
	slot_class	sic_class;	/* the slot class */
	u_int		sic_num_lans;	/* # of valid entries in table below */
	struct
	{
	    char	    sicl_IMCname[IMCportname_size + 1]; /* port name */
	    char	    sicl_lan_name[MAX_LAN_NAME + 1];	/* LAN name */
	    bool_t	    sicl_IMCscope; /* GLOBAL if true - else REGIONAL */
	    bool_t	    sicl_IMCopen;  /* is the IMC port open? */
	}		sic_lan_info[MAX_LAN];
	u_short		sic_num_sess;	/* # of current sessions (IMC conns.) */
    } si_c[SUBPU_MAX_CLASSES];
};

/* cursor for subpu search */
struct cur_subpu
{
    struct cr_subpu	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    bool_t		single_node;	/* search limited to single PU */
    bool_t		first_subpu;	/* look for first subpu on a PU? */
    struct comm_subpu	*subpu;		/* valid if first_subpu is false */
};
#define	CURSZ_SUBPU	sizeof(struct cur_subpu)

/*
 * file system requests
 */

/* SIF_MOUNT request */
/* Search criteria for file system mount info */
struct cr_mount
{
    UID_T	cr_uid;			/* file system or lv uid */
    si_voluid	cr_uidident:8;		/* cr_uid tag: none, lv, fs, mfs */
    short	cr_nodeid;		/* PU node id: SI_ANY, 0 mine */
    short	cr_lvtype;	   	/* LVT_xxxx or SI_ANY */
    char	cr_name[SI_LV_LABEL];	/* logical volume label */
};

/* file system mount info */
struct si_mount
{
    UID_T	si_uid;			/* stamp unique to this querry */
    UID_T	si_lvuid;		/* logical volume uid */
    UID_T	si_fsuid;		/* default file system uid */
    UID_T	si_mfsuid;		/* mounted file system uid */
    short	si_nodeid;		/* PU node id */
    char	si_name[SI_LV_LABEL];	/* logical volume label */
    char	si_fsname[SI_FS_LABEL];	/* first chars of fs mount pt name */
    u_char	si_lvtype;	   	/* LVT_xxxx */
    bool_t	si_automount;		/* is volume auto-mounted? */
    u_short	si_lvc_1;		/* PU node id, LVC choice 1 */
    u_short	si_lvc_2;		/* PU node id, LVC choice 2 */
    time_t	si_mounttime;		/* time fs last mounted */
    si_fst      si_fs_type:8;		/* File system type SI_FST_xxx */
};

/* cursor for file system mount search */
struct cur_mount		
{
    struct cr_mount	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    int			lv_nth;		/* nth logical volume */
    u_long		lv_sum[4];	/* checksum of first lv_uids */
    bool_t		single_node;	/* search limited to PU */
};
#define	CURSZ_MOUNT	sizeof(struct cur_mount)

/* SIF_SPACE request */
/* Search criteria for file system space info */
struct cr_fxspace
{
    UID_T	cr_uid;			/* file system or lv uid */
    si_voluid	cr_uidident:8;		/* cr_uid tag: none, lv, fs, mfs */
    short	cr_nodeid;		/* PU node id: SI_ANY, 0 mine */
    char	cr_mounted;		/* 1 mounted, 0 umounted: SI_ANY */
    char	cr_name[SI_LV_LABEL];	/* logical volume label */
};

/* file system space info */
#define	SI_FS_TIERS	14
struct si_fxspace
{
    UID_T	si_lvuid;		/* logical volume uid */
    UID_T	si_fsuid;		/* default file system uid */
    UID_T	si_mfsuid;		/* mounted file system uid */
    short	si_nodeid;		/* PU node id */
    bool_t	si_mounted;		/* mounted ? */
    char	si_name[SI_LV_LABEL];	/* logical volume label */
    char	si_fsname[SI_FS_LABEL];	/* first chars of fs mount pt name */
    long	si_size;		/* number of blocks in fx */
    long	si_dsize;		/* number of data blocks in fx */
    long	si_nau;			/* number of allocation units */
    long	si_bsize;		/* size of basic blocks in fx */
    long	si_minfree;		/* minimum percentage of free blocks */
    long	si_dbpu;		/* data blocks per allocation unit */
    long	si_ipu;			/* inodes per alloc unit */
    long	si_bpu;			/* blocks per alloc unit */
    long	si_blocksfree;		/* total free blocks in fx */
    long	si_ndir;		/* number of allocated directories */
    long	si_nifree;		/* number of free inodes */
    long	si_nefree[SI_FS_TIERS];	/* numbers of free extents */
};

/* cursor for file system space search */
struct cur_fxspace		
{
    struct cr_fxspace	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    UID_T		lvuid;		/* last lv uid */
    bool_t		single_node;	/* search limited to PU */
};
#define	CURSZ_FXSPACE	sizeof(struct cur_fxspace)

/*
 * LAN requests
 */

/* SIL_CONFIG request */
/* Search criteria for LAN configuration info */
struct cr_lanconf
{
    short		cr_nodeid;	/* PU node id, SI_ANY_PU, 0 mine */
    char		cr_name[MAX_LAN_NAME + 1];	/* LAN name */
};

/* LAN configuration info */
struct si_lanconf
{
    char		si_name[MAX_LAN_NAME + 1];	/* LAN name */
    short		si_nodeid;			/* PU node id */
};

/* cursor for LAN search */
struct cur_lanconf
{
    struct cr_lanconf	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    bool_t		single_node;	/* search limited to single PU */
    int			lan_nth;	/* nth LAN */
};
#define	CURSZ_LANCONF	sizeof(struct cur_lanconf)

/* SIL_IMCPORT request */
/* Search criteria for open IMC ports */
struct cr_imcport
{
    short		cr_nodeid;	/* PU node id, SI_ANY_PU, 0 mine */
    char		cr_name[IMCportname_size + 1];	/* IMC port name */
    char		cr_lanname[MAX_LAN_NAME + 1];	/* LAN name */
};

/* IMC port info */
struct si_imcport
{
    char		si_name[IMCportname_size + 1];	/* IMC port name */
    char		si_lanname[MAX_LAN_NAME + 1];	/* LAN name */
    short		si_nodeid;			/* PU node id */
};

/* cursor for IMC port search */
struct cur_imcport
{
    struct cr_imcport	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    bool_t		single_node;	/* search limited to single PU */
    u_short		lan_nth;	/* nth LAN */
    u_short		index;		/* curr. index in nth nametable */
};
#define	CURSZ_IMCPORT	sizeof(struct cur_imcport)

/* SIL_LANNAME request */
struct cr_lanname
{
    short		cr_nodeid;	/* PU node id, SI_ANY_PU, 0 mine */
};

/* LAN name info */
struct si_lanname
{
    char		si_ifname[16];	/* interface name e.g. "lo" or "en" */
    char		si_name[MAX_LAN_NAME + 1];	/* LAN name */
    int			si_unit;	/* unit number ex en0 is unit 0 */
    short		si_nodeid;			/* PU node id */
};

/* cursor for LAN search */
struct cur_lanname
{
    struct cr_lanname	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    bool_t		single_node;	/* search limited to single PU */
    int			lan_nth;	/* nth LAN */
};
#define	CURSZ_LANNAME	sizeof(struct cur_lanname)

/*
 * Node requests
 */

/* SIN_VERSION request */
/* Search criteria for node kernel versions, node txinfo */
struct cr_node
{
    short	cr_nodeid;		/* PU node id */
};

#define	SI_VSN_STRING	80
struct si_nodeversion
{
    short	si_nodeid;		/* PU node id */
    int		si_upuvsn;		/* UPU version serial number */
    int		si_rpuvsn;		/* RPU version serial number */
    int		si_rtevsn;		/* RTE version serial number */
    char	si_upustring[SI_VSN_STRING];	/* UPU version string */
    char	si_rpustring[SI_VSN_STRING];	/* RPU version string */
    char	si_rtestring[SI_VSN_STRING];	/* RTE version string */
};

struct cur_node	/* version, txinfo */
{
    struct cr_node		cri;
    short			nth;	/* local pu id */
};
#define	CURSZ_NODEVERSION	sizeof(struct cur_node)

/* SIN_STATUS request */
/* Search criteria for node status */
struct cr_nodestatus
{
    short	cr_nodeid;		/* PU node id */
    short	cr_lnetid;		/* local net id, any, 0 mine */
    char	cr_nodename[SI_NODE_NAME]; /* PU name */
};

/* Status information for node */
struct si_nodestatus
{
    UID_T		si_uid;			/* stamp for this querry */
    short		si_nodeid;		/* PU node id */
    short		si_lnetid;		/* local net id */
    char		si_nodename[SI_NODE_NAME]; /* PU name */
    long		si_serialno;		/* serial number */
    struct en_addr	si_etheraddr;		/* ethernet address */
    bool_t		si_up;			/* up or down/alien */
    time_t		si_boottime;		/* bootup time (uid) */
};

struct cur_nodestatus
{
    struct cr_nodestatus	cri;	/* search criteria */
    short			nth;	/* local pu id */
};
#define	CURSZ_NODESTATUS	sizeof(struct cur_nodestatus)

/* SIN_TXINFO request */
struct si_nodetxinfo
{
    short			si_nodeid;	/* PU id */
    short			si_hz;		/* clock rate (ticks/sec) */
    short			si_tick;	/* time incr at each tick */
    short			si_maxslp;	/* # secs to very swapable */
    int				si_ecmx;	/* last core map entry */
    int				si_ccpu;	/* cpu scheduling quanta */
    int				si_avenrun[3];	/* 1, 5, 15 load averages */
    int				si_avenscale;	/* scale factors */
    time_t			si_boottime;	/* wallclock time */
};
#define	CURSZ_NODETXINFO	sizeof(struct cur_node)

/* SIN_BRDCONF request */
struct si_nodeboard
{
    short			si_nodeid;		/* pu node id */
    struct	board_conf	si_puboard[16];		/* pu boards */
    struct	board_conf	si_chanboard[4*8];	/* channel controller boards */
};
#define	CURSZ_NODEBOARD		sizeof(struct cur_node)

/* SIN_CONFIG request */
struct si_nodeconfig
{
    short	si_nodeid;	/* pu node id */
    int		si_physmem;	/* physical memory size in bytes */
    char	si_nchannel;	/* number of IOCs (0-4) */
    char	si_processor;	/* always 0 */
    char	si_nether;	/* number of sib ethernet ports (0, 2, 4) */
    char	si_nlan;	/* number of lan ethernet ports (0 - 4) */
    short	si_nsema;	/* number of memory board sem. pages. */
    short	si_unused1;
    int		si_unused2;
};
#define	CURSZ_NODECONFIG	sizeof(struct cur_node)

/*
 * Process requests
 */
/* SIP_LONGP, SIP_SHORTP request */
/* Search criteria for process status (both) */
struct cr_process
{
    /* also a struct procid. p_my_puid SI_ANY, 0 local. p_localpid SI_ANY */
    int			cr_pid;		/* pid, pu : SI_ANY, 0 mine, specific */
					/*      localpid : SI_ANY, specific   */
    int			cr_ppid;	/* parent pid, SI_ANY */
    long		cr_pgrp;	/* process group, SI_ANY, 0 none */
    short		cr_uid;		/* effective uid, SI_ANY */
    short		cr_ctty_dev;	/* device type of ctty, SI_ANY,0 none */
    struct rcomm	cr_ctty_com;	/* tty, when cr_ctty_dev specified */
    bool_t		cr_use_dead:1;	/* dying/zombie/exiting */
    bool_t		cr_use_idle:1;	/* sleeping, stopped */
    bool_t		cr_use_notty:1;	/* no pgrp */
    bool_t		cr_use_initchild:1;/* a child of init */
    bool_t		cr_no_args:1;	/* don't look for args */
    bool_t		cr_use_subpu:1;	/* match on subpu instead of tty */
    bool_t		cr_use_p_subpu:1;/* match on subpu (stored in proc) */
    UID_T		cr_p_subpu;	/* subpu uid */
};

/* Status information for process */
#define	SI_COMMAND	32
enum SI_PSTAT	{ SI_PSTAT_SLEEP = 1, SI_PSTAT_WAIT, SI_PSTAT_RUN, SI_PSTAT_IDL,
		  SI_PSTAT_ZOMB, SI_PSTAT_STOP };
typedef enum SI_PSTAT	si_pstat;
struct si_process
{
    int			si_pid;		/* Process id [p_pid] */
    short		si_euid;	/* Effective user id [u_uid] */
    short		si_ruid;	/* Real user id [u_ruid] */
    short		si_egid;	/* Effective group id [u_gid] */
    short		si_rgid;	/* Real group id [u_rgid] */
    long		si_pgrp;	/* Process group [p_pgrp] */
    short		si_ctty_dev;	/* Controlling term. dev. type [p_tty]*/
    struct rcomm	si_ctty_com;	/* Controlling term. dev. info [p_tty]*/
    int			si_ppid;	/* Parent Process id [p_ppid] */
    long		si_flag;	/* Process Flags [p_flag] */
    char		si_command[SI_COMMAND];	/* Process cmd name [u_comm]*/
    si_pstat		si_stat:8;	/* Process state [p_stat] */
    int			si_nice:8;    /* Process "nice" for CPU usage [p_nice]*/
    int			si_pri:8;   /* Process priority, negative-high [p_pri]*/
    int			si_slptime:8;	/* Time since last block [p_slptime] */
    int			si_time:8;    /* Resident time for scheduling [p_time]*/
    struct rusage	si_ru;		/* Resource utilization [u_ru] */
					/* see getrusage, wait3 */
    struct rusage	si_cru;		/* Child resource utilization [u_cru] */
    size_t		si_dsize;	/* Size of data space [p_dsize] */
    size_t		si_ssize;	/* Size of stack space [p_ssize] */
    size_t		si_rssize;     /* Current resident set size [p_rssize]*/
    long		si_pctcpu;	/* CPU fraction for this process during
					  si_time multiplied by scale [p_pctcpu]
					  see avenscale in SIN_TXINFO */
    size_t		si_xsize;	/* text size [p_textp->x_size] */
    int			si_xrssize:16;	/* text resident set size 
					  [p_textp->x_rssize] */
    int			si_xccount:8;	/* Text number of users 
					   [p_textp->x_ccount] */
    int			si_xswrss:16;	/* Text resident set size at last swap 
					   out [p_textp->xrssize] */
    size_t		si_swrss;	/* Resident set size before last swap
					   out [p_textp->xswrss] */
    size_t		si_maxrss;	/* Limit to resident set size as set
					   by setrlimit [p_maxrss] */
    int			si_cpu:8;	/* CPU usage for scheduling [p_cpu] */
    caddr_t		si_wchan;	/* Event process is awaiting [p_wchan]*/
    int			si_pfnum;	/* Page frame number for first page of
					   user area [p_addr[0].pg_pfnum] */
    int			si_sigintr;	/* Signal status for interrupt signal
					   [u_signal[SIGINT]] */
    int			si_sigquit;	/* Signal status for quit signal
					   [u_quit[SIGQUIT]] */
    UID_T		si_subpu;	/* Associated subpu */
    int			si_pad[6];
};

#define	SI_LONG_ARGS	10240
struct si_processl
{
    struct si_process	si_p;
    char		si_args[SI_LONG_ARGS];	/* args then envs */
};

#define	SI_SHORT_ARGS	128
struct si_processs
{
    struct si_process	si_p;
    char		si_args[SI_SHORT_ARGS]; /* args */
};

struct cur_process
{
    struct cr_process	cri;		/* search criteria */
    int			pu;		/* current pu */
    int			slot;		/* proc table slot */
};
#define	CURSZ_PROCESS		sizeof(struct cur_process)

/* SIP_RPU request */
/* Search criteria for rpu process status */
struct cr_procrpu
{
    short		cr_nodeid;	/* pu id */
    short		cr_procid;	/* process id, SI_ANY */
};

/* Status information for rpu processes */
struct si_procrpu
{
    short		si_nodeid;	/* pu id */
    short		si_procid;	/* process id */
    int			si_priority;	/* process' priority */
    QUEUE		*si_q;		/* process queue */
    caddr_t		si_stackbase;	/* base of process stack */
    caddr_t		si_stacktop;	/* top of process stack */
    int			si_alarmsec;	/* time to next alarm for process */
    bool_t		si_processor;	/* waiting on interprocessor queue */
    char		si_state[4];	/* process state name */
    char		si_wait[6];	/* process wait flags */
    char		si_name[32];	/* process name */
    int			si_time;	/* cpu time in this process */
    int			si_scale;	/* scale factor for si_time */
};

struct cur_procrpu
{
    struct cr_procrpu		cri;
    short			nth;	/* local pu id */
    short			procid;	/* process id */
};
#define	CURSZ_PROCRPU		sizeof(struct cur_procrpu)

/*
 * Statistics requests
 */

/* Search criteria with just a PU id */
struct cr_stats
{
    short	cr_nodeid;		/* PU node id */
};

/* Cursor for just a PU id */
struct cur_stats
{
    struct cr_stats	cri;
    short		nth;		/* local pu id */
};

/* SIS_LOADAV request */
/* Status information for load averages */
struct si_statsloadav
{
    short	si_nodeid;		/* PU id. */
    short	si_scale;		/* scale factor for following */
    int		si_upu[3];		/* upu load avg, 1, 5, 15 min. */
    int		si_rpu[3];		/* rpu load avg, 1, 5, 15 min. */
};
#define	CURSZ_STATSLOADAV	sizeof(struct cur_stats)

/* SIS_CHAN request */
/* Search criteria for channel status */
struct cr_statschan
{
    short	cr_nodeid;		/* PU node id, 0 mine, SI_ANY_PU */
    char	cr_channel;		/* channel number [0-3], SI_ANY */
    char	cr_ctlr;		/* ctlr number [0-7], SI_ANY */
    char	cr_device;		/* device number [0-7], SI_ANY */
};

/* Status information for channel status */
struct si_statschan
{
    short	si_nodeid;		/* pu id */
    char	si_channel;		/* channel number */
    char	si_ctlr;		/* controller number */
    char	si_device;		/* device number */
    char	si_ctlrtype[10];	/* string for controller type */
    char	si_ctlrstate[9];	/* string for controller state */
    char	si_devstate[9];		/* string for device state */
};

struct cur_statschan
{
    struct cr_statschan	cri;
    short		nth;		/* local pu id */
    int			device;		/* RTE device (chan/ctlr/dev 4 bits) */
};
#define	CURSZ_STATSCHAN		sizeof(struct cur_statschan)

/* SIS_RTE request */
/* Status information for rte process statistics */
struct si_statsrte
{
    short	si_nodeid;		/* pu node id */
    short	si_curproc;		/* current process id */
    int		si_switchcount;		/* number of process switches */	
    int		si_scale;		/* scale factor for following */
    int		si_totused;		/* total time used since boot */
    int		si_sampleused;		/* time since last stats clear */
    int		si_inactive;		/* time for exited processes */
};
#define	CURSZ_STATSRTE		sizeof(struct cur_stats)

/* SIS_DISK request */
/* Search criteria for disk statistics */
struct cr_statsdisk
{
    short	cr_nodeid;		/* PU node id, 0 mine, SI_ANY_PU */
    char	cr_channel;		/* channel number [0-1], SI_ANY */
    char	cr_ctlr;		/* ctlr number [1-f], SI_ANY */
    char	cr_device;		/* device number [0-7], SI_ANY */
};

/* Status information for disk statistics */
struct si_statsdisk
{
    short	si_nodeid;		/* pu id */
    char	si_channel;		/* channel number */
    char	si_ctlr;		/* controller number */
    char	si_device;		/* device number */
    short	si_scale;		/* scale factor for avgla */
    int		si_avgla[3];		/* 1, 5, 15 min avg load */
    int		si_maxla[3];		/* 1, 5, 15 min max load */
    int		si_curla;		/* current load (queue depth) */
    int		si_absmax;		/* maximum load since disk online */
    long	si_iocnt;		/* number of i/o's */
    long	si_trfcnt;		/* number of sectors transferred */
    long	si_rdcnt;		/* number of trfcnt that are reads */
};

struct cur_statsdisk
{
    struct cr_statsdisk	cri;
    short		nth;		/* local pu id */
    int			device;		/* RTE device (chan/ctlr/dev 4 bits) */
};
#define	CURSZ_STATSDISK		sizeof(struct cur_statsdisk)

/* SIS_VMSTAT request */
/* Status information for vmstat miscellaneous statistics */
struct si_statsvmstat
{
    short	si_nodeid;		/* pu id */
    int		si_freemem;		/* 4k of free real memory */
    int		si_deficit;		/* anticipated shortterm shortfall */
    int		si_time_user;		/* cpu time in user state */
    int		si_time_nice;		/* cpu time in nice state */
    int		si_time_sys;		/* cpu time in system state */
    int		si_time_idle;		/* cpu time in idle state */
    int		si_scale;		/* scale factor for times above */
    int		si_rectime;		/* time in page reclaim */
    int		si_rscale;		/* scale for rectime */
    int		si_pgintime;		/* time in pagein */
    int		si_pscale;		/* scale for pgintime */
};
#define	CURSZ_STATSVMSTAT	sizeof(struct cur_stats)

/* SIS_VMTOTAL request */
/* Status information for vmstat total statistics */
struct si_statsvmtotal
{
    short	si_nodeid;		/* pu id */
    int		si_rq;			/* length of run queue */
    int		si_dw;			/* jobs in "disk wait" (neg. prio.) */
    int		si_pw;			/* jobs in page wait */
    int		si_sl;			/* jobs sleeping in memory */
    int		si_sw;			/* swapped out runnable/block jobs */
    int		si_vm;			/* total virtual memory (4k) */
    int		si_avm;			/* active virtual memory (4k) */
    int		si_rm;			/* total real memory in use (4k) */
    int		si_arm;			/* active real memory (4k) */
    int		si_vmtxt;		/* virtual memory used by text (4k) */
    int		si_avmtxt;		/* active virtual memory in text (4k) */
    int		si_rmtxt;		/* real memory used by text (4k) */
    int		si_armtxt;		/* active real memory in text (4k) */
    int		si_free;		/* free memory (4k) */
    int		si_vmshm;		/* virtual memory used by shm (4k) */
    int		si_avmshm;		/* active virtual memory in shm (4k) */
    int		si_rmshm;		/* real memory used by shm (4k) */
    int		si_armshm;		/* active real memory in shm (4k) */
};
#define	CURSZ_STATSVMTOTAL	sizeof(struct cur_stats)

/* SIS_VMMETER request */
/* Search criteria for vmstat metering statistics */
struct cr_statsvmmeter
{
    short	cr_nodeid;		/* PU node id, 0 mine, SI_ANY_PU */
    bool_t	cr_sum;			/* give sum since boot */
    bool_t	cr_rate;		/* give current rate */
};

/* Status information for vmstat metering statistics */
struct si_statsvmmeter
{
    short	si_nodeid;	/* pu id */
    bool_t	si_sum;		/* true if sum, false if rate */
    u_int	si_swtch;	/* context switches */
    u_int	si_tlbpid;	/* calls to new_tlbpid */
    u_int	si_trap;	/* calls to trap */
    u_int	si_syscall;	/* calls to syscall */
    u_int	si_intr;	/* device interrupts */
    u_int	si_tlbmiss;	/* tlbmiss incl kernel tlbmiss, excl utlbmiss */
    u_int	si_ktlbmiss;	/* kernel tlbmiss, excl kpte window miss */
    u_int	si_pswpin;	/* pages swapped in (4k units, also below) */
    u_int	si_pswpout;	/* pages swapped out */
    u_int	si_pgin;	/* pageins */
    u_int	si_pgout;	/* pageouts */
    u_int	si_pgpgin;	/* pages paged in */
    u_int	si_pgpgout;	/* pages paged out */
    u_int	si_intrans;	/* intransit blocking page faults */
    u_int	si_pgrec;	/* total page reclaims */
    u_int	si_xsfrec;	/* found in free list rather than on swapdev */
    u_int	si_xifrec;	/* found in free list rather than in filsys */
    u_int	si_exfod;	/* pages filled on demand from executables */
    u_int	si_zfod;	/* pages zero filled on demand */
    u_int	si_shmzfod;	/* pages zero filled on demand for shm */
    u_int	si_nexfod;	/* number of exfod's created */
    u_int	si_nzfod;	/* number of zfod's created */
    u_int	si_nshmzfod;	/* number of shm zfod's created */
    u_int	si_pgfrec;	/* page reclaims from free list */
    u_int	si_faults;	/* total faults taken (real pages) */
    u_int	si_scan;	/* scans in page out daemon */
    u_int	si_rev;		/* revolutions of the hand */
    u_int	si_seqfree;	/* pages taken from sequential programs (4k) */
    u_int	si_dfree;	/* pages freed by daemon (4k) */
    u_int	si_swpin;	/* swapins */
    u_int	si_swpout;	/* swapouts */
};

struct cur_statsvmmeter
{
    struct cr_statsvmmeter	cri;
    short			nth;	/* local pu id */
    short			next;	/* 0 sum, 1 rate */
};
#define	CURSZ_STATSVMMETER	sizeof(struct cur_statsvmmeter)

/* SIS_FORK request */
/* Status information for vmstat fork statistics */
struct si_statsfork
{
    short	si_nodeid;		/* pu id */
    int		si_cntfork;		/* count of forks */
    int		si_cntvfork;		/* count of vforks */
    int		si_sizfork;		/* total size of forks */
    int		si_sizvfork;		/* total size of vforks */
};
#define	CURSZ_STATSFORK		sizeof(struct cur_stats)

/* SIS_MISCMEM request */
/* Status information for miscellaneous memory statistics */
struct si_statsmiscmem
{
    short	si_nodeid;	/* pu id */
    int		si_wmem;	/* pages of zmemall'ed/wmemall'ed memory */
    int		si_pmem;	/* pages of pmemall'ed memory */
    int		si_umem;	/* pages of u-area memory */
    int		si_ptemem;	/* pages of page table memory */
};
#define	CURSZ_STATSMISCMEM	sizeof(struct cur_stats)

/* SIS_SWAPIO request */
/* Status information for swap i/o statistics */
struct si_statsswapio
{
    short	si_nodeid;	/* pu id */
    int		si_cblkcurwt;	/* current # command block waiters */
    int		si_cblkmaxwt;	/* max command block waiters since boot */
    int		si_curpushiop;	/* current # async page pushes in progress */
    int		si_maxpushiop;	/* max # concurrent async pushes since boot */
    int		si_curswvoliop;	/* current # swap vol I/Os in progress */
    int		si_maxswvoliop;	/* max # concurrent swap vol I/Os since boot */
    int		si_maxpgiolim;	/* # pushes aborted due to maxpgio limit */
    int		si_swbufcuruse;	/* current # swap buffer headers in use */
    int		si_swbufmaxuse;	/* max # swap buf headers in use since boot */
    int		si_swbufnavail;	/* # times swap buf header not available */
};
#define	CURSZ_STATSSWAPIO	sizeof(struct cur_stats)

/* SIS_IP request */
/* Status information for IP transport statistics */
struct si_statsip
{
    short	si_nodeid;		/* pu node id */
    long	si_total;		/* total packets received */
    long	si_badsum;		/* checksum bad */
    long	si_tooshort;		/* packet too short */
    long	si_toosmall;		/* not enough data */
    long	si_badhlen;		/* ip header length < data size */
    long	si_badlen;		/* ip length < ip header length */
    long	si_fragments;		/* fragments received */
    long	si_fragdropped;		/* frags dropped (dups, out of space) */
    long	si_fragtimeout;		/* fragments timed out */
    long	si_forward;		/* packets forwarded */
    long	si_cantforward;		/* packets rcvd for unreachable dest */
    long	si_redirectsent;	/* packets forwarded on same net */
};
#define	CURSZ_STATSIP	sizeof(struct cur_stats)

/* SIS_INPCB request */
/* Search criteria for internet protocol statistics */
struct cr_statsinpcb
{
    short		cr_nodeid;	/* PU node id, 0 mine, SI_ANY_PU */
    bool_t		cr_tcp;		/* tcp statistics */
    bool_t		cr_udp;		/* udp statistics */
};

/* Status information for internet protocol statistics */
struct si_statsinpcb
{
    short		si_nodeid;	/* pu node id */
    bool_t		si_tcp;		/* tcp vs. udp */
    struct in_addr	si_laddr;	/* local host table entry */
    struct in_addr	si_faddr;	/* foreign host table entry */
    int			si_lport;	/* local port */
    int			si_fport;	/* foreign port */
    caddr_t		si_ppcb;	/* per-procotol pcb (control block) */
    int			si_pgrp;	/* process group of owner */
    int			si_rcv_sb_cc;	/* bytes in receive buffer */
    int			si_snd_sb_cc;	/* bytes in send buffer */
    int			si_state;	/* tcp only: tcp state */
    char		si_statename[16];/* tcp only: name of st. if defined */
};

struct cur_statsinpcb
{
    struct cr_statsinpcb	cri;
    short			nth;		/* local pu id */
    short			next;		/* 0 tcp, 1 udp */
    short			idx;		/* list index */
};
#define	CURSZ_STATSINPCB	sizeof(struct cur_statsinpcb)

/* SIS_TCP request */
/* Status information for TCP statistics */
struct si_statstcp
{
    short	si_nodeid;		/* pu node id */
    u_long	si_connattempt;		/* connections initiated */
    u_long	si_accepts;		/* connections accepted */
    u_long	si_connects;		/* connections established */
    u_long	si_drops;		/* connections dropped */
    u_long	si_conndrops;		/* embryonic connections dropped */
    u_long	si_closed;		/* conn. closed (includes drops) */
    u_long	si_segstimed;		/* segs where we tried to get rtt */
    u_long	si_rttupdated;		/* times we succeeded */
    u_long	si_delack;		/* delayed acks sent */
    u_long	si_timeoutdrop;		/* conn. dropped in rxmt timeout */
    u_long	si_rexmttimeo;		/* retransmit timeouts */
    u_long	si_persisttimeo;	/* persist timeouts */
    u_long	si_keeptimeo;		/* keepalive timeouts */
    u_long	si_keepprobe;		/* keepalive probes sent */
    u_long	si_keepdrops;		/* connections dropped in keepalive */

    u_long	si_sndtotal;		/* total packets sent */
    u_long	si_sndpack;		/* data packets sent */
    u_long	si_sndbyte;		/* data bytes sent */
    u_long	si_sndrexmitpack;	/* data packets retransmitted */
    u_long	si_sndrexmitbyte;	/* data bytes retransmitted */
    u_long	si_sndacks;		/* ack-only packets sent */
    u_long	si_sndprobe;		/* window probes sent */
    u_long	si_sndurg;		/* packets sent with URG only */
    u_long	si_sndwinup;		/* window update-only packets sent */
    u_long	si_sndctrl;		/* control (SYN|FIN|RST) packets sent */

    u_long	si_rcvtotal;		/* total packets received */
    u_long	si_rcvpack;		/* packets received in sequence */
    u_long	si_rcvbyte;		/* bytes received in sequence */
    u_long	si_rcvbadsum;		/* packets received with ccksum errs */
    u_long	si_rcvbadoff;		/* packets received with bad offset */
    u_long	si_rcvshort;		/* packets received too short */
    u_long	si_rcvduppack;		/* duplicate-only packets received */
    u_long	si_rcvdupbyte;		/* duplicate-only bytes received */
    u_long	si_rcvpartduppack;	/* packets with some duplicate data */
    u_long	si_rcvpartdupbyte;	/* dup. bytes in part-dup. packets */
    u_long	si_rcvoopack;		/* out-of-order packets received */
    u_long	si_rcvoobyte;		/* out-of-order bytes received */
    u_long	si_rcvpackafterwin;	/* packets with data after window */
    u_long	si_rcvbyteafterwin;	/* bytes rcvd after window */
    u_long	si_rcvafterclose;	/* packets rcvd after "close" */
    u_long	si_rcvwinprobe;		/* rcvd window probe packets */
    u_long	si_rcvdupack;		/* rcvd duplicate acks */
    u_long	si_rcvacktoomuch;	/* rcvd acks for unsent data */
    u_long	si_rcvackpack;		/* rcvd ack packets */
    u_long	si_rcvackbyte;		/* bytes acked by rcvd acks */
    u_long	si_rcvwinupd;		/* rcvd window update packets */
};
#define	CURSZ_STATSTCP	sizeof(struct cur_stats)

/* SIS_UDP request */
/* Status Information for UDP statistics */
struct si_statsudp
{
    short	si_nodeid;		/* pu node id */
    int		si_hdrops;		/* dropped packets */
    int		si_badsum;		/* bad checksum */
    int		si_badlen;		/* bad packet length */
};
#define	CURSZ_STATSUDP	sizeof(struct cur_stats)

/* SIS_ICMP request */
#define	SI_ICMP_HIST	19		/* ICMP_MAXTYPE + 1 */
/* Status Information for ICMP statistics */
struct si_statsicmp
{
    short	si_nodeid;		/* pu node id */
/* statistics related to icmp packets generated */
    int		si_error;		/* # of calls to icmp_error */
    int		si_oldshort;		/* no error because old IP too short */
    int		si_oldicmp;		/* no error because old was ICMP */
    int		si_outhist[SI_ICMP_HIST]; /* histogram for all ICMP types */
/* statistics related to input messages processed */
    int		si_badcode;		/* icmp_code out of range */
    int		si_tooshort;		/* packet < ICMP_MINLEN */
    int		si_checksum;		/* bad checksum */
    int		si_badlen;		/* calculated bound mismatch */
    int		si_reflect;		/* number of responses */
    int		si_inhist[SI_ICMP_HIST]; /* histogram for all ICMP types */
};
#define	CURSZ_STATSICMP	sizeof(struct cur_stats)

/* SIS_RTINFO request */
/* Search criteria for route table info */
struct cr_statsrtinfo
{
    short	cr_nodeid;		/* PU node id, 0 mine, SI_ANY_PU */
    bool_t	cr_host;		/* set for hosts */
    bool_t	cr_net;			/* set for networks */
};

/* Information for the route table */
struct si_statsrtinfo
{
    short		si_nodeid;	/* PU node id */
    char		si_name[16];	/* interface name */
    int			si_unit;	/* unit number of interface */
    					/* NOTE!! keep word aligned */
    struct sockaddr	si_dst_addr;	/* destination of route */
    struct sockaddr	si_gate_addr;	/* gateway to use */
    bool_t		si_ifp;		/* interface associated? */
    bool_t		si_up;		/* route useable */
    bool_t		si_gateway;	/* destination is a gateway */
    bool_t		si_host;	/* host entry (net otherwise) */
    bool_t		si_dynamic;	/* created dynamically (by redirect) */
    bool_t		si_modified;	/* modified dynamically (by redirect) */
    int			si_refcnt;	/* # active users */
    int			si_use;		/* # packets sent using this route*/
};

struct cur_statsrtinfo
{
    struct cr_statsrtinfo	cri;
    short			nth;		/* local pu id */
    short			next;		/* 0 host, 1 net */
    short			rtno;		/* route hash table entry */
    short			mbno;		/* mbuf list index */
};
#define	CURSZ_STATSRTINFO	sizeof(struct cur_statsrtinfo)

/* SIS_ROUTE request */
struct si_statsroute
{
    short	si_nodeid;		/* PU node id */
    int		si_badredirect;		/* bogus redirect calls */
    int		si_dynamic;		/* routes created by redirects */
    int		si_newgateway;		/* routes modified by redirects */
    int		si_unreach;		/* lookups which failed */
    int		si_wildcard;		/* lookups satisfied by a wildcard */
};
#define	CURSZ_STATSROUTE	sizeof(struct cur_stats)

/* SIS_INIFADDR request */
struct si_statsinifaddr
{
    struct sockaddr_in	si_addr;	/* addr of interface */
    struct sockaddr_in	si_broadaddr;	/* broadcast addr */
    struct sockaddr_in	si_dstaddr;	/* desitnation address */
    u_long		si_net;		/* network number */
    u_long		si_netmask;	/* mask of net part */
    u_long		si_subnet;	/* subnet number, including net */
    u_long		si_subnetmask;	/* mask of net + subnet */
    struct in_addr	si_netbroadcast;/* broadcast addr. for logical net */
    short		si_nodeid;	/* PU node id */
    char		si_name[16];	/* interface name e.g. "lo" or "en" */
    int			si_unit;	/* unit number ex en0 is unit 0 */
    int			si_metric;	/* routing metric (external only) */
    bool_t		si_up;		/* interface is up */
    bool_t		si_broadcast;	/* broadcast is allowed */
    bool_t		si_debug;	/* debugging turned on */
    bool_t		si_loopback;	/* loopback interface */
    bool_t		si_pointopoint;	/* interface is point to point link */
    bool_t		si_notrailers;	/* no trailers is allowed */
    bool_t		si_running;	/* ressources is allocated */
    bool_t		si_noarp;	/* no address resolution protocol */
    int			si_mtu;		/* maximum transmission units */
    int			si_timer;	/* time till next error timeout */
    int			si_ifq_len;	/* current output queue length (bytes)*/
    int			si_ifq_maxlen;	/* max output queue length (bytes) */
    int			si_ifq_high;	/* High water mark (bytes) */
    int			si_ifq_drops;	/* pkts dropped from full queue */
    int			si_ipackets;	/* total input pkts count */
    int			si_ierrors;	/* total input pkts error count */
    int			si_oerrors;	/* total output pkts error count */
    int			si_opackets;	/* total output pkts count */
    int			si_collisions;	/* total collisions count on csma */
};

struct cur_statsinifaddr
{
    struct cr_stats	cri;
    short		nth;		/* local pu id */
    short		idx;		/* list index */
};
#define	CURSZ_STATSINIFADDR	sizeof(struct cur_statsinifaddr)

/* SIS_INTRQ request */
/* Search criteria for intrq information */
struct cr_statsintrq
{
    short	cr_nodeid;		/* PU node id, 0 mine, SI_ANY_PU */
    bool_t	cr_rawintrq;		/* true if raw interrupt queue wanted */
    bool_t	cr_ipintrq;		/* true if IP interrupt queue wanted */
    bool_t	cr_nsintrq;		/* true if XNS interrupt queue wanted */
};

struct si_statsintrq
{
    short		si_nodeid;	/* pu node id */
    bool_t		si_raw;		/* true => is raw queue */
    bool_t		si_ip;		/* true => is IP queue */
					/* else => is XNS queue */
    int			si_len;		/* current length of queue */
    int			si_maxlen;	/* max length of queue */
    int			si_high;	/* high water mark of queue */
    int			si_drops;	/* pkts dropped from full queue*/
};

struct cur_statsintrq
{
    struct cr_statsintrq	cri;
    short			nth;	/* local pu id */
    short			next;	/* 0 raw, 1 ipintrq */
};
#define	CURSZ_STATSINTRQ	sizeof(struct cur_statsintrq)

/* SIS_ARPTAB request */
/*
 * Status information for description of the devices connected to the local
 * ethernet
 */
struct si_statsarptab
{
    short		si_nodeid;	/* PU node id */
    struct in_addr	si_iaddr;	/* 32 bit internet address */
    struct en_addr	si_enaddr;	/* 48 bit ethernet address */
    int			si_timer;	/* minutes since last use */
    bool_t		si_com;		/* completed entry (enaddr valid) */
    bool_t		si_perm;	/* permanent entry */
    bool_t		si_publ;	/* published (respond for other host) */
    bool_t		si_usetrailers;	/* has requested trailers */
    int			si_nbuckets;	/* number of hash buckets */
    int			si_bsiz;	/* size of each hash bucket */
};

struct cur_statsarptab
{
    struct cr_stats	cri;
    short		nth;		/* local pu id */
    short		arpno;		/* list index */
};
#define	CURSZ_STATSARPTAB	sizeof(struct cur_statsarptab)

/* SIS_RDWR request */
/* Status information for read/write statistics */
struct si_statsrdwr
{
    short			si_nodeid;	/* pu node id */
    int				si_read_calls;	/* # of read operations */
    int				si_bytes_read;	/* # of bytes read */
    int				si_write_calls;	/* # of write operations */
    int				si_bytes_written; /* # of bytes written */
    int				si_dsk_read_r;	/* # of remote disk read op */
    int				si_dsk_read_l;	/* # of local disk read op */
    int				si_dsk_write_r;	/* # of remote disk write op */
    int				si_dsk_write_l;	/* # of local disk write op */
};
#define	CURSZ_STATSRDWR		sizeof(struct cur_stats)

/* SIS_ETHER request */
/* Search criteria for ethernet statistics */
struct cr_statsether
{
    short		cr_nodeid;
    bool_t		cr_en[EN_MAX_ETHERS];
};

struct si_statsether
{
    short		si_nodeid;	/* pu node id */
    short		si_etherno;	/* ethernet number 0..EN_MAX_ETHERS-1*/
    u_long		si_status;	/* status command from 82586 */
    u_long		si_recd_good;	/* # good packets received */
    u_long		si_recd_fail;	/* # bad packets received */
    u_long		si_sent_good;	/* # good packets sent */
    u_long		si_sent_fail;	/* # bad packets sent */
    u_long		si_reset;	/* # of resets */
    u_long		si_reset_ret;	/* # of packets returned by reset */
    u_long		si_coll_errs;	/* # of max collisions */
    u_long		si_send_ncs;	/* # of no carrier senses */
    u_long		si_send_lcs;	/* # of lost clear to sends */
    u_long		si_send_udr;	/* # of underruns */
    u_long		si_def;
    u_long		si_sqe;
    u_long		si_crc_errs;	/* # of crc errors */
    u_long		si_aln_errs;	/* # of bad alligment errors */
    u_long		si_rsc_errs;	/* # of ressource errors */
    u_long		si_ovrn_errs;	/* # of overruns */
    u_long		si_res_errs;	/* # of command ressource errors */
    u_long		si_collisions[15]; /* collission count */
    int			si_tb_low;	/* low number of free transmit bufs */
    int			si_tb_free_cnt; /* transmit free list size */
    int			si_tb_actv_cnt; /* transmit active list size */
    int			si_rb_free_cnt; /* receive free list size */
    int			si_rb_actv_cnt; /* receive active list size */
    bool_t		si_alive;	/* ether net alive */
};

struct cur_statsether
{
    struct cr_statsether	cri;
    short			nth;		/* local pu id */
    short			etherno;	/* lan # */
};
#define	CURSZ_STATSETHER	sizeof(struct cur_statsether)

/* SIS_IOP request */
/* Search criteria for IOP statistics */
struct cr_statsiop
{
    short		cr_nodeid;
    short		cr_channel;	/* channel number [0-3], SI_ANY */
};

struct si_statsiop
{
    short		si_nodeid;	/* pu node id */
    short		si_channel;	/* channel number [0-3] */
    u_int		si_initiated;	/* number of exec_chan_program */
    u_int		si_attentions;	/* number of interrupts received */
};

struct cur_statsiop
{
    struct cr_statsiop	cri;
    short		nth;		/* local pu id */
    short		channel;	/* IOP # */
};
#define	CURSZ_STATSIOP		sizeof(struct cur_statsiop)

/* SIS_TXQ request */
/* Status information for txqueue statistics */
struct si_statstxq
{
    short		si_nodeid;	/* pu node id */
    int			si_inserts;	/* # of tx_queue_insert calls */
    int			si_waits;	/* # of inserts with no waiting proc */
    int			si_max_mcount; 	/* max value queue depth */
    char		si_name[32];	/* name of queue */
};

struct cur_statstxq
{
    struct cr_stats	cri;
    short		nth;		/* local pu id */
    short		txqno;		/* list index */
};
#define	CURSZ_STATSTXQ		sizeof(struct cur_statstxq)

/* SIS_SEM request */
/* Status information for semaphore status */
struct si_statssem
{
    short		si_nodeid;	/* pu node id */
    u_int		si_uwaits;	/* # UPU sem_lock(s) which blocked */
    u_int		si_rwaits;	/* # RPU sem_lock(s) which blocked */
    u_int		si_uwblock;	/* # UPU sem_lock(s) which would have
					   blocked */
    u_int		si_rwblock;	/* # RPU sem_lock(s) which would have
					   blocked */
    u_int		si_uspins;	/* # UPU sem_lock/sem_unlock spins */
    u_int		si_rspins;	/* # RPU sem_lock/sem_unlock spins */
    char		si_name[32];	/* name of semaphore */
};

struct cur_statssem
{
    struct cr_stats	cri;
    short		nth;		/* local pu id */
    short		semno;		/* list index */
};
#define	CURSZ_STATSSEM		sizeof(struct cur_statssem)

/* SIS_CMEM request */
/* Status information for cmem usage statistics */
struct si_statscmem
{
    short		si_nodeid;	/* pu node id */
    short		si_npool;
    int			si_avefree;
    int			si_inuse_count;
    int			si_free_count;
    int			si_page_count;
    int			si_cget_count;
    int			si_cfree_count;
    int			si_memalls;
    int			si_memall_pages;
    int			si_memall_waits;
    int			si_memfrees;
    int			si_memfree_pages;
    int			si_daemons;
    int			si_upu_newpages;
    int			si_rpu_newpages;
    int			si_upu_pagefrees;
    int			si_rpu_pagefrees;
    int			si_upu_cgets;
    int			si_rpu_cgets;
    int			si_upu_cgetfails;
    int			si_rpu_cgetfails;
    int			si_upu_cfrees;
    int			si_rpu_cfrees;
};
#define	CURSZ_STATSCMEM		sizeof(struct cur_stats)

/* SIS_HEAP request */
/* Status information RTE heap */
struct si_statsheap
{
    short		si_nodeid;	/* pu node id */
    u_int		si_heap_size;
    caddr_t		si_heap_addr;
    u_int		si_alloc_fail;
    u_int		si_alloc_cnt;
    u_int		si_search_cnt;
    u_int		si_free_mem;
};


/* SIS_TOTALS request */
/* Status information for totals of table usages (for pstat) */
struct si_statstotals
{
    short			si_nodeid;	/* pu node id */
    int				si_file_use;	/* file table currently used */
    int				si_file_tot;	/* file table size */
    int				si_inode_use;	/* inode table currently used */
    int				si_inode_tot;	/* inode table size */
    int				si_proc_use;	/* proc table currently used */
    int				si_proc_tot;	/* proc table size */
    int				si_text_use;	/* text table currently used */
    int				si_text_tot;	/* text table size */
    int				si_swap_use;	/* swap area currently used */
    int				si_swap_tot;	/* swap area size (1k) */
    int				si_pad[10];
};
#define	CURSZ_STATSTOTALS	sizeof(struct cur_stats)
#define	CURSZ_STATSHEAP		sizeof(struct cur_stats)

/* SIS_TRANS request */
/* Status information for transaction statistics */
struct si_statstrans
{
    short		si_nodeid;	/* pu node id */
    int			si_begin;
    int			si_commit;
    int			si_abort;
    int			si_lock_wait;
    int			si_deadlock;
    int			si_timeout;
    struct timeval	si_wait_time;
    struct timeval	si_resp_time;
};
#define	CURSZ_STATSTRANS	sizeof(struct cur_stats)

/* SIS_BUFFER request */
/* Status information for buffer cache statistics */
struct si_statsbuffer
{
    short			si_nodeid;	/* pu node id */
    short			si_bpercent;
    int				si_nbuf;
    int				si_rpuloc_hit;
    int				si_rpuloc_req;
    int				si_upuloc_hit;
    int				si_upuloc_req;
    int				si_upurmt_hit;
    int				si_upurmt_req;
};
#define	CURSZ_STATSBUFFER	sizeof(struct cur_stats)

/* SIS_RPULA request */
/* Status information for RPU load statistics */
struct si_statsrpula
{
    short			si_nodeid;	/* pu node id */
    int				si_maxla[3];	/* 1, 5, 15 min max load */
    int				si_curla;	/* current load */
    int				si_absmax;	/* max load since boot */
};
#define	CURSZ_STATSRPULA	sizeof(struct cur_stats)

/*
 * Volume manager requests
 */

/* SIV_LOGVOL request */
/* Search criteria for logical volume status */
struct cr_lvestat
{
    UID_T	cr_uid;		/* a uid */
    si_voluid	cr_uidident:8;	/* cr_uid tag: none, lv, fs */
    si_onoff	cr_lvonline:8;	/* LV online */
    short	cr_nodeid;	/* PU node id: SI_ANY_PU, 0 mine */
    char	cr_lvlab[SI_LV_LABEL]; /* lv label: null if any */
};

/* status information of logical volume */
struct si_lvestat
{
    UID_T	si_uid;			/* stamp unique to this query */
    UID_T	si_lvuid;		/* logical volume uid */
    UID_T	si_fsuid;		/* file system uid */
    short	si_nodeid;		/* PU node id */
    u_short	si_lvstatus;		/* logical volume status */
    u_short	si_dsdgs;		/* defined subdisk group in LV */
    u_short	si_dplex;		/* defined plexes in LV */
    bool_t	si_mnt_subset;		/* auto mount subset LV */
    bool_t	si_mnt_incons;		/* auto mount inconsistent LV */
    bool_t	si_automnt_fs;		/* file system is to be automounted */
    char	si_lvlab[SI_LV_LABEL];	/* logical volume label */
    int		si_lvtype;		/* logical volume type */
    short	si_lvc_1;		/* PU no for LVC choice #1 */
    short	si_lvc_2;		/* PU no for LVC choice #2 */
    int		si_reserved[6];		/* reserved for future use */
};

/* cursor for LV status search */
struct cur_lve		
{
    struct cr_lvestat	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    short		lv_nth;		/* nth logical volume */
    bool_t		match;		/* matched */
};
#define	CURSZ_LVE	sizeof(struct cur_lve)

/* SIV_SUBDISK request */
/* Search criteria for subdisk status of a logical volume */
struct cr_sddstat
{
    short	cr_nodeid;	/* PU node id: SI_ANY_PU, 0 mine */
    char	cr_sdgsno;	/* SD group seq no.: SI_ANY any */
    si_onoff	cr_sdonline:4;	/* SD online flag */
    si_voluid	cr_uidident:4;	/* cr_uid tag: none, lv, sd, pd */
    UID_T	cr_uid;		/* a uid */
};

/* status information of subdisk */
struct si_sddstat
{
    UID_T	si_uid;			/* stamp unique to this querry */
    UID_T	si_lvuid;		/* logical volume uid */
    UID_T	si_sduid;		/* subdisk uid */
    UID_T	si_pduid;		/* physical disk uid */
    short	si_nodeid;		/* PU node id */
    short	si_sdgsno;		/* subdisk group no. */
    short	si_sdplexno;		/* subdisk plex no. */
    short	si_physeqno;		/* physical disk sequence no. */
    u_short	si_sdstus;		/* see sdentry.h for status defs */
    u_short	si_sdonline;		/* online/offline flag */
    u_int	si_sdsucrds;		/* successful reads */
    u_int	si_sderrrds;		/* error reads */
    u_int	si_sdsucwrts;		/* successful writes */
    u_int	si_sderrwrts;		/* error writes */
    time_t	si_sdtstmp;		/* current SD timestamp */
    daddr_t	si_sdpadr;		/* physical sector adr of SD start */
    u_long	si_sdpsz;		/* SD size in sectors */
    u_short	si_sdrvadrspc;		/* address spaced being revived. */
    u_short	si_sdstate;		/* see sdinfo.h for state defs */
    daddr_t	si_sdrvlow;		/* revive addr (lv adr) low bound */
    daddr_t	si_sdrvupper;		/* revive addr (lv adr) high bound */
    u_long	si_sdrvtotal;		/* total no blks copied in revive */
    int		si_reserved[6];		/* reserved for future use */
};

/* cursor for subdisk status search */
struct cur_sdd		
{
    struct cr_sddstat	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    short		lvuid_nth;	/* lvuid index */
    short		sdgsno_idx;	/* subdisk uid array index of SD grp */
    short		nth_onln;	/* nth online */
    short		nth_ofln;	/* nth offline */
    short		nth_orphan;	/* nth orphan subdisk */
    bool_t		match;		/* match */
    UID_T		lvuid_cur;	/* current lvuid */
};
#define	CURSZ_SDD	sizeof(struct cur_sdd)

/* SIV_PHYSDISK request */
/* Search criteria for physical disk status */
#define	SI_PD_LABEL	32
struct cr_pddstat
{
    short	cr_nodeid;	/* PU node id: SI_ANY_PU, 0 mine */
    struct rawdev cr_device;	/* ignoring ic_pu_id, 0 for any */
    si_onoff	cr_pdsoftofl;	/* PD online */
    char	cr_pdname[SI_PD_LABEL]; /* pd name: null if any */
    UID_T	cr_pduid;	/* physical disk uid: 0 any */
};

/* status information of physical disk */
struct si_pddstat
{
    UID_T	si_uid;		/* stamp unique to this querry */
    UID_T	si_pduid;	/* physical disk uid */
    u_int	si_pdstate;	/* physical disk status */
    struct rawdev si_device;	/* pu/chnl/ctrlr/drv */
    u_short	si_subdisks;	/* subdisks defined on this disk */
    u_short	si_numpaths;	/* no. of paths to this disk */
    char	si_pdname[SI_PD_LABEL]; /* physical disk name */
    int		si_reserved[6];	/* reserved for future use */
};

/* cursor for physical disk status search */
struct cur_pdd		
{
    struct cr_pddstat	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    short		pd_nth;		/* nth logical volume */
    bool_t		match;		/* match */
}; 
#define	CURSZ_PDD	sizeof(struct cur_pdd)

/* SIV_LVGROUP request */
/* search criteria for logical volume group */
struct cr_lvgstat
{
    UID_T	cr_lvuid;	/* logical volume uid. */
    short	cr_sdgsno;	/* subdisk group, SI_ANY any */
};

/* status information of logical volume group */
#define	SI_MAXPLX 	8 	/* Maximum allowable Subdisk plexes */
struct si_lvgstat
{
    UID_T	si_uid;		/* stamp unique to this querry */
    u_short	si_t_ntries;	/* SDEs chained on SDG */
    u_short	si_t_valid;	/* Valid SDEs in this SDG */
    u_short	si_t_defined;	/* Defined SDEs for this SDG */
    u_short	si_t_online;	/* Online SDEs in this SDG */
    short	si_nodeid;	/* PU node id */
    UID_T	si_sduids[SI_MAXPLX]; /* Defined SD uid list for this SDG */
    u_long	si_dsize;	/* Data size in sectors */
    u_long	si_psize;	/* Pre-image size in sectors */
    int		si_reserved[6];	/* reserved for future use */
};

struct cur_lvg			/* cursor for LVG status search */
{
    struct cr_lvgstat	cri;		/* search criteria */
    short		pu_nth;		/* nth PU */
    short		sdgsno_no;	/* subdisk group seq no. */
    bool_t		match;		/* match */
};
#define	CURSZ_LVG	sizeof(struct cur_lvg)

/*
 *  End of sysinfo.h
 */
