.title WHAT_STATUS ; .psect what_status_data, noexe, pic, noshr, lcl, wrt, rd, rel, con ; $syidef ; Get $GETSYI definitions ; ijoblim: .address sys$gw_ijoblim ijobcnt: .address sys$gw_ijobcnt bjobcnt: .address sys$gw_bjobcnt njobcnt: .address sys$gw_njobcnt proccnt: .address sch$gw_proccnt freecnt: .address sch$gl_freecnt ; MAX_NODE_LEN = 6 ; Length of a node name MAX_VER_LEN = 8 ; Length of the op sys version MAX_CPU_LEN = 4 ; Lenght of the cpu type ; device: .ascid /LAV0:/ ; Device we talk to for load info assigned: .byte 0 ; Whether we have assign a channel yet load_chan: .long 0 ; The channel to the load average device iosblk: .quad 0 ; IO status block ; stat_buf: node: .blkb MAX_NODE_LEN ; Maximum node length version: .blkb MAX_VER_LEN ; Suggested amount to reserve for version, $GETSYI cpu_type: .blkb MAX_CPU_LEN ; Suggested amount to reserve for type of cpu, $GETSYI CHAR_PART_LEN = . - node ; How long the character fields total boot_time: .quad 0 ; Boot time of processor, $GETSYI job_lim: .word 0 ; Maximum number of users int_cnt: .word 0 ; Number of interactive processes bat_cnt: .word 0 ; Number of batch processes net_cnt: .word 0 ; Number of network processes tot_cnt: .word 0 ; Total number of processes load_avg: .float -1 ; Load average, 1 5 15 minute intervals .float -1 .float -1 freepages: .long 0 ; Number of memory pages free STAT_LEN = .-stat_buf ; How long is our status buffer ; stat_descr: .long STAT_LEN ; Length of the information .address stat_buf ; Where information is ; temp_node: .blkb 15 ; Temporary place to hold the node l_node: .long 0 ; Actual length of the node l_ver: .long 0 ; Actual length of the op sys version l_cpu: .long 0 ; Actual length of the cpu type retlength: .long 0 ; Dummy return length ; syi_list: .word 15 ; Suggested length of the buffer .word SYI$_NODENAME ; We want the node name .address temp_node ; Temporary place to put the node .address l_node ; How long the node is ; .word 8 ; Boot time is a quad word, 8 bytes .word SYI$_BOOTTIME ; We want the boot time .address boot_time ; Where to put the boot time .address retlength ; Always a 8 byte field ; .word MAX_VER_LEN ; Suggested length of buffer .word SYI$_VERSION ; We want the op sys version .address version ; Where to put the version .address l_ver ; Length actually returned ; .word MAX_CPU_LEN ; Suggested length of the buffer .word SYI$_NODE_HWTYPE ; We want the cpu type .address cpu_type ; Where to put the cpu type .address l_cpu ; Length actually returned ; .long 0 ; End of item list ; ; ; ;******************************************************************************* ;* Status * ;* This procedure talks to the system device to get the load average. * ;* It then moves all nescessary information out of system space and into our * ;* little buffer. If the second argument is odd, we use the first argument as * ;* the address of a channel to send the information on. If second argument is * ;* even, we use the first argument as the address of buffer of where to put * ;* the information. The format of the record we send is: * ;* * ;* Field Bytes * ;* +------------------+---------+ * ;* | node | 0 - 5 | * ;* +------------------+---------+ * ;* | op sys version | 6 - 13 | * ;* +------------------+---------+ * ;* | cpu type | 14 - 17 | * ;* +------------------+---------+ * ;* | boot time | 18 - 25 | * ;* +------------------+---------+ * ;* | max # of proc | 26 - 27 | * ;* +------------------+---------+ * ;* | interactive proc | 28 - 29 | * ;* +------------------+---------+ * ;* | batch proc | 30 - 31 | * ;* +------------------+---------+ * ;* | network proc | 32 - 33 | * ;* +------------------+---------+ * ;* | total proc | 34 - 35 | * ;* +------------------+---------+ * ;* | load average | 36 - 47 | * ;* +------------------+---------+ * ;* | freepages | 48 - 51 | * ;* +------------------+---------+ * ;******************************************************************************* ; .psect what_status_code, con, exe, lcl, shr, nowrt, pic, rel ; .entry what_status, ^m ; movl 4(ap), r9 ; Save the channel or buffer to send info on movl 8(ap), r10 ; Move whether we want a channel of a buffer ; movw @ijoblim, job_lim ; Move maximum number of users allowed movw @ijobcnt, int_cnt ; Move number of interactive jobs movw @bjobcnt, bat_cnt ; Move number of batch jobs movw @njobcnt, net_cnt ; Move number of network jobs movw @proccnt, tot_cnt ; Move total number of processes movl @freecnt, freepages ; Return the number of free pages ; tstb assigned ; Have we assigned a channel yet bneq cont ; If we have, continue on... ; $assign_s - ; Assign chan to load function devnam = device, - chan = load_chan movb #1, assigned ; Set that we have been here ; cont: $qiow_s - ; Talk to the function chan = load_chan, - ; Channel for the load average func = #IO$_READVBLK, - ; Read the load average p1 = load_avg, - ; Where to put them p2 = #12 ; Length in bytes to put load ; movc5 #0,#0,#32,#CHAR_PART_LEN,node ; Blank out the version string $getsyiw_s - itmlst = syi_list ; Get the specified info ; movc5 l_ver, version, #32, #MAX_VER_LEN, version movc5 l_cpu, cpu_type, #32, #MAX_CPU_LEN , cpu_type movc5 l_node, temp_node, #32, #MAX_NODE_LEN, node ; bbc #7, r10, use_buffer $qiow_s - chan = (r9), - ; What channel to write to func = #IO$_WRITEVBLK,- ; Write out the line iosb = iosblk, - ; Status of operation p1 = stat_buf, - ; Where to write from p2 = #STAT_LEN ; Length of bytes to put out movzwl iosblk, r0 ; Return the status condition ret ; Possibly successful ; use_buffer: movc3 #STAT_LEN, stat_buf, (r9) movl #1, r0 ; Always successful ret ; End of What_status ; .end