Home

WSTOPSIG

WSTOPSIG is a macro defined in the POSIX C standard library header sys/wait.h. It is used to obtain the signal number that caused a child process to stop, as reported by wait or waitpid when the child is in a stopped state.

Use and behavior: WSTOPSIG(status) should be used only when WIFSTOPPED(status) returns true. In that case, WSTOPSIG(status)

Typical context: A parent process may invoke waitpid with options such as WUNTRACED to be notified when

Portability: WSTOPSIG is part of the POSIX wait/waitpid interface and is supported on POSIX-compatible systems, including

See also: WIFSTOPPED, WIFEXITED, WIFSIGNALED, WCONTINUED, WEXITSTATUS, WTERMSIG.

yields
the
signal
number
that
halted
the
child.
This
information
is
helpful
for
debuggers,
job
control,
or
process-tracing
scenarios
where
a
process
has
been
stopped
by
a
signal
rather
than
exited
or
being
signaled
to
terminate.
a
child
stops.
If
the
child
stops,
WIFSTOPPED(status)
is
true
and
WSTOPSIG(status)
returns
the
specific
signal
that
caused
the
stop
(for
example,
a
stop
signal
like
SIGSTOP,
SIGTSTP,
or
a
signal
such
as
SIGTRAP
in
debugging
with
ptrace).
The
exact
signal
depends
on
how
the
stop
occurred.
Linux,
macOS,
and
BSD
variants.
It
is
intended
to
be
used
together
with
other
macros
such
as
WIFEXITED,
WIFSIGNALED,
WIFCONTINUED,
and
WEXITSTATUS
to
interpret
the
status
value
returned
by
waitpid.