Guardian Application Conversion Guide

Converting a C Program to Run at a High PIN
Converting C Applications
096047 Tandem Computers Incorporated 5–13
Converting MYPID
Procedure Calls
Your existing program might call the MYPID procedure to obtain its CPU and PIN
values:
short cpu_pin;
...
cpu_pin = MYPID();
If a high-PIN process calls MYPID, a trap condition occurs. You must convert all
MYPID calls into calls to the PROCESSHANDLE_DECOMPOSE_ procedure.
The PROCESSHANDLE_DECOMPOSE_ procedure requires a process handle as an
input parameter. If you do not know the process handle of your process, first call the
PROCESSHANDLE_GETMINE_ procedure. Then pass the result to
PROCESSHANDLE_DECOMPOSE_ , which returns the CPU and PIN values as
separate integer values. For example:
short my_cpu, my_pin;
...
/* Return my process handle */
status = PROCESSHANDLE_GETMINE_(my_phandle);
if (status != 0) err_routine (status);
/* Return my CPU and PIN values */
status = PROCESSHANDLE_DECOMPOSE_ (my_phandle,
my_cpu,
my_pin);
if (status != 0) err_routine (status);
Your existing program might also call the MYPID procedure within another Guardian
procedure call (for example, in a SETMODE function 11, GETCRTPID, or
PROCESSINFO call). This example shows MYPID in a SETMODE (function 11)
procedure call:
status = SETMODE (file_number,
11,
MYPID(), /* return cpu and pin */
0,
previous_owner);
For SETMODE function 11, you are not required to set the
parameter_1
value to the
CPU and PIN values. Instead, set
parameter_1
to any positive value:
...
status = SETMODE (file_number,
11,
1, /* set to any positive value */
0,
previous_owner);