Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)

The Guardian PROCESS_LAUNCH_ and PROCESS_SPAWN_ procedures obey the Guardian
MOM and ancestor relationships, but the OSS functions obey the UNIX parent and child process
relationships. See “Using Process-Creation Calls” (page 96) for a discussion of the UNIX parent
and child process relationship. Guardian MOM and ancestors are notified of child termination
using system messages on $RECEIVE. OSS parents are notified of child termination using the
SIGCHLD signal and wait status.
PROCESS_SPAWN_ Procedure
This process-creation procedure is mainly used by Guardian programs that need to create OSS
processes. The osh utility uses PROCESS_SPAWN_ to start a Korn shell. OSS scripts can also be
run by executing this procedure.
The PROCESS_SPAWN_ procedure can be called either from the Guardian or OSS environments.
Various open timeout and nowait creation options are available with this procedure. Note that the
files are opened in the child process and are not propagated or shared.
Process-Management Interoperability
In general, you should manage OSS processes with OSS functions, which makes your applications
more portable. However, there might be cases in which you want to use Guardian procedures to
manage OSS processes, or to use OSS functions to manage Guardian processes. For example, if
you want to use a product or subsystem that runs only in the Guardian environment, you might
need to manage a process from the opposite environment.
The process handle of an OSS process allows most Guardian process-management procedures to
access it. On the other hand, a Guardian process does not have an OSS process ID, which is
required by most OSS process-management functions. There is a small set of OSS
process-management functions that can access Guardian processes.
Refer to the Open System Services Programmer’s Guide for a detailed discussion on
process-management; it includes various interoperability tables. It also includes programming
examples of how to mange processes with the OSS and Guardian APIs.
Guardian Procedure Calls Extended for OSS
The Open System Services Programmer’s Guide contains a table listing the many Guardian
process-management procedure calls that can access OSS processes. The Guardian procedures
that provide information about OSS processes as well as Guardian processes are
PROCESS_GETINFO_ and PROCESS_GETINFOLIST_. The PROCESS_GETINFO_ procedure returns
a limited set of information about a specified process, including the process handle, execution
priority, home terminal, type (OSS or Guardian), swap file and program file statistics, and the
OSS process ID if the process is an OSS process.
The PROCESS_GETINFOLIST_ procedure returns detailed information about a process or set of
processes that meets specified criteria that identify processes for which information is returned. A
search parameter such as OSS process ID may be specified to return detailed information about
an OSS process. Search attributes, particularly OSS attributes, can also be specified. The procedure
call also returns OSS attributes. Refer to the Guardian Procedure Calls Reference Manual for details
about these attributes.
It should be noted that when you are looking for detailed information about a process, such as its
controlling tty or an OSS program pathname, translation by a slower name server may be involved.
The caller of this routine should also provide sufficiently large output buffers to hold the additional
process information that can be returned.
OSS Functions for Accessing Guardian Processes
Many OSS process-management functions can access Guardian processes; some are abort(),
_exit(), exit(), getegid(), getenv(), geteuid(), getgid(), getgroups(),
getuid(), putenv(), setpgid(), setuid(), and times(). Refer to the API interoperability
76 Interoperating Between Programming Environments