Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 57
Sample $CMON Program
!------------------------------------------------------------
! Procedure to process an Altpri^msg message. This request
! is rejected during the shutdown phase. Otherwise, the
! request is accepted only if it reduces the priority of
! the process.
!------------------------------------------------------------
PROC PROCESS^ALTPRI^MSG;
BEGIN
STRUCT MSG(*); !template for Altpri^msg message
BEGIN
INT MSGCODE;
INT USERID;
INT CIPRI;
INT CIINFILE[0:11];
INT CIOUTFILE[0:11];
INT CRTPID[0:3];
INT PROGNAME[0:11];
INT PRIORITY;
INT PHANDLE[0:9];
END;
INT .EXT ALTPRI^MSG(MSG) :=
$XADR(BUFFER); !structure pointer to I/O buffer
STRUCT .ALTPRI^REPLY; !structure for reply
BEGIN
INT REPLYCODE;
STRING REPLYTEXT[0:63];
END;
INT PRIORITY; !current priority of process
! Blank the reply display text:
ALTPRI^REPLY.REPLYTEXT[0] ':=' " ";
ALTPRI^REPLY.REPLYTEXT[1] ':='
ALTPRI^REPLY.REPLYTEXT[0] FOR 63;
! Extract the group ID:
REQUESTING^GROUPID := ALTPRI^MSG.USERID.<0:7>;
! If shutting the system down, accept requests only from
! the operator group:
IF REFUSE^ALL AND (REQUESTING^GROUPID <> 255) THEN
BEGIN
ALTPRI^REPLY.REPLYCODE := 1;
ALTPRI^REPLY.REPLYTEXT ':=' SHUTDOWN^TEXT FOR 64;
END
ELSE