Like Tree1Likes
  • 1 Post By ssharish2005

struct sigaction

This is a discussion on struct sigaction within the C Programming forums, part of the General Programming Boards category; Hey guys, I'm in the process of experimenting few things in the signal handler. But whatever reason i'm not able ...

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

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

  2. #2
    cas
    cas is offline
    Registered User
    Join Date
    Sep 2007
    Posts
    991
    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-17-2010, 11:50 PM
  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21