From: SMTP%"DSJ@WKUVX1.WKU.EDU" 21-DEC-1993 10:53:28.92 To: EVERHART CC: Subj: AUGUST93.BUMP X-FileServer: Digital Systems Journal File Server Date: Tue, 21 Dec 1993 09:54:33 CDT Sender: DSJ-Mgr@WKUVX1.WKU.EDU Errors-To: DSJ-Mgr@WKUVX1.WKU.EDU Warnings-To: <> From: DSJ-Mgr@WKUVX1.WKU.EDU Reply-To: DSJ@WKUVX1.WKU.EDU Subject: AUGUST93.BUMP To: EVERHART@arisia.gce.com $! ------------------ CUT HERE ----------------------- $ v='f$verify(f$trnlnm("SHARE_UNPACK_VERIFY"))' $! $! This archive created: $! Name : BUMP $! By : Hunter Goatley $! Date : 12-AUG-1993 12:04:13.30 $! Using: VMS_SHARE 8.4, (C) 1993 Andy Harper, Kings College London UK $! $! Credit is due to these people for their original ideas: $! James Gray, Michael Bednarek $! $! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER $! AND EXECUTE AS A COMMAND PROCEDURE ( @name ) $! $! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING: $! 1. AVOID_SPIRIT.FOR;1 $! 2. BUMP.DESC;1 $! 3. BUMPBUFIO.COM;1 $! 4. BUMP_BIOCNT.MAR;1 $! 5. SUB_BUMPBIO.COM;1 $! $ set="set" $ set symbol/scope=(nolocal,noglobal) $ f=f$parse("SHARE_UNPACK_TEMP","SYS$SCRATCH:."+f$getjpi("","PID")) $ e="write sys$error ""%UNPACK"", " $ w="write sys$output ""%UNPACK"", " $ if .not. f$trnlnm("SHARE_UNPACK_LOG") then $ w = "!" $ if f$getsyi("CPU") .gt. 127 then $ goto start $ ve=f$getsyi("version") $ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto start $ e "-E-OLDVER, Must run at least VMS 4.4" $ v=f$verify(v) $ exit 44 $unpack: subroutine ! P1=filename, P2=checksum, P3=attributes,P4=size $ if f$parse(P1) .nes. "" then $ goto dirok $ dn=f$parse(P1,,,"DIRECTORY") $ w "-I-CREDIR, Creating directory ''dn'" $ create/dir 'dn' $ if $status then $ goto dirok $ e "-E-CREDIRFAIL, Unable to create ''dn' File skipped" $ delete 'f'* $ exit $dirok: $ x=f$search(P1) $ if x .eqs. "" then $ goto file_absent $ e "-W-EXISTS, File ''P1' exists. Skipped" $ delete 'f'* $ exit $file_absent: $ w "-I-UNPACK, Unpacking ", P5, " of ", P6, " - ", P1, " - ", P4, " Blocks" $ n=P1 $ if P3 .nes. "" then $ n=f $ if .not. f$verify() then $ define/user sys$output nl: $ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT/NOJOURNAL 'f'/OUT='n' PROCEDURE GetHex(s,p)LOCAL x1,x2;x1:=INDEX(t,SUBSTR(s,p,1))-1;x2:=INDEX(t, SUBSTR(s,p+1,1))-1;RETURN 16*x1+x2;ENDPROCEDURE;PROCEDURE SkipPartsep LOCAL m; LOOP m:=MARK(NONE);EXITIF m=END_OF(b);DELETE(m);EXITIF INDEX(ERASE_LINE, "-+-+-+-+-+-+-+-+")=1;ENDLOOP;ENDPROCEDURE;PROCEDURE ProcessLine LOCAL c,s,l,b, n,p;c := ERASE_CHARACTER(1);s := ERASE_LINE;IF c = "X" THEN SPLIT_LINE; ENDIF; MOVE_HORIZONTAL(-1);l := LENGTH(s);p := 1;LOOP EXITIF p > l;c := SUBSTR(s,p,1); p := p+1;CASE c FROM ' ' TO '`' ['`']: COPY_TEXT(ASCII(GetHex(s,p))); p:=p+2;[ ' ']: p:=p+1;[INRANGE,OUTRANGE]: COPY_TEXT(c);ENDCASE;ENDLOOP;ENDPROCEDURE; PROCEDURE Decode LOCAL m;POSITION(BEGINNING_OF(b));LOOP m:=MARK(NONE);EXITIF m= END_OF(b);DELETE(m);IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+-")= 1 THEN SkipPartSep;ELSE ProcessLine;MOVE_HORIZONTAL(1);ENDIF;ENDLOOP; ENDPROCEDURE;SET(FACILITY_NAME,"UNPACK");SET(SUCCESS,OFF);SET(INFORMATIONAL, OFF);t:="0123456789ABCDEF";f:=GET_INFO(COMMAND_LINE,"file_name");b:= CREATE_BUFFER(f,f);Decode;WRITE_FILE(b,GET_INFO(COMMAND_LINE,"output_file")); QUIT; $ if p3 .eqs. "" then $ goto dl $ open/write fdl &f $ write fdl "RECORD" $ write fdl P3 $ close fdl $ w "-I-CONVRFM, Converting record format to ", P3 $ convert/fdl=&f &f-1 &P1 $dl: delete 'f'* $ checksum 'P1' $ if checksum$checksum .nes. P2 then $ - e "-E-CHKSMFAIL, Checksum of ''P1' failed." $ exit $ endsubroutine $start: $! $ create 'f' Xc Xc`20AVOID_SPIRIT Xc Xc`20This`20program`20will`20call`20the`20kernal`20mode`20macro`20routine`20BUM VP_BIOCNT`20in`20order Xc`20to`20increment`20the`20PHD$L_BIOCNT`20value`20in`20the`20process`20header V`20of`20the`20indicated Xc`20process. Xc Xc`20This`20program`20is`20expecting`20to`20be`20called`20with`20a`20foreign`20 Vcommand`20like`20... Xc Xc`09$`20Dena`20nnn Xc Xc`20...where`20"Dena"`20is`20a`20foreign`20command`20defined`20as`20"$dua?:`5B V???`5Davoid_spirit.exe" Xc`20`20`20`20`20`20and`20"nnn"`20is`20the`20PID`20of`20the`20process`20whose V`20PHD$L_BIOCNT`20is`20to`20be`20bumped. Xc X`09integer*4`20pid,status,arg_list(4) X`09character*80`20command X X`09integer*4`20bump_biocnt,sys$cmkrnl X`09external`20bump_biocnt Xc Xc`20Get`20the`20PID`20parameter`20from`20the`20command`20line... Xc X`09status`20=`20lib$get_foreign(command) Xc Xc`20...and`20convert`20is`20to`20a`20binary`20hex`20digit. Xc`20`20(this`20is`20one`20way) Xc X`09do`2010`20i=1,10 X`09`09if(command(i:i).eq.'`20')go`20to`2011 X`20`20`2010`09continue X`20`20`2011`09continue X`09i=i-1 X`09status`20=`20ots$cvt_tz_l(command(1:i),pid) Xc Xc`20Now`20bump`20the`20BIOCNT`20entry`20in`20the`20PHD`20of`20the`20PCB`20of V`20the`20process`20indicated Xc`20by`20PID. Xc X`09arg_list(1)`20=`203`09`09!`20number`20of`20arguments`20that`20follow X`09arg_list(2)`20=`20pid`09!`20arg.1`20=`20the`20PID`20of`20the`20desired`20pr Vocess X`09arg_list(3)`20=`201`09`09!`20arg.2`20=`20the`20amount`20to`20increment`20th Ve`20old`20BIOCNT X`09arg_list(4)`20=`200`09`09!`20arg.3`20=`20the`20old`20value`20of`20BIOCNT Xc X`09status`20=`20sys$cmkrnl(bump_biocnt,arg_list) Xc Xc`20debug`20writes Xc X`09write(*,5010)arg_list(2),arg_list(3),arg_list(4) X`205010`09format(1x,'PID=',z8,'`20;`20inc.`20value=',i4,'`20;`20old`20BIOCNT=' V,i8) X`09write(*,5020)status X`205020`09format(1x,'return`20status`20from`20BUMP_BIOCNT`20=',i8) X`09stop X`09end $ call unpack AVOID_SPIRIT.FOR;1 846806255 "" 3 1 5 $! $ create 'f' XThis`20file`20offers`20a`20program`20originally`20published`20in`20the`20July/ VAugust`201993 Xissue`20of`20Digital`20Systems`20Journal.`20It`20was`20first`20run`20as`20part V`20of`20Horace`20A. XVallas's`20article`20"Avoiding`20the`20Evil`20SPIRIT,"`20found`20on`20page`201 V8.`20The`20article Xprovides`20an`20example`20of`20how`20to`20integrate`20DCL,`20FORTRAN`20and`20M VACRO.`20The`20example Xrequires`20kernel`20mode`20execution`20to`20allow`20write`20access`20to`20cert Vain`20process Xheader`20information`20by`20a`20user`20process. $ call unpack BUMP.DESC;1 1612597299 "" 1 2 5 $! $ create 'f' X$! X$!`20`20BUMPBUFIO.COM X$! X$!`20The`20purpose`20of`20this`20.COM`20procedure`20is`20to`20call`20the`20AVO VID_SPIRIT`20 X$!`20program`20when`20needed`20for`20the`20indicated`20interactive`20process. V X$!`20This`20.COM`20process`20will`20be`20run`20in`20batch`20by`20the`20system V`20operator. X$! X$!`20Four`20parameters`20are`20required... X$! X$!`20`09p1`20=`20the`20PID`20of`20the`20process`20to`20be`20watched... X$!`09p2`20=`20the`20user`20name`20of`20the`20process`20to`20be`20watched X$!`09p3`20=`20the`20number`20of`20loops`20to`20be`20performed`20for`20the`20in Vdicated`20process X$!`09p4`20=`20the`20number`20of`20minutes`20to`20wait`20between`20each`20loop V X$! X$`20on`20warning`20then`20goto`20done X$`20priv`09`09`09`09!`20set`20cmkrnl`20priv X$`20loop_count`20=`200 X$! X$!`20`20define`20the`20foreign`20command`20used`20to`20call`20the`20AVOID_SPIR VIT`20program X$! X$`20avoid_spirit:=="$dua5:`5Bvallas`5Davoid_spirit.exe"`20 X$! X$!`20initialize`20the`20OLD_CNT`20counter X$! X$`20old_io_cnt`20=`20f$getjpi(p1,"bufio") X$LOOP: X$`20wait`20'p4'`09`09`09`09`09`09!`20wait`20between`20loops X$`20io_cnt=f$getjpi(p1,"bufio")`09`09`09`09!`20get`20PID's`20cur`20BUFIOCNT X$`20if`20io_cnt.gt.old_io_cnt`20then`20goto`20swap X$`20avoid_spirit`20'p1'`09`09`09`09`09!`20go`20bump`20BUFIOCNT X$`20io_cnt=f$getjpi(p1,"bufio")`09`09`09`09!`20and`20reset`20OLD`20CNT`20value V X$`20loop_count`20=`20loop_count`20+`201 X$`20if`20loop_count.gt.p3`20then`20goto`20re_enable_spirit X$! X$!`20build`20and`20send`20a`20message`20to`20the`20user`20showing`20how`20much V`20idle`20time`20remains X$! X$`20a_string=f$fao("!/Welcome`20to`20`20`20S`20P`20I`20R`20I`20T`20`20`20`20B V`20U`20S`20T`20E`20R`20!!!!") X$`20b_string=f$fao("!/last`20count`20=''old_io_cnt';`20cur`20count`20=`20''io_ Vcnt'") X$`20c_string=f$fao("!/`20Dena`20is`20helping`20you`20avoid`20the`20evil`20SPIR VIT...") X$`20time_string=f$integer((p3-loop_count+1)*4) X$`20d_string=f$fao("!/`20But`20you`20only`20have`20''time_string'`20minutes`20 Vof`20idle`20time`20left.") X$`20m_string=f$fao("!4(AS)",a_string,c_string,b_string,d_string) X$`20reply`20/username='p2'`20"''m_string'" X$SWAP: X$`20old_io_cnt`20=`20io_cnt X$`20goto`20loop X$! X$RE_ENABLE_SPIRIT: X$! X$!`20if`20alloted`20time`20is`20up;`20then`20tell`20the`20user`20that`20he`20i Vs`20back`20on`20his`20own X$! X$`20a_string=f$fao("!/Since`20all`20good`20things`20must`20come`20to`20an`20en Vd...") X$`20b_string=f$fao("!/`20SPIRIT_BUSTER`20is`20now`20aborting...") X$`20c_string=f$fao("!/`20Spirit`20is`20resuming...you`20have`2012`20minutes`20 V!!") X$`20m_string=f$fao("!3(AS)",a_string,b_string,c_string) X$`20reply`20/username='p2'`20"''m_string'" X$done: $ call unpack BUMPBUFIO.COM;1 2048990764 "" 4 3 5 $! $ create 'f' X;;`20 X;;`20BUMP_BIOCNT X;; X;;`20This`20routine`20is`20designed`20to`20increment`20the`20PHD$L_BIOCNT`20va Vlue`20in`20the`20 X;;`20PHD`20of`20a`20specified`20process`20by`20a`20specified`20amount.`20`20 X;;`20This`20routine`20must`20be`20executed`20in`20Kernal`20Mode. X;; X;;`20This`20routine`20expects`203`20arguments`20defined`20in`20the`20following V`20order... X;; X;;`09p1`20(int*4)`20The`20PID`20of`20the`20process`20whose`20BIOCNT`20is`20to V`20be`20incremented. X;;`09p2`20(int*4)`20The`20amount`20by`20which`20the`20BIOCNT`20is`20to`20be`20 Vincremented. X;;`09p3`20(int*4)`20The`20old`20BIOCNT`20from`20the`20PHD`20(return`20value). V X;; X;; X`09.LIBRARY`09/SYS$LIBRARY:LIB.MLB/ X`09.LINK`09`09"SYS$SYSTEM:SYS.STB" X`09$PCBDEF X`09$PHDDEF X`09$IPLDEF X X;;pid,`20inc_val,`20old`20biocnt`20(ret.`20val) X;; X`09.ENTRY`09`09BUMP_BIOCNT,`5EM`20 X X`09TSTL`09`09(AP)`09`09`09;was`20an`20ARG_LIST`20provided`20? X`09BEQL`09`09STOP_SHORT`09`09;NO`20so`20error`20exit`20(code=18) X X`09SETIPL`09`09#8`09`09`09;synch`20with`20schedule`20db`20(set`20ipl=8) X;; X;;`20Get`20the`20address`20of`20the`20desired`20process'`20PCB`20in`20R0... X;; X;;...by`20first`20getting`20the`20PID`20of`20desired`20process`20into`20R0... V X`09MOVL`09`094(AP),R0`09`09 X X;;...and`20then`20getting`20the`20address`20of`20PCB`20for`20desired`20PID`20i Vn`20R0 X`09JSB`09`09G`5EEXE$EPID_TO_PCB`09 X`09TSTL`09`09R0`09`09`09;is`20the`20desired`20process`20still`20active`20? X`09BEQL`09`09ER_EXIT`09`09`09;NO`20so`20error`20exit`20(code=99) X;; X;;`20Get`20the`20address`20of`20the`20PHD$L_BIOCNT`20entry`20in`20the`20PHD`20 Vby`20using`20the`20pointer`20 X;;`20to`20the`20PHD`20in`20the`20PCB`20of`20the`20specified`20process. X;;`20Save`20the`20old`20value`20of`20BIOCNT. X;; X;;`20get`20addr.`20of`20BIOCNT`20in`20PHD`20into`20R9 X`09ADDL3`09`09PCB$L_PHD(R0),#PHD$L_BIOCNT,R9`09 X X;;`20save`20old_value`20of`20BIOCNT`20from`20the`20PHD X`09MOVL`09`09(R9),12(AP) X;; X;;`20Increment`20the`20BIOCNT`20value`20in`20the`20PHD`20by`20the`20specified V`20amount. X;; X`09ADDL2`09`098(AP),(R9)`09`09`09;bump`20BIOCNT`20in`20PHD X;; X;;`20And`20finally`20return`20to`20the`20caller. X;; X`09MOVL`09`09#1,R0`09`09`09`09;set`20ok`20ret.`20status=ss$_normal X`09SETIPL`09`09#0`09`09`09`09;set`20return`20normal`20ipl X`09RET`09`09`09`09`09`09;return`20to`20caller X XER_EXIT: X`09SETIPL`09`09#0`09`09`09`09;set`20return`20normal`20ipl X`09MOVL`09`09#99,R0`09`09`09`09;set`20error`20exit X`09RET X XSTOP_SHORT: X`09MOVL`09`09#18,R0`09`09`09`09;set`20bad`20parameter`20value X`09RET`09`09`09`09`09`09;error`20return`20to`20caller X X`09.END $ call unpack BUMP_BIOCNT.MAR;1 359561857 "" 4 4 5 $! $ create 'f' X$! X$!`20SUB_BUMPBIO.COM X$! X$!`20This`20.COM`20file`20makes`20it`20easy`20for`20the`20system`20operator`20 Vto`20submit`20the X$!`20batch`20job`20which`20will`20be`20doing`20the`20work. X$! X$!`20Two`20parameters`20are`20required... X$! X$!`09p1`20=`20user`20name`20for`20the`20process`20to`20be`20protected X$!`09p2`20=`20the`20number`20of`20minutes`20of`20IDLE`20time`20to`20be`20given V X$!`09`20`20`20`20`20to`20the`20indicated`20process X$! X$`20on`20error`20then`20goto`20er_exit X$`20on`20warning`20then`20goto`20er_exit X$! X$!`20verify`20that`20user`20name`20selected X$! X$GET_P1: X$`20if`20p1.nes.""`20then`20goto`20test_user_name X$`20inquire`20p1`20"Please`20enter`20the`20user`20name`20of`20the`20process`20 Vto`20be`20protected" X$`20goto`20get_p1 X$TEST_USER_NAME: X$! X$!`20get`20the`20PID`20of`20the`20selected`20user`20...`20if`20not`20a`20valid V`20user`20then`20error`20exit X$! X$`20set`20proc`20/priv=world X$`20p1`20=`20f$edit(p1,"trim") X$`20context`20=`20"" X$PID_LOOP: X$`20`20pid=f$pid(context) X$`20`20if`20pid.eqs.""`20then`20goto`20user_error X$`20`20user`20=`20f$edit(f$getjpi(pid,"username"),"trim") X$`20`20if`20user.nes.p1`20then`20goto`20pid_loop X$GOT_USER_NAME: X$! X$!`20now`20get`20for`20the`20number`20of`20minutes`20of`20idle`20time`20to`20a Vllow`20for`20the`20 X$!`20selected`20user's`20process X$! X$GET_IDLE_TIME: X$`20if`20p2.nes.""`20then`20goto`20got_idle_time X$`20inquire`20p2`20"Enter`20the`20number`20of`20IDLE`20minutes`20allowed`20for V`20''p1'"`20 X$`20goto`20get_idle_time X$GOT_IDLE_TIME: X$`20time_value`20=`20p2 X$! X$!`20initialize`20the`20loop`20factor`20=`204`20min`20`20(ie`20loop`20every`20 V4`20min's) X$!`20and`20wait-length`20string`20=`20"00:04:00"`20for`20wait`20call X$! X$`20loop_fact`20=`204 X$`20wait_len`20=`20"00:04:00" X$! X$!`20now`20calculate`20the`20number`20of`20loops`20for`20the`20requested X$!`20number`20of`20minutes`20of`20idle`20time`20requested`20as`20... X$!`20`20`09TIME_VALUE`20/`20LOOP_FACT X$! X$`20t_len=f$integer("''time_value'"/'loop_fact')`20!calculate`20#`20of`20loops V`20 X$`20if`20t_len.gt.0`20then`20goto`20do_it X$`20write`20sys$output`20"`20" X$`20write`20sys$output`20"`20OOPS...`20Please`20try`20again...`20must`20be`20m Vore`20than`20''loop_fact'`20minutes" X$`20write`20sys$output`20"`20" X$`20p2`20=`20"" X$`20goto`20get_idle_time X$! X$DO_IT: X$! X$!`20show`20the`20operator`20the`20user`20and`20his`20PID X$! X$`20write`20sys$output`20"`20" X$`20write`20sys$output`20"`20" X$`20write`20sys$output`20"''user'`20`5B''pid'`5D" X$`20write`20sys$output`20"------------------------" X$! X$!`20and`20finaly`20submit`20the`20batch`20process`20for`20the`20indicated`20u Vser X$! X$`20submit`20/log=dua1:`5Bvallas.article`5Dtest.log`20/name="''user'_avoid"`20 V- X`20/param=('pid','user','t_len','wait_len)`20- X`20/notify`20dua1:`5Bvallas.article`5Dbumpbufio.com X$! X$`20sh`20queue`20sys$batch X$`20goto`20DONE X$! X$USER_ERROR: X$! X$!`20error`20exit`20if`20selected`20user`20not`20active X$! X$`20write`20sys$output`20"Sorry...`20user`20''p1'`20not`20found`20on`20system. V" X$! X$ER_EXIT: X$! X$!`20error`20exit`20for`20fatal`20errors X$! X$`20write`20sys$output`20"`20Fatal`20error" X$DONE: X$`20exit $ call unpack SUB_BUMPBIO.COM;1 226244120 "" 5 5 5 $ v=f$verify(v) $ exit