From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  4-MAR-1992 00:31:02.19
To:	ARISIA::EVERHART
CC:	
Subj:	MWAIT V1.06, part 7 of 7

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.123)
	 id AA26244; Tue, 3 Mar 92 23:58:25 EST
Message-Id:  <9203040458.AA26244@crdgw1.ge.com>
Received: From SUN2.NSFNET-RELAY.AC.UK by CRVAX.SRI.COM with TCP; Tue,  3 MAR 92 17:32:53 PST
Received: from ncdlab.ulcc.ac.uk by sun2.nsfnet-relay.ac.uk via JANET 
          with NIFTP id <3509-9@sun2.nsfnet-relay.ac.uk>;
          Tue, 3 Mar 1992 08:49:29 +0000
Date: Tue, 3 Mar 92 8:28 GMT
From: Nick de Smith <NICK@ncdlab.ulcc.ac.uk>
To: INFO-VAX <@nsfnet-relay.ac.uk:INFO-VAX@KL.SRI.com>
Subject: MWAIT V1.06, part 7 of 7

-+-+-+-+-+-+-+-+ START OF PART 7 -+-+-+-+-+-+-+-+
X Author`09`09: Nick de Smith
X Date`09`09: 09-Dec-91
X
X This program makes the process go into a LEF wait on more than one event fl
Vag.
X We do this to test the MWAIT utility.
X
X Usage:`09$ spawn/nowait run test2
X`09$ run mwait
X*/
X
X#include`09ssdef
X
XLEF_ALL_TEST()
X`7B
X`09SYS$WFLAND( 60, 0xF0F0F0F0 );`09`09`09`09`09/* Wait for loads of event fl
Vags`09*/
X
X`09return`09SS$_NORMAL;`09`09`09`09`09`09/* Return success to caller`09`09*/
X`7D
$ CALL UNPACK TEST2.C;1 2105375176
$ create 'f'
X/*
X Program`09: TEST3
X Author`09`09: Nick de Smith
X Date`09`09: 09-Dec-91
X
X This program makes the process go into an MWAIT state by creating a mailbox
V and then
X writing to it until the mailbox's buffer count is exhausted. We do this to
V test the
X MWAIT utility.
X
X Usage:`09$ spawn/nowait run test3
X`09$ run mwait
X*/
X
X#include`09descrip
X#include`09psldef
X#include`09stsdef
X#include`09ssdef
X#include`09iodef
X
X#define`09ss_check( command ) `7B`09`09`09\
X`09long`09l_status = (command);`09`09\
X`09if ( (l_status & STS$M_SUCCESS) == 0 ) `7B \
X`09`09LIB$SIGNAL( l_status );`09`09\
X`09`7D`09`09`09`09`09\
X`7D
X
X#define`09MBX_MSGMAX`0910`09`09`09`09`09`09/* Maximum size of a message`09`0
V9*/
X#define`09MBX_BUFQUO`09(MBX_MSGMAX * 5)`09`09`09`09/* Ammount of buffering t
Vo allow`09*/
X
X#define`09MBX_WRITE_SIZE`098`09`09`09`09`09`09/* Size of messages to write`0
V9`09*/
X
XMWAIT_TEST()
X`7B
X`09$DESCRIPTOR( mbx$x_name, "MWAIT_BOX" );
X`09short`09mbx$w_chan;`09`09`09`09`09`09/* Mailbox channel`09`09`09*/
X`09long`09mbx$l_efn = 0;`09`09`09`09`09`09/* Mailbox I/O event flag`09`09*/
X`09char`09mbx$t_buffer`5B MBX_MSGMAX `5D;`09`09`09`09/* Mailbox read buffer`
V09`09`09*/
X`09short`09mbx$q_iosb`5B 4 `5D;
X
X`09ss_check( SYS$CREMBX(`09`09`09`09`09`09/* Create logging mailbox`09`09*/
X`09`090`09`09,`09`09`09`09`09/* Mailbox is temp`09`09`09*/
X`09`09&mbx$w_chan`09,`09`09`09`09`09/* Channel number returned here`09`09*/
X`09`09MBX_MSGMAX `09,`09`09`09`09`09/* Maximum size of message`09`09*/
X`09`09MBX_BUFQUO`09,`09`09`09`09`09/* Buffer quota`09`09`09`09*/
X`09`090`09`09,`09`09`09`09`09/* Protection mask`09`09`09*/
X`09`09PSL$C_USER`09,`09`09`09`09`09/* User mode access`09`09`09*/
X`09`09&mbx$x_name`09) )`09`09`09`09`09/* Mailbox name`09`09`09`09*/
X
X`09printf( "Mailbox channel number is %04X\n", mbx$w_chan );`09/* Display th
Ve channel number`09`09*/
X
X`09for ( ;; ) `7B`09`09`09`09`09`09`09/* Until we run out of quota...`09`09*
V/
X`09`09ss_check( SYS$QIO(
X`09`09`09mbx$l_efn`09,`09`09`09`09/* Use our own event flag`09`09*/
X`09`09`09mbx$w_chan`09,`09`09`09`09/* Channel to use`09`09`09*/
X`09`09`09IO$_WRITEVBLK`09,`09`09`09`09/* Write console channel`09`09*/
X`09`09`09mbx$q_iosb`09,`09`09`09`09/* I/O status block`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* QIO AST address`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* QIO AST parameter`09`09`09*/
X`09`09`09mbx$t_buffer`09,`09`09`09`09/* P1 = Message buffer`09`09`09*/
X`09`09`09MBX_WRITE_SIZE`09,`09`09`09`09/* P2 = Size of buffer`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P3`09`09`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P4`09`09`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P5`09`09`09`09`09*/
X`09`09`090`09`09) )`09`09`09`09/* P6`09`09`09`09`09*/
X`09`7D
X
X`09return`09SS$_NORMAL;`09`09`09`09`09`09/* Return success to caller`09`09*/
X`7D
X`0C
$ CALL UNPACK TEST3.C;1 1197564475
$ create 'f'
X
X/*
X Program`09: TEST4
X Author`09`09: Nick de Smith
X Date`09`09: 09-Dec-91
X
X This program makes the process go into an MWAIT state by creating a mailbox
V and then
X writing to it until the mailbox's buffer count is exhausted. We do this to
V test the
X MWAIT utility. The version goes into RWMBX in the user mode AST routine.
X
X Usage:`09$ spawn/nowait run test4
X`09$ run mwait
X*/
X
X#include`09descrip
X#include`09psldef
X#include`09stsdef
X#include`09ssdef
X#include`09iodef
X
X#define`09ss_check( command ) `7B`09`09`09\
X`09long`09l_status = (command);`09`09\
X`09if ( (l_status & STS$M_SUCCESS) == 0 ) `7B \
X`09`09LIB$SIGNAL( l_status );`09`09\
X`09`7D`09`09`09`09`09\
X`7D
X
X#define`09MBX_MSGMAX`0910`09`09`09`09`09`09/* Maximum size of a message`09`0
V9*/
X#define`09MBX_BUFQUO`09(MBX_MSGMAX * 5)`09`09`09`09/* Ammount of buffering t
Vo allow`09*/
X
X#define`09MBX_WRITE_SIZE`098`09`09`09`09`09`09/* Size of messages to write`0
V9`09*/
X
XMWAIT_TEST()
X`7B
X`09$DESCRIPTOR( mbx$x_name, "MWAIT_BOX" );
X`09short`09mbx$w_chan;`09`09`09`09`09`09/* Mailbox channel`09`09`09*/
X`09long`09mbx$l_efn = 0;`09`09`09`09`09`09/* Mailbox I/O event flag`09`09*/
X`09char`09mbx$t_buffer`5B MBX_MSGMAX `5D;`09`09`09`09/* Mailbox read buffer`
V09`09`09*/
X`09short`09mbx$q_iosb`5B 4 `5D;
X`09static`09ast_routine();
X
X`09ss_check( SYS$CREMBX(`09`09`09`09`09`09/* Create logging mailbox`09`09*/
X`09`090`09`09,`09`09`09`09`09/* Mailbox is temp`09`09`09*/
X`09`09&mbx$w_chan`09,`09`09`09`09`09/* Channel number returned here`09`09*/
X`09`09MBX_MSGMAX `09,`09`09`09`09`09/* Maximum size of message`09`09*/
X`09`09MBX_BUFQUO`09,`09`09`09`09`09/* Buffer quota`09`09`09`09*/
X`09`090`09`09,`09`09`09`09`09/* Protection mask`09`09`09*/
X`09`09PSL$C_USER`09,`09`09`09`09`09/* User mode access`09`09`09*/
X`09`09&mbx$x_name`09) )`09`09`09`09`09/* Mailbox name`09`09`09`09*/
X
X`09printf( "Mailbox channel number is %04X\n", mbx$w_chan );`09/* Display th
Ve channel number`09`09*/
X
X`09`09ss_check( SYS$QIO(
X`09`09`09mbx$l_efn`09,`09`09`09`09/* Use our own event flag`09`09*/
X`09`09`09mbx$w_chan`09,`09`09`09`09/* Channel to use`09`09`09*/
X`09`09`09IO$_WRITEVBLK `7C IO$M_NOW,`09`09`09/* Write console channel`09`09*
V/
X`09`09`09mbx$q_iosb`09,`09`09`09`09/* I/O status block`09`09`09*/
X`09`09`09ast_routine`09,`09`09`09`09/* QIO AST address`09`09`09*/
X`09`09`09mbx$w_chan`09,`09`09`09`09/* QIO AST parameter`09`09`09*/
X`09`09`09mbx$t_buffer`09,`09`09`09`09/* P1 = Message buffer`09`09`09*/
X`09`09`09MBX_WRITE_SIZE`09,`09`09`09`09/* P2 = Size of buffer`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P3`09`09`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P4`09`09`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P5`09`09`09`09`09*/
X`09`09`090`09`09) )`09`09`09`09/* P6`09`09`09`09`09*/
X
X`09SYS$HIBER();
X
X`09return`09SS$_NORMAL;`09`09`09`09`09`09/* Return success to caller`09`09*/
X`7D
X
Xstatic
Xast_routine(
X`09unsigned short`09mbx$w_chan`09)
X`7B
X`09long`09mbx$l_efn = 0;`09`09`09`09`09`09/* Mailbox I/O event flag`09`09*/
X`09char`09mbx$t_buffer`5B MBX_MSGMAX `5D;`09`09`09`09/* Mailbox read buffer`
V09`09`09*/
X`09short`09mbx$q_iosb`5B 4 `5D;
X
X`09for ( ;; ) `7B`09`09`09`09`09`09`09/* Until we run out of quota...`09`09*
V/
X`09`09ss_check( SYS$QIO(
X`09`09`09mbx$l_efn`09,`09`09`09`09/* Use our own event flag`09`09*/
X`09`09`09mbx$w_chan`09,`09`09`09`09/* Channel to use`09`09`09*/
X`09`09`09IO$_WRITEVBLK `7C IO$M_NOW ,`09`09`09`09/* Write console channel`09
V`09*/
X`09`09`09mbx$q_iosb`09,`09`09`09`09/* I/O status block`09`09`09*/
X`09`09`09ast_routine`09,`09`09`09`09/* QIO AST address`09`09`09*/
X`09`09`09mbx$w_chan`09,`09`09`09`09/* QIO AST parameter`09`09`09*/
X`09`09`09mbx$t_buffer`09,`09`09`09`09/* P1 = Message buffer`09`09`09*/
X`09`09`09MBX_WRITE_SIZE`09,`09`09`09`09/* P2 = Size of buffer`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P3`09`09`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P4`09`09`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P5`09`09`09`09`09*/
X`09`09`090`09`09) )`09`09`09`09/* P6`09`09`09`09`09*/
X`09`7D
X`7D
X`0C
$ CALL UNPACK TEST4.C;1 39340974
$ create 'f'
X
X/*
X Program`09: TEST5
X Author`09`09: Nick de Smith
X Date`09`09: 09-Dec-91
X
X This program makes the process go into an MWAIT state by assigning a channe
Vl
X to the terminal, and then queuing up a lot of large reads until the process
V's
X BYTCNY quota is exceeded. We do this to test the MWAIT utility. This versio
Vn
X goes into JIBYT wait (JIB related wait on BYTCNT). MWAIT displays the reaso
Vn.
X
X Usage:`09$ spawn/nowait run test5
X`09$ run mwait
X*/
X
X#include`09descrip
X#include`09psldef
X#include`09stsdef
X#include`09ssdef
X#include`09iodef
X
X#define`09ss_check( command ) `7B`09`09`09\
X`09long`09l_status = (command);`09`09\
X`09if ( (l_status & STS$M_SUCCESS) == 0 ) `7B \
X`09`09LIB$SIGNAL( l_status );`09`09\
X`09`7D`09`09`09`09`09\
X`7D
X
X#define`09TERM_READ_SIZE`092000`09`09`09`09`09`09/* Size of messages to writ
Ve`09`09*/
X
XMWAIT_TEST()
X`7B
X`09$DESCRIPTOR( tt$x_name, "SYS$COMMAND" );
X`09short`09tt$w_chan;`09`09`09`09`09`09/* Terminal channel`09`09`09*/
X`09long`09tt$l_efn = 0;`09`09`09`09`09`09/* Terminal I/O event flag`09`09*/
X`09char`09tt$t_buffer`5B TERM_READ_SIZE `5D;`09`09`09`09/* Terminal read buf
Vfer`09`09`09*/
X`09short`09tt$q_iosb`5B 4 `5D;
X
X`09ss_check( SYS$ASSIGN(
X`09`09&tt$x_name`09`09`09,`09`09`09/* Name of the device`09`09`09*/
X`09`09&tt$w_chan`09`09,`09`09`09/* The channel for the NV device`09*/
X`09`09PSL$C_USER`09`09,
X`09`090`09`09`09) )
X
X`09printf( "Terminal channel number is %04X\n", tt$w_chan );`09/* Display th
Ve channel number`09`09*/
X
X`09for ( ;; ) `7B`09`09`09`09`09`09`09/* Until we run out of quota...`09`09*
V/
X`09`09ss_check( SYS$QIO(
X`09`09`09tt$l_efn`09,`09`09`09`09/* Use our own event flag`09`09*/
X`09`09`09tt$w_chan`09,`09`09`09`09/* Channel to use`09`09`09*/
X`09`09`09IO$_READVBLK`09,`09`09`09`09/* Read message`09`09`09`09*/
X`09`09`09tt$q_iosb`09,`09`09`09`09/* I/O status block`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* QIO AST address`09`09`09*/
X`09`09`09tt$w_chan`09,`09`09`09`09/* QIO AST parameter`09`09`09*/
X`09`09`09tt$t_buffer`09,`09`09`09`09/* P1 = Message buffer`09`09`09*/
X`09`09`09TERM_READ_SIZE`09,`09`09`09`09/* P2 = Size of buffer`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P3`09`09`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P4`09`09`09`09`09*/
X`09`09`090`09`09,`09`09`09`09/* P5`09`09`09`09`09*/
X`09`09`090`09`09) )`09`09`09`09/* P6`09`09`09`09`09*/
X`09`7D
X`09SYS$HIBER();
X
X`09return`09SS$_NORMAL;`09`09`09`09`09`09/* Return success to caller`09`09*/
X`7D
X
X`0C
$ CALL UNPACK TEST5.C;1 1835742202
$ v=f$verify(v)
$ EXIT

