HP OpenVMS Systems

ask the wizard
Content starts here

Correct use of Opaque Arguments? ($getjpi)

» close window

The Question is:

 
I am wondering how GETJPI works in the case of the wildcard being specified for
 process ID.
 
The example given in the System Services manual works, and I guess that some
 internal context is being maintained so that the system knows where in the
 list of processes it is. If this is so, how can I reset this context so that I
 can repeatedly loop thro
ugh the set of processes?
 


The Answer is :

 
  The contents of the PID context are quite deliberately and
  intentionally opaque, save for initialization of the context
  to -1.  (If you wish to repeatedly loop through all processes,
  simply reset the value back to -1 after SS$_NOMOREPROC to
  restart the search.)
 
  "If you give pidadr the value -1, $GETJPI assumes a wildcard
  operation and returns the requested information for each
  process on the system that it has the privilege to access,
  one process per call. To perform a wildcard operation, you
  must call $GETJPI in a loop, testing for the condition value
  SS$_NOMOREPROC after each call and exiting from the loop
  when SS$_NOMOREPROC is returned."
 
  Also note that sys$process_scan may be a better and more
  flexible tool for selecting the processes to scan, and you
  can use available mechanisms such as locks to coordinate among
  cooperating processes -- scanning all processes for specific
  process names can, for instance, easily lead to run-time problems
  if (when) a process name collision occurs.
 

answer written or last revised on ( 21-MAY-2001 )

» close window