[mod.computers.vax] bigsis

u3369429@murdu.OZ.AU.UUCP (03/20/87)

In message <8703162033.AA04165@sdcsvax.UCSD.EDU>
  bruceb@telesoft.UUCP (Bruce Bergman @spot) writes:
>It occurred to me the other day that I have been using this neat
>utility for viewing processes (similar to SHOW SYSTEM), and that
>there are others who may like this program.
>	bigsis.c
>	bigsis.man
>The .c file should be compiled with DEC C V2.0 or greater, on
>VMS V4.2 or greater.

Well, it doesn't. This VMS 4.5 / CC 2.2-015

Our JPIDEF.H looks probably different from yours, but that can be fixed by
commenting your JPI define`s. But I cant't find PCBDEF.H nor any PCB-symbols
in any library. What am I missing?

Anyway, when I finally read BIGSIS's man page, it occurred to me that I have
a procedure which does roughly the same thing.
I found this procedure a long time ago and it works for me; i.e. on group and
user level. I don't know anything about world privs.

>I've got a bunch of other nifty utilities I wrote, which I may
>post at a later date.  I'd like to see how this one goes over
>first, though.

Yeah, post a summary of what they do. (But make sure they compile :-) )

>  Oh yes, the means of collecting the files into
>one 'archive' is my own design.  I didn't have any of the shar
>programs running around, so I wrote my own.  Hope it works okay.
 
I immediately went away and incorporated your checksum feature in my shar.
BTW, both files (bigsis) failed.

Michael Bednarek (u3369429@murdu.oz.au)

X----X----X----X----X----X----X Cut here and execute X----X----X----X----X----X
$! SHAR STATG.COM
$! created by U3369429 19-MAR-1987 10:59:10.49
$ Pass_or_Failed="Failed,Passed"
$ File ="STATG.COM"
$ Check_Sum=858615415
$write sys$error "extract STATG.COM"
$copy sys$input STATG.COM
$deck/dollars="870319 10:59:10"
$ Verify='F$Verify(F$TRNLNM("COMMAND_DEBUG"))
$! STATG.COM Procedure to display status of processes in a group
$ On Control_Y then goto Clean_up		! Provide an orderly exit
$ Old_Priv=F$SetPRV("GROUP,WORLD")		! Enable privileges
$!
$ If P1.eqs."" then P1=F$GetJPI(0,"GRP")
$ Write SYS$Output "Status of processes in ''Old_Priv' ''P1'"
$ Write SYS$Output ""
$ CTX=""
$ Write SYS$Output "''F$FAO("!8AS !8AS !14AS !3AS !3AS !6AS !10AS !9AS !4AS", -
	"PID","Username","Proc Name","Sta","Pri","   I/O"," CPU Time",  -
	"Page Flts","Size")'"
$ Write SYS$Output ""
$!
$Loop:
$ PID=F$PID(CTX)
$ If "''PID'".eqs."" then goto Clean_up
$ prcn=f$getjpi(pid,"PRCNAM")'
$ User=F$GetJPI(PID,"Username")
$ state=F$GetJPI(PID,"STATE")
$ prio=F$GetJPI(PID,"PRI")
$ dirio=F$GetJPI(PID,"DIRIO")+F$GetJPI(PID,"BUFIO")
$ cput=F$GetJPI(PID,"CPUTIM")
$ cpu_m=cput/6000
$ cpu_s=(cput-(cpu_m*6000))/100
$ cpu_h=cput-(cpu_m*6000)-(cpu_s*100)
$ pagf=F$GetJPI(PID,"PAGEFLTS")
$ size=F$GetJPI(PID,"WSSIZE")
$ ImagName=F$GetJPI(PID,"IMAGNAME")
$ Write SYS$Output -
	"''F$FAO("!8AS !8AS !14AS !3AS !2SW !7SL !3ZL:!2ZL.!2ZL !9SL !5SL", -
	pid,User,prcn,state,prio,dirio,cpu_m,cpu_s,cpu_h,pagf,size)'"
$! use your favourite method of displaying real life names here
$ Set NoOn	! in case we don't know her/him
$!WhoIs 'User
$ Search COM_LIB:ALLDIR.COM 'User
$ Set On
$ Write SYS$Output F$GetJPI(PID,"LOGINTIM")
$ If ImagName.nes."" then Write SYS$Output "	Image Name: ",ImagName
$ Write SYS$Output ""
$ Goto loop
$!
$ Clean_up:	! Restore settings to their value at entry time
$ Old_Priv=F$SetPRV("''Old_Priv'")
$ Verify=F$Verify(Verify)
870319 10:59:10
$ Write SYS$ERROR "Checking CHECKSUM"
$ Checksum 'File
$ Success=F$Element(Check_Sum.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)
$ Write SYS$ERROR "Original checksum:",'Check_Sum'," and now:", -
	'CHECKSUM$CHECKSUM'," (''Success')"

carl@CITHEX.CALTECH.EDU.UUCP (03/22/87)

> Our JPIDEF.H looks probably different from yours, but that can be fixed by
> commenting your JPI define`s. But I cant't find PCBDEF.H nor any PCB-symbols
> in any library. What am I missing?

You need to extract and edit the module $PCBDEF from SYS$SHARE:LIB.MLB.
If you'd rather not edit it by hand, the following procedure is a crude
MACRO to C include file converter (i.e., it simply takes the definitions
in the macro code and converts them to C #defines; it doesn't attempt to
define the appropriate structures/unions.  Maybe someday there will be a
shareable image to enable the use of SDL to do such things for C [anybody
from DEC listening?  If so, this is part of my wishlist, as is documentation
for SDL])

$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$       set noon
$       IF "''F$SEARCH("TMPFILE.TMP")'" .NES. "" THEN delete tmpfile.tmp;*
$	on error then goto oops
$       library/extract='p1'/output=tmpfile.tmp/macro sys$share:starlet
$	goto form
$ oops:	on error then exit
$	library/extract='p1'/output=tmpfile.tmp/macro sys$share:lib
$ form: ON ERROR THEN GOTO DONE
$	OPEN/READ INFILE tmpfile.tmp
$	DELETE TMPFILE.TMP;
$       OPEN/WRIT OUFILE TMPFILE.TMP
$	MAXLEN = 0
$ LOOP: READ/ERRO=SORT   INFILE  SYM
$	sym = f$edit(sym,"COMPRESS,TRIM")
$	if f$element(0," ", sym) .nes. "$EQU" then goto LOOP
$	token = f$element(1," ",sym)
$	IF F$LEN(TOKEN) .GT. MAXLEN THEN MAXLEN = F$LEN(TOKEN)
$	value = F$FAO("!XL",f$integer(f$element(2," ",sym)))
$	WRITE OUFILE VALUE,TOKEN
$	IF "''P2'" .NES. "" THEN WRITE 'P2' VALUE,TOKEN
$	GOTO LOOP
$ SORT:	CLOSE INFILE
$	CLOSE OUFILE
$	SORT/KEY=(POS=9,SIZ='MAXLEN') TMPFILE.TMP TMPFILE.TMP
$	OPEN/READ INFILE TMPFILE.TMP
$	DELETE TMPFILE.TMP;*
$	OPEN/WRITE OUFILE 'P1'.H
$	SPACES = F$FAO("!#* ", MAXLEN + 1)
$	MAXLEN = MAXLEN + 9
$ NICE:	READ/ERR=DONE INFILE SYM
$	VALUE = F$EXTRACT(0,8,SYM)
$	SYM = SYM - VALUE + F$EXTR(0, MAXLEN-F$LEN(SYM), SPACES) + "0x" + VALUE
$       WRITE OUFILE "#define ", SYM
$	IF "''P2'" .NES. "" THEN WRITE 'P2' "#define ", SYM
$       GOTO NICE
$ DONE: CLOSE INFILE
$       CLOSE OUFILE
$       IF "''F$SEARCH("TMPFILE.TMP")'" .NES. "" THEN delete tmpfile.tmp;*
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

bruceb@telesoft.UUCP.UUCP (03/26/87)

> Our JPIDEF.H looks probably different from yours, but that can be fixed by
> commenting your JPI define`s. But I cant't find PCBDEF.H nor any PCB-symbols
> in any library. What am I missing?

I don't understand why I have not yet seen the original posting in this news-
group, however I understand that a few people have had problems getting BIGSIS.C
to compile.  My fault.  Here is my 'standard' solution; sent to all who have
contacted me in person...

BTW, if anyone who is NOT on BITNET has seen the original posting, I'd like
to hear from you.  I am going to find out whoose mailer is loosing things.  I'm
getting pretty pissed that I can't seem to see anything I post to this newsgroup.

Comments, etc., to me.  Thanks.

bruce bergman
------------------------------- how to fix BIGSIS.C ------------------------
Thanks for your response about BIGSIS.C not compiling correctly.
You were not the only one who informed me that BIGSIS.C would
not compile correctly with DEC C v2.[>0], so to make things
simple, I have created this document.  It will be sent to everyone
who expresses the same problem, so please excuse anything that
might seem 'simple' or 'obvious.'

Meanwhile, here is the procedure for making sure it will compile
on your system.  First, I'll tell you why it *didn't* work.

The 'globalvalue' statements in the code itself were to take
care of the fact that DEC C v2.0 didn't have complete .h files
in the distribution.  For everyone who is using something more
recent than v2.0, the correct .h files were provided by DEC, so
we can simply remove those lines.

So, to remedy situation #1, comment out all the 'globalvalue'
statements in the original source.  If you aren't familiar with
C, use the /* and */ statements to surround the offending lines.

E.g,
        OLD_49:   globalvalue JPI$_CLINAME;
        NEW_49:   /* globalvalue JPI$_CLINAME;

        OLD_56:   globalvalue JPI$_MAXDETACH;
        NEW_56:   globalvalue JPI$_MAXDETACH; */

Now, the second problem - not finding <pcbdef.h> and <statedef.h> -
was strictly inattention on my part.  I forgot that I created
special .h files to solve some problems.  Basically, these have
to be created because the source code references some VMS internal
values which aren't covered by the standard .h files included with
DEC C (another bug in my opinion).  In this case, we just want to
*add* some statements to the .h files and change two lines.

So, to remedy situation #2, first SET DEFAULT into the directory
where you now have BIGSIS.C.  Once there, you need to create two
files and modify the source once more.  The two files you should
create can be made by doing the following (replace the <CTRL/Z>
with the actual keystroke...):

	$ CREATE PCBDEF.H
	globalvalue PCB$V_BATCH;
	globalvalue PCB$V_NETWRK;
	<CTRL/Z>
	$ CREATE STATEDEF.H
	globalvalue SCH$C_CEF;
	globalvalue SCH$C_COM;
	globalvalue SCH$C_COMO;
	globalvalue SCH$C_CUR;
	globalvalue SCH$C_COLPG;
	globalvalue SCH$C_FPG;
	globalvalue SCH$C_HIB;
	globalvalue SCH$C_HIBO;
	globalvalue SCH$C_LEF;
	globalvalue SCH$C_LEFO;
	globalvalue SCH$C_MWAIT;
	globalvalue SCH$C_PFW;
	globalvalue SCH$C_SUSP;
	globalvalue SCH$C_SUSPO;
	<CTRL/Z>

Once these have been created, edit BIGSIS.C and change the angle
braces around pcbdef.h and statedef.h to be double quote marks.
Using quote marks tells the compiler to look for the files in the
current directory instead of SYS$LIBRARY: (which is where we have
just created the necessary files).

E.g.,
        OLD_59:   #include <pcbdef.h>
        NEW_59:   #include "pcbdef.h"

        OLD_60:   #include <statedef.h>
        NEW_60:   #include "statedef.h"

Now, you should be all set to compile again.  If you compile
and still have errors, please let me know.  It could be something
else I haven't seen yet, however the procedure I outlined to you
above has been tested on another site and worked properly.

In any case, sorry about the mess-up.  If I can help out any
further in making it work, please contact me.  Oh yes, comments
and suggestions are always welcome...

Thanks

bruce
-------------------- end of how to fix BIGSIS.C ----------------------