Back to index

glibc  2.9
Functions | Variables
tst-raise.c File Reference
#include <errno.h>
#include <error.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void sh (int sig)
int main (void)

Variables

volatile int count

Function Documentation

int main ( void  )

Definition at line 35 of file tst-raise.c.

{
  struct sigaction sa;
  sa.sa_handler = sh;
  sigemptyset (&sa.sa_mask);
  sa.sa_flags = 0;
  if (sigaction (SIGUSR1, &sa, NULL) < 0)
    {
      printf ("sigaction failed: %m\n");
      exit (1);
    }
  if (raise (SIGUSR1) < 0)
    {
      printf ("first raise failed: %m\n");
      exit (1);
    }
  if (raise (SIGUSR1) < 0)
    {
      printf ("second raise failed: %m\n");
      exit (1);
    }
  if (count != 2)
    {
      printf ("signal handler not called 2 times\n");
      exit (1);
    }
  exit (0);
}

Here is the call graph for this function:

void sh ( int  sig)

Definition at line 29 of file tst-raise.c.

{
  ++count;
}

Variable Documentation

volatile int count

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