The Question is:
What item(s) in a call to $GETJPI will cause an outswapped process to be
swapped back in? I wrote a SHOW SYSTEM command that also includes executing
image, node, and username, but every time I run it, outswapped processes get
swapped back in.
The Answer is :
Any $GETJPI item which requires access to the process private address space
will necessarily require an inswap. In your case the likely culprit is
the image name. Get hold of an internals manual, and see what's available
from the PCB and JIB data structures. Since these live in system space,
they can be directly read by a suitably privileged process. Anything else
requires a special Kernel Mode AST to be sent to the process to read
data from the context of the process itself.
You may want to consider reading only externally accessible information
first, including the process state. Make a second call to $GETJPI to gather
the other fields of interest, but only if the process is not currently
outswapped. Notice that SHOW SYSTEM displays "-- swapped out --" instead
of I/O count, CPU time and pagefault count for precisely this reason.
For OpenVMS V7.2 and higher, the item JPI$_GETJPI_CONTROL_FLAGS can be used
to control the effect of a $GETJPI on the target process. For example,
JPI$M_NO_TARGET_INSWAP will prevent inswapping (those items which would
have required an inswap will be returned with zero length).
JPI$M_NO_TARGET_AST supresses the Kmode AST regardless of process state
See the documentation for full details.