Article 13467 of alt.sources: Submitted-by: ljp@tiac.net Archive-name: orion-1.0/part05 ---- Cut Here and feed the following to sh ---- #!/bin/sh # This is `orion.05' (part 5 of orion-1.0). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `orion-1.0/liborion/max.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" != 5; then $echo 'Please unpack part' "$shar_sequence" 'next!' exit 1 fi if test ! -f _sh05649/new; then $echo 'x -' 'STILL SKIPPING' 'orion-1.0/liborion/max.c' else $echo 'x -' 'continuing file' 'orion-1.0/liborion/max.c' sed 's/^X//' << 'SHAR_EOF' >> orion-1.0/liborion/max.c && 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 X X#if defined(__GNUC__) || defined(__cplusplus) Xinline X#endif Xsize_t maximum( size_t current, int count, size_t size ) X{ X return current>(count*size) ? current : (count*size); X} SHAR_EOF $echo 'File' 'orion-1.0/liborion/max.c' 'is complete' && chmod 0664 'orion-1.0/liborion/max.c' || $echo 'restore of' 'orion-1.0/liborion/max.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/liborion/max.c:' 'MD5 check failed' 00f1612e219e7f67bd60616f4044a089 orion-1.0/liborion/max.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/max.c'`" test 835 -eq "$shar_count" || $echo 'orion-1.0/liborion/max.c:' 'original size' '835,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/mkaddr.c ============== if test -f 'orion-1.0/liborion/mkaddr.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/mkaddr.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/mkaddr.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/mkaddr.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 X X/* X** createAddr() X** X** Create an address file. Call nlist(3) with the given array of X** nlist records, then write the array out to the given filename. X*/ Xint createAddr( struct nlist *recNlist, size_t sizeNlist, X const char *pathAddr, const char *pathKern ) X{ X int fdAddr; X X if( (fdAddr=open(pathAddr,O_WRONLY|O_CREAT|O_TRUNC,0666)) == -1 ) X { X fprintf( stdout, "Bad open(2) of \"%s\". %s.\n", X pathAddr, sys_errlist[errno] ); X return 0; X } X X X if( nlist(pathKern,recNlist) == -1 ) X { X fprintf( stdout, "Bad nlist(3) of \"%s\".\n", X pathKern ); X close( fdAddr ); X return 0; X } X#if 0 X { X int i; X unsigned long info; X X for( i=0; recNlist[i].n_name[0]!='\0'; ++i ) X { X recNlist[i].n_value = 0; X info = 0; X if( getksym(recNlist[i].n_name,&(recNlist[i].n_value), X &info) == -1 ) X { X recNlist[i].n_value = 0; X } X } X } X#endif X X if( write(fdAddr,(void*)recNlist,sizeof(struct nlist)*sizeNlist) == -1 ) X { X fprintf( stdout, "Unable to write to \"%s\".\n", X pathKern ); X close( fdAddr ); X return 0; X } X X close( fdAddr ); X X return 1; X} SHAR_EOF chmod 0664 'orion-1.0/liborion/mkaddr.c' || $echo 'restore of' 'orion-1.0/liborion/mkaddr.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/liborion/mkaddr.c:' 'MD5 check failed' 47e1bb471ca583821a323fdc769dba75 orion-1.0/liborion/mkaddr.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/mkaddr.c'`" test 1761 -eq "$shar_count" || $echo 'orion-1.0/liborion/mkaddr.c:' 'original size' '1761,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/native.mk ============== if test -f 'orion-1.0/liborion/native.mk' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/native.mk' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/native.mk' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/native.mk' && 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# native.mk X# X# General purpose makefile to be distributed with release. This makefile X# is not part of the LPS source code control system. X# X# There should be no need to edit this file; see "../orion.mk". X# X Xinclude ../defines.mk X X.SUFFIXES: .o .C X X# "PLATFORM" is from "../orion.mk". X# "CF" can be used from command line. X# "CFLAGS_LOCAL" can be set in this file. X# XCFLAGS = -D${PLATFORM} ${COPTS} -I. -I${DIR_INC} ${CF} XLDFLAGS = -L. -L${DIR_LIB} X XORION_SRCS = getsyms.c max.c mkaddr.c memread.c fmtbyte.c fmtsec.c \ X fmtstart.c pathadj.c XORION_OBJS=${ORION_SRCS:.c=.o} X Xall:: liborion.a X Xliborion.a:: ${ORION_OBJS} X if [ ! -d ${DIR_LIB} ]; then mkdir -p ${DIR_LIB}; fi X rm -f $@ X ${AR} crv $@ ${ORION_OBJS} X Xclean:: X rm -f liborion.a ${ORION_OBJS} X Xliborion.a:: X /bin/cp liborion.a ${DIR_LIB} X Xincludes:: liborion.h X if [ ! -d ${DIR_INC} ]; then mkdir -p ${DIR_INC}; fi; X -rm -f ${DIR_INC}/liborion.h X ln liborion.h ${DIR_INC}/liborion.h X Xinstall:: X Xinclude ../rules.mk X Xfmtbyte.o: ${DIR_INC}/liborion.h Xgetsyms.o: ${DIR_INC}/liborion.h Xmax.o: ${DIR_INC}/liborion.h Xmemread.o: ${DIR_INC}/liborion.h Xmkaddr.o: ${DIR_INC}/liborion.h Xpathadj.o: ${DIR_INC}/liborion.h SHAR_EOF chmod 0664 'orion-1.0/liborion/native.mk' || $echo 'restore of' 'orion-1.0/liborion/native.mk' '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/liborion/native.mk:' 'MD5 check failed' 526fd1770242462a978a1688cf8e70ec orion-1.0/liborion/native.mk SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/native.mk'`" test 1788 -eq "$shar_count" || $echo 'orion-1.0/liborion/native.mk:' 'original size' '1788,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/fmtbyte.c ============== if test -f 'orion-1.0/liborion/fmtbyte.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/fmtbyte.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/fmtbyte.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/fmtbyte.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 X X/* X** fmtByte() X** X** Convert an unsigned number representing a size in bytes, to a string. X*/ Xconst char *fmtByte( unsigned b ) X{ X static char buf[31+1]; X unsigned m, k; X X if( b >= 1024*1024 ) X { X if( b % (1024*1024) ) X sprintf( buf, "%.1fM", (float)b/(1024.0*1024.0) ); X else X sprintf( buf, "%uM", b/(1024*1024) ); X } X else if( b >= 1024 ) X { X if( b % 1024 ) X sprintf( buf, "%.1fK", (float)b/1024.0 ); X else X sprintf( buf, "%uK", b/1024 ); X } X else X sprintf( buf, "%ubytes", b ); X X return (const char*)buf; X} SHAR_EOF chmod 0664 'orion-1.0/liborion/fmtbyte.c' || $echo 'restore of' 'orion-1.0/liborion/fmtbyte.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/liborion/fmtbyte.c:' 'MD5 check failed' db492973b46fd2a8bf841e14bf971a0c orion-1.0/liborion/fmtbyte.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/fmtbyte.c'`" test 1213 -eq "$shar_count" || $echo 'orion-1.0/liborion/fmtbyte.c:' 'original size' '1213,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/memread.c ============== if test -f 'orion-1.0/liborion/memread.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/memread.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/memread.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/memread.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 X X/* X** memRead() X** X*/ Xint memRead( int fd, caddr_t addr, void *buf, unsigned size ) X{ X int rc; X X if( lseek(fd,addr,SEEK_SET) == -1 ) X { X#ifdef DEBUG X fprintf( stdout, "Bad lseek() (SEEK_SET,0x%x), %s.\n", X sys_errlist[errno] ); X#endif X return 0; X } X X if( (rc=read(fd,buf,size)) == -1 ) X { X#ifdef DEBUG X fprintf( stdout, "Bad read(), %s.\n", X sys_errlist[errno] ); X#endif X return 0; X } X X if( rc != size ) X return 0; X X return 1; X} SHAR_EOF chmod 0664 'orion-1.0/liborion/memread.c' || $echo 'restore of' 'orion-1.0/liborion/memread.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/liborion/memread.c:' 'MD5 check failed' b9c0262b0249746de9f95b9724ad7adb orion-1.0/liborion/memread.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/memread.c'`" test 1120 -eq "$shar_count" || $echo 'orion-1.0/liborion/memread.c:' 'original size' '1120,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/fmtstart.c ============== if test -f 'orion-1.0/liborion/fmtstart.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/fmtstart.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/fmtstart.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/fmtstart.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 X X#ifdef VENIX32 Xextern struct tm *localtime( time_t*); X#endif X Xconst char *startFormat( time_t *t ) X{ X struct tm *recTm; X static char buffer[127+1]; X static time_t timeToday = 0; X X if( timeToday == 0 ) X { X struct tm *recTmToday; X X timeToday = time( NULL ); X recTmToday = localtime( &timeToday ); X X timeToday -= (recTmToday->tm_hour*60*60) + (recTmToday->tm_min*60) + X recTmToday->tm_sec; X } X X recTm = localtime( t ); X X#if defined(SVR4) || defined(UW2) || defined(SUN5) || defined(SCO5) X if( *t > timeToday ) X strftime( buffer, 127, "%I:%M:%S %p", recTm ); X else X strftime( buffer, 127, "%D %I:%M:%S %p", recTm ); X#endif X X#if defined(VENIX32) || defined(SVR3) X if( *t > timeToday ) X cftime( buffer, "%I:%M:%S %p", recTm ); X else X cftime( buffer, "%D %I:%M:%S %p", recTm ); X#endif X X return (const char*)buffer; X} SHAR_EOF chmod 0664 'orion-1.0/liborion/fmtstart.c' || $echo 'restore of' 'orion-1.0/liborion/fmtstart.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/liborion/fmtstart.c:' 'MD5 check failed' 9445857b03ae90d8753c1ebb7ec6059f orion-1.0/liborion/fmtstart.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/fmtstart.c'`" test 1506 -eq "$shar_count" || $echo 'orion-1.0/liborion/fmtstart.c:' 'original size' '1506,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/fmtsec.c ============== if test -f 'orion-1.0/liborion/fmtsec.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/fmtsec.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/fmtsec.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/fmtsec.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"liborion.h" X Xconst char *secFormat( time_t seconds ) X{ X unsigned long min, sec; X static char strTime[31+1]; X X min = seconds / 60; X sec = seconds % 60; X X sprintf( strTime, "%02ld:%02ld", min, sec ); X X return (const char*)strTime; X} SHAR_EOF chmod 0664 'orion-1.0/liborion/fmtsec.c' || $echo 'restore of' 'orion-1.0/liborion/fmtsec.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/liborion/fmtsec.c:' 'MD5 check failed' fc6380f394402d9cbffb97ce45e10967 orion-1.0/liborion/fmtsec.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/fmtsec.c'`" test 892 -eq "$shar_count" || $echo 'orion-1.0/liborion/fmtsec.c:' 'original size' '892,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/pathadj.c ============== if test -f 'orion-1.0/liborion/pathadj.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/pathadj.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/pathadj.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/pathadj.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 X X/* X** pathAdjust() X** X** Given a path, a buffer and a length, Put as much of the path X** as will fit into the buffer. Copying is done on a per segment X** basis, starting with the last segment in the path. X*/ Xint pathAdjust( const char *path, char *buf, size_t len ) X{ X int curs, last; X int plen; X X /* X ** Copy an appropriate amount of the path into the saved X ** table. Starting at the end of the path, back up segment X ** by segment copying until the buffer is full. X */ X X#if 0 X /* Skip the leading "/dev". */ X path += 4; X#endif X X /* Set cursor to last character in path. */ X for( curs=0; path[curs]!='\0'; ++curs ); X X /* Length of source path. */ X plen = curs; X X /* Remember the start of the last fitting segment. */ X last = curs; X X /* Loop through the segments. */ X while( 1 ) X { X /* Set cursor to the start of the segment (or start of path). */ X for( ; (curs>0)&&(path[curs]!='/'); --curs ); X X /* Cursor is on a '/'. Check size without '/'. */ X if( path[curs] == '/' ) X { X if( plen-(curs+1) > len ) X break; X X if( curs <= 0 ) X { X last = curs+1; X break; X } X } X X /* If at the start of the path, quit. */ X if( curs <= 0 ) X { X /* Will the current segment fit? */ X if( plen-curs <= len ) X last = curs; X break; X } X X /* New previous segment. */ X last = curs+1; X X /* Start of next segment. */ X --curs; X } X X strncpy( buf, &path[last], len ); X buf[len] = '\0'; X X return 1; X} SHAR_EOF chmod 0664 'orion-1.0/liborion/pathadj.c' || $echo 'restore of' 'orion-1.0/liborion/pathadj.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/liborion/pathadj.c:' 'MD5 check failed' d9aeeb7e836f7052aa619d508025910f orion-1.0/liborion/pathadj.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/pathadj.c'`" test 2122 -eq "$shar_count" || $echo 'orion-1.0/liborion/pathadj.c:' 'original size' '2122,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/orion.mk ============== if test -f 'orion-1.0/orion.mk' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/orion.mk' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/orion.mk' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/orion.mk' && 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# orion.mk X# X# Makefile to be distributed with release. This makefile is not part of X# the lps source code control system. X# X# This makefile should not need to be edited. X# X Xinclude defines.mk X X Xall:: X for i in ${SUBDIRS}; do \ X cd $$i; ${MAKE} -f native.mk all; cd ..; done X Xclean:: X for i in ${SUBDIRS}; do \ X cd $$i; ${MAKE} -f native.mk clean; cd ..; done X -rm -f lib/*.a include/*.h X Xincludes:: X for i in ${SUBDIRS}; do \ X cd $$i; ${MAKE} -f native.mk includes; cd ..; done X Xinstall:: X if [ ! -d ${DIR_INST} ]; then mkdir -p ${DIR_INST}; fi X if [ ! -d ${DIR_INST}/bin ]; then mkdir -p ${DIR_INST}/bin; fi X if [ ! -d ${DIR_INST}/man/${MAN_MAN1} ]; \ X then mkdir -p ${DIR_INST}/man/${MAN_MAN1}; fi X for i in ${SUBDIRS}; do \ X cd $$i; ${MAKE} -f native.mk install; cd ..; done X XFORCE: SHAR_EOF chmod 0664 'orion-1.0/orion.mk' || $echo 'restore of' 'orion-1.0/orion.mk' '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/orion.mk:' 'MD5 check failed' 6e7cdd6e2adad0301ecc8a01a0a0dd13 orion-1.0/orion.mk SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/orion.mk'`" test 1422 -eq "$shar_count" || $echo 'orion-1.0/orion.mk:' 'original size' '1422,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/rules.mk ============== if test -f 'orion-1.0/rules.mk' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/rules.mk' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/rules.mk' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/rules.mk' && 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# rules.mk X# X# Makefile to be distributed with release. This makefile is not part of X# the lps source code control system. X# X# This makefile should not need to be edited; see "orion.mk". X# X X# X# Basic rules. X# X X.c.o: X ${CC} -c ${CFLAGS} $< X X.C.o: X ${CXX} -c ${CXXFLAGS} $< SHAR_EOF chmod 0664 'orion-1.0/rules.mk' || $echo 'restore of' 'orion-1.0/rules.mk' '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/rules.mk:' 'MD5 check failed' 5c3c41dec0a168245c878df429c38c51 orion-1.0/rules.mk SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/rules.mk'`" test 887 -eq "$shar_count" || $echo 'orion-1.0/rules.mk:' 'original size' '887,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/defines.mk ============== if test -f 'orion-1.0/defines.mk' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/defines.mk' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/defines.mk' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/defines.mk' && 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# defines.mk X# X# Makefile to be distributed with release. This makefile is not part of X# the lps source code control system. X# X# Edit the labeled section. No other makefile should need to be edited. X# X X# X# Start of editable defines. X# X X# X# Source/build directory (root of distribution). X# XDIR_BUILD = /usr/answers/tmp/orion-1.0 X X# X# Root of install directory. X# XDIR_INST = /usr/local X X# X# Platform. X# X X# X# For UnixWare 2 systems X# Excluding UnixWare 1 X# XPLATFORM = UW2 XCOPTS = XPIS_LIBS = -lelf XSARG_LIBS = -lelf XMEMOWN = bin XMEMGRP = sys XMAN_MAN1 = man1 X X# X# For SunOS 5.x (Solaris 2.x) systems. X# X#PLATFORM = SUN5 X#PIS_LIBS = -lelf X#SARG_LIBS = -lelf X#MEMOWN = root X#MEMGRP = sys X#MAN_MAN1 = man1 X X# X# For SCO 3.2v5 systems. X# X#PLATFORM = SCO5 X#COPTS = X#PIS_LIBS = -lelf -lsocket X#SARG_LIBS = -lelf -lsocket X#MEMOWN = bin X#MEMGRP = mem X#MAN_MAN1 = man.1 X X# X# For SCO 3.2v4 systems. X# X#PLATFORM = SCO4 X#COPTS = X#PIS_LIBS = X#SARG_LIBS = X#MEMOWN = bin X#MEMGRP = mem X#MAN_MAN1 = man.1 X X# X# For SVR4 systems X# Including UnixWare 1 X# Excluding UnixWare 2 X# Excluding SunOS 5 X# X#PLATFORM = SVR4 X#COPTS = X#PIS_LIBS = -lelf X#SARG_LIBS = -lelf X#MEMOWN = bin X#MEMGRP = sys X#MAN_MAN1 = man1 X X# X# For VENIX 3.2 systems. X# Remove the WOLLONG32 define and use of "netinclude", if Wollongong's X# WIN/TCP include files are not being used. X# X#PLATFORM = VENIX32 X#COPTS = -DWOLLONG32 -I/usr/netinclude X#PIS_LIBS = -lrtx X#SARG_LIBS = -lrtx X#MEMOWN = bin X#MEMGRP = sys X#MAN_MAN1 = man1 X X# X# For SVR3 systems X# Excluding VENIX 3.2 X# Including SCO 3.2v2 X# For SCO UNIX, set MAN_MAN1 to "man.1". X# X#PLATFORM = -DSVR3 X#COPTS = X#MEMOWN = bin X#MEMGRP = sys X#MAN_MAN1 = man1 X XCC = gcc XSHELL = /bin/sh XMAKE = make X X# X# End of editable defines. X# X XDIR_LIB = ${DIR_BUILD}/lib XDIR_INC = ${DIR_BUILD}/include XDIR_BIN = ${DIR_BUILD}/bin X XSUBDIRS = liborion pis docs X#SUBDIRS = liborion pis sargent sarrep docs SHAR_EOF chmod 0664 'orion-1.0/defines.mk' || $echo 'restore of' 'orion-1.0/defines.mk' '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/defines.mk:' 'MD5 check failed' 05bdaf0d1f284ee1b2b67dd73f3d42b6 orion-1.0/defines.mk SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/defines.mk'`" test 2518 -eq "$shar_count" || $echo 'orion-1.0/defines.mk:' 'original size' '2518,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/README ============== if test -f 'orion-1.0/README' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/README' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/README' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/README' && 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 Xorion 1.0 X X XINTRODUCTION X X This is the distribution of Orion 1.0. Orion is a set of administration X utilities which make use of information found in the UNIX kernel. X X This distribution includes only the 1.0 version of "pis" - a X replacement for the standard ps utility. And an alpha version of X "sargent" - a replacement for the sar command. X X Official support exists for UnixWare 2, SCO 3.2v5, SunOS 5.4. Nominal X support exists for SCO 3.2v2, VENIX 3.2, generic SVR3 and generic X SVR4. X X The sargent alpha code only compiles under UnixWare 2 and SCO UNIX X 3.2v5. X X XBUILDING X X Edit "defines.mk" as instructed. X X make -f orion.mk clean X make -f orion.mk includes X make -f orion.mk all X make -f orion.mk install X X The constant "CF" can be set on the make command line to add X compile options such as "-g". X X The source for other commands is included, but is not built X (or supported) at this time. X X XINSTALLED FILES X X /bin/mkpis X /bin/pis X /man/man.1/pis.1 X X Both executables must be set-gid so that they can read "/dev/kmem" X (either "sys" or "mem"). X X XDOCUMENTATION X X In addtion to the man page, the troff file orion.ps is a PostScript X rendition of the pis manual. X X XTHE FUTURE X X The next release of Orion will probably feature "sargent" and "sarrep", X replacements for the standard sar utility. X X XBUGS AND INFORMATION X X Send mail to: X Larry Plona X ljp@tiac.net X X All comments, suggestions and bug reports are welcome. SHAR_EOF chmod 0664 'orion-1.0/README' || $echo 'restore of' 'orion-1.0/README' '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/README:' 'MD5 check failed' 5d4fe03370577fc693f7374f1f3bf76a orion-1.0/README SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/README'`" test 2128 -eq "$shar_count" || $echo 'orion-1.0/README:' 'original size' '2128,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/native.mk ============== if test ! -d 'orion-1.0/sargent'; then $echo 'x -' 'creating directory' 'orion-1.0/sargent' mkdir 'orion-1.0/sargent' fi if test -f 'orion-1.0/sargent/native.mk' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/native.mk' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/native.mk' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/native.mk' && 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# native.mk X# X# General purpose makefile to be distributed with release. This makefile X# is not part of the LPS source code control system. X# X# There should be no need to edit this file; see "../orion.mk". X# X Xinclude ../defines.mk X X# "PLATFORM" is from "../orion.mk". X# "CF" can be used from command line. X# XCFLAGS = -D${PLATFORM} ${COPTS} -I. -I${DIR_INC} ${CF} XLDFLAGS = -L. -L${DIR_LIB} X XSARG_SRCS = sarg.c netstat.c mount.c ipcs.c ps.c venix.c wollong.c sar.c \ X proc.c basic1.c kern.c streams.c tty.c memsys.c module.c disk.c XSARG_OBJS=${SARG_SRCS:.c=.o} X Xall:: sargent X Xincludes:: sarg.h X if [ ! -d ${DIR_INC} ]; then mkdir -p ${DIR_INC}; fi; X -rm -f ${DIR_INC}/sarg.h; X ln sarg.h ${DIR_INC}/sarg.h X Xsargent:: ${SARG_OBJS} X rm -f $@ X ${CC} -o $@ ${SARG_OBJS} ${LDFLAGS} -lorion ${SARG_LIBS} X Xclean:: X rm -f sargent ${SARG_OBJS} X Xinstall:: X chown ${MEMOWN} sargent X chgrp ${MEMGRP} sargent X chmod 775 sargent X if [ ${PLATFORM} = "SUN5" ]; then chmod u+s; fi X if [ ${PLATFORM} != "SUN5" ]; then chmod g+s; fi X mv sargent ${DIR_INST}/bin/sargent X Xinclude ../rules.mk SHAR_EOF chmod 0664 'orion-1.0/sargent/native.mk' || $echo 'restore of' 'orion-1.0/sargent/native.mk' '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/native.mk:' 'MD5 check failed' 84b46f64fd5fb38b540a08660d2e6383 orion-1.0/sargent/native.mk SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/native.mk'`" test 1689 -eq "$shar_count" || $echo 'orion-1.0/sargent/native.mk:' 'original size' '1689,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/basic1.c ============== if test -f 'orion-1.0/sargent/basic1.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/basic1.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/basic1.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/basic1.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** basic1Sample() X** X** Sysinfo version. X** X** Create a basic1 record from the sysinfo, minfo and other X** sar related kernel structures. X*/ X#if defined(ORION_FEAT_SYSINFO) Xint basic1Sample( int fdMem ) X{ X int i; X struct syserr recErr; X struct flckinfo recFlock; X struct minfo recMinfo; X struct sargBasic1 recBasic1; X struct sysinfo *si; X X if( globalProfile.p_debug ) X fputs( "Making Basic1 sample.\n", stdout ); X X /* X ** Lots of data comes from the sysinfo structure. X */ X X si = (struct sysinfo*)siFetch( SARG_VAR_SYSINFO ); X X /* X ** CPU usage. X */ X recBasic1.cpu[SARG_CPU_IDLE] = si->cpu[CPU_IDLE]; X recBasic1.cpu[SARG_CPU_USER] = si->cpu[CPU_USER]; X recBasic1.cpu[SARG_CPU_KERN] = si->cpu[CPU_KERNEL]; X recBasic1.cpu[SARG_CPU_WAIT] = si->cpu[CPU_WAIT]; X recBasic1.cpu[SARG_CPU_SWAP] = si->cpu[CPU_SXBRK]; X recBasic1.wait[SARG_WAIT_IO] = si->wait[W_IO]; X recBasic1.wait[SARG_WAIT_SWAP] = si->wait[W_SWAP]; X recBasic1.wait[SARG_WAIT_PIO] = si->wait[W_PIO]; X X /* X ** System call data. X */ X recBasic1.cntSys = si->syscall; X recBasic1.cntSysFork = si->sysfork; X recBasic1.cntSysLwp = 0; /* Not available. */ X recBasic1.cntSysExec = si->sysexec; X recBasic1.cntSysRead = si->sysread; X recBasic1.cntSysWrite = si->syswrite; X X /* X ** Misc. X */ X recBasic1.cntPswitch = si->pswitch; X recBasic1.cntSwapIn = si->swapin; X recBasic1.cntSwapOut = si->swapout; X X /* X ** X */ X X memRead( fdMem, memAddr(SARG_VAR_MINFO), (void*)&recMinfo, X sizeof(recMinfo) ); X X recBasic1.cntVfault = recMinfo.vfault; X X /* X ** Get table sizes. X */ X recBasic1.cntProcMax = globalProfile.kern_var.v_proc; X recBasic1.cntFileMax = globalProfile.kern_var.v_file; X recBasic1.cntInodeMax = globalProfile.kern_var.v_inode; X X memRead( fdMem, memAddr(SARG_VAR_SYSERR), (void*)&recErr, X sizeof(recErr) ); X recBasic1.cntProcOvf = recErr.procovf; X recBasic1.cntFileOvf = recErr.fileovf; X recBasic1.cntInodeOvf = recErr.inodeovf; X X memRead( fdMem, memAddr(SARG_VAR_FLOCK), (void*)&recFlock, X sizeof(recFlock) ); X recBasic1.cntLock = recFlock.reccnt; X recBasic1.cntLockMax = recFlock.recs; X recBasic1.cntLockOvf = recFlock.recovf; 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,globalProfile.p_scratch, X sizeof(struct inode)*recBasic1.cntInodeMax) ) X { X fprintf( stdout, "Could not fetch \"inode\". %s.\n", X sys_errlist[errno] ); X return 0; X } X recBasic1.cntInode = 0; X for( recInode=(struct inode*)globalProfile.p_scratch,i=0; X ii_count <= 0 ) X continue; X ++(recBasic1.cntInode); 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 if( !memFetch(SARG_VAR_FILE,globalProfile.p_scratch, X sizeof(struct file)*recBasic1.cntFileMax) ) X { X fprintf( stdout, "Could not fetch \"file\". %s.\n", X sys_errlist[errno] ); X return 0; X } X recBasic1.cntFile = 0; X for( recFile=(struct file*)globalProfile.p_scratch,i=0; X if_count <= 0 ) X continue; X ++(recBasic1.cntFile); 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 if( !memFetch(SARG_VAR_PROC,globalProfile.p_scratch, X sizeof(struct proc)*recBasic1.cntProcMax) ) X { X fprintf( stdout, "Bad read(2) of table proc. %s.\n", X sys_errlist[errno] ); X return 0; X } X recBasic1.cntProc = 0; X for( recProc=(struct proc*)globalProfile.p_scratch,i=0; X ip_stat != 0 ) X ++(recBasic1.cntProc); X } X } X X return diskWrite((void*)&recBasic1,sizeof(recBasic1), X SARG_RTYP_BASIC1); X} X#endif X X/* X** basic1Sample() X** X** Metrics version. X** X** Create a basic1 record from the "metrics" family of X** kernel structures. Other System V variants use the X** "sar" family of structures. X*/ X#if defined(ORION_FEAT_METRICS) Xint basic1Sample( int fdMem ) X{ X struct sargBasic1 recBasic1; X struct mets *m; X X if( globalProfile.p_debug ) X fputs( "Making Basic1 sample.\n", stdout ); X X if( !memFetch(SARG_VAR_METS,(void*)&globalProfile.kern_mets, X sizeof(struct mets)) ) X { X fprintf( stdout, "Could not fetch \"mets\". %s.\n", X sys_errlist[errno] ); X return 0; X } X X m = &globalProfile.kern_mets; X X recBasic1.cntProcMax = m->mets_proc_resrc.msr_proc[MET_MAX]; X recBasic1.cntFileMax = m->mets_files.msf_file[MET_MAX]; X recBasic1.cntLockMax = m->mets_files.msf_flck[MET_MAX]; X recBasic1.cntProcOvf = m->mets_proc_resrc.msr_proc[MET_FAIL]; X recBasic1.cntFileOvf = m->mets_files.msf_file[MET_FAIL]; X recBasic1.cntLockOvf = m->mets_files.msf_flck[MET_FAIL]; X recBasic1.cntProc = m->mets_proc_resrc.msr_proc[MET_INUSE]; X recBasic1.cntFile = m->mets_files.msf_file[MET_INUSE]; X recBasic1.cntLock = m->mets_files.msf_flck[MET_INUSE]; X if( globalProfile.p_findings ) X { X fprintf( stdout, "proc max %d\n", recBasic1.cntProcMax ); X fprintf( stdout, "proc fail %d\n", recBasic1.cntProcOvf ); X fprintf( stdout, "proc use %d\n", recBasic1.cntProc ); X } X X /* X ** Aggregate inode metrics. X */ X { X int i; X X recBasic1.cntInodeMax = 0; X recBasic1.cntInode = 0; X recBasic1.cntInodeOvf = 0; X X for( i=0; imets_inodes[i].msi_inodes[MET_MAX]; X recBasic1.cntInode += m->mets_inodes[i].msi_inodes[MET_INUSE]; X recBasic1.cntInodeOvf += m->mets_inodes[i].msi_inodes[MET_FAIL]; X } X } X X /* X ** Aggregate CPU metrics. X */ X { X int i; X struct metp_cpu *ptr; X X recBasic1.cpu[SARG_CPU_IDLE] = 0; X recBasic1.cpu[SARG_CPU_USER] = 0; X recBasic1.cpu[SARG_CPU_KERN] = 0; X recBasic1.cpu[SARG_CPU_WAIT] = 0; X recBasic1.cpu[SARG_CPU_SWAP] = 0; /* Not available. */ X recBasic1.wait[SARG_WAIT_IO] = 0; /* Not available. */ X recBasic1.wait[SARG_WAIT_SWAP] = 0; X recBasic1.wait[SARG_WAIT_PIO] = 0; X X if( (ptr=(struct metp_cpu*)metFetch(SARG_VAR_CPU)) != NULL ) X { X for( i=0; impc_cpu[MET_CPU_IDLE]; X recBasic1.cpu[SARG_CPU_WAIT] += ptr->mpc_cpu[MET_CPU_WAIT]; X recBasic1.cpu[SARG_CPU_USER] += ptr->mpc_cpu[MET_CPU_USER]; X recBasic1.cpu[SARG_CPU_KERN] += ptr->mpc_cpu[MET_CPU_SYS]; X ptr += sizeof(struct metp_cpu); X } X } X else X { X fputs( "Could not read CPU metrics.\n", stdout ); X } X X if( globalProfile.p_findings ) X { X fprintf( stdout, "idle %ld.\n", recBasic1.cpu[SARG_CPU_IDLE] ); X fprintf( stdout, "wait %ld.\n", recBasic1.cpu[SARG_CPU_USER] ); X fprintf( stdout, "user %ld.\n", recBasic1.cpu[SARG_CPU_KERN] ); X fprintf( stdout, "kern %ld.\n", recBasic1.cpu[SARG_CPU_WAIT] ); X } X } X X /* X ** FUTURE: Formerly minfo.vfault. X */ X X { X struct vmmeter *ptr; X X if( (ptr=(struct vmmeter*)metFetch(SARG_VAR_VMMETER)) != NULL ) X { X recBasic1.cntPswitch = ptr->v_swtch; X recBasic1.cntVfault = ptr->v_faults; X if( globalProfile.p_findings ) X { X fprintf( stdout, "pswitch %ld\n", ptr->v_swtch ); X fprintf( stdout, "vfault %ld\n", ptr->v_faults ); X } X } X } X X /* X ** System call activity. X */ X { X int i; X struct metp_syscall *ptr; X X if( (ptr=(struct metp_syscall*)metFetch(SARG_VAR_SYSCALL)) != NULL ) X { X for( i=0; imps_syscall; X recBasic1.cntSysFork = ptr->mps_fork; X recBasic1.cntSysLwp = ptr->mps_lwpcreate; X recBasic1.cntSysExec = ptr->mps_exec; X recBasic1.cntSysRead = ptr->mps_read; X recBasic1.cntSysWrite = ptr->mps_write; X ptr += sizeof(struct metp_syscall); X } X } X else X { X fputs( "Could not read syscall metrics.\n", stdout ); X } X } X X /* X ** X */ X { X int i; X struct metp_vm *ptr; X X if( (ptr=(struct metp_vm*)metFetch(SARG_VAR_VM)) != NULL ) X { X for( i=0; impv_swpin; X recBasic1.cntSwapOut = ptr->mpv_swpout; X ptr += sizeof(struct metp_vm); X } X } X else X { X fputs( "Could not read VM metrics.\n", stdout ); X } X } X X return diskWrite((void*)&recBasic1,sizeof(recBasic1), X SARG_RTYP_BASIC1); X} X#endif SHAR_EOF chmod 0664 'orion-1.0/sargent/basic1.c' || $echo 'restore of' 'orion-1.0/sargent/basic1.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/basic1.c:' 'MD5 check failed' 0c69afaaa8320b261da9595ee4374d2e orion-1.0/sargent/basic1.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/basic1.c'`" test 9229 -eq "$shar_count" || $echo 'orion-1.0/sargent/basic1.c:' 'original size' '9229,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/ipcs.c ============== if test -f 'orion-1.0/sargent/ipcs.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/ipcs.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/ipcs.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/ipcs.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** Ipcs record type. X** X** Tracks data regarding the IPC facility. X*/ Xint ipcsSample( int fdMem ) X{ X int i; X unsigned long cntMsgs; X unsigned long cntMdata; X struct msginfo msginfo; X struct msqid_ds *recQid; X struct seminfo recSeminfo; X struct sargIpcs sargIpcs; X#if defined(ORION_FEAT_SYSINFO) X struct sysinfo *si; X#endif X X /* X ** Note that under UnixWare 2, the message queue code is X ** loaded on demand. X */ X X#if defined(ORION_FEAT_SYSINFO) X si = siFetch( SARG_VAR_SYSINFO ); X X sargIpcs.cntOpMsg = si->msg; X sargIpcs.cntOpSem = si->sema; X#endif X X if( !memFetch(SARG_VAR_MSGINFO, X (void*)&msginfo,sizeof(struct msginfo)) ) X { X#if defined(UW2) X sargIpcs.loaded = 0; X return diskWrite((void*)&sargIpcs,sizeof(struct sargIpcs), X SARG_RTYP_IPCS); X#else X fputs( "Could not fetch \"msginfo\".\n", stdout ); X return 0; X#endif X } X X if( !memFetch(SARG_VAR_MSGQUE,globalProfile.p_scratch, X sizeof(struct msqid_ds)*msginfo.msgmni) ) X { X#if defined(UW2) X sargIpcs.loaded = 0; X return diskWrite((void*)&sargIpcs,sizeof(struct sargIpcs), X SARG_RTYP_IPCS); X#else X fputs( "Could not fetch \"msgque\".\n", stdout ); X return 0; X#endif X } X X sargIpcs.cntQueues = msginfo.msgmni; X cntMsgs = 0; X cntMdata = 0; X X for( recQid=(struct msqid_ds*)globalProfile.p_scratch,i=0; X imsg_qnum; X cntMdata += recQid->msg_cbytes; X } X X sargIpcs.cntMsgs = cntMsgs; X sargIpcs.cntMdata = cntMdata; X sargIpcs.perMsgs = ((float)cntMsgs/(float)msginfo.msgtql) * 100.0; X sargIpcs.perMdata = ((float)cntMdata/(float)msginfo.msgmnb) * 100.0; X X if( !memFetch(SARG_VAR_SEMINFO,&recSeminfo,sizeof(struct seminfo)) ) X { X#if defined(UW2) X sargIpcs.loaded = 0; X return diskWrite((void*)&sargIpcs,sizeof(struct sargIpcs), X SARG_RTYP_IPCS); X#else X fputs( "Could not fetch \"seminfo\".\n", stdout ); X return 0; X#endif X } X X sargIpcs.cntSems = recSeminfo.semmns; X X return diskWrite((void*)&sargIpcs,sizeof(struct sargIpcs),SARG_RTYP_IPCS); X} SHAR_EOF chmod 0664 'orion-1.0/sargent/ipcs.c' || $echo 'restore of' 'orion-1.0/sargent/ipcs.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/ipcs.c:' 'MD5 check failed' 0642fd3c205a5f59495e2ea960477699 orion-1.0/sargent/ipcs.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/sargent/ipcs.c'`" test 2720 -eq "$shar_count" || $echo 'orion-1.0/sargent/ipcs.c:' 'original size' '2720,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/sargent/kern.c ============== if test -f 'orion-1.0/sargent/kern.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/sargent/kern.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/sargent/kern.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/sargent/kern.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** This module contains all of the data structures and functions which X** find and retreive kernel structures. X** X** There are three basic records used: X** X** recNlist: Array of standard nlist(3E) records. Each platform has X** two, one of addresses used by sar, the other used by sargent. X** Only one table is used during the execution. The table X** is populated by reading nlist structures stored in the address X** file (either /tmp/sa.adrfl or /tmp/ssa.adrfl). X** X** tableOffsets: Maps variable ids to indices into the recNlist X** table. Each kernel structure has an id defined in "_p.h". X** The memXXX() functions access this table. X** X** metTab: The local metrics family of kernel structures are X** dynamically stored. This table maps their variable ids to X** storage locations. These kernel structures come in multiples - X** one for each CPU in the system. X** X** The following functions act on the above tables. X** X** memInit() X** Selects which table "recNlist" will point to. This is chosen X** by runtime option. X** X** [kernel address] memAddr( [var id] ) X** Converts a kernel id into a memory address. This only works for X** ids of non local metrics variables. X** X** [0/1] memFetch( [var id], [buffer], [var size] ) X** Reads the given kernel structure from memory. Places the data in X** the given buffer. X** X** [0/1] metInit() X** Initializes the local metrics cache. Reads the array of addresses X** of engines and initializes the offsets into the engine for each X** local metrics structure. X** X** [local address] metFetch( [var id] ) X** Reads the given local metrics structures, caches them, and X** returns a pointer to the cached record. This routine only X** works on variable ids of local metrics structures. X** X** The metrics and local metrics family of kernel structures only exists X** in the UnixWare 2 platform. Support for sar(1M) compatability does not X** exist in the UnixWare 2 platform. X** X** Adding new entries X** The sar version of the "recNlist" table must match the address file X** used by that platform's sar(1M) utility. You can't change this. X** X** Entries may be added to the version of the "recNlist" table at X** will. Just add a new variable id, and update the "recOffsets" table. X** Make sure that the id is defined only for those platforms which X** actully have the variable. X** X** Adding entries to the local metrics cache is more complicated. The X** cache init routine (metInit()) must be updated to insert the offset X** into the engine record (struct plocalmet) of this new structure. The X** offset is added into the "metTab" table. And a new variable id must X** be added. X*/ X X/* X** Entry in local metrics cache table. X*/ Xstruct metEnt X{ X unsigned var; X size_t size; X off_t offset; X void *ptr; X}; X X/* X*/ Xstruct siEnt X{ X unsigned var; X size_t size; X char init; X void *buf; X}; X X#ifdef SVR4 X/* X** The SVR4 address file used by sar. Reverse engineered. X** When sar compatability is used, "recNlist" points to X** this table. X*/ X#define SARG_NL_HDSTAT 0 X#define SARG_NL_SYSINFO 1 X#define SARG_NL_MINFO 2 X#define SARG_NL_INODE 3 X#define SARG_NL_FILECNT 4 X#define SARG_NL_TEXT 5 X#define SARG_NL_NPROC 6 X#define SARG_NL_FLCKINFO 7 X#define SARG_NL_V 8 X#define SARG_NL_SYSERR 9 X#define SARG_NL_RFSRVINFOT 10 X#define SARG_NL_MINSERVE 11 X#define SARG_NL_MAXSERVE 12 X#define SARG_NL_RFCINFOT 13 X#define SARG_NL_NINODE 14 X#define SARG_NL_RFSRVINFO 15 X#define SARG_NL_RFCLFSINFO 16 X#define SARG_NL_RFSRFSINFO 17 X#define SARG_NL_RFCINFO 18 X#define SARG_NL_KMEMINFO 19 X#define SARG_NL_VMINFO 20 X#define SARG_NL_BOOTINFO 21 X#define SARG_NL_i214BDD 22 Xstatic struct nlist recNlistSar[] = X{ X { "hdstat", 0, 0 }, X { "sysinfo", 0, 0 }, X { "minfo", 0, 0 }, X { "inode", 0, 0 }, X { "filecnt", 0, 0 }, X { "text", 0, 0 }, X { "nproc", 0, 0 }, X { "flckinfo", 0, 0 }, X { "v", 0, 0 }, X { "syserr", 0, 0 }, X { "rf_srv_info_t", 0, 0 }, X { "minserve", 0, 0 }, X { "maxserve", 0, 0 }, X { "rfc_info_t", 0, 0 }, X { "ninode", 0, 0 }, X { "rf_srv_info", 0, 0 }, X { "rfcl_fsinfo", 0, 0 }, X { "rfsr_fsinfo", 0, 0 }, X { "rfc_info", 0, 0 }, X { "kmeminfo", 0, 0 }, X { "vminfo", 0, 0 }, X { "bootinfo", 0, 0 }, X { "i214bdd", 0, 0 }, X { 0, 0, 0 } X}; X/* X** Lsar address file for SVR4. When sar compatability is not being X** used, "recNlist" points to this table. X*/ X#define SARG_LNL_SYSINFO 0 X#define SARG_LNL_MINFO 1 X#define SARG_LNL_NPROC 2 X#define SARG_LNL_V 3 X#define SARG_LNL_MSGINFO 4 X#define SARG_LNL_SEMINFO 5 Xstatic struct nlist recNlistLsar[] = X{ X { "sysinfo", 0, 0 }, /* struct sysinfo */ X { "minfo", 0, 0 }, /* struct minfo */ X { "nproc", 0, 0 }, /* short */ X { "v", 0, 0 }, /* struct var */ X { "msginfo", 0, 0 }, /* struct msginfo */ X { "seminfo", 0, 0 }, /* struct seminfo */ X { "", 0, 0 }, /* Terminating entry */ X}; X#endif X X#if defined(UW2) X/* X** Sargent does not support sar(1M) compatability for the UnixWare 2 X** platform. The stub below exists to reduce the number of "ifdefs" X** in the code. X*/ X#define SARG_NL_V -1 Xstatic struct nlist recNlistSar[] = X{ X { "", 0, 0 }, /* Terminating entry. */ X}; X X/* X** Lsar address file for UnixWare 2. "recNlist" always points to X** this table. X*/ X/* These constants are offsets into a table. */ X#define SARG_LNL_METS 0 X#define SARG_LNL_LOCALPTR 1 X#define SARG_LNL_LOCALOFF 2 X#define SARG_LNL_V 3 X#define SARG_LNL_MODHEAD 4 X#define SARG_LNL_DISKCNT 5 X#define SARG_LNL_SD01DP 6 X#define SARG_LNL_ROOTVFS 7 Xstatic struct nlist recNlistLsar[] = X{ X { "m", 0, 0 }, /* struct mets */ X { "met_localdata_ptrs_p", 0, 0 }, /* struct met_localdata_ptrs */ X { "met_ppmets_offsets", 0, 0 }, /* struct met_ppmets_offsets */ X { "v", 0, 0 }, /* struct var */ X { "modhead", 0, 0 }, /* struct modctl */ X { "sd01_diskcnt", 0, 0 }, /* int */ X { "sd01_dp", 0, 0 }, /* struct disk[] */ X { "rootvfs", 0, 0 }, /* struct vfs */ X { "", 0, 0 }, /* Terminating entry */ X}; X X/* X** UnixWare 2 metrics buffer pool. X*/ Xstatic struct metEnt metTab[] = X{ X { SARG_VAR_STR, sizeof(struct metp_str_resrc), 0, NULL }, X { SARG_VAR_CPU, sizeof(struct metp_cpu), 0, NULL }, X { SARG_VAR_VMMETER, sizeof(struct vmmeter), 0, NULL }, X { SARG_VAR_BUF, sizeof(struct metp_buf), 0, NULL }, X { SARG_VAR_TTY, sizeof(struct metp_tty), 0, NULL }, X { SARG_VAR_SYSCALL, sizeof(struct metp_syscall), 0, NULL }, X { SARG_VAR_VM, sizeof(struct metp_vm), 0, NULL }, X { SARG_VAR_KMEM, sizeof(struct metp_kmem)*MET_KMEM_NCLASS, 0, NULL }, X { SARG_VAR_NULL, 0, 0, NULL } X}; X#endif X X#ifdef SCO5 X/* X** Sargent does not support sar(1M) compatability for the SCO5 X** platform. The stub below exists to reduce the number of "ifdefs" X** in the code. X*/ X#define SARG_NL_V -1 X#define SARG_NL_SYSINFO -1 X#define SARG_NL_MINFO -1 X#define SARG_NL_INODE -1 X#define SARG_NL_FILE -1 X#define SARG_NL_PROC -1 X#define SARG_NL_FLOCK -1 X#define SARG_NL_SYSERR -1 Xstatic struct nlist recNlistSar[] = X{ X { "", 0, 0 }, /* Terminating entry. */ X}; X/* X** Sargent address file for SCO 3.2v5. 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 X#define SARG_LNL_NDISKS 19 X#define SARG_LNL_DSKPROBE 20 X#define SARG_LNL_SDSKSTATS 21 X#define SARG_LNL_DSKSTUFF 22 X#define SARG_LNL_STRSTAT 23 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[] */ SHAR_EOF : || $echo 'restore of' 'orion-1.0/sargent/kern.c' 'failed' fi $echo 'End of' 'orion-1.0' 'part' '5' $echo 'File' 'orion-1.0/sargent/kern.c' 'is continued in part' '6' echo 6 > _sh05649/seq exit 0