Getting status of a signal in process?

Hi all,
How can a process be aware of the signals it handles. I looked at available signal API, but couldn't find any help.

If a process defines it own handler for a signal, the default handler for that signal becomes overridden.

I am interested in getting to know the status(SIG_IGN/SIG_DFL) of a signal within a process.

e.g. if a program has been launched like this:
$nohup ./my_exe&

In this case, is it possible for the process to know that as it has been launched with nohup (i.e. SIGHUP => SIG_IGN)... it should ignore its own handler for SIGHUP if exists.

My application always catches the signal and exits. :frowning:

--Vishal

Look at sigaction

I believe this should work.

[/tmp]$ cat try.cpp 
#include <signal.h>
#include <stdio.h>

int main ()
{
    struct sigaction current;
    ::sigaction (SIGHUP, NULL, &current);
    printf ("SIGHUP:[%d]\n", current.sa_flags);
    return 0;
}
[/tmp]$ gcc -o try try.cpp -lstdc++
[/tmp]$ ./try
SIGHUP:[0]
[/tmp]$ 

And signum.h tells me 0 corresponds to SIG_DFL

[/tmp]$ grep SIG_ /usr/include/bits/signum.h
#define SIG_ERR ((__sighandler_t) -1)           /* Error return.  */
#define SIG_DFL ((__sighandler_t) 0)            /* Default action.  */
#define SIG_IGN ((__sighandler_t) 1)            /* Ignore signal.  */
# define SIG_HOLD       ((__sighandler_t) 2)    /* Add signal to hold mask.  */
[/tmp]$