.TITLE SYSTAT.MAC 89e17a 05-MAR-82/17-May-89. .ENABL LC ; Author: N. A. Bourgeois, Jr. ; NAB Software Services, Inc. ; PO Box 20009 ; Albuquerque, NM 87154 ; The code and information in this software is subject to ; change without notice and should not be construed as a ; commitment by NAB Software Services, Inc. NAB Software ; Services,Inc. assumes no responsibility for any errors ; that may appear in this software. ; ; ; NOTICE ; ; This software is sponsored by NAB Software Services, Inc. ; Neither NAB Software Services, Inc., nor any of their ; employees, nor any of their contractors, subcontractors, ; or their employees makes any warranty, express or implied, ; or assumes any legal liability or responsibility for the ; accuracy, completeness or usefulness of any information, ; apparatus, product or process disclosed, or represents ; that its use would not infringe privately owned rights. ; THIS SOFTWARE WAS ORIGINALLY ISSUED BY SANDIA NATIONAL ; LABORATORIES, OPERATED FOR THE UNITED STATES DEPARTMENT ; OF ENERGY BY SANDIA CORPORATION. ; ; NOTICE ; ; THIS SOFTWARE WAS ORIGINALLY SPONSORED BY THE UNITED ; STATES GOVERNMENT. NEITHER THE UNITED STATES GOVERNMENT ; NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF ; THEIR EMPLOYEES, NOR ANY OF THEIR CONTRACTORS, ; SUBCONTRACTORS, OR THEIR EMPLOYEES MAKES ANY WARRANTY, ; EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR ; RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS OR ; USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT OR ; PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT ; INFRINGE PRIVATELY OWNED RIGHTS. ; ; THIS WORK WAS ORIGINALLY FUNDED BY: ; ; HEADQUARTERS, ESD / OCB / STOP 36 ; HANSCOM AIR FORCE BASE, MA 01731 .SBTTL EDIT RECORD 05-MAR-82/17-May-89. ;05-MAR-82 ORIGINAL CREATION. ;06-Jan-84 Maintenance assumed by NAB Software Services, Inc. ;03-Oct-84 Minor revisions for V5.1. ;26-Mar-87 Revised for V6.2. Added NAB Software disclaimer. ; Added descriptions and code for JOBPRI and GTJBNM ; routines. ;16-May-89 Revised for V6.40a. Added the IPRPAN routine. .PAGE .SBTTL DESCRIPTION 05-MAR-82/17-May-89. ;THESE SYSTEM STATUS INFORMATION ROUTINES ARE CALLABLE AS SUBROUTINES. ;THIS MODULE IS A PART OF THE LIBRARY OF FORTRAN CALLABLE TSX-PLUS EMT ;ROUTINES. ;CHECK THE STATUS OF A LINE. ; ;CALLING SEQUENCE: ; ; CALL ILNSTS ( LINUM , ISTAT [ , IERR ] ) ; ; WHERE: LINUM IS THE NUMBER OF THE TSX-PLUS LINE ABOUT WHICH ; STATUS INFORMATION IS TO BE RETURNED. ; ; ISTAT IS THE VARIABLE INTO WHICH THE FOLLOWING BIT- ; FLAG STATUS INFORMATION IS RETURNED: ; ; 000001 THE LINE IS VIRTUAL. ; 000002 THE LINE IS DETACHED. ; 000100 THE JOB IS LOCKED IN MEMORY. ; 000200 THE JOB HAS OPERATOR PRIVILEGE. ; ; IERR IS NEGATIVE OR ONE OF THE FOLLOWING: ; ; 0 THE LINE IS NOT CURRENTLY LOGGED ON. ; 2 INVALID LINE NUMBER. ;GET A JOB'S EXECUTION STATE. ; ;CALLING SEQUENCE: ; ; CALL IEXSTS ( LINUM , ISTAT [ , IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; ISTAT IS ONE OF THE FOLLOWING STATUS VALUES: ; ; 1 HIGH PRIORITY RUN STATE. ; 2 NORMAL PRIORITY RUN STATE. ; 3 LOW PRIORITY RUN STATE. ; 4 WAITING ON INPUT FROM THE TERMINAL. ; 5 WAITING TO OUTPUT TO THE TERMINAL. ; 6 DOING A TIMED WAIT. ; 7 SUSPENDED BY THE .SPND EMT. ; 8 WAITING TO ACCESS A SHARED FILE. ; 9 WAITING FOR AN INTER-JOB MESSAGE. ; 10 WAITING TO ACCESS THE USR. ; 11 WAITING FOR I/O TO FINISH. ; 12 WAITING TO ACCESS THE SPOOL FILE. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;DETERMINE THE AMOUNT OF MEMORY USED BY A JOB. ; ;CALLING SEQUENCE: ; ; CALL MEMUSE ( LINUM , IRET [ , IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; IRET IS THE NUMBER OF 512-byte BLOCKS OF MEMORY ; CURRENTLY BEING USED BY THE JOB. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;DETERMINE THE CONNECT TIME FOR A JOB. ; ;CALLING SEQUENCE: ; ; CALL ICONTM ( LINUM , IRET [ , IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; IRET IS THE CONNECT TIME IN MINUTES. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;DETERMINE THE POSITION OF A JOB IN MEMORY. ; ;CALLING SEQUENCE: ; ; CALL MEMPOS ( LINUM , IRET [ , IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; IRET IS THE NUMBER OF THE 512-byte BLOCK OF THE ; START OF THE MEMORY AREA ALLOCATED TO THE ; JOB. THIS VALUE WILL BE ZERO IF THE JOB IS ; SWAPPED OUT OF MEMORY. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;GET THE NAME OF THE PROGRAM BEING RUN BY A JOB. ; ;CALLING SEQUENCE: ; ; CALL IPGNAM ( LINUM , PGMNAM [ , IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; PGMNAM IS THE NAME OF THE TWO-WORD VARIABLE INTO ; WHICH THE RAD50 VALUE FOR THE NAME OF THE ; PROGRAM IS RETURNED. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;GET THE PROJECT-PROGRAMMER NUMBER FOR A JOB. ; ;CALLING SEQUENCE: ; ; CALL IPPNUM ( LINUM , NMBRS [ IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; NMBRS IS THE NAME OF THE TWO ELEMENT ARRAY INTO ; WHICH THE PROJECT AND THE PROGRAMMER NUMBERS ; ARE RETURNED. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;GET THE CPU TIME USED BY A JOB. ; ;CALLING SEQUENCE: ; ; CALL ICPUTM ( LINUM , JCPUTM [ , IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; JCPUTM IS THE NAME OF THE THE TWO ELEMENT VARIABLE ; INTO WHICH THE CPU TIME IN CLOCK TICKS IS ; RETURNED. THE FIRST ELEMENT CONTAINS THE HIGH ; ORDER 16 BITS AND THE SECOND ELEMENT CONTAINS ; THE LOW ORDER 16 BITS. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;Get a job's priority. ; ;Calling sequence: ; ; CALL JOBPRI ( LINUM , IPRI [ , IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; LPRI is the name of a two element array the first ; of which is to receive the job's priority ; value in the range of 0 to 127. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;Get a job's name. ; ;Calling sequence: ; ; CALL GTJBNM ( LINUM , JOBNAM [ , IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; JOBNAM is the name of the 12 byte array that is to ; receive the ASCII name of the job. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. ;Get a job's primary and parent process numbers. ; ;Calling sequence: ; ; CALL IPRPAN ( LINUM,IBUF [ ,IERR ] ) ; ; where: LINUM is the number of the TSX-Plus line about which ; the status information is to be returned. ; ; IBUF is the address of a two element integer array, ; the first element receives the primary process ; number and the second element receives the ; parent process number. ; ; IERR is negative or one of the following: ; ; 0 the line is not currently logged on. ; ; 2 invalid line number. .PAGE .SBTTL DIRECTIVES 05-MAR-82/17-May-89. .IDENT \89e17a\ ;TELL LINKER OUR VERSION .PSECT TSXLIB .GLOBL TSLBID .WORD TSLBID .DSABL GBL .SBTTL ASSIGNMENTS 05-MAR-82/. ERRBYT = 52 ;ERROR CODE LOCATION NOERR = -1 ;CODE FOR NO ERROR .PAGE .SBTTL ENTRY POINTS 05-MAR-82/17-May-89. ;CHECK THE STATUS OF A LINE. ; ILNSTS::MOV #144 ,R1 ;EMT CODE CLR R2 ;SUBFUNCTION CODE JSR PC ,DOIT ;CHECK THE STATUS RTS PC ;GET A JOB'S EXECUTION STATE. ; IEXSTS::MOV #144 ,R1 ;EMT CODE MOV #1 ,R2 ;SUBFUNCTION CODE JSR PC ,DOIT ;GET THE STATE RTS PC ;DETERMINE THE AMOUNT OF MEMORY USED BY A JOB. ; MEMUSE::MOV #144 ,R1 ;EMT CODE MOV #2 ,R2 ;SUBFUNCTION CODE JSR PC ,DOIT ;GET MEMORY USE RTS PC ;DETERMINE THE CONNECT TIME FOR A JOB. ; ICONTM::MOV #144 ,R1 ;EMT CODE MOV #3 ,R2 ;SUBFUNCTION CODE JSR PC ,DOIT ;GET THE TIME RTS PC ;DETERMINE THE POSITION OF A JOB IN MEMORY. ; MEMPOS::MOV #144 ,R1 ;EMT CODE MOV #4 ,R2 ;SUBFUNCTION CODE JSR PC ,DOIT ;GET THE POSITION RTS PC ;GET THE NAME OF THE PROGRAM BEING RUN BY A JOB. ; IPGNAM::MOV #144 ,R1 ;EMT CODE MOV #5 ,R2 ;SUBFUNCTION CODE JSR PC ,DOIT ;GET THE NAME RTS PC ;GET THE PROJECT-PROGRAMMER NUMBER FOR A JOB. ; IPPNUM::MOV #144 ,R1 ;EMT CODE MOV #6 ,R2 ;SUBFUNCTION CODE JSR PC ,DOIT ;GET THE NUMBERS RTS PC ;GET THE CPU TIME USED BY A JOB. ; ICPUTM::MOV #144 ,R1 ;EMT CODE MOV #7 ,R2 ;SUBFUNCTION CODE JSR PC ,DOIT ;GET THE TIME RTS PC ;Get a job's priority. ; JOBPRI::MOV #144 ,R1 ;EMT code MOV #8. ,R2 ;subfunction code CALL DOIT ;get the priority RETURN ;Get a job's name. ; GTJBNM::MOV #144 ,R1 ;EMT code MOV #9. ,R2 ;subfunction code CALL DOIT ;get the name RETURN ;Get a job's primary and parent process numbers. ; IPRPAN::MOV #144 ,R1 ;EMT code MOV #10. ,R2 ;subfunction code CALL DOIT ;get the numbers RETURN .PAGE .SBTTL SUPPORTING SUBROUTINES 05-MAR-82/. DOIT: MOV 4(R5) ,-(SP) ;SA FOR ARGUMENT 2 MOV @2(R5) ,-(SP) ;LO BYTE = ARGUMENT 1 MOV SP ,R0 ;SET UP A POINTER MOVB R2 ,1(R0) ;HI BYTE = SUBFUNCTION CLR -(SP) ;LO BYTE = 0 MOV SP ,R0 ;SET UP THE POINTER MOVB R1 ,1(R0) ;HI BYTE = EMT CODE MOV #NOERR ,R1 ;NO ERROR CODE EMT 375 ;LET TSX DO IT BCC 1$ ; IF NO ERROR CLR R1 ; IF ERROR MOVB @#ERRBYT,R1 ; GET CODE 1$: CMPB #3 ,(R5) ;ERROR RETURN ARGUMENT? BNE 2$ ; NO MOV R1 ,@6(R5) ; YES 2$: ADD #6 ,SP ;FIX THE STACK POINTER RTS PC .SBTTL END 05-MAR-82/. .END