Guardian Programmer's Guide

Table Of Contents
Creating and Managing Processes
Guardian Programmer’s Guide 421922-014
16 - 51
Using Stop Mode to Control Process Deletion
.
.
!Delete the process created earlier:
ERROR := PROCESS_STOP_(OUTPUT_LIST.Z^PHANDLE);
IF ERROR <> 0 THEN ...
In this case, the process issuing the PROCESS_STOP_ procedure call also receives
the Process-deletion message because it is the creator of the process.
Using Stop Mode to Control Process Deletion
You can use the SETSTOP procedure to determine who has the authority to delete
your process. This procedure sets the stop mode for the process as follows:
If the attempt to stop the process is rejected because of the stop mode, an error is
returned to the calling process and the stop request is queued until stop mode is
reduced to the level at which the stop request is accepted:
If a stop request passes the security checks but the target process is at stop
mode 2, then the request is queued until the stop mode is reduced to 1 or 0. File-
system error 638 is returned to the calling process.
If a stop request fails the security checks for a process running at either stop
mode 1 or stop mode 2, then the request is queued until the stop mode is reduced
to 0. File-system error 639 is returned to the calling process.
The following example uses the SETSTOP procedure to set the stop mode of the
calling process to 0;
LITERAL ANYONE^CAN^STOP^ME = 0;
.
.
CALL SETSTOP(ANYONE^CAN^STOP^ME);
A process can always stop itself, even if the stop mode is 2.
Reusing Resources Held by a Stopped Process
You need to be sure that a process has terminated before reusing any files the process
had exclusive access to. If the PROCESS_STOP_ procedure returned error 0, 638, or
639, then the process might not yet have terminated and will not have released the
0 Any other process can stop your process.
1 Only processes qualified as previously described can stop your process. This is
the default value.
2 No other process can stop your process. Only a privileged caller can set this
mode.
Caution. Any process using stop mode 2 when a trap or nondeferrable signal occurs will
cause a IPU halt. Such a halt occurs, for example, if an unmirrored disk that contains a swap
volume fails.