IPC via signals
QNX supports a rich set of POSIX signals, in addition to QNX-specific
signals as well as signals historically found on some UNIX systems. If
you want to generate a signal from the shell you can use kill or slay utilities, within a process
kill() or raise() C functions can be used. A
process can receive a signal in one of three different ways, depending
on how it has dfined its signal-handling environment:
- If the process has taken no special action to hanlde signals, the
default action for the signal is taken. Usually, this action is to
terminate the process.
- The process can ignore the signal. If a process ignores a signal,
there is no effect on the process when the signal is delivered. Some
signals, such as SIGCONT, SIGKILL, and SIGSTOP can not be ignored
under normal cicumstances.
- The process can provide a signal handler for the
signal. This is a function in the process that is invoked when the
signal is delivered. When a process contains a signal handler for a
signal, it is able to catch the signal. No data is transferred with
the signal.
To define the type of handling you want for each signal, you use the
ANSI C signal() function or
the POSIX sigaction()
function. Only some POSIX and ANSI C library functions are specified
as being safe to use within signal handlers. You should not try to use
any other library functions, since the results of doing so are
unspecified and unpredictable. Nor should you try to use any user
functions in your program unless they are re-entrant.