[mod.computers.vax] SET_TIME limit command/utility

BRENT@uwovax.UWO.CDN (Brent Sterner) (03/18/87)

   In reply to my query for a CPU time limit setting command,
Brian Beesley was kind enough to send along his FORTRAN program
and 2 assembler routines.  We found the assembler routines
just fine, but the interface via FORTRAN to be clumsy.  So
we hacked the interface in "C", and have the following
product available for the world.  (Apologies for the length).
   SET_TIME n   treats "n" as a delta time (in seconds), and
sets the time limit for your process to the sum of your
current elapsed CPU time and "n" minutes.  SET_TIME is define
at UWO CCS as a foreign command.  The EXE processes "n".
   Treating "n" in minutes prevents ridiculously low limits
from being set.  As a delta time, inconsistencies associated
with setting the limit less than elapsed CPU time are avoided.
   We are planning on implementing batch queues with time limits.
So we made the command into a no-op for batch queues (SUBMIT
lets you control the CPU limit adequately).
   The program requires CMKRNL privilege, and so is INSTALLed
at our site.  In limited testing it behaves as intended.
   The author included some caveats which follow (his own
words).  Following that is all our code along with the MAR
routines to actually set the limit and read it back for
confirmation.  Feel free to suggest improvements or modify
this code for your own site usage.  Brent.
----------------
Brent,
      Here's the package for CPU override. I've tested it
with VMS V4.5 (after originally developing under VMS V3.7) and
it works OK. But, the macro routines must be recompiled and the
image relinked after an OS upgrade - well, major upgrades
anyway.

      The Fortran source is "skeletal", please feel free to
improve the user interface to your own convenience. The hard
work gets done in macro anyway.

      The program simply reads the new CPU limit as a long
integer in 10mS units (i.e. enter 6000 for 1 minute, etc) and
sets the CPU limit. Enter zero for infinite CPU. The program
then reports the new CPU limit, again in 10mS units.

      Notes: a "strange" value may be set if you attempt to
set a CPU limit smaller than the current elapsed CPU of the
process. Also the program may "appear" to work if the process
isn't sufficiently priveleged (needs CMKRNL) but in this case
the limit isn't changed - what I mean is that I didn't bother
to put in a check for CMKRNL but the priveleged routine does
nothing without the required priveleges set.

      (The project dates from a time when we were looking
at letting all our users log on at priority 5 with a small
CPU limit, then allowing them to get more CPU in return for
a drop in base priority. It was dropped for "political"
reasons rather than technical difficulties).

      Following are four short text files: one Fortran
source, two Macro source and a command file to compile & link.

                              Best wishes
                              Brian Beesley

**** CPU.FOR ****

      READ (5,200) ICPU
  200 FORMAT(I6)
      CALL CPUW(%REF(ICPU))
      CALL CPUR(%REF(ICPU))
      WRITE (6,100) ICPU
  100 FORMAT (1X,'CPUTIME: ',I12)
      END

**** CPUR.MAR ****      (duplicated later)
**** CPUW.MAR ****      (duplicated later)

**** CPU.COM ****
$ for cpu
$ mac cpur
$ mac cpuw
$ lin cpu,cpur,cpuw,sys$system:sys.stb
**** end of files ****

Brent,
Please feel at liberty to make as much in the way of improvement
as you wish to the "main program". Also distribute to the net by
all means ... bearing in mind the potential hazard to security
when intercepted by undesirable beings with too much privelege!

I would think the main areas to aim for are:
(1) making input values "user friendly" (e.g. 30:00.00 instead
of 180000)
(2) if you want to run at logon time, look at day of week and
hour of day (or load on machine?) then calculate a limit for
the user
(3) installing with privelege - don't forget to lose the symbols
and traceback, else VMS V4 won't let you do this

Incidentally, if you list the macros included in the assembler
modules that I supplied you with, it will become obvious how to
do other things with the entries in the process table - e.g.
change user name, page file quota, ... a real hacker's dream!

                        Best wishes
                        Brian Beesley

Warning on anything using CMKRNL ... all checking for illegal
addresses etc is removed in kernel mode. Therefore any code which
does anything daft in kernel mode will very probably cause the
machine to lie down and stick its feet in the air, maybe even
destroying a disk or two before finally coming to rest.

Dependencies in the code I supplied are as follows:

CPUR.MAR & CPUW.MAR *must* be recompiled if a new release of the
operating system contains a modified SYS$LIBRARY:MACROLIB.MLB

The image *must* be relinked if SYS$SYSTEM:SYS.STB has been updated
(or following recompilation of the .MAR files)

The Fortran bit probably never needs to be recompiled. Old, old .OBJ's
created under VMS V1 still seem to link OK, though you might get better
code from the optimizer by recompiling with a later version.

As regards future compatibility, there's nothing in the code which DEC
could take out without a complete restructure of the OS. So far as
process tables are concerned, this did in fact happen between VMS V3
and V4 but the code still works. This bodes well for the future, although
I am of course not in a position to answer for the VMS development team!
(Of course, LOGINOUT.EXE does something similar to create the process
table entries in the first place, by reading values from SYSUAF and
stuffing them into the table slots. So long as it is possible to create
a process table entry in this way, it must be possible to change it
afterwards).

                             Brian Beesley

p.s. You've probably guessed that the call to CPUR is, in fact, for
reassurance only and is not neccessary to merely set the CPU limit.

pps. If you're relatively new to VAX, a couple of hours spent in a quiet
corner with the System Services and Run-Time Library manuals will prove
to be time well spent. Leave I/O till later, it's less neccessary (unless
you're into comms in a big way) and a lot harder to get a grip on.
---------------

   Thanks also to Jeremy Skelton, London School of Economics, who had
a C program, but we were already well on the way by the time his offer
arrived.


=============   UWO CCS CODE NOW FOLLOWS        ============    (Brent)

-------------   TIME_LIMIT.C    ---------------------
#include <stdio.h>
#include <ssdef.h>
#include <jpidef.h>
#include <ctype.h>
#include "accounting.h"
#include "$quidef.h"
#include "$jbcdef.h"
#include "descript.h"

static int jpi_cputim, junk;
static int name_len, search_flags;
static char queue_name[32];

static struct iolist jpilist[] = {
        {4,JPI$_CPUTIM,&jpi_cputim,&junk},
        {0,0,0,0}};

static struct iolist quilist[] = {
        {4,QUI$_SEARCH_FLAGS,&search_flags,0},
        {31,QUI$_QUEUE_NAME,queue_name,&name_len},
        {0,0,0,0}};

main(argc,argv)

int argc;
char *argv[];
    {
    int cputime, delta_time;
    int limit_hr, limit_min, limit_sec, limit_hsec;
    int now_hr, now_min, now_sec, now_hsec;
    int temp, test_len;
    char char_test[20];

    struct IO_STATUS_BLOCK iosb;

    search_flags = QUI$M_SEARCH_THIS_JOB;

    SYS$GETQUIW(0,                      /* No event flag        */
                QUI$_DISPLAY_JOB,       /* Function code        */
                0,                      /* Reserved for Dec     */
                &quilist,               /* Item list:a structure*/
                &iosb,                  /* IO status block      */
                0,                      /* No AST routine       */
                0);                     /* No AST paramater     */

    if(name_len > 0)
        {
        fprintf(stdout,"UWOCC-W-NBQ Set_time not implemented for Batch queues\n"
        exit();
        }

    if(argc < 2)
        {
        fprintf(stderr,"UWOCC-F-Insuficient parameters\n");
        exit();
        }

    sprintf(char_test,argv[1]);
    test_len = strlen(char_test);
    for(temp = 0;temp < test_len;temp++)
        {
        if(isalpha(char_test[temp]))
            {
            fprintf(stdout,"UWOCC-F-NNINPT Non numeric input\n");
            exit();
            }
        }

    sscanf(argv[1],"%d",&cputime);

    if (cputime == 0)
        {
        delta_time = 0;
        cpuw(&delta_time);
        cpur(&delta_time);


        fprintf(stdout,"Time set to infinite \n");
        }
    else
        {
        SYS$GETJPI(0,0,0,       /* No event flag, same job      */
                   &jpilist,    /* Item list                    */
                   0,0,0);      /* No IO status block or AST    */

        delta_time = jpi_cputim + (cputime * 60 * 100);
        cpuw(&delta_time);
        cpur(&delta_time);

        now_hr  = jpi_cputim / 360000;
        temp    = jpi_cputim - (now_hr * 360000);
        now_min = temp /6000;
        temp    = temp - (now_min * 6000);
        now_sec = temp / 100;
        now_hsec = temp - (now_sec * 100);

        limit_hr  = delta_time / 360000;
        temp      = delta_time - (limit_hr * 360000);
        limit_min = temp / 6000;
        temp      = temp - (limit_min * 6000);
        limit_sec = temp / 100;
        limit_hsec = temp - (limit_sec * 100);


        fprintf(stdout,"Cpu time %02d:%02d:%02d.%02d     Limit time %02d:%02d:%0
                        now_hr, now_min, now_sec, now_hsec,
                        limit_hr, limit_min, limit_sec, limit_hsec);
        }
    }
-------------   CPUR.MAR        ----------------------
    .TITLE    CPUR
    .LIBRARY /SYS$LIBRARY:LIB/
    $PCBDEF
    $PHDDEF
CPU:     .LONG     0
CPUR::   .WORD
    $CMKRNL_S CPURF,
    MOVL CPU,@4(AP)
    RET
CPURF:   .WORD
    MOVL @#SCH$GL_CURPCB,R0
    MOVL PCB$L_PHD(R0),R0
    MOVL PHD$L_CPULIM(R0),CPU
    RET
    .END
-------------   CPUW.MAR        ----------------------
    .TITLE    CPUW
    .LIBRARY /SYS$LIBRARY:LIB/
    $PCBDEF
    $PHDDEF
CPU:     .LONG     0
CPUW::   .WORD
    MOVL @4(AP),CPU
    $CMKRNL_S CPUWF,
    RET
CPUWF:   .WORD
    MOVL @#SCH$GL_CURPCB,R0
    MOVL PCB$L_PHD(R0),R0
    MOVL CPU,PHD$L_CPULIM(R0)
    RET
    .END
-------------   $JBCDEF.H       ----------------------
/* File: $jbcdef.h              */

#define JBC$_FACILITY  4

/*                                                                          */
/* THE FOLLOWING CODES ARE RETURNED BY THE $SNDJBC, $GETQUI, $SNDJBC, AND $SNDSM
/* SYSTEM SERVICES, OR PLACED IN THE ACCOUNTING FILE.                       */
/*                                                                          */
/* THESE VALUES ARE PUBLIC AND MUST NOT CHANGE FROM RELEASE TO RELEASE.     */
/*                                                                          */
/* NOTE:        ERROR CODES WITH ASSOCIATED TEXT OF <> ARE RETIRED ERROR CODES A
/*      A SEVERITY LEVEL OF SEVERE.                                         */
/*                                                                          */

#define JBC$_NORMAL  262145           /* <normal success completion>      */
#define JBC$_NOCMKRNL  272386         /* <operation requires CMKRNL privilege> *
#define JBC$_NOOPER  272530           /* <operation requires OPER privilege> */
#define JBC$_NOSYSNAM  272402         /* <operation requires SYSNAM privilege> *
#define JBC$_ILLDEVNAM  294916
#define JBC$_UNSDEVTYP  294924
#define JBC$_ILLFILNAM  294932
#define JBC$_INVQUENAM  294940
#define JBC$_NOPRIV  294946
#define JBC$_NOQUEHDR  294956
#define JBC$_NOQUESPACE  294962
#define JBC$_NOSUCHQUE  294970
#define JBC$_NOSUCHJOB  294978
#define JBC$_NOOPENJOB  294986
#define JBC$_REFERENCED  294994
#define JBC$_STARTED  295002
#define JBC$_INVITMCOD  295012
#define JBC$_INVFUNCOD  295020
#define JBC$_EMPTYJOB  295026
#define JBC$_JOBQUEDIS  295034
#define JBC$_JOBABORT  295044
#define JBC$_ACMINVOP  295052
#define JBC$_INVPARLEN  295060
#define JBC$_TRMMBXUSE  295068
#define JBC$_MAXSYMEXD  295076
#define JBC$_SCTTABFUL  295084
#define JBC$_CREPRCFAL  295092
#define JBC$_SYMNTBFUL  295100
#define JBC$_NODSTQUE  295106
#define JBC$_INVDSTQUE  295116
#define JBC$_JOBDELETE  295124
#define JBC$_NORESTART  295130
#define JBC$_JOBREQUEUE  295140
#define JBC$_QUERESET  295148
#define JBC$_SYSFAIL  295156
#define JBC$_EXECUTING  295162
#define JBC$_INVMSGBUF  295172
#define JBC$_MISREQPAR  295180
#define JBC$_INVPARVAL  295188
#define JBC$_INCQUETYP  295196
#define JBC$_INCDSTQUE  295204
#define JBC$_JOBQUEENA  295210
#define JBC$_NOTASSIGN  295218
#define JBC$_INCOMPLETE  295226
#define JBC$_INVCHANAM  295236
#define JBC$_INVFORNAM  295244
#define JBC$_NOSUCHCHAR  295250
#define JBC$_NOSUCHFORM  295258
#define JBC$_DUPFORM  295266
#define JBC$_INCFORMPAR  295276
#define JBC$_NOSUCHFILE  295282
#define JBC$_DELACCESS  295290
#define JBC$_QUENOTSTOP  295298
#define JBC$_NOMORECHAR  295306
#define JBC$_NOMOREFILE  295314
#define JBC$_NOMOREFORM  295322
#define JBC$_NOMOREJOB  295330
#define JBC$_NOMOREQUE  295338
#define JBC$_NOJOBCTX  295346
#define JBC$_NOQUECTX  295354

/*                                                                          */
/* THE FOLLOWING CODES ARE SIGNALLED TO THE CONSOLE OR BROADCAST TO THE USER'S *
/* TERMINAL BY THE JOB CONTROLLER.                                          */
/*                                                                          */
/* THESE MESSAGES ARE NOT PUBLIC AND MAY CHANGE FROM RELEASE TO REALEASE.   */
/*                                                                          */
/* NOTE:  THE JOB CONTROLLER ABORTS EXECUTION AND RESTARTS ITSELF WHEN A SEVERE
/*       ERROR IS SIGNALLED TO THE CONSOLE.                                 */
/*                                                                          */

#define JBC$_ACCDISERR  295939
#define JBC$_ALLOCMEM  295948
#define JBC$_COMREMJBC  295956
#define JBC$_INVBLOCK  295964
#define JBC$_INVMSG  295970
#define JBC$_NEWQUEUE  295979
#define JBC$_OPEJBCMBX  295988
#define JBC$_PRCREAT  295996
#define JBC$_QUEFORMAT  296000
#define JBC$_REAJBCMBX  296012
#define JBC$_REQUEST  296019
#define JBC$_SETIMR  296026
#define JBC$_SYMCREPRC  296034
#define JBC$_SYMDEL  296042
#define JBC$_WRIRSPMSG  296050
#define JBC$_WRISMBMBX  296058
#define JBC$_NFY_COMPLETE  296067
#define JBC$_NFY_CURRENT  296075
#define JBC$_NFY_HOLD  296083
#define JBC$_NFY_PENDING  296091
#define JBC$_NFY_TIMER  296099
#define JBC$_STRUCT_LEVEL  296107
#define JBC$_DIAGNOSTIC  296112
#define JBC$_DIAG_TEXT  296120
#define JBC$_DIAG_DATA  296128
#define JBC$_RESTRICT  296136
#define JBC$_NFY_FAILURE  296147
#define JBC$_NFY_CPULIM  296155
#define JBC$_NFY_WSVAL  296163
-------------   $QUIDEF.H       ----------------------
/*** MODULE $QUIDEF ***/

/* Get Queue Information Service                                            */
/*                                                                          */
/* NOTE: New items must always be added at the end so users will not have to */
/*       relink.                                                            */
/* Function codes                                                           */

#define QUI$_CANCEL_OPERATION   1      /* Cancel a wildcard operation      */
#define QUI$_DISPLAY_CHARACTERISTIC   2 /* Return characteristic attributes */
#define QUI$_DISPLAY_FILE   3          /* Return file attributes           */
#define QUI$_DISPLAY_FORM   4          /* Return form attributes           */
#define QUI$_DISPLAY_JOB   5           /* Return job attributes            */
#define QUI$_DISPLAY_QUEUE   6         /* Return queue attributes          */
#define QUI$_TRANSLATE_QUEUE   7       /* Validate and translate queue name */
#define QUI$_RESERVED_FUNC_1   8       /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_FUNC_2   9       /* Reserved for Digital use (name may cha

/* Item codes                                                               */

#define QUI$_ACCOUNT_NAME   1          /* Job: Submitter's account name    */
#define QUI$_AFTER_TIME   2            /* Job: /AFTER time                 */
#define QUI$_ASSIGNED_QUEUE_NAME   3   /* Queue: ASSIGN/QUEUE target       */
#define QUI$_BASE_PRIORITY   4         /* Queue: /BASE_PRIORITY n          */
#define QUI$_CHARACTERISTIC_NAME   5   /* Characteristic: Name             */
#define QUI$_CHARACTERISTIC_NUMBER   6 /* Characteristic: Number           */
#define QUI$_CHARACTERISTICS   7       /* Job, queue: /CHARACTERISTICS (c,...) *
#define QUI$_CHECKPOINT_DATA   8       /* Job: Checkpoint data             */
#define QUI$_CLI   9                   /* Job: /CLI filename               */
#define QUI$_COMPLETED_BLOCKS   10     /* Job: Completed blocks including checkp
#define QUI$_CONDITION_VECTOR   11     /* Job: Completion status           */
#define QUI$_CPU_DEFAULT   12          /* Queue: /CPUDEFAULT t             */
#define QUI$_CPU_LIMIT   13            /* Job, queue: /CPUMAXIMUM t        */
#define QUI$_DEVICE_NAME   14          /* Queue: /ON device                */
#define QUI$_ENTRY_NUMBER   15         /* Job: Entry number                */
#define QUI$_FILE_COPIES   16          /* File: /COPIES n                  */
#define QUI$_FILE_COPIES_CHKPT   17    /* File: File copies checkpoint     */
#define QUI$_FILE_COPIES_DONE   18     /* File: File copies completed      */
#define QUI$_FILE_FLAGS   19           /* File: Boolean information        */
#define QUI$_FILE_SETUP_MODULES   20   /* File: /SETUP (module,...)        */
#define QUI$_FILE_SPECIFICATION   21   /* File: Full file specification    */
#define QUI$_FILE_STATUS   22          /* File: Status information         */
#define QUI$_FIRST_PAGE   23           /* File: /PAGES (n,"")              */
#define QUI$_FORM_DESCRIPTION   24     /* Form: /DESCRIPTION string        */
#define QUI$_FORM_FLAGS   25           /* Form: Boolean information        */
#define QUI$_FORM_LENGTH   26          /* Form: /LENGTH n                  */
#define QUI$_FORM_MARGIN_BOTTOM   27   /* Form: /MARGIN BOTTOM n           */
#define QUI$_FORM_MARGIN_LEFT   28     /* Form: /MARGIN LEFT n             */
#define QUI$_FORM_MARGIN_RIGHT   29    /* Form: /MARGIN RIGHT n            */
#define QUI$_FORM_MARGIN_TOP   30      /* Form: /MARGIN TOP n              */
#define QUI$_FORM_NAME   31            /* Form, job, queue: Form name      */
#define QUI$_FORM_NUMBER   32          /* Form: Number                     */
#define QUI$_FORM_SETUP_MODULES   33   /* Form: /SETUP (module,...)        */
#define QUI$_FORM_STOCK   34           /* Form: /STOCK stock-name          */
#define QUI$_FORM_WIDTH   35           /* Form: /WIDTH n                   */
#define QUI$_GENERIC_TARGET   36       /* Queue: /GENERIC (queue-name,...) */
#define QUI$_INTERVENING_BLOCKS   37   /* Job: Intervening pending blocks  */
#define QUI$_INTERVENING_JOBS   38     /* Job: Intervening pending jobs    */
#define QUI$_JOB_COPIES   39           /* Job: /JOB_COUNT n                */
#define QUI$_JOB_COPIES_CHKPT   40     /* Job: Job copies checkpoint       */
#define QUI$_JOB_COPIES_DONE   41      /* Job: Job copies completed        */
#define QUI$_JOB_FLAGS   42            /* Job: Boolean information         */
#define QUI$_JOB_LIMIT   43            /* Queue: /JOB_LIMIT n              */
#define QUI$_JOB_NAME   44             /* Job: Name                        */
#define QUI$_JOB_RESET_MODULES   45    /* Queue: /SEPARATE RESET (module,...) */
#define QUI$_JOB_SIZE   46             /* Job: Total blocks in job         */
#define QUI$_JOB_SIZE_MAXIMUM   47     /* Queue: /BLOCK_LIMIT n            */
#define QUI$_JOB_SIZE_MINIMUM   48     /* Queue: /BLOCK_LIMIT (n,"")       */
#define QUI$_JOB_STATUS   49           /* Job: Status information          */
#define QUI$_LAST_PAGE   50            /* File: /PAGES n                   */
#define QUI$_LIBRARY_SPECIFICATION   51 /* Queue: /LIBRARY file-specification */
#define QUI$_LOG_QUEUE   52            /* Job: /PRINTER queue-name         */
#define QUI$_LOG_SPECIFICATION   53    /* Job: /LOG_FILE file-specification */
#define QUI$_NOTE   54                 /* Job: /NOTE string                */
#define QUI$_OPERATOR_REQUEST   55     /* Job: /OPERATOR string            */
#define QUI$_OWNER_UIC   56            /* Queue: /OWNER uic                */
#define QUI$_PAGE_SETUP_MODULES   57   /* Form: /PAGE_SETUP (module,...)   */
#define QUI$_PARAMETER_1   58          /* Job: /PARAMETER string           */
#define QUI$_PARAMETER_2   59
#define QUI$_PARAMETER_3   60
#define QUI$_PARAMETER_4   61
#define QUI$_PARAMETER_5   62
#define QUI$_PARAMETER_6   63
#define QUI$_PARAMETER_7   64
#define QUI$_PARAMETER_8   65
#define QUI$_PRIORITY   66             /* Job: /PRIORITY n                 */
#define QUI$_PROCESSOR   67            /* Queue: /PROCESSOR filename       */
#define QUI$_PROTECTION   68           /* Queue: /PROTECTION mask          */
#define QUI$_QUEUE_FLAGS   69          /* Queue: Boolean information       */
#define QUI$_QUEUE_NAME   70           /* Job, queue: Queue name           */
#define QUI$_QUEUE_STATUS   71         /* Queue: Status information        */
#define QUI$_REFUSAL_REASON   72       /* Job: Reason symbiont refused job */
#define QUI$_REQUEUE_PRIORITY   73     /* Job: Priority after requeue      */
#define QUI$_REQUEUE_QUEUE_NAME   74   /* Job: Queue after requeue         */
#define QUI$_SCSNODE_NAME   75         /* Queue: /ON node::                */
#define QUI$_SEARCH_FLAGS   76         /* Flags to control search          */
#define QUI$_SEARCH_NAME   77          /* Object name to search for         */
#define QUI$_SEARCH_NUMBER   78        /* Object number to search for      */
#define QUI$_SUBMISSION_TIME   79      /* Job: Submission time             */
#define QUI$_UIC   80                  /* Job: Submitter's UIC             */
#define QUI$_USERNAME   81             /* Job: Submitter's username        */
#define QUI$_WSDEFAULT   82            /* Job, queue: /WSDEFAULT n         */
#define QUI$_WSEXTENT   83             /* Job, queue: /WSEXTENT n          */
#define QUI$_WSQUOTA   84              /* Job, queue: /WSQUOTA n           */
#define QUI$_RESERVED_BOOLEAN_1   85   /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_BOOLEAN_2   86   /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_INPUT_1   87     /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_INPUT_2   88     /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_OUTPUT_1   89    /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_OUTPUT_2   90    /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_OUTPUT_3   91    /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_OUTPUT_4   92    /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_OUTPUT_5   93    /* Reserved for Digital use (name may cha
#define QUI$_RESERVED_OUTPUT_6   94    /* Reserved for Digital use (name may cha

/*                                                                          */
/* Structure of FILE_FLAGS item.                                            */
/*                                                                          */

#define QUI$M_FILE_BURST   1
#define QUI$M_FILE_BURST_EXP   2
#define QUI$M_FILE_DELETE   4
#define QUI$M_FILE_DOUBLE_SPACE   8
#define QUI$M_FILE_FLAG   16
#define QUI$M_FILE_FLAG_EXP   32
#define QUI$M_FILE_TRAILER   64
#define QUI$M_FILE_TRAILER_EXP   128
#define QUI$M_FILE_PAGE_HEADER   256
#define QUI$M_FILE_PAGINATE   512
#define QUI$M_FILE_PASSALL   1024
#define QUI$M_FILE_PAGINATE_EXP   2048

/*                                                                          */
/* Structure of FILE_STATUS item.                                           */
/*                                                                          */

#define QUI$M_FILE_CHECKPOINTED   1
#define QUI$M_FILE_EXECUTING   2

/*                                                                          */
/* Structure of FORM_FLAGS item.                                            */
/*                                                                          */

#define QUI$M_FORM_SHEET_FEED   1
#define QUI$M_FORM_TRUNCATE   2
#define QUI$M_FORM_WRAP   4


/*                                                                          */
/* Structure of JOB_FLAGS item.                                             */
/*                                                                          */

#define QUI$M_JOB_CPU_LIMIT   1
#define QUI$M_JOB_FILE_BURST   2
#define QUI$M_JOB_FILE_BURST_ONE   4
#define QUI$M_JOB_FILE_BURST_EXP   8
#define QUI$M_JOB_FILE_FLAG   16
#define QUI$M_JOB_FILE_FLAG_ONE   32
#define QUI$M_JOB_FILE_FLAG_EXP   64
#define QUI$M_JOB_FILE_TRAILER   128
#define QUI$M_JOB_FILE_TRAILER_ONE   256
#define QUI$M_JOB_FILE_TRAILER_EXP   512
#define QUI$M_JOB_LOG_DELETE   1024
#define QUI$M_JOB_LOG_NULL   2048
#define QUI$M_JOB_LOG_SPOOL   4096
#define QUI$M_JOB_LOWERCASE   8192
#define QUI$M_JOB_NOTIFY   16384
#define QUI$M_JOB_RESTART   32768
#define QUI$M_JOB_WSDEFAULT   65536
#define QUI$M_JOB_WSEXTENT   131072
#define QUI$M_JOB_WSQUOTA   262144
#define QUI$M_JOB_FILE_PAGINATE   524288
#define QUI$M_JOB_FILE_PAGINATE_EXP   1048576


/*                                                                          */
/* Structure of JOB_STATUS item.                                            */
/*                                                                          */

#define QUI$M_JOB_ABORTING   1
#define QUI$M_JOB_EXECUTING   2
#define QUI$M_JOB_HOLDING   4
#define QUI$M_JOB_INACCESSIBLE   8
#define QUI$M_JOB_REFUSED   16
#define QUI$M_JOB_REQUEUE   32
#define QUI$M_JOB_RESTARTING   64
#define QUI$M_JOB_RETAINED   128
#define QUI$M_JOB_STARTING   256
#define QUI$M_JOB_TIMED   512


/*                                                                          */
/* Structure of QUEUE_FLAGS item.                                           */
/*                                                                          */

#define QUI$M_QUEUE_BATCH   1
#define QUI$M_QUEUE_CPU_DEFAULT   2
#define QUI$M_QUEUE_CPU_LIMIT   4
#define QUI$M_QUEUE_FILE_BURST   8
#define QUI$M_QUEUE_FILE_BURST_ONE   16
#define QUI$M_QUEUE_FILE_FLAG   32
#define QUI$M_QUEUE_FILE_FLAG_ONE   64
#define QUI$M_QUEUE_FILE_TRAILER   128
#define QUI$M_QUEUE_FILE_TRAILER_ONE   256
#define QUI$M_QUEUE_GENERIC   512
#define QUI$M_QUEUE_GENERIC_SELECTION   1024
#define QUI$M_QUEUE_JOB_BURST   2048
#define QUI$M_QUEUE_JOB_FLAG   4096
#define QUI$M_QUEUE_JOB_SIZE_SCHED   8192
#define QUI$M_QUEUE_JOB_TRAILER   16384
#define QUI$M_QUEUE_RETAIN_ALL   32768
#define QUI$M_QUEUE_RETAIN_ERROR   65536
#define QUI$M_QUEUE_SWAP   131072
#define QUI$M_QUEUE_TERMINAL   262144
#define QUI$M_QUEUE_WSDEFAULT   524288
#define QUI$M_QUEUE_WSEXTENT   1048576
#define QUI$M_QUEUE_WSQUOTA   2097152
#define QUI$M_QUEUE_FILE_PAGINATE   4194304
#define QUI$M_QUEUE_RECORD_BLOCKING   8388608


/*                                                                          */
/* Structure of QUEUE_STATUS item.                                          */
/*                                                                          */

#define QUI$M_QUEUE_ALIGNING   1
#define QUI$M_QUEUE_IDLE   2
#define QUI$M_QUEUE_LOWERCASE   4
#define QUI$M_QUEUE_OPERATOR_REQUEST   8
#define QUI$M_QUEUE_PAUSED   16
#define QUI$M_QUEUE_PAUSING   32
#define QUI$M_QUEUE_REMOTE   64
#define QUI$M_QUEUE_RESETTING   128
#define QUI$M_QUEUE_RESUMING   256
#define QUI$M_QUEUE_SERVER   512
#define QUI$M_QUEUE_STALLED   1024
#define QUI$M_QUEUE_STARTING   2048
#define QUI$M_QUEUE_STOPPED   4096
#define QUI$M_QUEUE_STOPPING   8192
#define QUI$M_QUEUE_UNAVAILABLE   16384


/*                                                                          */
/* Definition of SEARCH_FLAGS                                               */
/*                                                                          */

#define QUI$M_SEARCH_ALL_JOBS   1
#define QUI$M_SEARCH_WILDCARD   2
#define QUI$M_SEARCH_BATCH   4
#define QUI$M_SEARCH_SYMBIONT   8
#define QUI$M_SEARCH_THIS_JOB   16

-------------   ACCOUNTING.H    ------------------
-------------   (from another "C" project)--------

#include <stdio.h>
#include <ssdef.h>
#include <iodef.h>
#include <stsdef.h>
#include <descrip.h>

#define EFN_MBX_INPUT   1       /* event flag for mailbox input         */

#define SUCCESS(cond_value)         (cond_value & STS$M_SUCCESS)
#define FAILURE(cond_value)         !(cond_value & STS$M_SUCCESS)

struct IO_STATUS_BLOCK
        {
        unsigned short      status;
        short               transfer_count;
        unsigned long       device_specific;
        };

#define DSC$K_DTYPE_BU  2
#define DSC$K_CLASS_S   1
#define DVI$_TT_PHYDEVNAM       0x00000112

----------      DESCRIPT.H      ------------

/*      FIXED LENGTH DESCRIPTOR */

struct  fix_len_descript
        {
        short   b_len;
        char    b_dtype;
        char    b_clas;
        char    *b_adr;
        } ;

/*      IOLIST   DESCRIPTOR     */

struct  iolist
        {
        short   item;
        short   buflen;
        long    *bufadr;
        long    *retlen;
        } ;

-------------   TIME_LIMIT.COM  ----------------------
$ !  time_limit.com
$ !  Build time_limit.exe for UWO CCS time limit command.
$ !  Brent Sterner.   March 3 1987.
$ !  Modified by Chris Lee later in March.
$ cc time_limit/lis
$ macro/list cpur
$ macro/list cpuw
$ link/notrace/nodebug time_limit,cpur,cpuw,sys$system:sys.stb
$ purge *.obj, *.exe
$ ! **** end of files ****
$exit
-------------------------
        As a last step, define time_limit as a foreign command to
        run the EXE file, and INSTALL with CMKRNL privileges.
-------------------------
--
Brent Sterner                                    ***********************
Lord Protector,  d i g i t a l  Systems          *                     *
Computing & Communications Services              *   ...this space     *
Natural Sciences Building                        *   for rent...       *
The University of Western Ontario                *   Apply within.     *
London, Ontario, Canada  N6A 5B7                 *                     *
Telephone (519)661-2151 x6036                    ***********************
Network     <BRENT@uwovax.UWO.CDN>  ! VAX 8600
            <A105@UWOCC1.BITNET>    ! IBM 4341