If the argument "act" is not a null pointer, it points to a structure
specifying the action to be associated with the specified signal.
If the argument "oact" is not a null pointer, the action previously
associated with the signal is stored in the location pointed to by
the argument "oact".
If the argument "act" is a null pointer, signal handling is unchanged.
The SIGKILL and SIGSTOP signals shall not be added to the signal mask
using sigaction(), but will not result in sigaction reporting a failure.
If the SA_SIGINFO flag is cleared in the sa_flags field of the sigaction
structure, the sa_handler field indentifies the action to be associated
with the specified signal.
If the SA_SIGINFO flag is set in the sa_flags field, and the implementation
supports the Realtime Signals Extension option or the XSI Extension option,
the sa_sigaction field specifies a signal catching function.
If the SA_SIGINFO bit is cleared and the sa_handler field specifies a
signal catching function, or if the SA_SIGINFO bit is set, the sa_mask
field indentifies a set of signals that shall be added to the signal mask
of the thread before the signal-catching function is invoked.
If the sa_handler field specifies a signal-catching function, the sa_mask
field indentifies a set of signals that shall be added to the process'
signal mask before the signal-catching function is invoked.
If the SA_NOCLDSTOP bit is set in the sa_flags field when calling sigaction
on SIGCHLD, then the SIGCHLD signal will not be generated when children stop
or stopped children continue.
If sig is SIGCHLD and the SA_NOCLDSTOP flag is not set in sa_flags, and the
implementation supports the SIGCHLD signal, then a SIGCHLD signal shall be
generated for the calling process whenever any of its child processes
stop.
Not setting the SA_NOCLDSTOP flag on the SIGCHLD signal will result in a
SIGCHLD signal being generated for the parent process whenever any of it's
stopped children are continued.
If the SA_ONSTACK flag is set in sa_flags, and an alternate signal stack has
been declared with sigaltstack(), the signal shall be delivered to the calling
process on the stack. Otherwise, the signal shall be delivered on the current
stack.
If the SA_ONSTACK flag is not set in sa_flags, the signal shall be delivered
on the current stack.
If the SA_RESETHAND flag is set in sa_flags, then the disposition of the signal
shall be reset to SIG_DFL and the SA_SIGINFO flag shall be cleared on entry
to the signal handler. The routine behaves as if SA_NODEFER was also set.
If the SA_RESETHAND flag is not set in sa_flags, the disposition of the signal
shall not be modified on entry to the signal handler.
Interruptable functions (functions specified to fail with errno set to [EINTR]
when interrupted by a signal) shall restart and shall not fail with [EINTR]
if the SA_RESTART flag is set in sa_flags.
If the SA_RESTART flag is not set in sa_flags, then interruptable functions
will fail with with errno set to [EINTR].
If the SA_SIGINFO flag is not set for a signal and the signal is caught then
the signal-catching function shall be entered as "void func(int signo);".
If the SA_SIGINFO flag is set for a signal and the signal is caught then
the signal -catching function shall be entered as
"void func(int signo, siginfo_t *info, void *context);"
If the SA_NOCLDWAIT flag is set and sig equals SIGCHLD, then child processes
of the calling process shall not be trasformed into zombie processes when
they terminate.
If a process has set the SA_NOCLDWAIT flag on SIGCHLD and subseqeunetly waits
for a its children, and the process has not unwaited-for children that were
trasformed into zombie processes, it shall block until all of its children
terminate, and wait(), waitid(), and waitpid() shall fail and set errno to
[ECHILD].
If the SA_NODEFER flag is set for a signal and the signal is caught, the signal
shall not be added to the process' signal mask on entry to the signal handler
unless it is included in sa_mask.
If the SA_NODEFER flag is not set for a signal and the signal is caught, the
signal shall be added to the process' signal mask on entry to the signal
handler.
When a signal-catching function installed by sigaction() is entered, a new
signal mask is calculated and installed for the duration of the signal-catching
function (or until a call to either sigprocmask() or sigsuspend() is made.)
The new signal mask installed on entry to a signal-catching function installed
by sigaction shall be calculated as the union of the current signal mask
and the value of sa_mask for the signal being delivered (unless SA_NODEFER
or SA_RESETHAND is set) and then including the signal being delivered.
If and when the user's signal handler returns normally, the original signal
mask is restored.
If sigaction fails, no new signal handler is installed.
If the signal action was set with the signal() function, getting it into oact
then reinstalling it with act must be valid.
If SA_SIGINFO is set and realtime signals extension is supported, queueable
signals generated by sigqueue or some other functions are delivered in FIFO
order.
sigaction returns -1 and errno is set to EINVAL if signal number is invalid
or an attempt to do an operation which is not allowed is made.