(go to: table of contents, index, list of vms_sys, prev: NUMUTC, next: PURGWS)
Format:
Examples:
PROCESS_SCAN - Process Scan
Creates and initializes a process context that is used by $GETJPI to
scan processess on the local system or across the nodes in a VMScluster system.
pidctx = vms_lib.process_scan (pidctx [,itmlst])
Returns:
Arguments:
$! want to see all processes
$ set PROCESS /PRIVILEGE= (WORLD)
>>> import vms_sys
>>> import vms_pscandef
>>> import vms_lib
>>> # ----------
>>> # define useful procedures
>>> # loop over all processes with PSCAN-context
>>> # supplied in argument 1 (ctx)
>>> def getjpi_loop (ctx):
... try:
... while(1): # let loop terminate by exception
... print vms_lib.getjpi ('JPI$_PRCNAM', ctx) [1]
... except: # any exception aborts the loop
... pass
... # -getjpi_loop()
>>>
>>> # list which processes exist
>>> def show_processes():
... ctx = -1
... print ' ctx ap grp prcnam'
... try:
... while(1): # let loop terminate by exception
... ctx,pid = vms_lib.getjpi ('JPI$_PID',ctx)
... x,ap = vms_lib.getjpi ('JPI$_AUTHPRI',pid)
... x,gr = vms_lib.getjpi ('JPI$_GRP',pid)
... x,pn = vms_lib.getjpi ('JPI$_PRCNAM',pid)
... print '%6d %2d %6o %s' % (ctx,ap,gr,pn)
... # -while
... except: # any exception aborts the loop
... pass
... # -show_processes()
>>>
# ----------
>>> show_processes()
ctx ap grp prcnam
-65535 16 1 SWAPPER
-65533 4 10040 ZESSIN_MBA41
-65531 8 1 IPCACP
-65530 7 1 ERRFMT
-65529 6 1 OPCOM
-65528 8 1 AUDIT_SERVER
-65527 8 1 JOB_CONTROL
-65526 8 1 QUEUE_MANAGER
-65525 8 1 SECURITY_SERVER
-65523 4 10040 ZESSIN_MBA45
-65522 4 10040 ZESSIN_MBA47
-65521 4 37770 CRON-HERE
-65520 6 10040 DECW$SERVER_0
-65519 4 10040 DECW$SESSION
-65518 4 10040 DECW$TE_0092
-65516 4 10040 CLASS_SCHEDULER
-65515 4 10040 ZESSIN_FTA13
-65514 4 10040 ZESSIN_FTA14
-65513 4 10040 ZESSIN_FTA15
-65494 4 10040 DECW$MWM
>>>
>>> # even a single item must be a tuple -------+
>>> # |
>>> # all processes with UIC group > 1 |
>>> ctx = vms_sys.process_scan (0, # v
... (('PSCAN$_GRP', 1,vms_pscandef.PSCAN_M_GTR), )
... )
>>> getjpi_loop (ctx)
ZESSIN_MBA41
ZESSIN_MBA45
ZESSIN_MBA47
CRON-HERE
DECW$SERVER_0
DECW$SESSION
DECW$TE_0092
CLASS_SCHEDULER
ZESSIN_FTA13
ZESSIN_FTA14
ZESSIN_FTA15
DECW$MWM
>>>
>>> ctx = vms_sys.process_scan (0,
... (('PSCAN$_GRP', 1, vms_pscandef.PSCAN_M_GTR),
... ('PSCAN$_PRCNAM', '*_*', vms_pscandef.PSCAN_M_NEQ+
... vms_pscandef.PSCAN_M_WILDCARD)
... )
... )
>>> getjpi_loop (ctx)
CRON-HERE
DECW$SESSION
DECW$MWM
>>>
>>> ctx = vms_sys.process_scan (0,
... (('PSCAN$_GRP', 3, vms_pscandef.PSCAN_M_LSS),
... ('PSCAN$_PRCNAM', '*_*', vms_pscandef.PSCAN_M_WILDCARD)
... )
... )
>>> getjpi_loop (ctx)
AUDIT_SERVER
JOB_CONTROL
QUEUE_MANAGER
SECURITY_SERVER
>>>
24-MAR-1999 ZE.
>>> # see GENMAN 'programming', 'privileges' for details
>>> import vms_prvdef
>>> q_prvmsk = vms_prvdef.PRV_M_BYPASS
>>> print q_prvmsk
536870912L
>>>
>>> ctx = vms_sys.process_scan (0,
... (('PSCAN$_CURPRIV', q_prvmsk, vms_pscandef.PSCAN_M_BIT_ANY),
... )
... )
>>> getjpi_loop (ctx)
SWAPPER
ERRFMT
JOB_CONTROL
QUEUE_MANAGER
DECW$SESSION
CLASS_SCHEDULER
ZESSIN_FTA13
>>>
---------------------------------
>>> ctx = vms_sys.process_scan (0,
... (('PSCAN$_PRCNAM', 'ZESSIN_*' ,vms_pscandef.PSCAN_M_NEQ+
... vms_pscandef.PSCAN_M_WILDCARD),
... ('PSCAN$_PRCNAM', 'DECW$*' ,vms_pscandef.PSCAN_M_NEQ+
... vms_pscandef.PSCAN_M_WILDCARD)
... )
... )
Traceback (innermost last):
File "<stdin>", line 1, in ?
vms_sys.error: (372, '%SYSTEM-F-IVSSRQ, invalid system service request')
>>>
>>> ctx = vms_sys.process_scan (0,
... ((0, 1,vms_pscandef.PSCAN_M_NEQ), )
... )
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: argument 2: itmlst - item:0 item-code must be string
>>>
>>> ctx = vms_sys.process_scan (0,
... (('PSCAN$_GRP', 'ZESSIN_*' ,vms_pscandef.PSCAN_M_NEQ), )
... )
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: argument 2: itmlst - item:0 data must be integer
>>>
>>> ctx = vms_sys.process_scan (0,
... (('PSCAN$_PRCNAM', 1,vms_pscandef.PSCAN_M_NEQ), )
... )
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: argument 2: itmlst - item:0 data must be string
>>>
>>> ctx = vms_sys.process_scan (0,
... (('PSCAN$__BAD', 1,vms_pscandef.PSCAN_M_NEQ), )
... )
Traceback (innermost last):
File "<stdin>", line 1, in ?
ValueError: argument 2: itmlst - unknown item code: PSCAN$__BAD
>>>
(go to: table of contents,
index,
list of vms_sys,
prev: NUMUTC,
next: PURGWS)