Article 13470 of alt.sources: Submitted-by: ljp@tiac.net Archive-name: orion-1.0/part04 ---- Cut Here and feed the following to sh ---- #!/bin/sh # This is `orion.04' (part 4 of orion-1.0). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `orion-1.0/pis/util.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" != 4; then $echo 'Please unpack part' "$shar_sequence" 'next!' exit 1 fi if test ! -f _sh05649/new; then $echo 'x -' 'STILL SKIPPING' 'orion-1.0/pis/util.c' else $echo 'x -' 'continuing file' 'orion-1.0/pis/util.c' sed 's/^X//' << 'SHAR_EOF' >> orion-1.0/pis/util.c && X X /* X ** Print the node id. Currently this only works for Inodes. X */ X if( id != -1 ) X fprintf( stdout, " I%lu", id ); X X path = NULL; X X /* X ** Print other information we can dig up. X */ X X /* X ** If it happens to be a device in the TTY database, great. X */ X#if defined(ORION_FEAT_VNODE) X if( type == VCHR ) X#else X if( type & IFCHR ) X#endif X { X if( (path=ttyFind(rdev)) != NULL ) X fprintf( stdout, " (%s)", path ); X } X X /* X ** If it was found above, there is no need to print anything else. X ** Otherwise, ... X */ X if( path == NULL ) X { X /* X ** Create a string containing the file type. X */ X path = mkftype( type, rdev ); X if( path[0] != '\0' ) X fprintf( stdout, " (%s)", path ); X X#if defined(ORION_FEAT_INODE) X if( ((type&IFCHR)!=IFCHR) && ((type&IFBLK)!=IFBLK) ) X { X fprintf( stdout, " on %u:%u", major(dev), minor(dev) ); X } X#endif X } X X fputc( (int)'\n', stdout ); X} SHAR_EOF $echo 'File' 'orion-1.0/pis/util.c' 'is complete' && chmod 0664 'orion-1.0/pis/util.c' || $echo 'restore of' 'orion-1.0/pis/util.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/pis/util.c:' 'MD5 check failed' 5f523b5d0476bf8e0c5b75e5f1a27bc4 orion-1.0/pis/util.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/util.c'`" test 13451 -eq "$shar_count" || $echo 'orion-1.0/pis/util.c:' 'original size' '13451,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/post.c ============== if test -f 'orion-1.0/pis/post.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/post.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/post.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/post.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#include X#include X#include X Xint setperm( const char*, uid_t, gid_t, mode_t ); X Xextern int errno; Xextern char *sys_errlist[]; X Xmain() X{ X#if defined(SUN5) X setperm( "pis", 0, 3, S_ISUID ); X setperm( "sargent", 0, 3, S_ISGID ); X setperm( "mkpis", 2, 3, S_ISGID ); X#else X setperm( "pis", 2, 3, S_ISGID ); X setperm( "sargent", 2, 3, S_ISGID ); X setperm( "mkpis", 2, 3, S_ISGID ); X#endif X exit( 0 ); X} X Xint setperm( const char *file, uid_t owner, gid_t group, mode_t mode ) X{ X if( access(file,F_OK) == -1 ) X { X fprintf( stdout, "Could not access file \"%s\".\n", file ); X return 0; X } X X if( chown(file,owner,group) == -1 ) X { X fprintf( stdout, "Bad chown(). %s.\n", sys_errlist[errno] ); X return 0; X } X X if( chmod(file,S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH| X S_IXOTH|mode) == -1 ) X { X fprintf( stdout, "Bad chmod(). %s.\n", sys_errlist[errno] ); X return 0; X } X X return 1; X} SHAR_EOF chmod 0664 'orion-1.0/pis/post.c' || $echo 'restore of' 'orion-1.0/pis/post.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/pis/post.c:' 'MD5 check failed' 28bab94d7757c0c0f181a7f13929b185 orion-1.0/pis/post.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/post.c'`" test 1614 -eq "$shar_count" || $echo 'orion-1.0/pis/post.c:' 'original size' '1614,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/native.mk ============== if test -f 'orion-1.0/pis/native.mk' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/native.mk' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/native.mk' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/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# XCFLAGS = -D${PLATFORM} ${COPTS} -I. -I${DIR_INC} ${CF} XLDFLAGS = -L. -L${DIR_LIB} X XPIS_SRCS = pis.c pis-svr3.c pis-sun5.c pis-uw2.c db.c util.c XPIS_OBJS=${PIS_SRCS:.c=.o} X XMKPIS_SRCS = mkpis.c tty.c uid.c sleep.c XMKPIS_OBJS=${MKPIS_SRCS:.c=.o} X Xall:: pis mkpis X Xincludes:: X X# X# "PIS_LIBS" is from "../orion.mk". X# Xpis:: ${PIS_OBJS} X rm -f pis X ${CC} -o $@ ${PIS_OBJS} ${LDFLAGS} -lorion ${PIS_LIBS} X Xmkpis:: ${MKPIS_OBJS} X rm -f mkpis X ${CC} -o $@ ${MKPIS_OBJS} ${LDFLAGS} -lorion X Xclean:: X rm -f pis ${PIS_OBJS} mkpis ${MKPIS_OBJS} X Xinstall:: mkpis pis X mv pis ${DIR_INST}/bin X mv mkpis ${DIR_INST}/bin X cd ${DIR_INST}/bin; chown ${MEMOWN} pis mkpis X cd ${DIR_INST}/bin; chgrp ${MEMGRP} pis mkpis X cd ${DIR_INST}/bin; chmod 775 pis mkpis X if [ ${PLATFORM} = "SUN5" ]; then chmod u+s ${DIR_INST}/bin/pis ; fi X if [ ${PLATFORM} = "SUN5" ]; then chmod u+s ${DIR_INST}/bin/mkpis ; fi X if [ ${PLATFORM} != "SUN5" ]; then chmod g+s ${DIR_INST}/bin/pis ; fi X if [ ${PLATFORM} != "SUN5" ]; then chmod g+s ${DIR_INST}/bin/mkpis; fi X Xinclude ../rules.mk X Xdb.o: pis.h Xmkpis.o: mkpis.h pisdb.h Xpis.o: pis.h pisdb.h Xpis-svr3.o: pis.h Xpis-svr4.o: pis.h Xsleep.o: mkpis.h pisdb.h Xtty.o: mkpis.h pisdb.h Xuid.o: mkpis.h pisdb.h SHAR_EOF chmod 0664 'orion-1.0/pis/native.mk' || $echo 'restore of' 'orion-1.0/pis/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/pis/native.mk:' 'MD5 check failed' eea5308e0ddb0efb858457b376623ef1 orion-1.0/pis/native.mk SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/native.mk'`" test 2153 -eq "$shar_count" || $echo 'orion-1.0/pis/native.mk:' 'original size' '2153,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/pis-svr3.c ============== if test -f 'orion-1.0/pis/pis-svr3.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/pis-svr3.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/pis-svr3.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/pis-svr3.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** pis-svr3.c X** X** Routines specific to SVR3 and VENIX 3.2.4 and SCO5. X*/ X X#if defined(VENIX32) || defined(SVR3) || defined(SCO4) || defined(SCO5) X X#include"pis.h" X Xstatic caddr_t allocScratch( int ); Xstatic int uFetch( pid_t, unsigned ); Xstatic const char *mkflags( unsigned int ); Xstatic const char *mkstatus( char ); Xstatic const char *mkprio( struct proc* ); X X/* X** dolist() X*/ Xint dolist( unsigned slot, struct proc *proc, struct user *u ) X{ X char devname[8+1]; X const char *ptr; X char username[PIS_MAX_LUSERNAME+1]; X char args[PIS_MAX_ARGV+1]; X X /* X ** FUTURE: Truncate the command line arguments so that they fit X ** onto a 80 character window. We should dynamically determine X ** the window size and perform a calculation. X */ X if( proc->p_stat != SZOMB ) X { X strncpy( args, u->u_psargs, 32 ); X if( args[32] != '\0' ) X { X args[32-2] = '>'; X args[32-1] = '>'; X args[32] = '\0'; X } X } X else X strcpy( args, "[zombie]" ); X X /* X ** Get the name of the controlling terminal. X */ X if( proc->p_stat != SZOMB ) X { X int i; X const char *ptr; X X if( (ptr=ttyFind(u->u_ttyd)) != NULL ) X pathAdjust( ptr, devname, 8 ); X else X devname[0] = '\0'; X } X else X devname[0] = '\0'; X X /* X ** Garbage appears in system processes on VENIX 3.2.4. X */ X if( proc->p_flag&SSYS || proc->p_pid==1 ) X devname[0] = '\0'; X X /* X ** Convert the uid to a username. X */ X if( (ptr=uidFind(proc->p_uid)) == NULL ) X strcpy( username, S_Empty ); X else X { X strncpy( username, ptr, PIS_MAX_LUSERNAME ); X username[PIS_MAX_LUSERNAME] = '\0'; X } X X#if 0 X if( (strflags=mkflags(proc->p_flag)) == NULL ) X strflags = S_Empty; X#endif X X fprintf( stdout, "%5ld %-5ld %s", X proc->p_pid, X proc->p_ppid, X mkstatus(proc->p_stat) ); X X fprintf( stdout, " %-*s %-8s", X PIS_MAX_LUSERNAME, X username, X devname ); X X if( proc->p_stat != SZOMB ) X { X fprintf( stdout, " %s", X secFormat((u->u_stime+u->u_utime)/HZ) ); X } X else X fprintf( stdout, " --:--" ); X X fprintf( stdout, " %-3ld %-3s %s\n", X proc->p_size, X mkprio(proc), X args ); X} X X/* X** dodetail() X** X** Show each process in "detail" form. This includes information X** beyond what "ps" would show. Most relevant data from process X** table and U block is shown. X*/ Xint dodetail( unsigned slot, struct proc *proc, caddr_t procaddr, X struct user *u ) X{ X char strPri[7+1]; X char strUlimit[31+1]; X int i; X int flagAny; X struct pisinfo pisinfo; X X pisinfo.flags = 0; X X if( proc->p_flag & SSYS ) X pisinfo.flags |= PIS_INF_SYS; X X if( proc->p_stat == SSLEEP ) X pisinfo.flags |= PIS_INF_SLEEP; X else if( proc->p_stat == SZOMB ) X pisinfo.flags |= PIS_INF_ZOMB; X X /* X ** Data pulled from the process record. X */ X pisinfo.pid = proc->p_pid; X pisinfo.ppid = proc->p_ppid; X pisinfo.grp = proc->p_pgrp; X pisinfo.size = proc->p_size; X if( pisinfo.flags & PIS_INF_SLEEP ) X pisinfo.sleep = proc->p_unw.p_cad; X else X pisinfo.sleep = 0; X pisinfo.pri = strPri; X X /* X ** Data pulled from the user block. X */ X if( !(pisinfo.flags&PIS_INF_ZOMB) ) X { X pisinfo.uid = u->u_uid; X pisinfo.ruid = u->u_ruid; X pisinfo.gid = u->u_gid; X pisinfo.rgid = u->u_rgid; X pisinfo.time = u->u_stime+u->u_utime; X pisinfo.args = u->u_psargs; X pisinfo.tty = u->u_ttyd; X pisinfo.cmask = u->u_cmask; X pisinfo.start = u->u_start; X pisinfo.nshm = u->u_nshmseg; X pisinfo.ulimit = strUlimit; X#ifdef VENIX32 X if( (proc->p_flag&RTX_SRTPRI) == RTX_SRTPRI ) X sprintf( strPri, "RT:%d", proc->p_xstat ); X else X#endif X sprintf( strPri, "%d", (int)proc->p_nice ); X sprintf( strUlimit, "%ld", u->u_limit ); X } X X pisinfo.slot = slot; X pisinfo.proc = procaddr; X X /* Not supported on these platforms. */ X pisinfo.heap = -1; X pisinfo.stk = -1; X pisinfo.nlwp = -1; X X dispBasic( &pisinfo ); X X /* X ** Display information on open files. X */ X if( !(pisinfo.flags&PIS_INF_SYS) && !(pisinfo.flags&PIS_INF_ZOMB) ) X { X unsigned i, flagAny; X struct file recFile; X struct inode recInode; X X for( i=0,flagAny=0; iu_ofile[i] == NULL ) X continue; X if( !memRead(globalProfile.p_fdKMem,(caddr_t)u->u_ofile[i], X (void*)&recFile,sizeof(recFile)) ) X { X break; X } X if( !memRead(globalProfile.p_fdKMem,(caddr_t)recFile.f_inode, X (void*)&recInode,sizeof(recInode)) ) X { X break; X } X if( !flagAny ) X { X fputs( " Open files:\n", stdout ); X ++flagAny; X } X X dispFd( i, recInode.i_number, X#if defined(SCO4) || defined(SCO5) X recFile.f_flag, X#else X (u->u_pofile[i]|recFile.f_flag), X#endif X recInode.i_ftype, recInode.i_rdev, recInode.i_dev ); X } X } X X if( !(pisinfo.flags&PIS_INF_SYS) && !(pisinfo.flags&PIS_INF_ZOMB) ) X dispSigs( u->u_signal ); X X fputc( (int)'\n', stdout ); X X return 1; X} X Xstatic const char *mkflags( unsigned int flags ) X{ X static char string[4+1]; X int i; X X i = 0; X X if( flags&SSYS ) X string[i++] = 's'; X if( flags&STRC ) X string[i++] = 't'; X /* X ** if( flags&SLOAD ) X ** string[i++] = 'c'; X */ X if( flags&SLOCK ) X string[i++] = 'l'; X#ifdef VENIX32 X if( flags&RTX_SRTPRI ) X string[i++] = 'r'; X#endif X X string[i] = '\0'; X X return (const char *)string; X} X Xstatic const char *mkstatus( char status ) X{ X static char string[1+1]; X X switch( status ) X { X case SSLEEP: X string[0] = 'S'; X break; X case SRUN: X string[0] = 'R'; X break; X case SZOMB: X string[0] = 'Z'; X break; X case SIDL: X string[0] = 'I'; X break; X case SONPROC: X string[0] = 'O'; X break; X case SXBRK: X string[0] = 'X'; X break; X default: X string[0] = '?'; X break; X } X X return (const char *)string; X} X Xstatic const char *mkprio( struct proc *proc ) X{ X static char string[16+1]; X X string[0] = '\0'; X X#ifdef VENIX32 X if( (proc->p_flag&RTX_SRTPRI) == RTX_SRTPRI ) X sprintf( string, "r%d", proc->p_xstat ); X else X#endif X sprintf( string, "%d", (int)proc->p_nice ); X X return (const char*)string; X} X X#else X Xextern int errno; X X#endif SHAR_EOF chmod 0664 'orion-1.0/pis/pis-svr3.c' || $echo 'restore of' 'orion-1.0/pis/pis-svr3.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/pis/pis-svr3.c:' 'MD5 check failed' 086b5d64d555c954fceea3186cf04ead orion-1.0/pis/pis-svr3.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/pis-svr3.c'`" test 6839 -eq "$shar_count" || $echo 'orion-1.0/pis/pis-svr3.c:' 'original size' '6839,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/mkpis.c ============== if test -f 'orion-1.0/pis/mkpis.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/mkpis.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/mkpis.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/mkpis.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#include"mkpis.h" X X#ifdef VENIX32 Xextern const char *getenv( const char* ); Xextern const char *strrchr( const char*, int ); X#endif X Xstatic int dbCreate( unsigned, int ); Xstatic caddr_t allocScratch( int ); Xstatic int walk( char*, struct stat*, int ); Xstatic void usage( unsigned ); X X/* X** Globals. X*/ X X/* X** String table. X*/ Xconst char * const S_Empty = ""; Xconst char * const S_PathMem = "/dev/kmem"; Xconst char * const S_PathDev = "/dev"; Xconst char * const S_PathPisdata = "/tmp/pisdata"; X#if defined(SVR4) || defined(UW2) || defined(SCO5) Xconst char * const S_PathKern = "/stand/unix"; X#endif X#if defined(SUN5) Xconst char * const S_PathKern = "/kernel/unix"; X#endif X#if defined(VENIX32) || defined(SVR3) || defined(SCO4) Xconst char * const S_PathKern = "/unix"; X#endif Xconst char * const S_Command = "mkpis"; X Xint flagDebug; X Xmain( int argc, const char *argv[] ) X{ X int fdMem; X int i; X int pidChild; X int flagMkdb; X void *scratch; X X flagDebug = 0; X X /* X ** Normally the uid/tty database is made only when X ** it does not exist. X */ X flagMkdb = 0; X X /* X ** Loop through all command line arguments. X */ X for( i=1; 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/pis/mkpis.c:' 'MD5 check failed' 7534757f006aad6f4092285692482d55 orion-1.0/pis/mkpis.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/mkpis.c'`" test 4272 -eq "$shar_count" || $echo 'orion-1.0/pis/mkpis.c:' 'original size' '4272,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/mkpis.h ============== if test -f 'orion-1.0/pis/mkpis.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/mkpis.h' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/mkpis.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/mkpis.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 MKPIS_H X#define MKPIS_H X X/* X** VENIX version gets all kernel includes from "liborion.h". X*/ X#include X X#if defined(SVR4) || defined(UW2) || defined(SUN5) X#include X#endif X X#include X/* To prevent reinclusion from "liborion.h". */ X#if !defined(VENIX32) && !defined(SVR3) X#include X#include X#endif X X#include X#include X#include X#include X#include X#if defined(SUN5) X#include X#endif X#if defined(SCO4) || defined(SCO5) X#include X#include X#endif X X#define MKPIS_MAX_MDEVLINE 80 X X#define MKPIS_USAGE_GOSEE 1 X#define MKPIS_USAGE_FULL 2 X Xextern const char * const S_PathDev; Xextern const char * const S_PathKern; X Xextern int flagDebug; X Xextern int errno; Xextern char *sys_errlist[]; X Xextern caddr_t getAddr( unsigned ); Xextern int ttyWrite( int ); Xextern int uidWrite( int ); X#if defined(VENIX32) || defined(SVR3) || defined(SCO4) || defined(SCO5) Xextern int sleepWrite( int, int ); X#endif X X#endif SHAR_EOF chmod 0664 'orion-1.0/pis/mkpis.h' || $echo 'restore of' 'orion-1.0/pis/mkpis.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/pis/mkpis.h:' 'MD5 check failed' 77eda7f87a3d0afa98f0761b0271e0dc orion-1.0/pis/mkpis.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/mkpis.h'`" test 1659 -eq "$shar_count" || $echo 'orion-1.0/pis/mkpis.h:' 'original size' '1659,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/pis-sun5.c ============== if test -f 'orion-1.0/pis/pis-sun5.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/pis-sun5.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/pis-sun5.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/pis-sun5.c' && 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** pis-sun5.c Module of pis. X** X** Handle SunOS 5 and SVR4 specific operation of linet and detail modes. X*/ X X#if defined(SUN5) || defined(SVR4) X X#include"pis.h" X X/* X** dolist() X*/ Xint dolist( struct proc *proc_p, struct pid *recPid, X struct cred *cred_p, struct prpsinfo *recInfo ) X{ X char devname[8+1]; X char username[PIS_MAX_LUSERNAME+1]; X const char *ptr; X char args[PIS_MAX_ARGV+1]; X X /* X ** FUTURE: Truncate the command line arguments so that they fit X ** onto a 80 character window. We should dynamically determine X ** the window size and perform a calculation. X */ X if( recInfo->pr_sname == 'Z' ) X { X strcpy( args, "[zombie]" ); X } X else X { X strncpy( args, recInfo->pr_psargs, 32 ); X if( args[32] != '\0' ) X { X args[32-2] = '>'; X args[32-1] = '>'; X args[32] = '\0'; X } X } X X /* X ** Get the name of the controlling terminal. X */ X if( recInfo->pr_sname != 'Z' ) X { X int i; X const char *ptr; X X if( (ptr=ttyFind( recInfo->pr_lttydev)) != NULL ) X pathAdjust( ptr, devname, 8 ); X else X devname[0] = '\0'; X } X else X devname[0] = '\0'; X X /* X ** Convert the uid to a username. X */ X if( (ptr=uidFind( cred_p->cr_uid)) == NULL ) X sprintf( username, "%d", cred_p->cr_uid ); X else X { X strncpy( username, ptr, PIS_MAX_LUSERNAME ); X username[PIS_MAX_LUSERNAME] = '\0'; X } X X fprintf( stdout, "%5ld %-5ld %c", X recInfo->pr_pid, X recInfo->pr_ppid, X recInfo->pr_sname ); X X fprintf( stdout, " %-*s %-8s %s %-3ld %3s:%02d %s\n", X PIS_MAX_LUSERNAME, X username, X devname, X secFormat((proc_p->p_stime+proc_p->p_utime)/globalProfile.p_hz), X recInfo->pr_size, X recInfo->pr_clname, X recInfo->pr_pri, X args ); X} X X/* X** dodetail() X** X** Show each process in "detail" form. This includes information X** beyond what "ps" would show. X*/ Xint dodetail( struct proc *proc_p, caddr_t procaddr, struct pid *recPid, X struct cred *cred_p, struct prpsinfo *recInfo ) X{ X char strPri[7+1]; X char strUlimit[31+1]; X int i; X struct pisinfo pisinfo; X X pisinfo.flags = 0; X X if( recInfo->pr_sname == 'S' ) X pisinfo.flags |= PIS_INF_SLEEP; X else if( recInfo->pr_sname == 'Z' ) X pisinfo.flags |= PIS_INF_ZOMB; X else if( recInfo->pr_sname == 'T' ) X pisinfo.flags |= PIS_INF_TRACE; X if( proc_p->p_flag&SSYS ) X pisinfo.flags |= PIS_INF_SYS; X if( proc_p->p_flag&SLOCK ) X pisinfo.flags |= PIS_INF_LOCK; X X sprintf( strPri, "%s:%d", recInfo->pr_clname, recInfo->pr_pri ); X X if( !(pisinfo.flags&PIS_INF_ZOMB) ) X { X if( proc_p->p_user.u_rlimit[RLIMIT_FSIZE].rlim_cur == X RLIM_INFINITY ) X { X strcpy( strUlimit, "[unlimited]" ); X } X else X { X sprintf( strUlimit, "%lu", X proc_p->p_user.u_rlimit[RLIMIT_FSIZE].rlim_cur ); X } X } X X /* X ** Information taken from the proc filesystem "psinfo" record. X */ X pisinfo.pid = recInfo->pr_pid; X pisinfo.ppid = recInfo->pr_ppid; X pisinfo.sid = recInfo->pr_sid; X pisinfo.grp = recInfo->pr_pgrp; X pisinfo.size = recInfo->pr_size; X pisinfo.tty = recInfo->pr_lttydev; X pisinfo.args = recInfo->pr_psargs; X pisinfo.sleep = recInfo->pr_wchan; X pisinfo.start = recInfo->pr_start.tv_sec; X if( pisinfo.flags & PIS_INF_ZOMB ) X pisinfo.tty = NODEV; X if( !(pisinfo.flags&PIS_INF_SLEEP) ) X pisinfo.sleep = (caddr_t)0; X X /* X ** Information taken from the credentials structure. X */ X pisinfo.uid = cred_p->cr_uid; X pisinfo.ruid = cred_p->cr_ruid; X pisinfo.gid = cred_p->cr_gid; X pisinfo.rgid = cred_p->cr_rgid; X X /* X ** Information taken from the process record. X */ X pisinfo.time = proc_p->p_stime+proc_p->p_utime; X pisinfo.heap = proc_p->p_brksize; X pisinfo.stk = proc_p->p_stksize; X pisinfo.cmask = proc_p->p_user.u_cmask; X pisinfo.nshm = proc_p->p_user.u_nshmseg; X pisinfo.nlwp = proc_p->p_lwpcnt; X X pisinfo.slot = recPid->pid_prslot; X pisinfo.pri = strPri; X pisinfo.ulimit = strUlimit; X pisinfo.proc = (struct proc*)procaddr; X X dispBasic( &pisinfo ); X X /* X ** Display information on open files. X */ X if( !(proc_p->p_flag&SSYS) && !(pisinfo.flags&PIS_INF_ZOMB) ) X { X const char *path; X unsigned i, flagAny; X struct uf_entry *buffer; X struct file recFile; X struct vnode recVnode; X X if( (buffer=malloc(proc_p->p_user.u_nofiles*sizeof(struct uf_entry))) X == NULL ) X { X fputs( "Bad malloc().\n", stdout ); X return 0; X } X if( !memRead(globalProfile.p_fdKMem, X proc_p->p_user.u_flist, X (void*)buffer, X proc_p->p_user.u_nofiles*sizeof(struct uf_entry)) ) X { X fputs( "Could not fetch uf_entries.\n", stdout ); X return 0; X } X for( i=0,flagAny=0; ip_user.u_nofiles; ++i ) X { X if( buffer[i].uf_ofile == NULL ) X continue; X if( !memRead(globalProfile.p_fdKMem, X (caddr_t)buffer[i].uf_ofile, X (void*)&recFile,sizeof(recFile)) ) X { X break; X } X if( !memRead(globalProfile.p_fdKMem,(caddr_t)recFile.f_vnode, X (void*)&recVnode,sizeof(recVnode)) ) X { X break; X } X if( !flagAny ) X { X fputs( " Open files:\n", stdout ); X ++flagAny; X } X dispFd( i, -1, recFile.f_flag|buffer[i].uf_pofile, X recVnode.v_type, recVnode.v_rdev, recVnode.v_rdev ); X } X } X X if( !(proc_p->p_flag&SSYS) && !(pisinfo.flags&PIS_INF_ZOMB) ) X dispSigs( proc_p->p_user.u_signal ); X X fputc( (int)'\n', stdout ); X X return 1; X} X X#else X X/* Avoid warnings regarding empty files. */ Xextern int errno; X X#endif SHAR_EOF chmod 0664 'orion-1.0/pis/pis-sun5.c' || $echo 'restore of' 'orion-1.0/pis/pis-sun5.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/pis/pis-sun5.c:' 'MD5 check failed' 23de9550ee844bbadb1fec1d65e08e01 orion-1.0/pis/pis-sun5.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/pis-sun5.c'`" test 6109 -eq "$shar_count" || $echo 'orion-1.0/pis/pis-sun5.c:' 'original size' '6109,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/pis-uw2.c ============== if test -f 'orion-1.0/pis/pis-uw2.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/pis-uw2.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/pis-uw2.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/pis-uw2.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"pis.h" X X/* X** dolist() X*/ X#if defined(UW2) Xint dolist( struct proc *proc_p, struct cred *cred_p, struct psinfo *recInfo ) X{ X char devname[8+1]; X char username[PIS_MAX_LUSERNAME+1]; X const char *ptr; X char args[PIS_MAX_ARGV+1]; X X /* X ** FUTURE: Truncate the command line arguments so that they fit X ** onto a 80 character window. We should dynamically determine X ** the window size and perform a calculation. X */ X if( recInfo->pr_lwp.pr_sname == 'Z' ) X { X strcpy( args, "[zombie]" ); X } X else X { X strncpy( args, recInfo->pr_psargs, 32 ); X if( args[32] != '\0' ) X { X args[32-2] = '>'; X args[32-1] = '>'; X args[32-0] = '\0'; X } X } X X /* X ** Get the name of the controlling terminal. X */ X if( recInfo->pr_lwp.pr_sname != 'Z' ) X { X int i; X const char *ptr; X X if( (ptr=ttyFind( proc_p->p_cttydev)) != NULL ) X pathAdjust( ptr, devname, 8 ); X else X devname[0] = '\0'; X } X X /* X ** Convert the uid to a username. X */ X if( (ptr=uidFind( cred_p->cr_uid)) == NULL ) X strcpy( username, S_Empty ); X else X { X strncpy( username, ptr, PIS_MAX_LUSERNAME ); X username[PIS_MAX_LUSERNAME] = '\0'; X } X X fprintf( stdout, "%5ld %-5ld %c %-*s", X proc_p->p_epid, X proc_p->p_ppid, X recInfo->pr_lwp.pr_sname, X PIS_MAX_LUSERNAME, X username ); X X fprintf( stdout, " %-8s", X (recInfo->pr_lwp.pr_sname!='Z')?devname:S_Empty ); X X fprintf( stdout, " %s", X /* FUTURE: Fix the 64-bit stuff. */ X secFormat((proc_p->p_stime.dl_lop+proc_p->p_utime.dl_lop)/ X globalProfile.p_hz) ); X X if( recInfo->pr_lwp.pr_sname != 'Z' ) X { X fprintf( stdout, " %-3ld %3s:%02d", X recInfo->pr_size, X recInfo->pr_lwp.pr_clname, X recInfo->pr_lwp.pr_pri ); X } X else X fprintf( stdout, " %-3s %3s %2s", S_Empty, S_Empty, S_Empty ); X X fprintf( stdout, " %s\n", args ); X} X#endif X X/* X** dodetail() X** X** Show each process in "detail" form. This includes information X** beyond what "ps" would show. Most relevant data from process X** table and U block is shown. X*/ X#if defined(UW2) Xint dodetail( struct proc *proc_p, caddr_t procaddr, struct cred *cred_p, X struct psinfo *recInfo ) X{ X char strPri[7+1]; X int i; X struct pisinfo pisinfo; X X pisinfo.flags = 0; X X if( recInfo->pr_lwp.pr_sname == 'S' ) X pisinfo.flags |= PIS_INF_SLEEP; X else if( recInfo->pr_lwp.pr_sname == 'Z' ) X pisinfo.flags |= PIS_INF_ZOMB; X else if( recInfo->pr_lwp.pr_sname == 'T' ) X pisinfo.flags |= PIS_INF_TRACE; X if( proc_p->p_flag&P_SYS ) X pisinfo.flags |= PIS_INF_SYS; X if( proc_p->p_flag&P_NOSWAP ) X pisinfo.flags |= PIS_INF_LOCK; X X /* X ** Information pulled from the process record. X */ X pisinfo.pid = proc_p->p_epid; X pisinfo.ppid = proc_p->p_ppid; X pisinfo.grp = proc_p->p_pgid; X pisinfo.slot = proc_p->p_slot; X pisinfo.time = proc_p->p_stime.dl_lop+proc_p->p_utime.dl_lop; X pisinfo.tty = proc_p->p_cttydev; X pisinfo.heap = proc_p->p_brksize; X pisinfo.stk = proc_p->p_stksize; X pisinfo.cmask = proc_p->p_cmask; X pisinfo.start = proc_p->p_start.tv_sec; X pisinfo.nshm = proc_p->p_nshmseg; X pisinfo.nlwp = proc_p->p_nlwp; X if( pisinfo.flags&PIS_INF_ZOMB ) X pisinfo.tty = NODEV; X X /* X ** Information from the credentials record. X */ X pisinfo.uid = cred_p->cr_uid; X pisinfo.ruid = cred_p->cr_ruid; X pisinfo.gid = cred_p->cr_gid; X pisinfo.rgid = cred_p->cr_rgid; X X /* X ** Data from the proc filesystem's psinfo record. X */ X pisinfo.args = recInfo->pr_psargs; X pisinfo.size = recInfo->pr_size; X if( pisinfo.flags&PIS_INF_SLEEP ) X pisinfo.sleep = recInfo->pr_lwp.pr_wchan; X else X pisinfo.sleep = (caddr_t)0; X if( !(pisinfo.flags&PIS_INF_ZOMB) ) X { X sprintf( strPri, "%s:%d", X recInfo->pr_lwp.pr_clname, recInfo->pr_lwp.pr_pri ); X pisinfo.pri = strPri; X } X else X pisinfo.pri = S_Empty; X X pisinfo.ulimit = S_Empty; X pisinfo.proc = (struct proc*)procaddr; X X dispBasic( &pisinfo ); X X /* X ** Display information on open files. X */ X if( !(pisinfo.flags&PIS_INF_SYS) && !(pisinfo.flags&PIS_INF_ZOMB) ) X { X const char *path; X unsigned i, flagAny; X struct fd_entry *entry; X struct fd_entry entries[128]; /* FUTURE. */ X struct file recFile; X struct vnode recVnode; X X if( proc_p->p_fdtab.fdt_sizeused ) X { X memRead( globalProfile.p_fdKMem, X (caddr_t)proc_p->p_fdtab.fdt_entrytab, X (void*)entries, X sizeof(struct fd_entry)*proc_p->p_fdtab.fdt_sizeused ); X } X X for( i=0,flagAny=0; ip_fdtab.fdt_sizeused; ++i ) X { X entry = &entries[i]; X X if( entry==NULL || entry->fd_file==NULL ) X continue; X X if( !memRead(globalProfile.p_fdKMem, X (caddr_t)entry->fd_file, X (void*)&recFile,sizeof(recFile)) ) X { X break; X } X if( !memRead(globalProfile.p_fdKMem, X (caddr_t)recFile.f_vnode, X (void*)&recVnode,sizeof(recVnode)) ) X { X break; X } X if( !flagAny ) X { X fputs( " Open files:\n", stdout ); X ++flagAny; X } X dispFd( i, -1, recFile.f_flag|entry->fd_flag, X recVnode.v_type, recVnode.v_rdev, (dev_t)0 ); X } X } X X if( !(pisinfo.flags&PIS_INF_SYS) && !(pisinfo.flags&PIS_INF_ZOMB) ) X dispSigs( proc_p->p_sigstate ); X X fputc( (int)'\n', stdout ); X X return 1; X} X X#else X Xextern int errno; X X#endif SHAR_EOF chmod 0664 'orion-1.0/pis/pis-uw2.c' || $echo 'restore of' 'orion-1.0/pis/pis-uw2.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/pis/pis-uw2.c:' 'MD5 check failed' 9ef4d5e7085a5da57c2666dee673a0b8 orion-1.0/pis/pis-uw2.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/pis-uw2.c'`" test 5941 -eq "$shar_count" || $echo 'orion-1.0/pis/pis-uw2.c:' 'original size' '5941,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/sleep.c ============== if test -f 'orion-1.0/pis/sleep.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/sleep.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/sleep.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/sleep.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#include"mkpis.h" X X#if defined(VENIX32) || defined(SVR3) || defined(SCO5) || defined(SCO4) X Xstatic caddr_t fetch( const char* ); Xstatic int enter( const char*, caddr_t ); X Xstatic struct nlist tabSyms[] = X{ X { "u", 0, 0 }, X { "pollwait", 0, 0 }, X { "selwait", 0, 0 }, X { "com_tty", 0, 0 }, X { "maxcntlr", 0, 0 }, X { "asy_tty", 0, 0 }, X { "num_asy", 0, 0 }, X { "ptx_tty", 0, 0 }, X { "fas_tty", 0, 0 }, X { "fas_physical_units", 0, 0 }, X { "cn_tty", 0, 0 }, X { "cn_cnt", 0, 0 }, X { "spt_tty", 0, 0 }, X { "spt_cnt", 0, 0 }, X { "sio_tty", 0, 0 }, X { "sio_cnt", 0, 0 }, X { "", 0, 0 } X}; X Xstatic int cntSleep; Xstatic struct recSleep tabSleep[PIS_MAX_SLEEP+1]; X Xint sleepWrite( int fd, int fdMem ) X{ X int rc; X int i; X caddr_t addr; X X if( nlist(S_PathKern,tabSyms) == -1 ) X { X fputs( "Bad nlist().\n", stdout ); X return 0; X } X X cntSleep = 0; X X if( flagDebug ) X { X fputs( "Searching for sleep addresses.\n", stdout ); X } X X /* X ** Processes sleeping in pause(). X */ X if( (addr=fetch("u")) != NULL ) X { X enter( "pause", addr ); X } X X /* X ** Processes sleeping in poll(). X */ X if( (addr=fetch("pollwait")) != NULL ) X { X enter( "poll", addr ); X } X X /* X ** Processes sleeping in select(). X */ X if( (addr=fetch("selwait")) != NULL ) X { X enter( "select", addr ); X } X X /* X ** TTY record arrays. X */ X X /* X ** The asy driver is used on most versions of System V to control X ** stock PC serial ports. This code is for the SVR3 and VENIX32 X ** platforms. X */ X if( (addr=fetch("asy_tty")) != NULL ) X { X int count; X caddr_t base; X X base = addr; X X if( (addr=fetch("num_asy")) != NULL ) X { X if( !memRead(fdMem,addr,&count,sizeof(count)) ) X { X fputs( "Bad read of \"num_asy\".\n", stdout ); X return 0; X } X for( i=0; i= PIS_MAX_SLEEP ) X { X fprintf( stdout, X "Too many sleep addresses, ignoring \"%s\" 0x%lx.\n", X name, (long)addr ); X return 0; X } X X tabSleep[cntSleep].addr = addr; X strcpy( tabSleep[cntSleep].name, name ); X ++cntSleep; X X if( flagDebug ) X { X fprintf( stdout, " Address 0x%08x \"%s\"\n", X (unsigned)addr, name ); X } X X return 1; X} X Xstatic caddr_t fetch( const char *name ) X{ X int i; X X for( i=0; tabSyms[i].n_name[0]!='\0'; ++i ) X { X if( !strcmp(tabSyms[i].n_name,name) ) X { X return (caddr_t)tabSyms[i].n_value; X } X } X X return NULL; X} X X#endif SHAR_EOF chmod 0664 'orion-1.0/pis/sleep.c' || $echo 'restore of' 'orion-1.0/pis/sleep.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/pis/sleep.c:' 'MD5 check failed' 511b1741e4437858c16f7896299df874 orion-1.0/pis/sleep.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/sleep.c'`" test 7631 -eq "$shar_count" || $echo 'orion-1.0/pis/sleep.c:' 'original size' '7631,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/pis/pisdb.h ============== if test -f 'orion-1.0/pis/pisdb.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/pis/pisdb.h' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/pis/pisdb.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/pis/pisdb.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/* X** pisdb.h X** X** pis database API. X** X*/ X X#ifndef PISDB_H X#define PISDB_H X X#include X X#define PIS_MAX_TTYMAJ 64 /* Max tty drivers in database. */ X#define PIS_MAX_TTYMIN 256 /* Max tty records in database. */ X#define PIS_MAX_TTYNAME 15 /* Max length of tty name. */ X#define PIS_MAX_USERNAME 15 /* Max length of user name. */ X#define PIS_MAX_SLEEPNAME 15 /* Max length of user name in list. */ X#define PIS_MAX_UID 127 /* Max user records in database. */ X#define PIS_MAX_SLEEP 255 /* Max sleep records in database. */ X#define PIS_MAX_MDEVLINE 80 /* Max line size in mdevice file. */ X#if defined(UW2) X#define PIS_MAX_RESLINE 127 /* Max line size of res_major file. */ X#endif X X/* X** Kernel variables stored in address file. X*/ X#define PIS_VAR_NULL 0 X#define PIS_VAR_PROC 1 X#define PIS_VAR_V 2 X#define PIS_VAR_NPROC 3 X#define PIS_VAR_MSGINFO 4 X#define PIS_VAR_MSGQUE 5 X#define PIS_VAR_QUEUE 6 X#define PIS_VAR_PRACTIVE 7 X#define PIS_VAR_HZ 8 X X#ifdef VENIX32 Xtypedef int pid_t; X#endif X X#if defined(VENIX32) && !defined(WOLLONG32) Xtypedef unsigned short uid_t; X#endif X Xstruct cntltty X{ X dev_t dev; X char path[PIS_MAX_TTYNAME+1]; X}; X Xstruct urec X{ X uid_t uid; X char name[PIS_MAX_USERNAME+1]; X}; X X#if defined(VENIX32) || defined(SVR3) || defined(SCO4) || defined(SCO5) Xstruct recSleep X{ X caddr_t addr; X char name[PIS_MAX_SLEEPNAME+1]; X}; X#endif X X#endif SHAR_EOF chmod 0664 'orion-1.0/pis/pisdb.h' || $echo 'restore of' 'orion-1.0/pis/pisdb.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/pis/pisdb.h:' 'MD5 check failed' 4e63d9b458ffa1bef760c6f0159b9969 orion-1.0/pis/pisdb.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/pis/pisdb.h'`" test 2134 -eq "$shar_count" || $echo 'orion-1.0/pis/pisdb.h:' 'original size' '2134,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/liborion.h ============== if test ! -d 'orion-1.0/liborion'; then $echo 'x -' 'creating directory' 'orion-1.0/liborion' mkdir 'orion-1.0/liborion' fi if test -f 'orion-1.0/liborion/liborion.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/liborion.h' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/liborion.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/liborion.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 LIBORION_H X#define LIBORION_H X X/* X** Orion Library API Routines. X*/ X X/* X** We need to do this so we can access certain "kernel X** only" definitions. X*/ X#if defined(SVR3) || defined(VENIX32) X#define _INKERNEL X#endif X X/* X** Indicate that we need to know about kernel X** definitions. X*/ X#if defined(SVR4) || defined(SUN5) || defined(UW2) X#define _KMEMUSER X#endif X X/* X** SVR3 kernel includes are very particular about the order. X** Since these headers do not protect against multiple inclusion, X** all Orion programs should get their kernel includes from here. X*/ X#if defined(SVR3) || defined(VENIX32) X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#include X#undef INKERNEL X#define INKERNEL X#include X#undef INKERNEL X#include X#include X#include X#include X#include X#endif X X#if !defined(SVR3) && !defined(VENIX32) X#include X#include X#include X#include X#include X#include /* LJP. SCO5 only. */ X#endif X X/* X** Kernel statistics are either stored in metrics X** format or sysinfo format. X*/ X#if defined(UW2) X#define ORION_FEAT_METRICS 1 X#else X#define ORION_FEAT_SYSINFO 1 X#endif X X/* X** SVR3 kernels store process records in a fixed size array, X** have a ublock accessable through the sysi86() system call, X** use the fss filesystem interface and maintain a single X** mdevice file. X*/ X#if defined(SVR3) || defined(VENIX32) || defined(SCO4) || defined(SCO5) X#define ORION_FEAT_PROCTAB 1 X#define ORION_FEAT_UBLOCK 1 X#define ORION_FEAT_INODE 1 X#define ORION_FEAT_MDEVICE 1 X#endif X X/* X** SVR4 kernels have a procfs filesystem, have the vnode X** filesystem interface and keep process records in a X** linked list. X*/ X#if defined(SVR4) || defined(SUN5) || defined(UW2) X#define ORION_FEAT_PROCFS 1 X#define ORION_FEAT_VNODE 1 X#define ORION_FEAT_PROCLIST 1 X#endif X X/* X** getSymbols() X** X** Get the relevant kernel symbols. If an address file exists and X** is later than the kernel, use it. Otherwise create a new address X** file. X*/ Xextern int getSymbols( struct nlist *recNlist, size_t sizeNlist, X const char *pathAddr, const char *pathKern ); 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*/ Xextern int createAddr( struct nlist *recNlist, size_t sizeNlist, X const char *pathAddr, const char *pathKern ); X X/* X** maximum() X** X** Determine the greater of a given byte count and a given number X** of a given size object. X*/ X#if defined(__GNUC__) || defined(__cplusplus) Xinline size_t maximum( size_t current, int count, size_t size ); X#else Xextern size_t maximum( size_t current, int count, size_t size ); X#endif X X/* X** fmtByte() X** X** Create a string representation of a byte count. X*/ Xextern const char *fmtByte( unsigned ); X X/* X** UNIX. X*/ X Xextern int errno; Xextern char *sys_errlist[]; X X#endif SHAR_EOF chmod 0664 'orion-1.0/liborion/liborion.h' || $echo 'restore of' 'orion-1.0/liborion/liborion.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/liborion/liborion.h:' 'MD5 check failed' 7147f7949ccc2402fe0b9f3238045d52 orion-1.0/liborion/liborion.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/liborion.h'`" test 3904 -eq "$shar_count" || $echo 'orion-1.0/liborion/liborion.h:' 'original size' '3904,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/getsyms.c ============== if test -f 'orion-1.0/liborion/getsyms.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/getsyms.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/getsyms.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/getsyms.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** getSymbols() X** X** Get the relevant kernel symbols. If an address file exists and X** is later than the kernel, use it. Otherwise create a new address X** file. X*/ Xint getSymbols( struct nlist *recNlist, size_t sizeNlist, X const char *pathAddr, const char *pathKern ) X{ X const char *fileAddr; X int fdAddr; X int rc; X struct stat statKern, statAddr; X X if( stat(pathKern,&statKern) == -1 ) X { X fprintf( stdout, "Bad stat(2) on \"%s\". %s.\n", X pathKern, sys_errlist[errno] ); X return 0; X } X if( stat(pathAddr,&statAddr)==-1 || X statAddr.st_mtime<=statKern.st_ctime ) X { X /* Create file. */ X (void)createAddr( recNlist, sizeNlist, pathAddr, pathKern ); X } X if( (fdAddr=open(pathAddr,O_RDONLY)) == -1 ) X { X fprintf( stdout, "Bad open(2) of \"%s\". %s.\n", X pathAddr, sys_errlist[errno] ); X return 0; X } X if( (rc=read(fdAddr,recNlist, X sizeof(struct nlist)*sizeNlist)) == -1 ) X { X fprintf( stdout, "Bad read(2) of \"%s\". %s.\n", X pathAddr, sys_errlist[errno] ); X close( fdAddr ); X return 0; X } X if( rc != sizeof(struct nlist)*sizeNlist ) X { X fprintf( stdout, "Bad nlist array in \"%s\".\n", X pathAddr ); X close( fdAddr ); X return 0; X } X close( fdAddr ); X X return 1; X} SHAR_EOF chmod 0664 'orion-1.0/liborion/getsyms.c' || $echo 'restore of' 'orion-1.0/liborion/getsyms.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/getsyms.c:' 'MD5 check failed' 281a005f5074473d3bba5c50e314e83d orion-1.0/liborion/getsyms.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orion-1.0/liborion/getsyms.c'`" test 1905 -eq "$shar_count" || $echo 'orion-1.0/liborion/getsyms.c:' 'original size' '1905,' 'current size' "$shar_count!" fi fi # ============= orion-1.0/liborion/max.c ============== if test -f 'orion-1.0/liborion/max.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'orion-1.0/liborion/max.c' '(file already exists)' rm -f _sh05649/new else > _sh05649/new $echo 'x -' extracting 'orion-1.0/liborion/max.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'orion-1.0/liborion/max.c' && X X/* X** ---------------------------------------------------------------- SHAR_EOF : || $echo 'restore of' 'orion-1.0/liborion/max.c' 'failed' fi $echo 'End of' 'orion-1.0' 'part' '4' $echo 'File' 'orion-1.0/liborion/max.c' 'is continued in part' '5' echo 5 > _sh05649/seq exit 0