.title warn - warn someone about disk shortage .ident /V2.00/ .enable suppression .disable traceback, debug .sbttl Documentation ; ; This file contains two similar procedures. One sends a ; warning to a specific terminal, the other sends it to ; all operator-enabled terminals and the operator log file. ; This procedure is used for the DISKMON (eye in the sky) ; package. ; ; Eric F. Richards ; 19-Aug-85 ; Gould OSD VAX/VMS V4.1 ; .sbttl Symbolic Constants $brkdef ; define breakthrough offsets $opcdef ; define send operator offsets diskname = 4 ; for the disk name, freeblocks = 8 ; for the free block count, percentfre = 12 ; for the %free string, terminal = 16 ; offset for terminal in arg list urgent = 20 ; logical - is this an urgent warning? suffix = 24 ; extra text for non-oper's bell = 7 ; ascii bell code buflen = 130 ; length of the output buffer pflen = 8 ; length of $SNDOPR buffer prefix .psect $code, long, pic, shr, exe, nowrt .sbttl WARN - send a user or operator a notice .entry warn, 0 ; entry point, no regs saved movl #buflen, outbuf ; init the output buffer descriptor $fao_s ctrstr=ctrstr, - ; format the message outbuf=outbuf, - ; using the descriptor outlen=outbuf, - ; store in the out buffer p1=@freeblocks(ap), - ; free block count (integer) p2=percentfre(ap), - ; % free blocks (string descriptor) p3=diskname(ap), - ; disk name (string descriptor) p4=suffix(ap) ; suffix to be added to msg blbc r0, 10$ ; check for error assume brk$c_general eq 0 ; ??? why not? clrl r0 ; assume general message blbc @urgent(ap), 5$ ; if urgent log is false, that's true movl #brk$c_urgent, r0 ; otherwise, set the urgent flag 5$: $brkthruw_s - ; broadcast the message msgbuf=outbuf, - ; from the out buf sendto=@terminal(ap),- ; to the terminal sndtyp=#brk$c_device, - ; must tell it to send to a terminal reqid=r0, - ; the type of message we're sending iosb=iosb, - ; ...I/O status block timout=#15 ; wait 15 seconds before giving up blbc r0, 10$ ; on error exit movzwl iosb, r0 ; real error status is in the iosb 10$: ret ; ...that's it! .sbttl OPCOM - send operator terminals a notice .entry opcom, 0 ; entry point, no regs saved movl #buflen, outbuf ; init the output buffer descriptor $fao_s ctrstr=ctrtwo, - ; format the message outbuf=outbuf, - ; using the descriptor outlen=outbuf, - ; store in the out buffer p1=@freeblocks(ap), - ; free block count (integer) p2=percentfre(ap), - ; % free blocks (string descriptor) p3=diskname(ap) ; disk name (string descriptor) blbc r0, 20$ ; check for error addw3 #pflen, outbuf, opbuf ; set proper length for opmsg buffer $sndopr_s msgbuf=opbuf ; send the operator message 20$: ret ; ...that's it! ; ; local data ; .sbttl string descriptors and out buffer .psect $local, long, noexe, wrt, pic iosb: .blkq 1 ; I/O status block ctrstr: .long strend-string ; descriptor for the control string .address string ; ...address for descriptor ctrtwo: .long subend-substr ; descriptor for the opcom string .address substr ; ...address for string buffer opbuf: .long 0 ; descriptor for $SNDOPR buffer .address prefix ; start of sndopr buffer outbuf: .long buflen ; output buffer descriptor .address buffer ; ...address prefix: .byte opc$_rq_rqst ; message class is "request" .long opc$m_nm_disks ; this is a disk message .byte 0, 0, 0 ; request id area, left as nulls buffer: .blkb buflen ; the output buffer ; ; pure data ; .sbttl FAO control string for messages .psect $pdata, long, nowrt, noexe, pic, shr string: .ascii "!/Warning - " substr: .ascii "Only !UL block!%S free (!AS%) on !AS!/" subend: .ascii "!AS" strend: .end ; ...that's it!