Thread: struct sigaction

  1. #1
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732

    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
    Life is like riding a bicycle. To keep your balance you must keep moving - Einstein

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. signal vs sigaction
    By bhrugu in forum C Programming
    Replies: 1
    Last Post: 01-18-2010, 12:50 AM
  2. Replies: 3
    Last Post: 07-07-2009, 10:05 AM
  3. Wrapping sigaction() in loop until != EINTR;
    By heras in forum C Programming
    Replies: 5
    Last Post: 04-05-2008, 05:39 AM
  4. Reaping zombies with sigaction()
    By heras in forum Linux Programming
    Replies: 4
    Last Post: 03-12-2008, 01:05 PM
  5. sigaction() and ANSI C
    By awoodland in forum Linux Programming
    Replies: 4
    Last Post: 04-25-2004, 01:48 AM