0 0 1
default
Jean-Francois Pieronne - 5 years ago 2014-10-20 15:02:57
jf.pieronne@laposte.net
Initial version process_scan.py
1 file changed with 38 insertions and 0 deletions:
↑ Collapse Diff ↑
 
new file 100755
1
 
from vms.starlet import process_scan
2
 
from vms.rtl.lib import getjpi
3
 
from vms.itemList import *
4
 
from vms.pscandef import *
5
 
from vms.jpidef import *
6
 

	
7
 
# loop over all processes with PSCAN-context
8
 
#   supplied in argument 1 (ctx)
9
 
def getjpi_loop(ctx):
10
 
    try:
11
 
        while(1):     # let loop terminate by exception
12
 
            print getjpi(JPI__PRCNAM, ctx)[3]
13
 
    except VMSError, e:         # any exception aborts the loop
14
 
	print e
15
 

	
16
 

	
17
 
# list which processes exist
18
 
def show_processes():
19
 
    ctx = -1
20
 
    print '   ctx      ap    grp prcnam'
21
 
    try:
22
 
        while(1):     # let loop terminate by exception
23
 
            s, ctx, pid, str = getjpi(JPI__PID, ctx)
24
 
            s, x, ap, str = getjpi(JPI__AUTHPRI, pid)
25
 
            s, x, gr, str = getjpi(JPI__GRP, pid)
26
 
            s, x, n, pn = getjpi(JPI__PRCNAM, pid)
27
 
            print '%8X %2d %6o %s' % (pid, ap, gr ,pn)
28
 
    except:         # any exception aborts the loop
29
 
        pass
30
 

	
31
 
show_processes()
32
 

	
33
 
itmlst = [itemList(pscan__GRP, dtype=il_signedLongByValue, value=1, flags=pscan_M_GTR)]
34
 

	
35
 
print 'process_scan test'
36
 

	
37
 
s,ctx = process_scan(0, itmlst)
38
 
getjpi_loop (ctx)
0 comments (0 inline, 0 general)