Back to index

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

Go to the source code of this file.


static void handler (int sig)
int main (void)


int win = 0

Function Documentation

static void handler ( int  sig) [static]

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

  printf ("Received signal %d (%s).\n", sig, strsignal(sig));
  win = 1;

Here is the call graph for this function:

int main ( void  )

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

  if (signal (SIGTERM, handler) == SIG_ERR)
      perror ("signal: SIGTERM");
      exit (EXIT_FAILURE);

  puts ("Set handler.");

  printf ("Sending myself signal %d.\n", SIGTERM);
  fflush (stdout);

  if (raise (SIGTERM) < 0)
      perror ("raise: SIGTERM");
      exit (EXIT_FAILURE);

  if (!win)
      puts ("Didn't get any signal.  Test FAILED!");
      exit (EXIT_FAILURE);

  puts ("Got a signal.  Test succeeded.");

  return EXIT_SUCCESS;

Here is the call graph for this function:

Variable Documentation

int win = 0

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