The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

VMS::Process - Manage processes and retrieve process information on OpenVMS systems

SYNOPSIS

  use VMS::Process;

Routines to manage processes:

  @pid_list = process_list([@process_characteristics]);
  $WorkedOK = suspend_process($pid);
  $WorkedOK = release_process($pid);
  $WorkedOK = kill_process($pid);
  $WorkedOK = change_priority($pid, $priority);
  @char_list = valid_process_chars();

Routine to return a reference to a hash with all the process info for the process loaded into it:

  $procinfo = VMS::Process::get_all_proc_info_items(pid);
  $diolimit = $procinfo->{DIOLM};

Fetch a single piece of info:

  $diolm = VMS::Process::get_one_proc_info_item(pid, "DIOLM");

Decode a bitmap into a hash filled with names, with their values set to true or false based on the bitmap.

  $hashref = VMS::Process::decode_proc_info_bitmap("CREPRC_FLAGS", Bitmap);
  $hashref->{BATCH};

Get a list of valid info names:

  @InfoNames = VMS::Process::proc_info_names;

DESCRIPTION

VMS::Process allows a perl program to get a list of some or all the processes on one or more nodes in the cluster, change process priority, suspend, release, or kill them. Normal VMS system security is in effect, so a program can't see or modify processes that the process doesn't have the privs to see.

Narrowing down the PID list from process_list()

process_list uses the VMS $PROCESS_SCAN system service to narrow down the list of PIDs that it returns. Normally, a full-wildcard scan is done, returning all the PIDs for all the cluster nodes that your process has privileges to see. Oftentimes, though, you'll get more PIDS than you really want.

The process_list function takes an optional reference to a list with the characteristics of the processes whose pids will be returned. Each element of the list is a hash struct with required NAME and VALUE elements, and optional COMPARISION and MODIFIER elements.

The NAME element is the name of the thing you want to select on. They're the names of the constants that $PROCESS_SCAN takes, minus the leading PSCAN$_. A list is available from the process_list_names() function.

Some of the items you can select on, specifically JOBTYPE, MODE, and STATE, take symbolic values instead of integers. Rather than having to figure out what the constant SCH$C_MWAIT really is, you can use "MWAIT" instead.

The VALUE element is the value being compared to. It will be used either in an integer or string context, depending on what NAME is.

The COMPARISON element specifies what sort of comparison should be made. The choices are gt, lt, eq, le, ge, and ne, for greater than, less than, equal, less than or equal, greater than or equal, or not equal.

If the COMPARISON element is not specified, eq is assumed.

The MODIFIER element specifies the special things that affect this list item. They are pre, *, |, &&, ||, and I. pre indicates the list item is a prefix, and tacks on an implicit trailing *. * indicates the item has one or more wildcards in it, and VMS should do wildcard matching. | indicates this entry should be ORd with the next entry. && is a bitwise AND, and || is a bitwise OR (valid only for bitmask items). I makes comparisons case insensitive, and is valid only for string comparisions.

The standard VMS wildcards are used--* for any characters, and % for one character. Sorry, no Perl regexps.

Getting valid NAME names

The function process_list_names() returns a list of all the valid names that can be used as elements for the process_list() function.

BUGS

May leak memory. May not, though.

While process_list is supposed to take a hash ref, right now it doesn't. You get all the pids for the processes on the cluster that you would normally have privs to see.

LIMITATIONS

The list is built and passed to $PROCESS_SCAN in the order that they're passed to process_list. This means you must follow the rules and limitations of $PROCESS_SCAN. The biggest being that OR'd items must be of the same type. (No ORing NODENAME and USERNAME, for example)

Currently only one modifier may be used for each item.

VMS system security is in force, so process_list() is likely to show fewer PIDs than SHOW SYSTEM will. Nothing we can do about that, short if INSALLing Perl with lots of privs, which is a really, really bad idea, so don't.

No object or tied hash interface just yet.

Quadword values are returned as string values rather than integers.

Privilege info's not returned. Use VMS::Priv for that.

List info (rightslist and exceptions vectors) are not returned.

The bitmap decoder doesn't grok the CURRENT_USERCAP_MASK, MSGMASK, or PERMANENT_USERCAP_MASK fields, as I don't know where the bitmask defs for them are in the header files. When I do, support will get added.

AUTHOR

Dan Sugalski <dan@sidhe.org>

Craig A. Berry <craigberry@mac.com>

SEE ALSO

perl(1)