From:	SMTP%"turion@research.ptt.nl" 23-MAR-1994 08:43:05.68
To:	EVERHART
CC:	
Subj:	part 13 status tool

X-Newsgroups: comp.os.vms
From: turion_s@dnlts0research.ptt.nl. (Paul Turion)
Subject: part 13 status tool
Message-Id: <1994Mar21.144754.2032@news.research.ptt.nl>
Sender: turion_s@research.ptt.nl (Paul Turion)
Nntp-Posting-Host: dnlts0.research.ptt.nl
Reply-To: turion@research.ptt.nl
Organization: PTT Research
X-Newsreader: mxrn 6.18-4
Date: Mon, 21 Mar 1994 14:47:54 GMT
Lines: 394
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET


-- 
 ------- --------------------  			Paul Turion 
| p t t |  r e s e a r c h   |			The Netherlands
|      _|                    | 			e-mail address
|    _|_|   .  .  .  .  .    |			P.Turion@research.ptt.nl
|___|_|      
My interest is in the future because
I am going to spend the rest of my life there.
-+-+-+-+-+-+-+-+ START OF PART 13 -+-+-+-+-+-+-+-+
X   DAE_FULL = 8;  `123 Get interactive processes in full format `125
X   DAE_SYSTEM = 9;  `123 Get all processes in full format `125
X   DAE_STATUS = 64;  `123 Function code to just get the status `125
X
X   DAE_MAX_USER_LEN = 8;  `123 Maximum length for a user name `125
X   DAE_MAX_USERS = 128;  `123 Maximum number of users we will translate `125
X   DAE_MAX_USER_STR = DAE_MAX_USERS * (DAE_MAX_USER_LEN + 1);  `123 Maximum
V size in bytes of matching string `125
X   DAE_MAX_NUM_NODES = 128;  `123 Maximum number of nodes we will translate
V `125
X   DAE_MAX_NODE_LEN = 6;  `123 Maximum length for a node `125
X   DAE_MAX_VER_LEN = 8;  `123 Maximum length of op sys version `125
X   DAE_MAX_CPU_LEN = 4;  `123 Maximum length of cpu type `125
X   DAE_LRL = 80;  `123 Longest record we are going to have `125
X   DAE_MAX_REC = 2560;  `123 Maximum number of data records `125
X
Xtype
X   dae_node_len = `091byte`093 0..DAE_MAX_NODE_LEN;  `123 Byte containing th
Ve length of a node string `125
X   dae_node_num = `091byte`093 0..DAE_MAX_NUM_NODES;  `123 Byte containing t
Vhe number of nodes in record `125
X   dae_user_len = `091word`093 0..DAE_MAX_USER_STR;  `123 Byte containing le
Vngth of the matching string `125
X   dae_record_buffer = packed array `0911..DAE_LRL`093 of char;  `123 Defini
Vtion of record buffer `125
X   dae_record_ptr = `094dae_record_buffer;
X   dae_data = packed array `0911..DAE_MAX_REC`093 of dae_record_ptr;
X
X   dae_data_buf = record
X                     num_rec: integer;
X                     data_buf: dae_data;
X                  end;
X
X   dae_node_rec = record
X                     length: dae_node_len;
X                     node_name: packed array `0911..DAE_MAX_NODE_LEN`093 of
V char;
X                  end;  `123 record `125
X
X   dae_nodes_descr = record
X                        num_nodes: dae_node_num;
X                        node_arr: array `0911..DAE_MAX_NUM_NODES`093 of dae_
Vnode_rec;
X                     end;  `123 record `125
X
X   dae_stats_rec = record
X                      node_name: packed array `0911..DAE_MAX_NODE_LEN`093 of
V char;
X                      opr_sys: packed array `0911..DAE_MAX_VER_LEN`093 of ch
Var;
X                      cpu_type: packed array `0911..DAE_MAX_CPU_LEN`093 of c
Vhar;
X                      boot_time: $uquad;
X                      login_lim: $uword;
X                      inter_proc: $uword;
X                      batch_proc: $uword;
X                      netwrk_proc: $uword;
X                      total_proc: $uword;
X                      load_avg: packed array `0911..3`093 of real;
X                      freepages: unsigned;
X                   end;  `123 record `125
X
X   dae_stats_descr = record
X                        num_stats: dae_node_num;
X                        tot_int: $uword;
X                        tot_bat: $uword;
X                        tot_net: $uword;
X                        tot_prc: $uword;
X                        stat_arr: array `0911..DAE_MAX_NUM_NODES`093 of dae_
Vstats_rec;
X                     end;  `123 record `125
X
X   dae_match_buffer = varying `091DAE_MAX_USER_STR`093 of char;
X
X
Xconst
X  CLI$_ABSENT = %X000381F0;
X  CLI$_PRESENT = %X0003FD19;
X
X
X`091asynchronous, external(cli$get_value)`093
Xfunction cli$get_value(
X             entity_desc: `091class_s`093 packed array `091$l1..$u1:integer`
V093 of char;
X             retdesc: `091class_s`093 packed array `091$l2..$u2:integer`093
V of char;
X             retlength: `091reference`093 $uword := %immed 0
X             ): integer; external;
X
X
X`091asynchronous, external(cli$present)`093
Xfunction cli$present(
X             entity_desc: `091class_s`093 packed array `091$l1..$u1:integer`
V093 of char
X             ): integer; external;
X
X
X`091asynchronous, external(lib$signal)`093
Xprocedure lib$signal(condition_value: unsigned); external;
X
X
X`091asynchronous, external(str$trim)`093
Xfunction str$trim(
X             new_string: `091class_s`093 packed array `091l1..u1:integer`093
V of char;
X             old_string: `091class_s`093 packed array `091l2..u2:integer`093
V of char;
X             str_len: `091reference`093 $uword): integer; external;
X
X
X`091asynchronous, external(lib$getsyi)`093
Xfunction lib$getsyi(
X            item_code: `091reference`093 unsigned;
X            out_value: `091reference`093 unsigned := %immed 0;
X            out_string: `091class_s`093 packed array `091l1..u1:integer`093
V of char;
X            out_len: `091reference`093 $uword;
X            csid: `091reference`093 unsigned := %immed 0;
X            node_name: `091class_s`093 packed array `091l2..u2:integer`093 o
Vf char := %immed 0
X            ): integer; external;
X
X
X`091external`093 function dae_getinfo(
X              func: `091immediate`093 unsigned;
X              nodes: `091reference`093 dae_nodes_descr;
X              users: `091class_s`093 packed array `091l1..u1:integer`093 of
V char
X              ): boolean; external;
X
X
X`091external`093 procedure what_uptime(
X              boot_time: `091reference`093 $uquad;
X              up_string: `091class_s`093 packed array `091l1..u1:integer`093
V of char;
X              len: $uword); external;
X
X
X`091external`093 procedure what_trnlnm(
X              nodes: `091reference`093 dae_nodes_descr;
X              log_name: `091class_s`093 packed array `091l1..u1:integer`093
V of char
X              ); external;
X
X
X`091external`093 procedure what_retnodes(nodes: `091reference`093 dae_nodes_
Vdescr); external;
X
X
X`091external`093 procedure what_buildusers(
X              users: `091class_s`093 packed array `091l1..u1:integer`093 of
V char;
X              user_name: `091class_s`093 packed array `091l2..u2:integer`093
V of char;
X              len: `091reference`093 $uword
X              ); external;
X
X`091external`093 procedure what_sort(
X              data: `091reference`093 dae_data;
X              num: `091immediate`093 integer;
X              func: `091immediate`093 unsigned); external;
X
X
Xend.  `123 whatdefs `125
$ CALL UNPACK WHAT_DEFS.PAS;1 1241871733
$ create/nolog 'f'
X;***************************************************************************
V****
X;* Title:        What_look *
X;* *
X;* Version:      2-000 *
X;* *
X;* Facility:     System information formating and requests. *
X;* *
X;* Abstract:     This module contains the procedure that requests the proces
Vs *
X;*               information from the system and formats it as follows: *
X;* *
X;*  Full Format: *
X;* *
X;*  Username Pid  Process Name     Group   Term   Login State Cpu    Program
V *
X;*  ------------------------------------------------------------------------
V- *
X;*  ABC1234X xxxx abcdefghijklmno ABCDEFG ABxxxx: XX:XX ABCDE XXXX K ABCDEFG
VH *
X;* *
X;* *
X;*  Brief Format: *
X;* *
X;*  Username   Node     PID     Process Name     Terminal *
X;*  ABC1234   ABCDEF  2AE008FB  abcdefghijklmno  ABCxxx: *
X;* *
X;* Environment:  What_look is non-reentrant since it is written in MACRO wit
Vh- *
X;*               out useing the stack to store variables.  You can pass it a
Vn *
X;*               an address of a channel or buffer descriptor of where to pu
Vt *
X;*               information it gathers.  It needs WORLD privilege in order
V to *
X;*               look at all the processes on the system for their stats.  I
Vt *
X;*               does not return any information unless it finds processes *
X;*               that it can get the information on with out privilege. *
X;* *
X;* Author:       Andrew W. Potter, 198? *
X;* *
X;* Modified by:  Dave P. Mulvihill: 1986 *
X;*                 - Changed output so it can go down a given channel *
X;* *
X;*               Peter A. Portante: February, 1988 *
X;*                 - Broke entire routine down in to smaller modules. *
X;*                 - Rewrote FORTRAN subroutines in MACRO, just for fun *
X;*                 - Changed the language from FORTRAN to MACRO, just for fu
Vn *
X;*                 - Removed original internal sort routine. *
X;*                 - Eliminated double looping to search for system processe
Vs. *
X;*                   Now the process is totally parsed together on one pass
V *
X;*                   through the loop and sent to the appropriate place. *
X;*                 - Can either send down given channel or put into a users
V *
X;*                   buffer. *
X;*                 - Status returns for the system have been moved to anothe
Vr *
X;*                   module. *
X;* *
X;***************************************************************************
V****
X;
X                .title  WHAT_LOOK
X;
X                $iodef                          ; Get the system definitions
X                $ssdef
X                $jpidef
X                $dvidef
X                $syidef
X;
XSCH$C_COLPG   = 1
XSCH$C_MWAIT   = 2
XSCH$C_CEF     = 3
XSCH$C_PFW     = 4
XSCH$C_LEF     = 5
XSCH$C_LEFO    = 6
XSCH$C_HIB     = 7
XSCH$C_HIBO    = 8
XSCH$C_SUSP    = 9
XSCH$C_SUSPO   = 10
XSCH$C_FPG     = 11
XSCH$C_COM     = 12
XSCH$C_COMO    = 13
XSCH$C_CUR     = 14
X;
XDAE_M_CHANNEL = 128                             ; Mask for the channel
XDAE_M_NODE = 16                                 ; Mask for adding in the nod
Ve
XDAE_BRIEF = 0                                   ; Send user processes in bri
Vef format
XDAE_SYSTEM = 9                                  ; Send all processes in full
V format
XDAE_FULL = 8                                    ; Send user processes in ful
Vlformat
X;
XINFO_SIZE = 24000                               ; 300 80 byte lines
XALL_PROC = 0                                    ; Get all processes
XINT_ONLY = 3                                    ; Get only interactive proce
Vsses
X;
XSUBPROC = 4                                     ; We have a subprocess here.
V..
X;
X;
X;
X                .psect  what_look_data, con, noexe, lcl, pic, noshr, wrt, rd
V,rel
X;
X;       Data storage for building the nodes
X;
Xbuffer:         .blkb   INFO_SIZE               ; Size of the information bl
Vock to hold user strings
Xbuffer_desc:    .long   0                       ; Length of the buffer
X                .address buffer                 ; Address of where the buffe
Vris
X;
X;       The table is used by MOVTC to translate characters.
X;
Xtable:          .byte   32`09133`093
X                .ascii  `126!"#$%&'()*+,-./0123456789:;<=>?@`126
X                .ascii  /ABCDEFGHIJKLMNOPQRSTUVWXYZ`091\`093`094_`096/
X                .ascii  /abcdefghijklmnopqrstuvwxyz`123`124`125`126/
X                .byte   32`09134`093
X                .byte   161,162,163,32,165,32,167,168,169,170,171
X                .byte   32`0914`093,176,177,178,179,32,181,182,183,32
X                .byte   185,186,187,188,189,32,191,192,193,194,195,196,197
X                .byte   198,199,200,201,202,203,204,205,206,207,32
X                .byte   209,210,211,212,213,214,215,216,217,218,219,220
X                .byte   221,32,223,224,225,226,227,228,229,230,231,232,233
X                .byte   234,235,236,237,238,239,32,241,242,243,244,245,246
X                .byte   247,248,249,250,251,252,253,32,32
X;
Xnull_time:      .ascii  / --- /
Xnull_cpu:       .ascii  / ---/
Xsuspnd_str:     .ascii  /Suspended/
Xswapped_str:    .ascii  /Swapped  /
X;
Xchar_state_arr: .ascii  /CPG/                   ; Character string represent
Vations
X                .ascii  /MWT/                   ; - of the different process
X                .ascii  /CEF/                   ; - states
X                .ascii  /PFW/
X                .ascii  /LEF/
X                .ascii  /LEF/
X                .ascii  /HIB/
X                .ascii  /HIB/
X                .ascii  /SUS/
X                .ascii  /SUS/
X                .ascii  /FPG/
X                .ascii  /COM/
X                .ascii  /COM/
X                .ascii  /CUR/
X                .ascii  /   /
X;
Xchar_mode_arr:  .ascii  /-Det- /                ; Character string for the d
Vifferent process modes
X                .ascii  /-Net- /
X                .ascii  /-Bat- /
X                .ascii  /-Disc-/
X                .ascii  /-Sub- /
X;
Xctrl_brief:     .ascid  / !AD  !+!+!XL  !AF  !+!+!AD/              ; Skip th
Venodename, and the group
Xctrl_full:      .ascid  /!AD !+!+!XW !AF !AD !AD !AD !AD !AD !AD/  ; Skip th
Venodename
Xctrl_brief_node: .ascid / !AD  !AD  !XL  !AF  !+!+!AD/             ; Skip th
Vethe group
Xctrl_full_node: .ascid  /!AD !AD !XW !AF !AD !AD !AD !AD !AD !AD/
X;
Xctrl_list:      .address ctrl_brief             ; List of the different stri
Vng formats
X                .address ctrl_full
X                .address ctrl_brief_node
X                .address ctrl_full_node
X;
Xnode:           .byte   32`0916`093                   ; Where the DECnet nod
Ve name is stored
Xstrings_to_blank:                               ; All these are cleared for
V cleanlyness
Xusername:       .byte   32`0918`093                   ; User name from JPI
Xaccount:        .byte   32`0918`093                   ; Account from JPI
Xterm:           .byte   32`09116`093                  ; Terminal name return
Ved
Ximage:          .byte   32`091128`093                 ; Image name of the pr
Vocess
Xprcnam:         .byte   32`09115`093                  ; Process name returne
Vd
X;
Xname_only:      .byte   32`09117`093                  ; Actuall image name,
V with out rms stuff
Xoutstr:         .byte   32`091256`093                 ; Output string from t
Vhe SYS$FAO service
X;
Xchar_time:      .byte   32`09120`093                  ; Character representa
Vtion ofthe time
Xchar_state:     .byte   32`0913`093                   ; Character representa
Vtion ofthe state
Xchar_cpu:       .byte   32`0914`093                   ; Character representa
Vtion ofthe cpu time
X;
XBYTES_TO_BLANK = . - strings_to_blank
X;
Ximage_descr:    .long   0                       ; Length of the image
X                .address image                  ; Where the image is
Xterm_descr:     .long   0                       ; Length of the terminal
X                .address term                   ; Where the terminal is
X;
Xowner:          .long   0                       ; Owner of the process
Xstate:          .long   0                       ; State the process is in
Xcpu_time:       .long   0                       ; Cpu time for process
X                .long   0
Xlogin_time:     .long   0                       ; Login time for the process
X                .long   0
+-+-+-+-+-+-+-+-  END  OF PART 13 +-+-+-+-+-+-+-+-

