Article 13469 of alt.sources: Submitted-by: ljp@tiac.net Archive-name: orion-1.0/part06 ---- Cut Here and feed the following to sh ---- #!/bin/sh # This is `orion.06' (part 6 of orion-1.0). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `orion-1.0/sargent/kern.c' is being continued... # save_IFS="${IFS}" IFS="${IFS}:" gettext_dir=FAILED locale_dir=FAILED first_param="$1" for dir in $PATH do if test "$gettext_dir" = FAILED && test -f $dir/gettext \ && ($dir/gettext --version >/dev/null 2>&1) then set `$dir/gettext --version 2>&1` if test "$3" = GNU then gettext_dir=$dir fi fi if test "$locale_dir" = FAILED && test -f $dir/shar \ && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) then locale_dir=`$dir/shar --print-text-domain-dir` fi done IFS="$save_IFS" if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED then echo=echo else TEXTDOMAINDIR=$locale_dir export TEXTDOMAINDIR TEXTDOMAIN=sharutils export TEXTDOMAIN echo="$gettext_dir/gettext -s" fi if test ! -r _sh05649/seq; then $echo 'Please unpack part 1 first!' exit 1 fi shar_sequence=`cat _sh05649/seq` if test "$shar_sequence" != 6; then $echo 'Please unpack part' "$shar_sequence" 'next!' exit 1 fi if test ! -f _sh05649/new; then $echo 'x -' 'STILL SKIPPING' 'orion-1.0/sargent/kern.c' else $echo 'x -' 'continuing file' 'orion-1.0/sargent/kern.c' sed 's/^X//' << 'SHAR_EOF' >> orion-1.0/sargent/kern.c && X { "Sdsk_num_disks", 0, 0 }, /* int */ X { "SdskProbe",0, 0 }, /* int[] */ X { "Sdskstats",0, 0 }, /* struct iotime[] */ X { "Sdsk_data",0, 0 }, /* Sdsk_stuff[] */ X { "strst", 0, 0 }, /* struct strstat */ X { "", 0, 0 }, /* Terminating entry */ X}; X#endif X X#ifdef VENIX32 X/* X** Sar address file used by VENIX 3.2.4. Reverse engineered. When X** sar(1M) compatability is being used, "recNlist" points to this X** table. X*/ X#define SARG_NL_SYSINFO 1 X#define SARG_NL_MINFO 2 X#define SARG_NL_INODE 3 X#define SARG_NL_FILE 4 X#define SARG_NL_PROC 6 X#define SARG_NL_FLOCK 7 X#define SARG_NL_V 8 X#define SARG_NL_SYSERR 9 Xstatic struct nlist recNlistSar[] = X{ X { "oooooo", 0, 0 }, X { "sysinfo", 0, 0 }, /* struct sysinfo */ X { "minfo", 0, 0 }, /* struct minfo */ X { "inode", 0, 0 }, /* struct inode[] */ X { "file", 0, 0 }, /* struct file[] */ X { "oooooo", 0, 0 }, X { "proc", 0, 0 }, /* struct proc[] */ X { "flckinfo", 0, 0 }, /* struct flckinfo */ X { "v", 0, 0 }, /* struct var */ X { "syserr", 0, 0 }, /* struct syserr */ X { "dinfo", 0, 0 }, /* struct dinfo */ X { "oooooo", 0, 0 }, X { "oooooo", 0, 0 }, X { "rcinfo", 0, 0 }, /* struct rcinfo */ X { "", 0, 0 }, /* Terminating entry. */ X}; X X/* X** Lsar address file for VENIX 3.2.4. When sar compatability is not X** being used, "recNlist" points to this table. X*/ X#define SARG_LNL_SYSINFO 0 X#define SARG_LNL_MINFO 1 X#define SARG_LNL_INODE 2 X#define SARG_LNL_FILE 3 X#define SARG_LNL_PROC 4 X#define SARG_LNL_FLOCK 5 X#define SARG_LNL_V 6 X#define SARG_LNL_SYSERR 7 X#define SARG_LNL_FREEMEM 8 X#define SARG_LNL_QUEUE 9 X#define SARG_LNL_MBLOCK 10 X#define SARG_LNL_NMBLOCK 11 X#define SARG_LNL_DBLOCK 12 X#define SARG_LNL_MSGINFO 13 X#define SARG_LNL_MSGQUE 14 X#define SARG_LNL_SEMINFO 15 X#define SARG_LNL_MOUNT 16 X#define SARG_LNL_NFSTYP 17 X#define SARG_LNL_FSINFO 18 Xstatic struct nlist recNlistLsar[] = X{ X { "sysinfo", 0, 0 }, /* struct sysinfo */ X { "minfo", 0, 0 }, /* struct minfo */ X { "inode", 0, 0 }, /* struct inode[] */ X { "file", 0, 0 }, /* struct file[] */ X { "proc", 0, 0 }, /* struct proc[] */ X { "flckinfo", 0, 0 }, /* struct flckinfo */ X { "v", 0, 0 }, /* struct var */ X { "syserr", 0, 0 }, /* struct syserr */ X { "freemem", 0, 0 }, /* int */ X { "queue", 0, 0 }, /* struct queue[] */ X { "mblock", 0, 0 }, /* mblk_t[] */ X { "nmblock", 0, 0 }, /* int */ X { "dblock", 0, 0 }, /* dblk_t[] */ X { "msginfo", 0, 0 }, /* struct msginfo */ X { "msgque", 0, 0 }, /* struct msqid_ds[] */ X { "seminfo", 0, 0 }, /* struct seminfo */ X { "mount", 0, 0 }, /* struct mount[] */ X { "nfstyp", 0, 0 }, /* short */ X { "fsinfo", 0, 0 }, /* struct fsinfo[] */ X { "", 0, 0 }, /* Terminating entry */ X}; X#endif X X/* X** This array maps variable ids to indicies into the "recNlist" table. X*/ Xstruct recOffsets tableOffsets[] = X{ X { SARG_VAR_V, SARG_NL_V, SARG_LNL_V }, X#if !defined(UW2) X { SARG_VAR_MSGINFO, 0, SARG_LNL_MSGINFO }, X { SARG_VAR_SEMINFO, 0, SARG_LNL_SEMINFO }, X#endif X#if defined(ORION_FEAT_SYSINFO) X { SARG_VAR_SYSINFO, SARG_NL_SYSINFO, SARG_LNL_SYSINFO }, X { SARG_VAR_MINFO, SARG_NL_MINFO, SARG_LNL_MINFO }, X { SARG_VAR_NFSTYP, 0, SARG_LNL_NFSTYP }, X#endif X#if defined(VENIX32) || defined(SVR3) || defined(SCO5) X { SARG_VAR_INODE, SARG_NL_INODE, SARG_LNL_INODE }, X { SARG_VAR_FILE, SARG_NL_FILE, SARG_LNL_FILE }, X { SARG_VAR_PROC, SARG_NL_PROC, SARG_LNL_PROC }, X { SARG_VAR_FLOCK, SARG_NL_FLOCK, SARG_LNL_FLOCK }, X { SARG_VAR_NMBLOCK, 0, SARG_LNL_NMBLOCK }, X { SARG_VAR_SYSERR, SARG_NL_SYSERR, SARG_LNL_SYSERR }, X { SARG_VAR_FREEMEM, 0, SARG_LNL_FREEMEM }, X { SARG_VAR_QUEUE, 0, SARG_LNL_QUEUE }, X { SARG_VAR_MBLOCK, 0, SARG_LNL_MBLOCK }, X { SARG_VAR_DBLOCK, 0, SARG_LNL_DBLOCK }, X { SARG_VAR_MSGQUE, 0, SARG_LNL_MSGQUE }, X { SARG_VAR_MOUNT, 0, SARG_LNL_MOUNT }, X { SARG_VAR_FSINFO, 0, SARG_LNL_FSINFO }, X#endif X#if defined(SVR4) || defined(UW2) || defined(SUN5) X { SARG_VAR_MODHEAD, 0, SARG_LNL_MODHEAD }, X#endif X#if defined(UW2) X { SARG_VAR_METS, 0, SARG_LNL_METS }, X { SARG_VAR_LOCALPTR, 0, SARG_LNL_LOCALPTR }, X { SARG_VAR_LOCALOFF, 0, SARG_LNL_LOCALOFF }, X { SARG_VAR_DISKCNT, 0, SARG_LNL_DISKCNT }, X { SARG_VAR_SD01DP, 0, SARG_LNL_SD01DP }, X { SARG_VAR_ROOTVFS, 0, SARG_LNL_ROOTVFS }, X#endif X#if defined(SCO5) || defined(SCO4) X { SARG_VAR_NDISKS, 0, SARG_LNL_NDISKS }, X { SARG_VAR_DSKPROBE, 0, SARG_LNL_DSKPROBE }, X { SARG_VAR_SDSKSTATS,0, SARG_LNL_SDSKSTATS}, X { SARG_VAR_DSKSTUFF, 0, SARG_LNL_DSKSTUFF }, X { SARG_VAR_STRSTAT, 0, SARG_LNL_STRSTAT }, X#endif X { SARG_VAR_NULL, -1, -1 } X}; X X#if defined(ORION_FEAT_SYSINFO) Xstatic struct sysinfo siSysinfo; Xstatic struct minfo siMinfo; Xstatic struct siEnt siCache[] = X{ X { SARG_VAR_SYSINFO, sizeof(struct sysinfo), 0, (void*)&siSysinfo }, X { SARG_VAR_MINFO, sizeof(struct minfo), 0, (void*)&siMinfo }, X { SARG_VAR_NULL, 0, 0, NULL } X}; X#endif X X#ifdef ORION_FEAT_METRICS Xstatic struct met_localdata_ptrs *metEngines; X#endif X Xstatic const int C_MaxNlist = sizeof(recNlistSar)/sizeof(struct nlist); Xstatic const int C_MaxLnlist = sizeof(recNlistLsar)/sizeof(struct nlist); Xstatic struct nlist *recNlist; Xstatic unsigned int sizeNlist; X Xstatic void metOffset( unsigned, off_t ); X X/* X** memInit() X** X** Initialize the kernel access facility. Read in the saved table of X** kernel addresses from the address file. X*/ Xint memInit( void ) X{ X const char *fileAddr; X X if( globalProfile.p_sar ) X { X recNlist = recNlistSar; X sizeNlist = C_MaxNlist; X } X else X { X recNlist = recNlistLsar; X sizeNlist = C_MaxLnlist; X } X X fileAddr = ( globalProfile.p_sar ? S_PathAddr : S_PathLaddr ); X if( !getSymbols(recNlist,sizeNlist,fileAddr,S_PathKern) ) X { X return 0; X } X X /* X ** Open the kernel memory file. X */ X if( (globalProfile.p_fdMem=open(S_PathMem,O_RDONLY)) == -1 ) X { X fprintf( stdout, "Bad open(2) of \"%s\" (Kernel memory). %s.\n", X S_PathMem, sys_errlist[errno] ); X exit( 1 ); X } X X#if defined(ORION_FEAT_METRICS) X metInit(); X#endif X X#if defined(ORION_FEAT_SYSINFO) X siReset(); X#endif X X return 1; X} X X/* X** memAddr() X** X** Given a kernel variable id (SARG_VAR_*), return the address of that X** variable in kernel memory. X*/ Xcaddr_t memAddr( unsigned var ) X{ X int i; X off_t offset; X X /* X ** The following globals are used in the lookup. X ** X ** tableOffsets : Array of records indexed by SARG_VAR_* constants. X ** recNlist : Pointer to array of nlist structures. X */ X X for( i=0; tableOffsets[i].var!=SARG_VAR_NULL; ++i ) X { X if( tableOffsets[i].var == var ) X break; X } X if( tableOffsets[i].var == SARG_VAR_NULL ) X return 0; X X if( globalProfile.p_sar ) X offset = tableOffsets[i].sar; X else X offset = tableOffsets[i].sargent; X X return (caddr_t)(recNlist[offset].n_value); X} X Xint memFetch( unsigned token, void *buf, unsigned size ) X{ X return memRead(globalProfile.p_fdMem,memAddr(token),buf,size); X X return 1; X} X X#ifdef ORION_FEAT_SYSINFO Xvoid siReset( void ) X{ X int i; X X for( i=0; siCache[i].var!=SARG_VAR_NULL; ++i ) X { X siCache[i].init = 0; X } X} X#endif X X#ifdef ORION_FEAT_SYSINFO Xvoid *siFetch( unsigned var ) X{ X int i; X X for( i=0; siCache[i].var!=SARG_VAR_NULL; ++i ) X { X if( siCache[i].var == var ) X break; X } X if( siCache[i].var == SARG_VAR_NULL ) X { X return NULL; X } X X if( !siCache[i].init ) X { X if( !memFetch(var,(void*)siCache[i].buf,siCache[i].size) ) X { X fputs( "Can not read to sysinfo cache.\n", stdout ); X return NULL; X } X siCache[i].init = 1; X } X X return (void*)siCache[i].buf; X} X#endif X X/* X** metInit() X** X** Initialize the metrics structures cache. Two things need to be done. X** 1. Read in the kernel structure "met_localdata_ptrs". This record X** contains the number of engines in the system and the kernel X** address of each engine metrics table. We read this table of X** addresses into a global variable. X** 2. Fill in the offset field of each local metrics structure in the X** "metTab" table. The offsets are stored in the kernel variable X** "met_ppmets_offsets". There is no dynamic way to do this, so X** we hard code it. X*/ X#if defined(ORION_FEAT_METRICS) Xint metInit( void ) X{ X int count; X caddr_t addr; X struct met_ppmets_offsets recOff; X X /* X ** We want to read in the met_localdata_ptrs structure pointed to X ** by met_localdata_ptrs_p. This record is variable length, the X ** size being stored in a fixed portion of the record. X */ X X /* X ** Read in the address of the record. X */ X if( !memFetch(SARG_VAR_LOCALPTR,&addr,sizeof(addr)) ) X { X fputs( "Could not fetch \"met_localdata_ptrs_p\".\n", stdout ); X return 0; X } X X /* X ** Read the fixed portion of the record. This is a count of X ** engines in the system. X */ X if( !memRead(globalProfile.p_fdMem,addr,&count,sizeof(count)) ) X { X fputs( "Could not read \"*met_localdata_ptrs_p\".\n", stdout ); X return 0; X } X X globalProfile.p_cntEngines = count; X X /* X ** Allocate space for the full record. This is the record plus X ** enough bytes for the array of pointers to engines (minus one X ** element since the record declaration contains a one element X ** array). X */ X if( (metEngines=(struct met_localdata_ptrs*)malloc( X sizeof(struct met_localdata_ptrs)*(sizeof(vaddr_t)*count))) == NULL ) X { X fputs( "Bad malloc().\n", stdout ); X return 0; X } X X /* X ** Read the full record. X */ X if( !memRead(globalProfile.p_fdMem,addr,metEngines, X sizeof(struct met_localdata_ptrs)+((count-1)*sizeof(vaddr_t))) ) X { X fputs( "Could not read \"*met_localdata_ptrs_p\".\n", stdout ); X return 0; X } X X if( globalProfile.p_debug ) X fprintf( stdout, "Found %d engine(s).\n", count ); X if( globalProfile.p_findings ) X { X int i; X X for( i=0; ilocaldata_p[count] ); X } X } X X if( !memFetch(SARG_VAR_LOCALOFF,&recOff,sizeof(recOff)) ) X { X fputs( "Could not fetch \"met_ppmets_offsets\".\n", stdout ); X return 0; X } X X /* X ** There is no clean way to populate the offset fields of the X ** "recOffsets" table. X */ X metOffset( SARG_VAR_STR, (int)recOff.metp_str_resrc_offset ); X metOffset( SARG_VAR_CPU, (int)recOff.metp_cpu_offset ); X metOffset( SARG_VAR_BUF, (int)recOff.metp_buf_offset ); X metOffset( SARG_VAR_TTY, (int)recOff.metp_tty_offset ); X metOffset( SARG_VAR_SYSCALL, (int)recOff.metp_syscall_offset ); X metOffset( SARG_VAR_VM, (int)recOff.metp_vm_offset ); X metOffset( SARG_VAR_KMEM, (int)recOff.metp_kmem_offset ); X /* X ** The offsets record does not have an offset to the vmmeter X ** structure. X */ X metOffset( SARG_VAR_VMMETER, 0 ); X X return 1; X} X#endif X X#if defined(ORION_FEAT_METRICS) Xvoid *metFetch( unsigned var ) X{ X void *ptr; X int i, eng; X X for( i=0; metTab[i].var!=SARG_VAR_NULL; ++i ) X { X if( metTab[i].var == var ) X break; X } X if( metTab[i].var == SARG_VAR_NULL ) X return NULL; X X if( metTab[i].ptr == NULL ) X { X if( (ptr=(void*)malloc(metTab[i].size*globalProfile.p_cntEngines)) X == NULL ) X { X fputs( "Bad malloc()\n", stdout ); X return NULL; X } X X metTab[i].ptr = ptr; X } X else X ptr = metTab[i].ptr; X X for( eng=0; englocaldata_p[eng]+metTab[i].offset), X ptr, X metTab[i].size) ) X { X free( ptr ); X metTab[i].ptr = NULL; X return 0; X } X X ptr = (char*)ptr + metTab[i].size; X } X X return metTab[i].ptr; X} X#endif X X#if defined(ORION_FEAT_METRICS) Xstatic void metOffset( unsigned var, off_t offset ) X{ X int i; X X for( i=0; metTab[i].var!=SARG_VAR_NULL; ++i ) X { X if( metTab[i].var == var ) X { X metTab[i].offset = offset; X return; X } X } X} X#endif SHAR_EOF $echo 'File' 'orion-1.0/sargent/kern.c' 'is complete' && chmod 0664 'orion-1.0/sargent/kern.c' || $echo 'restore of' 'orion-1.0/sargent/kern.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'orion-1.0/sargent/kern.c:' 'MD5 check failed' 49cccb0d8a6abee471f9082d468adbaa orion-1.0/sargent/kern.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/kern.c'`" test 23353 -eq "$shar_count" || $echo 'orion-1.0/sargent/kern.c:' 'original size' '23353,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/ps.c ============== if test -f 'orion-1.0/sargent/ps.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/ps.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/ps.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/ps.c' && X X/* X** ---------------------------------------------------------------- X** X** Copyright (c) 1994,1995,1996 by Larry Plona X** X** This file is part of the Orion software package. The Orion X** software package is copyright by its author, Larry Plona. This X** software, both source code and prepared binaries, may be X** freely distributed as long as all copyright notices remain X** intact and this software is not sold or packaged with other X** commercial software. X** X** No warranty of any kind attached with this software. It is X** supplied as is. X** X** ---------------------------------------------------------------- X*/ X X#include"sarg_p.h" X X/* X** ps record type. X** X** Tracks data regarding all processes in process table. X*/ X#if defined(ORION_FEAT_PROCTAB) Xint psSample( int fd ) X{ X int i, j; X struct proc *recProc; X struct user recU; X struct sargPs sargPs; X X if( globalProfile.p_debug ) X fputs( "Making Processes sample.\n", stdout ); X X if( !memFetch(SARG_VAR_PROC,globalProfile.p_scratch,sizeof(struct X proc)*globalProfile.kern_var.v_proc) ) X { X fputs( "Could not fetch \"proc[]\".\n", stdout ); X return 0; X } X X sargPs.count = 0; X sargPs.cntZomb = 0; X sargPs.cntRun = 0; X sargPs.cntSwap = 0; X sargPs.cntSleep = 0; X X recProc = (struct proc*)globalProfile.p_scratch; X for( i=0,j=0; ip_stat == 0 ) X continue; X X sargPs.procs[j].flags = 0; X X if( recProc->p_stat == SZOMB ) X { X ++(sargPs.cntZomb); X continue; X } X X if( !(recProc->p_flag&SLOAD) ) X { X ++(sargPs.cntSwap); X continue; X } X X if( recProc->p_stat == SSLEEP ) X { X ++(sargPs.cntSleep); X sargPs.procs[j].flags |= SARG_PFLAG_SLEEP; X } X X if( recProc->p_stat == SRUN ) X { X ++(sargPs.cntRun); X sargPs.procs[j].flags |= SARG_PFLAG_RUN; X } X X if( recProc->p_stat == SONPROC ) X { X ++(sargPs.cntRun); X sargPs.procs[j].flags |= SARG_PFLAG_ONPROC; X } X X if( recProc->p_stat == SXBRK ) X sargPs.procs[j].flags |= SARG_PFLAG_XBRK; X X sargPs.procs[j].pid = recProc->p_pid; X sargPs.procs[j].size = recProc->p_size; X X /* X ** Get the U block for the process. X */ X if( sysi86(RDUBLK,recProc->p_pid,&recU,sizeof(recU)) == -1 ) X { X fprintf( stdout, "Bad sysi86(2) for pid %d. %s.\n", X recProc->p_pid, sys_errlist[errno] ); X sargPs.procs[j].time = 0; X strcpy( sargPs.procs[j].argv, "???" ); X } X else X { X sargPs.procs[j].time = recU.u_stime + recU.u_utime; X strncpy( sargPs.procs[j].argv, recU.u_psargs, X SARG_MAX_ARGV ); X sargPs.procs[j].argv[SARG_MAX_ARGV] = '\0'; X } X X ++j; X if( j >= SARG_MAX_TOTPROCS ) X break; X } X X sargPs.count = j; X X return diskWrite((void*)&sargPs,sizeof(sargPs),SARG_RTYP_PS); X} X#endif X X/* X** ps record type. X** X** Tracks data regarding all processes in process table. X*/ X#if defined(ORION_FEAT_PROCFS) Xint psSample( int fd ) X{ X char fullpath[255+1]; X int i, j; X struct proc *recProc; X struct sargPs sargPs; X struct dirent *dp; X struct psinfo recInfo; X static DIR *dirp = NULL; X X if( globalProfile.p_debug ) X fputs( "Making Processes sample.\n", stdout ); X X sargPs.count = 0; X sargPs.cntZomb = 0; X sargPs.cntRun = 0; X sargPs.cntSwap = 0; X sargPs.cntSleep = 0; X X if( dirp == NULL ) X { X if( (dirp=opendir(S_PathProc)) == NULL ) X { X fprintf( stdout, "Bad opendir() of \"%s\".\n", S_PathProc ); X return 0; X } X } X else X { X rewinddir( dirp ); X } X X j = 0; X while( (dp=readdir(dirp)) != NULL ) X { X if( dp->d_name[0] == '.' ) X continue; X#if defined(UW2) X sprintf( fullpath, "%s/%d/psinfo", S_PathProc, atoi(dp->d_name) ); X#else X sprintf( fullpath, "%s/%d", S_PathProc, atoi(dp->d_name) ); X#endif X X if( (fd=open(fullpath,O_RDONLY)) == -1 ) X { X if( globalProfile.p_debug ) X { X fprintf( stdout, "Bad open() of \"%s\". %s.\n", X S_PathProc, sys_errlist[errno] ); X } X continue; X } X X#if defined(UW2) X if( read(fd,&recInfo,sizeof(recInfo)) == -1 ) X { X close( fd ); X continue; X } X#else X if( ioctl(fd,PIOCPSINFO,&recInfo) == -1 ) X { X if( globalProfile.p_debug ) X fprintf( stdout, "Bad ioctl(). %s.\n", sys_errlist[errno] ); X continue; X } X#endif X close( fd ); X X sargPs.procs[j].pid = atoi(dp->d_name); X sargPs.procs[j].size = recInfo.pr_size; X sargPs.procs[j].time = recInfo.pr_time.tv_sec; X strncpy( sargPs.procs[j].argv, recInfo.pr_psargs, SARG_MAX_ARGV ); X sargPs.procs[j].argv[SARG_MAX_ARGV] = '\0'; X X X sargPs.procs[j].flags = 0; X X if( recInfo.pr_lwp.pr_sname == 'Z' ) X { X ++(sargPs.cntZomb); X continue; X } X X if( recInfo.pr_lwp.pr_sname == 'S' ) X { X ++(sargPs.cntSleep); X sargPs.procs[j].flags |= SARG_PFLAG_SLEEP; X } X X if( recInfo.pr_lwp.pr_sname == 'R' ) X { X ++(sargPs.cntRun); X sargPs.procs[j].flags |= SARG_PFLAG_RUN; X } X X if( recInfo.pr_lwp.pr_sname == 'O' ) X { X ++(sargPs.cntRun); X sargPs.procs[j].flags |= SARG_PFLAG_ONPROC; X } X X if( recInfo.pr_lwp.pr_sname == 'X' ) X { X ++(sargPs.cntSwap); X sargPs.procs[j].flags |= SARG_PFLAG_XBRK; X } X X ++j; X if( j >= SARG_MAX_TOTPROCS ) X break; X } X X sargPs.count = j; X X return diskWrite((void*)&sargPs,sizeof(sargPs),SARG_RTYP_PS); X} X#endif SHAR_EOF chmod 0664 'orion-1.0/sargent/ps.c' || $echo 'restore of' 'orion-1.0/sargent/ps.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'orion-1.0/sargent/ps.c:' 'MD5 check failed' 7f2d3e2123ee529e09d8f11ae7260dff orion-1.0/sargent/ps.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/ps.c'`" test 5204 -eq "$shar_count" || $echo 'orion-1.0/sargent/ps.c:' 'original size' '5204,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/proc.c ============== if test -f 'orion-1.0/sargent/proc.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/proc.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/proc.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/proc.c' && X X/* X** ---------------------------------------------------------------- X** X** Copyright (c) 1994,1995,1996 by Larry Plona X** X** This file is part of the Orion software package. The Orion X** software package is copyright by its author, Larry Plona. This X** software, both source code and prepared binaries, may be X** freely distributed as long as all copyright notices remain X** intact and this software is not sold or packaged with other X** commercial software. X** X** No warranty of any kind attached with this software. It is X** supplied as is. X** X** ---------------------------------------------------------------- X*/ X X#include"sarg_p.h" X X#if defined(UW2) Xstatic int fds[SARG_MAX_PROCS]; X#endif Xpid_t pids[SARG_MAX_PROCS]; X X/* X** procInit() X** X** Unlike other initialization routines, this one is called multiple X** times; once for each process id. X*/ Xint procInit( int fdMem, int idx ) X{ X#if defined(UW2) X { X char filename[127+1]; X X /* X ** Open up the status file in the proc filesystem for the X ** given process. The file descriptor will remain open. X */ X X sprintf( filename, "%s/%d/status", S_PathProc, pids[idx] ); X if( (fds[idx]=open(filename,O_RDONLY)) == -1 ) X { X fprintf( stdout, "Bad open() of \"%s\". %s.\n", X filename, sys_errlist[errno] ); X pids[idx] = -1; X fds[idx] = -1; X } X } X#endif X return 1; X} X X/* X** procReset() X** X** Re-read the process table. This is done once each pass. X*/ Xint procReset( void ) X{ X if( !memFetch(SARG_VAR_PROC,globalProfile.p_scratch, X sizeof(struct proc)*globalProfile.kern_var.v_proc) ) X { X fprintf( stdout, "Bad read(2) of table proc. %s.\n", X sys_errlist[errno] ); X return 0; X } X return 1; X} X X/* X** procFind() X** X** Find the process entry in the given process table for the given X** process id. X*/ X#if defined(ORION_FEAT_PROCTAB) Xstatic struct proc *procFind( int idx ) X{ X int i; X struct proc *procs; X X procs = (struct proc*)globalProfile.p_scratch; X X for( i=0; ip_region; preg!=NULL; ) X { X /* Read the pregion into memory. */ X if( !memRead(fdMem,(caddr_t)preg,(caddr_t)&pregion,sizeof(pregion)) ) X { X fputs( "Could not read a pregion.\n", stdout ); X return 0; X } X if( pregion.p_type==PT_DATA || pregion.p_type==PT_STACK ) X { X if( !memRead(fdMem,(caddr_t)pregion.p_reg, X (caddr_t)®ion,sizeof(region)) ) X { X fputs( "Bad read of a region.\n", stdout ); X return 0; X } X recProc.regions[ X pregion.p_type==PT_DATA?SARG_REGION_DATA:SARG_REGION_STACK] X += (region.r_pgsz*NBPP); X } X /* X ** If both the data and stack regions have been collected, X ** there is no point in continuing. X */ X if( recProc.regions[SARG_REGION_DATA]>0 && X recProc.regions[SARG_REGION_STACK]>0 ) X { X break; X } X X recProc.flagGone = 0; X ++preg; X } X X return diskWrite((void*)&recProc,sizeof(recProc),SARG_RTYP_PROC); X} X#endif X X/* X** procSample() X** X** UnixWare 2 version. X*/ X#if defined(UW2) Xint procSample( int fdMem, int idx ) X{ X int i; X struct pstatus pstatus; X struct sargProc recProc; X X if( globalProfile.p_debug ) X fprintf( stdout, "Making Proc sample for %d.\n", pids[idx] ); X X recProc.pid = pids[idx]; Xfprintf( stdout, "Proc fd %d.\n", fds[idx] ); X if( read(fds[idx],(void*)&pstatus,sizeof(struct pstatus)) == -1 ) X { X fprintf( stdout, "Bad read() on \"/proc\". %s.\n", X sys_errlist[errno] ); X close( fds[idx] ); X recProc.flagGone = 1; X } X else X { X recProc.flagGone = 0; X recProc.timeUsr = pstatus.pr_utime.tv_sec; X recProc.timeSys = pstatus.pr_stime.tv_sec; X X for( i=0; i&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'orion-1.0/sargent/proc.c:' 'MD5 check failed' 4c719b29f445bc28ca1b8a4e006b3126 orion-1.0/sargent/proc.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/proc.c'`" test 5279 -eq "$shar_count" || $echo 'orion-1.0/sargent/proc.c:' 'original size' '5279,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/sarg.h ============== if test -f 'orion-1.0/sargent/sarg.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/sarg.h' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/sarg.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/sarg.h' && X X/* X** ---------------------------------------------------------------- X** X** Copyright (c) 1994,1995,1996 by Larry Plona X** X** This file is part of the Orion software package. The Orion X** software package is copyright by its author, Larry Plona. This X** software, both source code and prepared binaries, may be X** freely distributed as long as all copyright notices remain X** intact and this software is not sold or packaged with other X** commercial software. X** X** No warranty of any kind attached with this software. It is X** supplied as is. X** X** ---------------------------------------------------------------- X*/ X X#ifndef SARG_H X#define SARG_H X X/* X** Public API to Sargent data files. X*/ X X#include X#if defined(SVR4) || defined(UW2) || defined(SUN5) || defined(SCO5) X#include X#endif X#include X#include X#include X/* #include */ /* Must get from "libdbg.h". */ X#include X/*#include*/ X X#if defined(SVR3) || defined(VENIX32) Xtypedef struct X{ X unsigned long dl_lop; X long dl_hop; X} dl_t; X#endif X X#define SARG_MAX_PROCS 16 X#define SARG_MAX_TOTPROCS 64 X#define SARG_MAX_MODULE 7 X#define SARG_MAX_ARGV 31 X#define SARG_MAX_DISKS 16 X#define SARG_MAX_DISKNAME 16 X X/* X** Update this one by hand!!!! X*/ X#define SARG_STR_VER "2.2" X Xextern int errno; Xextern char *sys_errlist[]; X X/* X** All Sargent records begin with one of these records (regardless X** of type or OS). X*/ Xstruct sargHdr X{ X unsigned short h_type; X time_t h_ts; X unsigned int h_len; X}; X X#ifdef VENIX32 X/* X** Sar record. Reverse engineered from VENIX 3.2.4. X** 460 bytes. X*/ Xstruct sa X{ X char pad1[4]; /* ? */ X struct sysinfo si; /* 5 (184) */ X struct minfo mi; /* 188 (92) */ X char pad2[124]; /* dinfo? rcinfo? */ X int szinode; X int szfile; X int szproc; X int szlckf; X int szlckr; X int mszinode; X int mszfile; X int mszproc; X int mszlckf; X int mszlckr; X long inodeovf; X long fileovf; X long procovf; X time_t ts; /* 456 (4) */ X}; X#endif X X#ifdef SVR3 X/* X** From System V/386 3.2 manual. X*/ Xstruct sa X{ X struct sysinfo si; X struct minfo mi; X struct dinfo di; X struct rcinfo rc; X struct bpbinfo bi; X int bpb_utilize; X int minserve, maxserve; X int szinode; X int szfile; X int szproc; X int szlckf; X int szlckr; X int mszinode; X int mszfile; X int mszproc; X int mszlckf; X int mszlckr; X long inodeovf; X long fileovf; X long procovf; X time_t ts; X long devio[NDEV][4]; X}; X#endif X X#ifdef SVR4 X/* X** Sar record. X*/ Xstruct sa X{ X struct sysinfo si; X struct minfo mi; X char pad1[16]; X struct kmeminfo kmem; X char pad2[8]; X int szinode; X int szfile; X int szproc; X int szlckf; X int szlckr; X int mszinode; X int mszfile; X int mszproc; X int mszlckf; X int mszlckr; X long inodeovf; X long fileovf; X long procovf; X time_t ts; X char pad3[100]; X}; X#endif X X/* X** Sargent Basic1 record. X*/ Xstruct sargBasic1 X{ X long flags; X#define SARG_CPU_IDLE 0 X#define SARG_CPU_WAIT 1 X#define SARG_CPU_USER 2 X#define SARG_CPU_KERN 3 X#define SARG_CPU_SWAP 4 X#define SARG_MAX_CPU 5 X time_t cpu[SARG_MAX_CPU]; X#define SARG_WAIT_IO 0 X#define SARG_WAIT_SWAP 1 X#define SARG_WAIT_PIO 2 X#define SARG_MAX_WAIT 3 X time_t wait[SARG_MAX_WAIT]; X long cntSwapIn; X long cntSwapOut; X long cntPswitch; X long cntSys; X long cntSysRead; X long cntSysWrite; X long cntSysFork; X long cntSysExec; X long cntSysLwp; X long cntMsg; X long cntSema; X unsigned cntProc; X unsigned cntFile; X unsigned cntInode; X unsigned cntLock; X unsigned cntVfault; X unsigned cntProcMax; X unsigned cntFileMax; X unsigned cntInodeMax; X unsigned cntLockMax; X unsigned cntProcOvf; X unsigned cntFileOvf; X unsigned cntInodeOvf; X unsigned cntLockOvf; X}; X X/* X** Sargent disk record. X*/ Xstruct sargDisk X{ X long cntReadBuf; /* From disk to cache. */ X long cntReadPhys; /* Raw reads. */ X long cntReadLogic; /* Total block read requests. */ X long cntWritePhys; /* Raw writes. */ X long cntWriteLogic; /* Total block write requests. */ X long cntWriteBuf; /* From cache to disk. */ X unsigned char cntDisks; X struct X { X char name[15+1]; X unsigned qlen; /* Outstanding jobs. */ X dl_t resp; X dl_t active; X /* X ** The two fields below do not include "misc" operations X ** (when reffering to SCSI devices). X */ X unsigned cntRW; /* Read and write operations. */ X unsigned cntBRW; /* Blocks read and written. */ X } disks [SARG_MAX_DISKS]; X}; X X/* X** Sargent Ipcs record. X*/ Xstruct sargIpcs X{ X unsigned char loaded; /* 0=Driver module not loaded. */ X unsigned cntOpMsg; /* Number of message queue operations (abs). */ X unsigned cntOpSem; /* Number of semaphore operations (abs). */ X unsigned cntQueues; /* Number of message queues in use. */ X unsigned cntMsgs; /* Number of messages in all queues. */ X unsigned cntMdata; /* Number of bytes in message queues. */ X unsigned cntSems; /* Number of semaphores in use. */ X float perMsgs; /* Percentage of message headers used. */ X float perMdata; /* Percentage of message data used. */ X}; X X/* X** Sargent Memsys record. X*/ Xstruct sargMemsys X{ X dl_t cntMemRam; X dl_t cntMemSwap; X long cntSucced; X unsigned long cntFail; X float perUsed; X}; X X/* X** Sargent kernel module record. X** X** This is a variable length record. X*/ Xstruct sargModule X{ X unsigned short count; X char pad[2]; X struct X { X unsigned int id; X char name[SARG_MAX_MODULE+1]; X } loaded[1]; X}; X X/* X** Sargent Mount record. X*/ Xstruct sargMount X{ X#define SARG_MAX_MOUNTS 16 X unsigned count; X struct mounts X { X unsigned short devMaj; X unsigned short devMin; X char fstype[FSTYPSZ+1]; X unsigned char rdonly; X } mounts[SARG_MAX_MOUNTS]; X}; X X/* X** Lsar Netstat record. X*/ Xstruct sargNetstat X{ X char loadTcp; X char loadUdp; X char loadIp; X char rfu1[1]; X X /* TCP connection data. */ X unsigned int cntAttempt; X unsigned int cntAccept; X unsigned int cntConnect; X unsigned int cntDropRtx; X unsigned int cntDropKeep; X unsigned int cntTimeoKeep; X unsigned int cntTimeoRtx; X unsigned int cntTimeoPersist; X X /* TCP transmit data. */ X unsigned int cntPktTx; X unsigned int cntPktRtx; X unsigned int cntPktData; X unsigned long cntBytesData; X X /* TCP receive data. */ X unsigned int cntPktRx; X unsigned int cntPktSeq; X unsigned int cntPktOorder; X unsigned int cntPktDup; X unsigned int cntPktSum; X unsigned int cntPktOff; X unsigned int cntPktShort; X unsigned long cntBytesSeq; X X /* IP data. */ X unsigned long cntIpForw; X unsigned long cntIpNforw; X unsigned long cntIpBad; X X /* UDP data. */ X unsigned long cntUdpBad; X unsigned long cntUdpDrop; X}; X X/* X** Lsar Proc record. X*/ Xstruct sargProc X{ X pid_t pid; X int flagGone; /* 1=pid not in process table. */ X time_t timeUsr; X time_t timeSys; X#define SARG_REGION_DATA 0 X#define SARG_REGION_STACK 1 X#define SARG_MAX_REGIONS 2 X long regions[SARG_MAX_REGIONS]; X}; X X/* X** Sargent Ps record. X*/ Xstruct sargPs X{ X unsigned int count; X unsigned char cntZomb; X unsigned char cntRun; X unsigned char cntSwap; X unsigned char cntSleep; X struct procs X { X pid_t pid; X#define SARG_PFLAG_RUN 0x01 X#define SARG_PFLAG_SLEEP 0x02 X#define SARG_PFLAG_ZOMB 0x03 X#define SARG_PFLAG_ONPROC 0x04 X#define SARG_PFLAG_XBRK 0x05 X#define SARG_PFLAG_BITS 0x07 X unsigned char flags; X time_t time; X char argv[SARG_MAX_ARGV+1]; X unsigned int size; X } procs[SARG_MAX_TOTPROCS]; X}; X X/* X** Sargent STREAMS record. X*/ Xstruct sargStreams X{ X float perQueues; X float perMsgblks; X float perDatablks; X}; X X/* X** Sargent Tty record. X*/ Xstruct sargTty X{ X long cntIntrRcv; X long cntIntrXmt; X long cntIntrMdm; X long cntTtyRaw; X long cntTtyCan; X long cntTtyOut; X}; X X/* X** Sargent VENIX record. X*/ Xstruct sargVenix X{ X /* X ** Count of hits of the "vhand" fix. Fix was created by VenturCom X ** in November 1995. Additional locking was placed around vhand X ** code which traverses the region list. A small window allowed X ** UNIX to lock when list was edited during traversal. Fix adds X ** locks (which do not completely close the window) and a check X ** during list traversal. Each time the check shows a bad index, X ** a kernel variable is incremented (and the traversal is X ** aborted). This window occurs in low memory situations with X ** lots of process creation and deletion. X */ X unsigned cntVhand; X char rfu[16]; X}; X X#ifdef WOLLONG32 X/* X** Sargent Wollongong record. X** Specific to Wollongong network drivers for System V3.2. X*/ Xstruct sargWollong X{ X unsigned char valid; X#define SARG_WOLLONG_EPLUS 0 X#define SARG_WOLLONG_EC503 1 X#define SARG_WOLLONG_EC501 2 X#define SARG_WOLLONG_LE16D 3 X#define SARG_MAX_WOLLONG 4 X struct devs X { X unsigned cntTxHard; X unsigned cntTxDiscard; X unsigned cntTxUnder; X unsigned cntRxHard; X unsigned cntRxDiscard; X unsigned cntRxOver; X unsigned cntRxCrc; X } devs[SARG_MAX_WOLLONG]; X}; X#endif X X/* X** Types of Sargent records. X*/ X#define SARG_RTYP_NULL 0 X#define SARG_RTYP_BASIC1 1 X#define SARG_RTYP_REBOOT 2 X#define SARG_RTYP_PROC 3 X#define SARG_RTYP_WOLLONG 4 X#define SARG_RTYP_NETSTAT 5 X#define SARG_RTYP_MOUNT 6 X#define SARG_RTYP_PS 7 X#define SARG_RTYP_IPCS 8 X#define SARG_RTYP_VENIX 9 X#define SARG_RTYP_STREAMS 10 X#define SARG_RTYP_TTY 11 X#define SARG_RTYP_MEMSYS 12 X#define SARG_RTYP_MODULE 13 X#define SARG_RTYP_DISK 14 X#define SARG_MAX_RTYP 14 X X#endif SHAR_EOF chmod 0664 'orion-1.0/sargent/sarg.h' || $echo 'restore of' 'orion-1.0/sargent/sarg.h' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'orion-1.0/sargent/sarg.h:' 'MD5 check failed' 889739d929eefc4caca68f4ac2cc16a6 orion-1.0/sargent/sarg.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/sarg.h'`" test 9859 -eq "$shar_count" || $echo 'orion-1.0/sargent/sarg.h:' 'original size' '9859,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/mount.c ============== if test -f 'orion-1.0/sargent/mount.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/mount.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/mount.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/mount.c' && X X/* X** ---------------------------------------------------------------- X** X** Copyright (c) 1994,1995,1996 by Larry Plona X** X** This file is part of the Orion software package. The Orion X** software package is copyright by its author, Larry Plona. This X** software, both source code and prepared binaries, may be X** freely distributed as long as all copyright notices remain X** intact and this software is not sold or packaged with other X** commercial software. X** X** No warranty of any kind attached with this software. It is X** supplied as is. X** X** ---------------------------------------------------------------- X*/ X X#include"sarg_p.h" X X/* X** Mount record type. X** X** Tracks data regarding mounted file systems. X*/ X Xstatic char *bufFsid; Xstatic short nfstyp; Xstatic char **fstypes; X Xint mountInit( int fd ) X{ X char *ptr; X int i; X X /* X ** Get the number of filesystem types. X */ X nfstyp = 0; X X#if defined(VENIX32) || defined(SVR3) X if( !memFetch(SARG_VAR_NFSTYP,(void*)&nfstyp,sizeof(nfstyp)) ) X { X fputs( "Could not fetch \"nfstyp\".\n", stdout ); X return 0; X } X#endif X X#if defined(SCO5) || defined(UW2) X if( (nfstyp=sysfs(GETNFSTYP)) == -1 ) X { X fprintf( stdout, "Bad sysfs(). %s.\n", sys_errlist[errno] ); X return 0; X } X#endif X X /* X ** Allocate space for all of the filesystem type identifiers. X */ X if( (bufFsid=(char*)malloc((FSTYPSZ+1)*nfstyp)) == NULL ) X { X fputs( "Bad malloc() for fsid buffer.\n", stdout ); X return 0; X } X X /* X ** Allocate an array of pointers. Each pointer will indicate X ** one of the filesystem identifiers in the above buffer. X */ X if( (fstypes=(char**)malloc(sizeof(char*)*nfstyp)) == NULL ) X { X fputs( "Bad malloc() for fstype buffer.\n", stdout ); X return 0; X } X X#if defined(VENIX32) || defined(SVR3) X if( !memFetch(SARG_VAR_FSINFO,globalProfile.p_scratch, X nfstyp*sizeof(struct fsinfo)) ) X { X fputs( "Could not fetch \"fsinfo[]\".\n", stdout ); X return 0; X } X#endif X X /* X ** Convert each index into a filesystem type identifier. X */ X { X struct fsinfo *recFsinfo; X X ptr = bufFsid; X X#if defined(VENIX32) || defined(SVR3) X recFsinfo = (struct fsinfo*)globalProfile.p_scratch; X#endif X X /* X ** File system indices start with 1. X */ X for( i=1; i<=nfstyp; ++i ) X { X#if defined(VENIX32) || defined(SVR3) X if( !memRead(fd,recFsinfo[i].fs_name,ptr,FSTYPSZ+1) ) X { X fputs( "Could not read in a fstyp id.\n", stdout ); X fstypes[i] = (char*)S_Empty; X continue; X } X#endif X X#if defined(SCO5) || defined(UW2) X if( sysfs(GETFSTYP,i,ptr) == -1 ) X { X fprintf( stdout, "Bad sysfs(). %s.\n", sys_errlist[errno] ); X fstypes[i] = (char*)S_Empty; X continue; X } X#endif X X fstypes[i] = ptr; X ptr += strlen(ptr) + 1; X } X } X X if( globalProfile.p_debug ) X { X if( nfstyp <= 0 ) X fputs( "Detected no filesystem types.\n", stdout ); X else X { X fprintf( stdout, X "Detected the following %d filesystem types.\n", nfstyp ); X for( i=0; i<=nfstyp; ++i ) X fprintf( stdout, " \"%s\"\n", fstypes[i] ); X } X } X X return 1; X} X Xint mountSample( int fd ) X{ X struct sargMount sargMount; X X if( globalProfile.p_debug ) X fputs( "Making Filesystems sample.\n", stdout ); X X#if defined(VENIX32) || defined(SVR3) || defined(SCO5) X /* X ** Fixed length array of mount records. X */ X { X int i, j; X struct mount *recMount; X X if( !memFetch(SARG_VAR_MOUNT,globalProfile.p_scratch,sizeof(struct X mount)*globalProfile.kern_var.v_mount) ) X { X fputs( "Could not fetch \"mount[]\".\n", stdout ); X return 0; X } X X recMount = (struct mount*)globalProfile.p_scratch; X for( i=0,j=0; i= SARG_MAX_MOUNTS ) X break; X } X sargMount.count = i; X } X#endif X X return diskWrite((void*)&sargMount,sizeof(struct sargMount), X SARG_RTYP_MOUNT); X} SHAR_EOF chmod 0664 'orion-1.0/sargent/mount.c' || $echo 'restore of' 'orion-1.0/sargent/mount.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'orion-1.0/sargent/mount.c:' 'MD5 check failed' 863b4e7578cd14c9bc0c71194f60654d orion-1.0/sargent/mount.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/mount.c'`" test 5258 -eq "$shar_count" || $echo 'orion-1.0/sargent/mount.c:' 'original size' '5258,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/netstat.c ============== if test -f 'orion-1.0/sargent/netstat.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/netstat.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/netstat.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/netstat.c' && X X/* X** ---------------------------------------------------------------- X** X** Copyright (c) 1994,1995,1996 by Larry Plona X** X** This file is part of the Orion software package. The Orion X** software package is copyright by its author, Larry Plona. This X** software, both source code and prepared binaries, may be X** freely distributed as long as all copyright notices remain X** intact and this software is not sold or packaged with other X** commercial software. X** X** No warranty of any kind attached with this software. It is X** supplied as is. X** X** ---------------------------------------------------------------- X*/ X X/* X** SVR3 and VENIX32 support uses Wollongong's WIN/TCP product. X*/ X#if (defined(SVR3)||defined(VENIX32)) && !defined(WOLLONG) X/* Keep compiler happy. */ Xextern inr errno; X#else X X/* X** VENIX32 and SVR3 versions get most kernel headers from "liborion.h". X*/ X X#if ( defined(VENIX32) || defined(SVR3) ) && defined(WOLLONG32) X/* X** WIN/TCP requires the headers in this order. X*/ X#include X#include X#include X#include X#include X#include X#include X#include X#endif X X#if defined(UW2) X#define _KMEMUSER X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#endif X X#include"sarg_p.h" X X/* X** TCP/IP record type. X** X** Tracks TCP and IP data. ICMP is not tracked. X*/ X Xstatic const char * const S_SymTcpstat = "tcpstat"; Xstatic const char * const S_SymIpstat = "ipstat"; Xstatic const char * const S_SymUdpstat = "udpstat"; X#define SARG_TCP_TCPSTAT 0 X#define SARG_TCP_IPSTAT 1 X#define SARG_TCP_UDPSTAT 2 X#define SARG_MAX_TCP 3 X X/* X** SVR3 has static structures. X*/ X#if !defined(UW2) Xstatic caddr_t addrTcpip[SARG_MAX_TCP+1]; X#endif X Xint netstatInit( int fd ) X{ X#if !defined(UW2) X { X struct nlist recNlists[SARG_MAX_TCP+1]; X X recNlists[0].n_name = (char*)S_Empty; X recNlists[SARG_TCP_TCPSTAT].n_name = (char*)S_SymTcpstat; X recNlists[SARG_TCP_TCPSTAT].n_value = 0; X recNlists[SARG_TCP_IPSTAT].n_name = (char*)S_SymIpstat; X recNlists[SARG_TCP_IPSTAT].n_value = 0; X recNlists[SARG_TCP_UDPSTAT].n_name = (char*)S_SymUdpstat; X recNlists[SARG_TCP_UDPSTAT].n_value = 0; X recNlists[SARG_MAX_TCP].n_name = (char*)S_Empty; X recNlists[SARG_MAX_TCP].n_value = 0; X X if( nlist(S_PathKern,recNlists) == -1 ) X { X fputs( "Bad nlist() on TCP/IP symbols.\n", stdout ); X return 0; X } X X addrTcpip[SARG_TCP_TCPSTAT] = X (caddr_t)recNlists[SARG_TCP_TCPSTAT].n_value; X addrTcpip[SARG_TCP_IPSTAT] = X (caddr_t)recNlists[SARG_TCP_IPSTAT].n_value; X addrTcpip[SARG_TCP_UDPSTAT] = X (caddr_t)recNlists[SARG_TCP_UDPSTAT].n_value; X#if defined(WOLLONG32) X if( addrTcpip[SARG_TCP_TCPSTAT] && globalProfile.p_debug ) X fputs( "Detected Wollongong WIN/TCP.\n", stdout ); X#endif X } X#endif X X return 1; X} X Xint netstatSample( int fd ) X{ X struct tcpstat recTcpstat; X struct ipstat recIpstat; X struct udpstat recUdpstat; X struct sargNetstat sargNetstat; X#if defined(UW2) X struct mioc_rksym sym; X#endif X X if( globalProfile.p_debug ) X fputs( "Making Netstat sample.\n", stdout ); X X sargNetstat.loadTcp = 1; X sargNetstat.loadUdp = 1; X sargNetstat.loadIp = 1; X X#if defined(UW2) X sym.mirk_symname = S_SymTcpstat; X sym.mirk_buf = (void*)&recTcpstat; X sym.mirk_buflen = sizeof(recTcpstat); X if( ioctl(fd,MIOC_READKSYM,&sym) == -1 ) X { X if( errno == ENOMATCH ) X { X sargNetstat.loadTcp = 0; X } X } X#endif X X#if defined(WOLLONG32) || defined(SCO4) || defined(SCO5) X if( addrTcpip[SARG_TCP_TCPSTAT] == NULL ) X { X sargNetstat.loadTcp = 0; X } X else X { X if( !memRead(fd,addrTcpip[SARG_TCP_TCPSTAT],(caddr_t)&recTcpstat, X sizeof(struct tcpstat)) ) X { X fputs( "Could not read \"tcpstat\".\n", stdout ); X return 0; X } X } X#endif X X if( sargNetstat.loadTcp ) X { X sargNetstat.cntAttempt = recTcpstat.tcps_connattempt; X sargNetstat.cntAccept = recTcpstat.tcps_accepts; X sargNetstat.cntConnect = recTcpstat.tcps_connects; X sargNetstat.cntDropRtx = recTcpstat.tcps_timeoutdrop; X sargNetstat.cntDropKeep = recTcpstat.tcps_keepdrops; X sargNetstat.cntTimeoKeep = recTcpstat.tcps_keeptimeo; X sargNetstat.cntTimeoRtx = recTcpstat.tcps_rexmttimeo; X sargNetstat.cntTimeoPersist = recTcpstat.tcps_persisttimeo; X X sargNetstat.cntPktTx = recTcpstat.tcps_sndtotal; X sargNetstat.cntPktData = recTcpstat.tcps_sndpack; X sargNetstat.cntPktRtx = recTcpstat.tcps_sndrexmitpack; X sargNetstat.cntBytesData = recTcpstat.tcps_sndbyte; X X sargNetstat.cntPktRx = recTcpstat.tcps_rcvtotal; X sargNetstat.cntPktSeq = recTcpstat.tcps_rcvpack; X sargNetstat.cntPktOorder = recTcpstat.tcps_rcvoopack; X sargNetstat.cntPktDup = recTcpstat.tcps_rcvduppack; X sargNetstat.cntBytesSeq = recTcpstat.tcps_rcvbyte; X sargNetstat.cntPktSum = recTcpstat.tcps_rcvbadsum; X sargNetstat.cntPktOff = recTcpstat.tcps_rcvbadoff; X sargNetstat.cntPktShort = recTcpstat.tcps_rcvshort; X } X X#if defined(UW2) X sym.mirk_symname = S_SymUdpstat; X sym.mirk_buf = (void*)&recUdpstat; X sym.mirk_buflen = sizeof(recUdpstat); X if( ioctl(fd,MIOC_READKSYM,&sym) == -1 ) X { X if( errno == ENOMATCH ) X { X sargNetstat.loadUdp = 0; X } X } X#endif X X#if defined(WOLLONG32) || defined(SCO4) || defined(SCO5) X if( addrTcpip[SARG_TCP_UDPSTAT] == NULL ) X { X sargNetstat.loadUdp = 0; X } X else X { X if( !memRead(fd,addrTcpip[SARG_TCP_UDPSTAT],(caddr_t)&recUdpstat, X sizeof(struct udpstat)) ) X { X fputs( "Could not read \"udpstat\".\n", stdout ); X return 0; X } X } X#endif X X sargNetstat.cntUdpBad = recUdpstat.udps_badsum + recUdpstat.udps_badlen; X#if defined(WOLLONG32) X sargNetstat.cntUdpDrop = recUdpstat.udps_qfull + recUdpstat.udps_busy; X#endif X#if defined(UW2) || defined(SCO4) || defined(SCO5) X sargNetstat.cntUdpDrop = recUdpstat.udps_hdrops; X#endif X X#if defined(UW2) X sym.mirk_symname = S_SymIpstat; X sym.mirk_buf = (void*)&recIpstat; X sym.mirk_buflen = sizeof(recIpstat); X if( ioctl(fd,MIOC_READKSYM,&sym) == -1 ) X { X if( errno == ENOMATCH ) X { X sargNetstat.loadIp = 0; X } X } X#endif X X#if defined(WOLLONG32) || defined(SCO4) || defined(SCO5) X if( addrTcpip[SARG_TCP_TCPSTAT] == NULL ) X { X sargNetstat.loadIp = 0; X } X else X { X if( !memRead(fd,addrTcpip[SARG_TCP_IPSTAT],(caddr_t)&recIpstat, X sizeof(struct ipstat)) ) X { X fputs( "Could not read \"ipstat\".\n", stdout ); X return 0; X } X } X#endif X X sargNetstat.cntIpForw = recIpstat.ips_forward; X sargNetstat.cntIpNforw = recIpstat.ips_cantforward; X sargNetstat.cntIpBad = recIpstat.ips_badlen + recIpstat.ips_badhlen + X recIpstat.ips_toosmall + recIpstat.ips_tooshort + X recIpstat.ips_badsum; X X return diskWrite((void*)&sargNetstat,sizeof(struct sargNetstat), X SARG_RTYP_NETSTAT); X} X#endif SHAR_EOF chmod 0664 'orion-1.0/sargent/netstat.c' || $echo 'restore of' 'orion-1.0/sargent/netstat.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'orion-1.0/sargent/netstat.c:' 'MD5 check failed' a4578f0957eca96c9020ca564c313221 orion-1.0/sargent/netstat.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/netstat.c'`" test 6988 -eq "$shar_count" || $echo 'orion-1.0/sargent/netstat.c:' 'original size' '6988,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/sar.c ============== if test -f 'orion-1.0/sargent/sar.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/sar.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/sar.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/sar.c' && X X/* X** ---------------------------------------------------------------- X** X** Copyright (c) 1994,1995,1996 by Larry Plona X** X** This file is part of the Orion software package. The Orion X** software package is copyright by its author, Larry Plona. This X** software, both source code and prepared binaries, may be X** freely distributed as long as all copyright notices remain X** intact and this software is not sold or packaged with other X** commercial software. X** X** No warranty of any kind attached with this software. It is X** supplied as is. X** X** ---------------------------------------------------------------- X*/ X X#include"sarg_p.h" X X#if defined(VENIX32) || defined(SVR3) X/* X** sampleSar() X** X** Given a sa (sar) record, a descriptor to the kernel memory and X** and an array of nlist records, populate the sar record. X*/ Xint sampleSar( struct sa *recSar, int fdMem, caddr_t ptr ) X{ X int i; X struct syserr recErr; X struct flckinfo recFlock; X X /* X ** Time of sample. X */ X time( &(recSar->ts) ); X X recSar->si = *siSysinfo(); X X memFetch( SARG_VAR_MINFO, (void*)&(recSar->mi), sizeof(recSar->mi) ); X X recSar->mszproc = globalVar.v_proc; X recSar->mszfile = globalVar.v_file; X recSar->mszinode = globalVar.v_inode; X X memFetch( SARG_VAR_SYSERR, (void*)&recErr, sizeof(recErr) ); X recSar->procovf = recErr.procovf; X recSar->fileovf = recErr.fileovf; X recSar->inodeovf = recErr.inodeovf; X X memFetch( SARG_VAR_FLOCK, (void*)&recFlock, sizeof(recFlock) ); X recSar->szlckf = recFlock.reccnt; X recSar->mszlckf = recFlock.recs; X X /* X ** Find out how many inodes are in use. Read in the entire X ** inode table and count the number of referenced inodes. X */ X { X struct inode *recInode; X X if( !memFetch(SARG_VAR_INODE,(void*)ptr, X sizeof(struct inode)*recSar->mszinode) == -1 ) X { X fprintf( stdout, "Bad read(2) of table inode. %s.\n", X sys_errlist[errno] ); X return 0; X } X recSar->szinode = 0; X for( recInode=(struct inode*)ptr,i=0; imszinode; X ++i,++recInode ) X { X if( recInode->i_count <= 0 ) X continue; X ++(recSar->szinode); X } X } X X /* X ** Find out how many files are in use. Read in the entire X ** file table and count the number of referenced entries. X */ X { X struct file *recFile; X X lseek( fdMem, getAddr(SARG_VAR_FILE), SEEK_SET ); X if( read(fdMem,ptr,sizeof(struct file)*recSar->mszfile) == -1 ) X { X fprintf( stdout, "Bad read(2) of table var. %s.\n", X sys_errlist[errno] ); X return 0; X } X recSar->szfile = 0; X for( recFile=(struct file*)ptr,i=0; imszfile; X ++i,++recFile ) X { X if( recFile->f_count <= 0 ) X continue; X ++(recSar->szfile); X } X } X X /* X ** Find out how many procs are in use. Read in the entire X ** proc table and count the number of referenced entries. X */ X { X struct proc *recProc; X X lseek( fdMem, getAddr(SARG_VAR_PROC), SEEK_SET ); X if( read(fdMem,ptr,sizeof(struct proc)*recSar->mszproc) == -1 ) X { X fprintf( stdout, "Bad read(2) of table proc. %s.\n", X sys_errlist[errno] ); X return 0; X } X recSar->szproc = 0; X for( recProc=(struct proc*)ptr,i=0; imszproc; X ++i,++recProc ) X { X if( recProc->p_stat != 0 ) X ++(recSar->szproc); X } X } X} X#endif X X/* X** sampleSar() X** X** Given a sa (sar) record, a descriptor to the kernel memory and X** and an array of nlist records, populate the sar record. X*/ X#if defined(SVR4) Xint sampleSar( struct sa *recSar, int fdMem, caddr_t ptr ) X{ X} X#endif SHAR_EOF chmod 0664 'orion-1.0/sargent/sar.c' || $echo 'restore of' 'orion-1.0/sargent/sar.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'orion-1.0/sargent/sar.c:' 'MD5 check failed' 20d92c3b39f974f44a109dcf657dffee orion-1.0/sargent/sar.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/sar.c'`" test 3513 -eq "$shar_count" || $echo 'orion-1.0/sargent/sar.c:' 'original size' '3513,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/sarg_p.h ============== if test -f 'orion-1.0/sargent/sarg_p.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/sarg_p.h' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/sarg_p.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/sarg_p.h' && X X/* X** ---------------------------------------------------------------- X** X** Copyright (c) 1994,1995,1996 by Larry Plona X** X** This file is part of the Orion software package. The Orion X** software package is copyright by its author, Larry Plona. This X** software, both source code and prepared binaries, may be X** freely distributed as long as all copyright notices remain X** intact and this software is not sold or packaged with other X** commercial software. X** X** No warranty of any kind attached with this software. It is X** supplied as is. X** X** ---------------------------------------------------------------- X*/ X X#ifndef SARG_P_H X#define SARG_P_H X X#if defined(SVR4) || defined(UW2) X#define _KMEMUSER X#endif X X/* X** VENIX32 and SVR3 get their kernel headers from "liborion". X*/ X#if defined(UW2) X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include SHAR_EOF : || $echo 'restore of' 'orion-1.0/sargent/sarg_p.h' 'failed' fi $echo 'End of' 'orion-1.0' 'part' '6' $echo 'File' 'orion-1.0/sargent/sarg_p.h' 'is continued in part' '7' echo 7 > _sh05649/seq exit 0