Path: utzoo!attcan!uunet!yale!cmcl2!polyof!john From: john@polyof.UUCP ( John Buck ) Newsgroups: comp.sys.att Subject: Full command line arguments/process status Keywords: uuencode/compressed binary included Message-ID: <455@polyof.UUCP> Date: 20 Mar 89 17:41:05 GMT Organization: Polytechnic University, Farmingdale NY Lines: 463 About a week ago, I posted an article about a program I wrote that gives extended process status information. I said if you wanted a copy of this (binary-only) program to send me mail, and I would send you a copy. Well, since that time I have received over 100 requests. (I am sure other requests will filter in as leaf USENET nodes get the message.) Being that the response was so large, I have decided to post the uuencoded/compressed(b12) program. I realize that this group may not be the best place to post this, but I'm sure many of the people that want this program either a) don't get unix-pc groups b) don't get full comp.sources Since I only posted the request to this group (and X-post to unix-pc), I will post the distribution here. It is really quite short (only about 16K bytes, 400 or so lines in shar-file.) John Buck john@polyof.poly.edu john@polygraf.bitnet trixie!polyof!john ---------- CUT HERE, then run through a Bourne Shell -------------------- #! /bin/sh echo copyright sed -e 's/^X//' <<"EOFcopyright" >copyright X XThis program is Copyright (c) 1989 by John Buck. It may not be sold Xor redistributed as part of any commerical product. It may not be Xbundled with any commercial product. It may not be copied without Xthe inclusion of this Copyright notice. X XThis program (and the algorithms contained within) may NOT be reverse Xassembled for purposes of recompilation or further re-distribution. X XDirect inquires (bug reports?) to: Xjohn@polyof.poly.edu [128.238.10.100], or john@polygraf.bitnet or Xtrixie!polyof!john. EOFcopyright echo readme sed -e 's/^X//' <<"EOFreadme" >readme XMon Mar 20 11:38:18 EST 1989 X X*----------------------------------------------------------------* X* Disclaimer: I am not responsible for any side-effects this * X* program may have. Carefully read the information below * X* and make sure you understand it. Stat will overwrite a * X* file in /etc (/etc/stat_nl). Be sure you do not have a * X* file by this name. Stat reads system memory (/dev/mem, * X* /dev/kmem, /dev/swap). It is possible for stat to get * X* bad pointers internally and reference possibly illegal * X* addresses. This could, theoretically, cause system crashes * X* Bad pointers are possible due to the fleeting nature * X* of some of the data in the OS. You run this program at * X* your own risk. * X*----------------------------------------------------------------* X X XHere is the 'stat' distribution. X XAfter 'un-shar'ing, simply run the 'makestat' shell script. XYou can do this by typeing: "sh makestat" X XThis will uncompress the 'stat' binary in the current directory. XYou may then install 'stat' in whatever directory you want (/bin?). X X'stat' does NOT have to be made 'sbit'. It does, however, require Xread permission on the following files: X /dev/swap X /dev/kmem X /dev/mem X /unix X /etc/mnttab X XIt also requires both read/write access to (an empty file): /etc/stat_nl XYou can do: X chmod 666 /etc/stat_nl >/etc/stat_nl X X'stat' uses this file to store the symbol table address it needs Xfrom /unix. It stores only those it needs for faster start-up. XIf 'stat' sees that /unix has changed, or stat_nl has disappeared, Xit will try to create a new /etc/stat_nl. Stat will take Xnoticably longer to run if it can not access the /etc/stat_nl file. XThe first time 'stat' is run, it will create this file. Expect Xslow start-up for the first run. X XIf you are lazy, you can just make 'stat' s-bit, owner root: X chown 0 stat X chmod 4711 stat X XIf you are paranoid, just make sure all the files above are accessible Xby stat. X XIf you have any questions, or problems, let me know: XJohn Buck X Xjohn@polyof.poly.edu Xjohn@polygraf.bitnet Xtrixie!polyof!john EOFreadme echo makestat sed -e 's/^X//' <<"EOFmakestat" >makestat Xuud="" Xunc="" X# Try to find where things are Xfor dir in /bin /usr/bin /etc /usr/lib /usr/lib/uucp /usr/lib/news /usr/local /local /usr/local/bin /usr/ucb Xdo X if test -z "$uud" -a -x $dir/uudecode X then X uud=$dir/uudecode X fi X if test -z "$unc" -a -x $dir/uncompress X then X unc=$dir/uncompress X fi X if test -z "$unc" -a -x $dir/compress X then X unc=$dir/compress -d X fi X if test -n "$unc" -a -n "$uud" X then X break X fi Xdone Xif test -z "$uud" Xthen X echo "I can't seem to find where uudecode is." X echo "" X while test -z "$uud" X do X echo "Enter the pathname of the 'uudecode' program:" X read a X if test -x "$a" X then uud=$a X else echo "" X echo "Sorry, but $a is not executable by you. Try again." X fi X done Xfi Xif test -z "$unc" Xthen X echo "I can't seem to find where uncompress is." X echo "" X while test -z "$unc" X do X echo "Enter the command you use to 'uncompress' things: " X read a b X if test -x "$a" X then unc="$a $b" X else echo "" X echo "Sorry, but $a is not executable by you. Try again." X fi X done Xfi X$uud stat X/bin/chmod 711 stat Xset `wc -c stat` Xsz="$1" Xif test "$1" -eq 10393 Xthen X echo stat has been successfully uncompressed. X /bin/rm -f stat.uue stat.comp.b12 Xelse X echo There was a problem uncompressing 'stat' -- I give up. Xfi EOFmakestat /bin/chmod 755 makestat echo stat.uue sed -e 's/^X//' <<"EOFstat.uue" >stat.uue Xbegin 644 stat.comp.b12 XM'YV, :0 ($"BA(,V !(J5,A!P(, "Q9NX)#0 *B$*=@!0*"08\($"5W0*8.' XMSD*/&R52'+BPI4L (%R0"4,GS$*0'Q=:3 CBI4\ 0%R(F3.G98*=1R\"R/BS XM*2 7;-*(,0J#$8 $59MJWO8,.*'4NVK-FS:-.J7,^^X'&UJI-< &(DQ/((Q),HCUQ@>H%DH!),9@#\X\=XXPAD &! (/ W XM)8\7 #H+Q@.#;P G0)Q8^0<+B3L.#/ZQ$^+JGS3:_YP)%S,#H#$(!V,. XM*PD)@$5N;TP' 'L!F$/D=(B2H 1OS$06@#5P( *D: $D:>1WD$H*C(^P (H XM&T8R PDJK++XNA&P;A!K+)W)&BF&K!L]JZJTKX)DBX\C .K XM+X@*H8 0/2&JPZ($H*LN2-2 (0,<%,"RJS)OH+#DB2#D *LRNAY\#B(BA)C XM"HP$$0]'2$"Q8HM/@(O &1*(&RVK31[;@AFV9*%JF1NQ!X U1!IPBKVPYIN0 XM,8LFH+(OPSH)90!24@F#P2 Y(T4>L#J#!##E,.PP"S",@ A'<6JC! 3*^F/" XML2R8H4+40D#P<]%#%WUTT@U?Q;3$'(E)Y1#I& E"(F52"8:Z0A!PI!-$(G!D XM8T4& 4:114( !E]% L+>/Y$)$<"1+BP* A@H$"G D?L)@<21% D!R)$6N,#+ XMC:'HR(F/EP(VFL;* J )%N."#(7(D?4#P9)R!# -)$U" $2@!PM1Q(*RN$" XM+(&(80LT0,"P P *.+$/ 8HP0\ +_CCQS^H8*]]]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##P*7'P=UD :& XM/P?/)P9UL/Z&#P="3P=S\ ,I )T\ 8ZH !J\ 9HX 9 >[G@=O8 8N >[ XMG@stat.1 X.de lp X.in .5i X.ta \\$2 X.in \\$1 X.ti -\\$2 X.. X.TH STAT 1M 11/01/81 X.SH NAME Xstat \- lots of system stats X.SH SYNOPSIS Xstat X.B "[ -b ] " X.B "[ -c kmem_file [ mem_file ] ] " X.B "[ -d ]" X.B "[ -e ] " X.B "[ -f ] " X.B "[ -h ] " X.B "[ -i ] " X.B "[ -I ] " X.B "[ -l ] " X.B "[ -n ] " X.br X\ \ \ X.B "[ -o [ dev1 dev2 ... ] ] " X.B "[ -p ] " X.B "[ -q ] " X.B "[ -r ] " X.B "[ -s ] " X.B "[ -S ] " X.B "[ -tx1,x2,.. ] " X.B "[ -T ] " X.br X\ \ \ X.B "[ -u namelist ] " X.B "[ -w ] " X.SH DESCRIPTION X.B Stat Xis the all purpose system table listing program. XIt will display a multitude of information, as indicated by the following Xoptions: X.LP X.LP X.lp +8 4 X-b Print long command names, I.E. Upto 5120 characters X.LP X.lp +8 4 X-c Take next two arguments as the KMEM and MEM replacement files X.LP X.lp +8 4 X-d Print disk structure X.LP X.lp +8 4 X-e Print the environment for the process. Implies -b as well. X.LP X.lp +8 4 X-f Full: Print process status, Pipes, Open files on all devs X.LP X.lp +8 4 X-h Print Informatory header (Time date etc...) X.LP X.lp +8 4 X-i Print only "In-core" processes, (Flag & 1) == 1 X.LP X.lp +8 4 X-I When printing any open file information, do not print Xthe pathnames, just the inode number, and the status Xstructure. X.LP X.lp +8 4 X-l Print long process listing X.LP X.lp +8 4 X-n When printing open files on /, do not print tty's X.LP X.lp +8 4 X-o Print open files on all devices. If arguments follow (without Xdash characters first), files open on these devices will NOT Xbe printed. So, to get all open files, except on rm0, Xstat -o rm0 X.LP X.lp +8 4 X-p print pipes X.LP X.lp +8 4 X-q set high priority (nice -20) while running X.LP X.lp +8 4 X-r Print Root procs, I.E. UID=0 X.LP X.lp +8 4 X-R# Repeat status every # seconds. Absence of # causes Xcontinuous iterations, non-stop. X.LP X.lp +8 4 X-s Print status only (default) X.LP X.lp +8 4 X-S Print signal dispostion for procs. X.br XT = being privately trapped X.br XI = being ignored X.br X- = Normal handling. X.LP X.lp +8 4 X-tx1,x2,... Print info only for procs on ttyx1,ttyx2,.... X.LP X.lp +8 4 X-T When printing cpu time, separate system and user time into two columns X.LP X.lp +8 4 X-u Take next argument as the namelist from which to get system table addresses X.LP X.lp +8 4 X-w Print Working Directories X.in -8 X.LP XFurthermore, an optional first argument Xof a \fBlogin name\fP or \fBUID\fP specifies that Xinformation for that user only will be printed. X.LP XExample: X.LP X.in +5 X\fBstat adm\fP\ \ \ or\ \ \ \fBstat 2\fP X.br X.LP Xwill print information for user 'adm' (UID=2) only. X.SH "SEE ALSO" Xps(1), pwd(1), who(1) EOFstat.1