From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 30-JUN-1989 19:09
To:	MRGATE::"ARISIA::EVERHART"
Subj:	RE: SYS$GETJPI / ASTs

Message-Id:  <8906302302.AA11173@crdgw1.ge.com>
Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 30 JUN 89 13:35:24 PDT
Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Fri, 30 Jun 89 13:30:02 PDT
Received: from FHCRCVAX.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 6865; Fri, 30 Jun 89 16:29:55 EDT
Date: Fri, 30 Jun 89 13:29 PST
From: Joe Meadows <JOE%FHCRCVAX.BITNET@CUNYVM.CUNY.EDU>
Subject: RE: SYS$GETJPI / ASTs
To: info-vax@kl.sri.com
X-Vms-To: INFO-VAX

>Unfortunately, I don't happen to have a copy.  Could someone give me a
>YES/NO for the following items:     Username, PID, terminal, acctname,
>processname, uic, priority, state, cpu time and connect time.
>Thanks.

Jeff,

The following routine returns the type of an item. It returns 0 for items
grabbed from a structure thats always in memory (like anything in the PCB).
It returns 1 if its an item that is in the process header (if the process
header is swapped out, requesting one of these items will require the process
to get swapped back in), and a 2 if it has to trigger an AST to retireive the
item. Just pass it in the item code.

Username        = 0
PID             = 0
terminal        = 0
acctname        = 0
processname     = 0
uic             = 0
priority        = 0
state           = 0
cpu time        = 1
connect time    = 2 (assuming you mean logintim)

Originally, the item codes reflected where they came from, but they moved
a few things from the process header into the PCB, and they couldn't change
the item codes, hence the slight weirdness in this routine. It's accurate as
of VMS 4.7, I believe it's still fine as of V5.1.

availability(itmcod)
  int itmcod;
{
  int retval,itmtyp;

  retval = 3; /* signify unknown item type handling.. should be impossible */

  itmtyp = itmcod >> 8;
  switch (itmtyp) {
    case JPI$C_JIBTYPE:         /* 7 */
    case JPI$C_PCBFLDTYPE:      /* 5 */
    case JPI$C_PCBTYPE:         /* 3 */
      retval = 0;
      break;
    case JPI$C_PHDTYPE:         /* 4 */
    case JPI$C_PHDFLDTYPE:      /* 6 */
      switch (itmcod) {
        case JPI$_PRCLM:
        case JPI$_PGFLQUOTA:
        case JPI$_PAGFILCNT:
        case JPI$_FILLM:
        case JPI$_TQLM:
          retval = 0;
          break;
        default:
          retval = 1;
          break;
      };
      break;
    default:
      switch (itmcod) {
        case JPI$_USERNAME:
        case JPI$_ACCOUNT:
        case JPI$_MAXDETACH:
        case JPI$_MAXJOBS:
        case JPI$_SHRFILLM:
          retval = 0;
          break;
        default:
          retval = 2;
          break;
      };
      break;
  };
  return(retval);
}

