Back to index

glibc  2.9
Functions | Variables
sigaction.c File Reference
#include <errno.h>
#include <signal.h>
#include <stddef.h>

Go to the source code of this file.

Functions

int __context_syscall (int, struct sigcontext *)
int __sigaction_syscall (int, const struct sigaction *, struct sigaction *)
static void trampoline (int sig, int code, struct sigcontext *context)
int __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)

Variables

static __sighandler_t user_handlers [NSIG]

Function Documentation

int __context_syscall ( int  ,
struct sigcontext  
)

Here is the caller graph for this function:

int __sigaction ( int  sig,
const struct sigaction act,
struct sigaction oact 
)

Definition at line 40 of file sigaction.c.

{
  struct sigaction myact;
  __sighandler_t ohandler;

  if (sig <= 0 || sig >= NSIG)
    {
      __set_errno (EINVAL);
      return -1;
    }

  ohandler = user_handlers[sig];

  if (act != NULL)
    {
      user_handlers[sig] = act->sa_handler;
      if (act->sa_handler != SIG_DFL && act->sa_handler != SIG_IGN)
       {
         myact = *act;
         act = &myact;
         act->sa_handler = (__sighandler_t) trampoline;
       }
    }

  if (__sigaction_syscall (sig, act, oact) < 0)
    {
      /* The syscall got an error.  Restore the old handler and return -1.  */
      user_handlers[sig] = ohandler;
      return -1;
    }

  if (oact != NULL && oact->sa_handler == (__sighandler_t) trampoline)
    oact->sa_handler = ohandler;

  return 0;
}

Here is the call graph for this function:

int __sigaction_syscall ( int  ,
const struct sigaction ,
struct sigaction  
)

Here is the caller graph for this function:

static void trampoline ( int  sig,
int  code,
struct sigcontext context 
) [static]

Definition at line 30 of file sigaction.c.

{
  (*(void (*) (int, int, struct sigcontext *)) user_handlers[sig])
    (sig, code, context);
  __context_syscall (1, context);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

__sighandler_t user_handlers[NSIG] [static]

Definition at line 23 of file sigaction.c.