Guardian Programmer's Guide

Table Of Contents
Creating and Managing Processes
Guardian Programmer’s Guide 421922-014
16 - 55
Getting Process Information
The next example returns the creator access ID and process access ID of the process
named $P2:
PROCESS^NAME ':=' "$P2" -> @S^PTR;
NAME^LENGTH := @S^PTR '-' @PROCESS^NAME;
ERROR := FILENAME_TO_PROCESSHANDLE_(PROCESS^NAME:NAME^LENGTH,
PROCESS^HANDLE);
IF ERROR <> 0 THEN ...
ERROR := PROCESS_GETINFO_(PROCESS^HANDLE,
!file^name:maxlen!,
!file^name^len!,
!priority!,
!moms^processhandle!,
!home^term:maxlen!,
!home^term^len!,
!process^time!,
CREATOR^ACCESS^ID,
PROCESS^ACCESS^ID,
!gmoms^processhandle!,
!jobid!,
!program^file:maxlen!,
!program^len!,
!swap^file:maxlen!,
!swap^len!,
ERROR^DETAIL);
IF ERROR <> 0 THEN
BEGIN
CASE ERROR OF
2 -> ... !parameter error, ERROR^DETAIL
! contains parameter number in error
3 -> ... !bounds error, ERROR^DETAIL contains
! contains parameter number in error
4 -> ... !process does not exist
OTHERWISE -> ... !other error
END;
In the example above, the FILENAME_TO_PROCESSHANDLE_ procedure returns
the process handle of process $P2. This process handle is then supplied to the
PROCESS_GETINFO_ procedure to refer to the desired process.