Back to index

glibc  2.9
Functions
tst-signal.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 26 of file tst-signal.c.

{
  struct sigaction old_sa, new_sa;

  if (sigaction (SIGHUP, NULL, &old_sa) < 0)
    {
      printf ("cannot get signal action for SIGHUP: %m\n");
      exit (1);
    }

  if (old_sa.sa_handler != SIG_IGN)
    {
      printf ("SIGHUP action should be SIG_IGN, is %p\n",
             (void *) old_sa.sa_handler);
      exit (1);
    }

  new_sa.sa_handler = SIG_DFL;
  if (sigaction (SIGHUP, &new_sa, NULL) < 0)
    {
      printf ("cannot set signal action for SIGHUP: %m\n");
      exit (1);
    }

  if (sigaction (SIGHUP, NULL, &old_sa) < 0)
    {
      printf ("cannot get signal action for SIGHUP: %m\n");
      exit (1);
    }

  if (old_sa.sa_handler != SIG_DFL)
    {
      printf ("SIGHUP action should be SIG_DFL, is %p\n",
             (void *) old_sa.sa_handler);
      exit (1);
    }

  return 0;
}

Here is the call graph for this function: