Home

WIFSIGNALED

WIFSIGNALED is a macro used in POSIX-compliant systems to analyze the termination status of a child process as reported by wait, waitpid, or waitid. It evaluates the status value returned by these wait system calls and indicates whether the child process ended because it received an uncaught signal.

When WIFSIGNALED(status) is true, the child process did not exit normally but was terminated by a signal.

WIFSIGNALED is one of several macros used to interpret wait status values. Others include WIFEXITED, which

Example usage in C after a wait call:

if (WIFSIGNALED(status)) {

int sig = WTERMSIG(status);

// handle termination by signal sig

}

Portability and scope: WIFSIGNALED and related macros are defined by the POSIX standard and are available on

---

In
this
case,
the
WTERMSIG(status)
macro
can
be
used
to
obtain
the
number
of
the
terminating
signal.
The
signal
number
corresponds
to
the
conventional
signal
identifiers
defined
in
signal.h,
such
as
SIGKILL
or
SIGTERM.
indicates
normal
termination,
and
WIFSTOPPED,
which
indicates
the
process
was
stopped
by
a
signal.
When
WIFEXITED(status)
is
true,
WEXITSTATUS(status)
yields
the
process’s
exit
code.
When
WIFSTOPPED(status)
is
true,
WSTOPSIG(status)
yields
the
signal
that
stopped
the
process.
POSIX-compliant
systems
(commonly
via
<sys/wait.h>).
They
are
not
applicable
on
non-POSIX
platforms
without
equivalent
wait
status
facilities.