z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


procinfo()

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-procinfo--(--+------------------+--)------------------------><
                '-pid-+----------+-'      
                      '-,request-'        

Function

Retrieves information about one or more processes.

Parameters

pid
The process ID number of the process for which information is to be returned. If pid is not specified, basic information is retrieved for all processes you have authorization to view.
request
Specify one of these:
file
Retrieves file information for the specified process.
filepath
Retrieves file information for the specified process and returns any portion of the path name that is available.
process
Retrieves information about the specified process. This is the default.
thread
Retrieves information for all threads in the specified process.

Results

Information is returned in simple and compound variables. Each variable name has a prefix that defaults to bpxw_. This prefix can be changed using the rexxopt() function. A stem can be used as the prefix, in which case the tails are the simple suffixes set by this function.

If pid is not specified, the following suffixes are set:
Suffix Description
PID.n Each variable contains one process ID number. PID.0 is the number of PIDs returned. PID.1, PID.2, ... are the PID numbers.
THREADS.n The number of threads for the process in the corresponding PID.n
ASID.n The address space ID for the process in the corresponding PID.n
JOBNAME.n The job name for the process in the corresponding PID.n
LOGNAME.n The login name (user ID) for the process in the corresponding PID.n
If process information is requested for a process, the following suffixes are set:
Suffix Description
STATE Contains 0 or more of the following strings:
  • MULPROCESS
  • SWAP
  • TRACE
  • STOPPED
  • INCOMPLETE
  • ZOMBIE
PID Process ID number
PPID Parent process ID number
PGRID Process group ID number
SID Session ID number
FPGID Foreground process group number
EUID Effective user ID
RUID Real user ID
SUID Saved set user ID
EGID Effective group ID
RGID Real group ID
SGID Saved set group ID
SIZE Region size
SLOWPATH Number of slow path syscalls
USERTIME Time spent in user code
SYSTIME Time spent in system code
STARTTIME Time when the process started (dub time)
OETHREADS Number of z/OS® UNIX threads
PTCREATE Number of threads created using pthread_create
THREADS Number of threads in the process
ASID Address space ID of the process
JOBNAME Job name for the process
LOGNAME Login name (user ID) for the process
CONTTY Path name for the controlling TTY
CMDPATH Path name for the command that started the process
CMDLINE Command line that started the process
If file information is requested for a process, the following suffixes are set:
Suffix Description
DEVNO Device number
INODE Inode number
NODES Count of the total number of file nodes returned
OPENF Open flags
PATH If request type FILEPATH is used, then PATH is set to any portion of the path name that is available.
PATHTRUNC If request type FILEPATH is used, then PATHTRUNC is set to either 0 or 1.
  • 0, if the path name is not truncated.
  • 1, if the path name might be truncated. The path name may be truncated on the left side, right side, or both.
TYPE Type number of the file
TYPECD Type code of the file:
  • rd: root directory
  • cd: current directory
  • fd: file descriptor
  • vd: vnode descriptor
If thread information is requested for a process, the following suffixes are set:
Suffix Description
THREAD_ID Thread ID
SYSCALL The current syscall, if in kernel
TCB TCB address
RUNTIME Time running in milliseconds
WAITTIME Time waiting in milliseconds
SEMNUM Semaphore number if on a semop (ptrunwait.x='D')
SEMVALUE Semaphore value if on a semop (ptrunwait.x='D')
LATCHPID Latch that the process waited for
SIGPENDMASK Signal pending mask
LOGNAME Login name
LASTSYSCALL.n Last 5 syscalls
PTCREATED Contains J if this was pthread-created
PTRUNWAIT Contains one of the following letters, to indicate the current run or wait state of the thread:
A
msgrecv wait
B
msgsend wait
C
communication wait
D
Semaphore wait
F
File System Wait
G
MVS™ in Pause
K
Other kernel wait
P
PTwaiting
R
Running or non-kernel wait
S
Sleep
W
Waiting for child
X
Fork new process
Y
MVS wait
PTTYPE Contains one of the following letters to indicate thread type:
N
Medium-wait thread
O
Asynchronous thread
U
Initial process thread
Z
Process terminated and parent has not completed wait
PTDETACH Contains V if the thread is detached
PTTRACE Contains E if the thread is in quiesce freeze
PTTAG Contains the ptagdata string if it exists
THREADS Contains the total number of threads

Usage notes

  1. This function uses the __getthent callable service. For additional information, see __getthent (BPX1GTH, BPX4GTH) — Get thread data in z/OS UNIX System Services Programming: Assembler Callable Services Reference.
  2. The procinfo() function returns as its value the prefix used to create variable names. If there is an error returned by the__getthent service, the function returns a null string, and sets the variables ERRNO and ERRNOJR to the hex values of the error codes returned by the__getthent service.

Example

To show the command line for each process:
call procinfo
   do i=1 to bpxw_pid.0
      if procinfo(bpxw_pid.1)<>'' then /* ignore processes that ended */
         say bpxw_cmdline
   end
To show the current directory for each process:
call procinfo
do i=1 to bpxw_pid.0
   if procinfo(bpxw_pid.i,'file')<>'' then /* ignore processes that ended */
      do j=1 to bpxw_nodes
         if bpxw_typecd.j='cd' then
            do
            address syscall 'getmntent m.' bpxw_devno.j
            strm=stream('find' m.mnte_path.1 '-xdev -inum', bpxw_inode.j,,
                        'c', 'popen read')
            say right(bpxw_pid.i,12) linein(strm)
            call stream strm,'c','pclose'
            leave
            end
      end
end

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014