Open System Services Programmer's Guide
Monitoring OSS Processes Reading Guardian System Messages
A Guardian parent process must monitor an OSS child process by reading Guardian system
messages from $RECEIVE. (An OSS parent process could monitor its child process by reading
Guardian system messages, but it would be very unusual.)
When monitoring an OSS child process by reading Guardian system messages, it is important for
the parent process to verify that the child process is still alive after any processor failure because:
• The parent process does not receive process-termination messages for any unnamed OSS
processes running in a particular processor if that processor fails.
• An OSS process can move to another processor using the tdm_execve() or tdm_execvep()
function. The parent receives a termination message so it can determine that an exec function
took place.
To monitor an OSS process effectively by reading Guardian system messages, a parent process
must do the following:
• Call the MONITORCPUS procedure regularly to be notified of any processor failure.
• If a processor fails, call the PROCESS_GETINFOLIST_ procedure to check on the status of the
OSS child process.
In Example 32 (page 127), a Guardian process creates an OSS process using PROCESS_SPAWN_.
The parent process monitors the status of the OSS child process by checking for processor failures
and reading system messages on its $RECEIVE file. If a processor fails, the parent verifies that the
OSS process is still alive by verifying the OSS process ID of the child process is still valid. This
example can run only as a native process because it calls the gfileno() function. A TNS process
must call the fdtogfn() function instead. A native process cannot call fdtogfn().
This example must be compiled in the OSS environment and executed from the Guardian
environment:
1. Compile the program
c89 ossprocess_spawn_.c -Wextensions -Wsystype=guardian
-Wtarget=tns/e -o ossprocess_spawn_
2. Copy the object file to the Guardian environment
3. Run the object file in the Guardian environment
TACL> Run ossprocess_spawn_
126 Managing Processes