Back to index

glibc  2.9
Defines | Functions
sysv_signal.c File Reference
#include <errno.h>
#include <signal.h>
#include <string.h>

Go to the source code of this file.

Defines

#define SA_ONESHOT   0
#define SA_NOMASK   0
#define SA_INTERRUPT   0

Functions

__sighandler_t __sysv_signal (int sig, __sighandler_t handler)

Define Documentation

#define SA_INTERRUPT   0

Definition at line 32 of file sysv_signal.c.

#define SA_NOMASK   0

Definition at line 29 of file sysv_signal.c.

#define SA_ONESHOT   0

Definition at line 26 of file sysv_signal.c.


Function Documentation

Definition at line 38 of file sysv_signal.c.

{
  struct sigaction act, oact;

  /* Check signal extents to protect __sigismember.  */
  if (handler == SIG_ERR || sig < 1 || sig >= NSIG)
    {
      __set_errno (EINVAL);
      return SIG_ERR;
    }

  act.sa_handler = handler;
  if (__sigemptyset (&act.sa_mask) < 0)
    return SIG_ERR;
  act.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT;
  act.sa_flags &= ~SA_RESTART;
  if (__sigaction (sig, &act, &oact) < 0)
    return SIG_ERR;

  return oact.sa_handler;
}

Here is the call graph for this function: