%title 'Format mailbox messages' module Format ( ident = 'V4.0') = begin %sbttl 'module declarations' library 'SYS$LIBRARY:STARLET'; library 'MBMLIB'; external routine RAB_Fao; field MSG_Field = set SLOT$W_MSGTYPE = [0, 0, 16, 0], SLOT$A_ROUTINE = [2, 0, 32, 0] tes; literal SLOT$C_SIZE = 6; psect nodefault = MSG_Slot0 (read, nowrite, align (0)), nodefault = MSG_Slot1 (read, nowrite, align (0)), nodefault = MSG_Slot2 (read, nowrite, align (0)); own Msg_Slot: psect (MSG_Slot0) blockvector[0, SLOT$C_SIZE, byte] field (MSG_Field), Last_Msg_Slot: psect (MSG_Slot2) blockvector[0, SLOT$C_SIZE, byte] field (MSG_Field); macro Format_Routine (Msg_Type, Routine_Name) = forward routine Routine_Name; psect nodefault = MSG_Slot1 (read, nowrite, align (0)); bind %name (Routine_Name, '_Slot') = uplit psect (MSG_Slot1) (word (Msg_Type), long (Routine_Name)); global routine Routine_Name %; %sbttl 'Format_Record -- interpret data and write' global routine Format_Record ( Buffer: ref vector[,byte], iosb: ref IOSB$DEF, rab: ref $RAB_DECL) = ( builtin argptr, callg; bind Msg_Type = Buffer[0]: word; local sts: VMS_sts; RAB_Fao (.rab, %ascid 'From pid !8XL, at !%D', .iosb[IOSB$L_PID], 0); if .iosb[IOSB$W_IOLEN] lss 2 then return RAB_Fao ( .rab, %ascid ' Undersize message, length = !UW!/', .iosb[IOSB$W_IOLEN]); incra s from Msg_Slot to Last_Msg_Slot - SLOT$C_SIZE by SLOT$C_SIZE do ( bind slot = s: ref $bblock[SLOT$C_SIZE] field (MSG_Field); if .slot[SLOT$W_MSGTYPE] eql .Msg_Type then if (sts = callg (argptr (), .slot[SLOT$A_ROUTINE])) then return .sts; ); return RAB_Fao ( .rab, %ascid ' Unknown message type !XW!/', .Msg_Type); ); %sbttl 'Delete_Process -- format delete process message' Format_Routine (MSG$_DELPROC, Delete_Process) ( Buffer: ref $bblock, iosb: ref IOSB$DEF, rab: ref $RAB_DECL) = ( external routine LIB$SUBX: addressing_mode (general); builtin emul; literal MsgSiz = 64; local MsgBuf: vector[MsgSiz, byte], Msg: $dsc_dynamic, CPU_Time: vector[2], Elapsed_Time: vector[2]; if .iosb[IOSB$W_IOLEN] neq ACC$K_TERMLEN then return 0; RAB_Fao ( .rab, %ascid ' User !AF job terminated at !%D', ACC$S_USERNAME, Buffer[ACC$T_USERNAME], Buffer[ACC$Q_TERMTIME]); RAB_Fao ( .rab, %ascid ' Process ID !XL Account !AF Owner PID !XL', .Buffer[ACC$L_PID], ACC$S_ACCOUNT, Buffer[ACC$T_ACCOUNT], .Buffer[ACC$L_OWNER]); Msg[DSC$W_LENGTH] = MsgSiz; Msg[DSC$A_POINTER] = MsgBuf; $GETMSG ( msgid = .Buffer[ACC$L_FINALSTS], msglen = Msg[DSC$W_LENGTH], bufadr = Msg); RAB_Fao ( .rab, %ascid ' Status !XL !AS', .Buffer[ACC$L_FINALSTS], Msg); RAB_Fao ( .rab, %ascid ' Buffered I/O count !13UL Peak working set size !6UL', .Buffer[ACC$L_BIOCNT], .Buffer[ACC$L_WSPEAK]); RAB_Fao ( .rab, %ascid ' Direct I/O count !15UL Peak virtual size !9UL', .Buffer[ACC$L_DIOCNT], .Buffer[ACC$L_PGFLPEAK]); RAB_Fao ( .rab, %ascid ' Page faults !19UL Mounted volumes !11UL', .Buffer[ACC$L_PAGEFLTS], .Buffer[ACC$L_VOLUMES]); emul (%ref (-100000), Buffer[ACC$L_CPUTIM], %ref (0), CPU_Time); LIB$SUBX ( Buffer[ACC$Q_LOGIN], Buffer[ACC$Q_TERMTIME], Elapsed_Time, %ref (2)); RAB_Fao ( .rab, %ascid ' Elapsed CPU time !%D Elapsed time !%D!/', CPU_Time, Elapsed_Time); return SS$_NORMAL ); end eludom