Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
accessing 64-bit addressable memory, see the 64-Bit Support in OSS and Guardian chapter in
the Open System Services Programmer's Guide.
On servers running J06.12 or later J-series RVUs or H06.23 or later H-series RVUs, both Guardian
processes and OSS processes can call the OSS shared memory functions, which are shmat(),
shmctl(), shmdt(), and shmget(). They can share segments as described for shmget().
On servers running J06.11 or earlier J-series RVUs, H06.22 or earlier H-series RVUs, or G-series
RVUs, only OSS processes can call shmget() and related functions; Guardian process calls to
these functions fail and errno is set to the value of [ENOTOSS].
The distinction between flat and selectable segments, and how to use these shared memory segments,
is discussed in detail in the Open System Services Programmer’s Guide. Using shared memory is
an efficient IPC mechanism that can be used when large amounts of data need to be shared
between an OSS process and a Guardian process running on the same processor.
Using Semaphores
Guardian semaphores are binary semaphores available to Guardian and OSS programs. OSS
semaphores are counting semaphores and are oriented towards resource allocation usage. OSS
semaphores are available only to OSS programs. Semaphores are commonly used in both the
OSS environment and the Guardian environment to synchronize access to shared memory. When
memory is shared between a Guardian process and an OSS process, Guardian semaphores must
be used.
Using Intermediate Processes
The osh and gtacl commands are provided as intermediate, or bridge, processes between the
Guardian and OSS environments. They can be used to map I/O, particularly terminal I/O, into
the opposite type, and to map death notifications into the opposite type. The osh and gtacl
commands can be used programmatically as well as commands to the TACL and shell command
interpreters, respectively.
From an OSS process, you can use the popen() function to programmatically call a TACL
command. For example, popen("gtacl -p FUP","w") can be used to pipe commands through
gtacl to FUP.
The gtacl command can also be used directly from the shell to pass commands to a TACL
command and redirect the output to a file in the OSS file system: for example, "gtacl -p 'FUP
INFO $SYSTEM.*.* '> tempfile".
The OSH command can be used directly from the TACL prompt to pass commands to the shell,
even redirecting output to a file in the Guardian file system. Because OSH and gtacl are
intermediate processes, they are expensive to create, and expensive to use for I/O between the
Guardian and OSS environments.
Using Signals
OSS processes can send and receive signals; Guardian TNS processes cannot send signals.
Guardian processes can generate signals by using kill(), but they cannot receive them. Neither
TNS nor native processes can send or receive signals using kill(). Thus, a Guardian process
can call kill() for an OSS process (or group). It needs to find the OSS process ID of the OSS
process to do this, possibly using PROCESS_GETINFO_. Signals can be used to communicate
small bits of information from a Guardian process to an OSS process, but they are not a
general-purpose IPC mechanism that should be used when Guardian and OSS processes need to
communicate.
Interoperating With OSS Programs 151