-
struct sigaction
Hey guys,
I'm in the process of experimenting few things in the signal handler. But whatever reason i'm not able to find the struct sigaction. Please see the following code snippet
Code:
#include <signal.h>
struct sigaction sig;
sig.sa_handler = my_handler;
But compiler complains on about not able reference the struct sigaction. But i thought it was defined in <signal.h>. But...
Code:
sign.c: In function āmainā:
sign.c:16: error: storage size of āsaā isnāt known
Any ideas? Is it defined anywhere else, which i'm not including.
ssharish
-
It's in signal.h, but it's not a standard C function, so make sure you're on a POSIX platform. If you are on a POSIX platform, make sure you're not compiling with -ansi, -std=c99, or similar; or if you are using those options, add -D_XOPEN_SOURCE=500 to select SuSv2.
There are many macros, apart from _XOPEN_SOURCE, to select various POSIX/SuS versions. Here is a decent place to start looking. If you're on Linux, check out the feature_test_macros(7) man page.