gdb: fall back on sigpending + sigwait if sigtimedwait is not available
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 5 Jul 2021 13:56:10 +0000 (09:56 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 5 Jul 2021 13:56:10 +0000 (09:56 -0400)
commitfa8740b675b0da1fa67370ccf042a78ae802b227
treebd5cd20274fd615fc3ea1b86fc3f4b3147e95695
parent507af45f6280a78163d07e3869573f295b34916c
gdb: fall back on sigpending + sigwait if sigtimedwait is not available

The macOS platform does not provide sigtimedwait, so we get:

      CXX    compile/compile.o
    In file included from /Users/smarchi/src/binutils-gdb/gdb/compile/compile.c:46:
    /Users/smarchi/src/binutils-gdb/gdb/../gdbsupport/scoped_ignore_signal.h:69:4: error: use of undeclared identifier 'sigtimedwait'
              sigtimedwait (&set, nullptr, &zero_timeout);
              ^

An alternative to sigtimedwait with a timeout of 0 is to use sigpending,
to first check which signals are pending, and then sigwait, to consume
them.  Since that's slightly more expensive (2 syscalls instead of 1),
keep using sigtimedwait for the platforms that provide it, and fall back
to sigpending + sigwait for the others.

gdbsupport/ChangeLog:

* scoped_ignore_signal.h (struct scoped_ignore_signal)
<~scoped_ignore_signal>: Use sigtimedwait if HAVE_SIGTIMEDWAIT
is defined, else use sigpending + sigwait.

Change-Id: I2a72798337e81dd1bbd21214736a139dd350af87
Co-Authored-By: John Baldwin <jhb@FreeBSD.org>
gdbsupport/ChangeLog
gdbsupport/scoped_ignore_signal.h
This page took 0.023532 seconds and 4 git commands to generate.