SYS$FORCEX, or Force Exit, is a system service that causes an Exit ($EXIT) service call to be issued on behalf of a specified process.
The Force Exit service causes an Exit service call to be issued on behalf of a specified process.
If the longword at address pidadr is 0, the PID of the target process is returned.
The Force Exit system service requires system dynamic memory.
The image executing in the target process follows normal exit procedures. For example, if any exit handlers have been specified, they gain control before the actual exit occurs. Use the Delete Process ($DELPRC) service if you do not want a normal exit.
When a forced exit is requested for a process, a user-mode asynchronous system trap (AST) is queued for the target process. The AST routine causes the $EXIT service call to be issued by the target process. Because the AST mechanism is used, user mode ASTs must be enabled for the target process, or no exit occurs until ASTs are reenabled. Thus, for example, a suspended process cannot be stopped by $FORCEX. The process that calls $FORCEX receives no notification that the exit is not being performed.
If an exit handler resumes normal processing, the process will not exit. In particular, if the program is written in Ada and there is a task within the program that will not terminate, the program will not exit.
The $FORCEX service completes successfully if a force exit request is already in effect for the target process but the exit is not yet completed.
int sys$forcex (unsigned int *pidadr, void *prcnam, unsigned int code);
Process identification (PID) of the process to be forced to exit. The pidadr argument is the address of a longword containing the PID. The pidadr argument can refer to a process running on the local node or a process running on another node in the OpenVMS Cluster system.
The pidadr argument is optional but must be specified if the process that is to be forced to exit is not in the same UIC group as the calling process.
|Type:||character-coded text string|
|Mechanism:||by descriptor–fixed-length string descriptor|
Process name of the process that is to be forced to exit. The prcnam argument is the address of a character string descriptor pointing to the process name string. A process running on the local node can be identified with a 1- to 15-character string. To identify a process on a particular node in a cluster, specify the full process name, which includes the node name as well as the process name. The full process name can contain up to 23 characters.
The prcnam argument can be used only on behalf of processes in the same UIC group as the calling process. To force processes in other groups to exit, you must specify the pidadr argument. This restriction exists because the operating system interprets the UIC group number of the calling process as part of the specified process name; the names of processes are unique to UIC groups.
Completion code value to be used as the exit parameter. The code argument is a longword containing this value. If you do not specify the code argument, the value 0 is passed as the completion codeю
Condition Values Returned
|SS$_NORMAL||The service completed successfully.|
|SS$_ACCVIO||The item list cannot be read by the caller, or the buffer length or buffer cannot be written by the caller.|
|SS$_INCOMPAT||The remote node is running an incompatible version of the operating system.|
|SS$_INSFMEM||The system dynamic memory is insufficient for the operation.|
|SS$_IVLOGNAM||The process name string has a length equal to 0 or greater than 15.|
|SS$_NONEXPR||The specified process does not exist, or an invalid process identification was specified.|
|SS$_NOPRIV||The process does not have the privilege to obtain information about the specified process.|
|SS$_NOSUCHNODE||The specified node is not currently a member of the cluster.|
|SS$_REMRSRC||The remote node has insufficient resources to respond to the request. (Bring this error to theattention of your system manager.)|
|SS$_UNREACHABLE||The remote node is a member of the cluster but is not accepting requests. This is normal for a brief period early in the system boot process.|
Depending on the operation, the calling process might need a certain privilege to use $FORCEX:
- You need GROUP privilege to force an exit for a process in the same group that does not have the same UIC as the calling process.
- You need WORLD privilege to force an exit for any process in the system.