poll.h incompatible with gcc -std=c99
It seems that sys/signal.h does not define sigset_t in standard C mode. Here is a very quick way to demonstrate the problem:
echo "#include <poll.h>" > /tmp/polltest.c
gcc -std=c99 /tmp/polltest.c
You'll see this error:
In file included from /tmp/polltest.c:1:0:
/usr/include/poll.h:51:18: error: unknown type name 'sigset_t'
poll.h does include <signal.h>, which includes <sys/signal.h>, which in turn defines sigset_t. However, the definition of sigset_t is wrapped in:
#if defined(EXTENSIONS) || defined(KERNEL) || !defined(_STRICT_STDC) || \\
I imagine that that's what's preventing this from working in c99 mode, and I'm not sure the correct way to deal with this.
Updated by Gary Mills over 6 years ago
On the web, I've seen the same question asked about Linux. The underlying reason in both cases is that sigset_t is not a part of the C99 standard, the one enforced by `gcc -std=c99'. It's an extension to the standard. Probably the best thing to do in both cases is to compile with `gcc -std=c99 -D_XOPEN_SOURCE=600'.
I'd recommend that this bug report be closed, as there is no real bug here.
Updated by Geoff Adams over 6 years ago
But shouldn't the system's own poll.h be not broken by C99 mode? Or is your argument that the interface exposed by poll.h is also not covered by the C99 standard, and so poll.h doesn't even have to parse in C99 mode?
Thanks for taking the time to weight in.