Back to index

glibc  2.9
Functions
sigaction.c File Reference
#include <string.h>
#include <syscall.h>
#include <sysdep.h>
#include <sys/signal.h>
#include <errno.h>
#include <kernel_sigaction.h>

Go to the source code of this file.

Functions

static void __rt_sigreturn_stub (void)
int __libc_sigaction (int sig, __const struct sigaction *act, struct sigaction *oact)
 libc_hidden_def (weak_alias(__libc_sigaction)

Function Documentation

int __libc_sigaction ( int  sig,
__const struct sigaction act,
struct sigaction oact 
)

Definition at line 35 of file sigaction.c.

{
  int ret;
  struct kernel_sigaction kact, koact;
  unsigned long stub = ((unsigned long) &__rt_sigreturn_stub) - 8;

  if (act)
    {
      kact.k_sa_handler = act->sa_handler;
      memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
      kact.sa_flags = act->sa_flags;
      kact.sa_restorer = NULL;
    }

  /* XXX The size argument hopefully will have to be changed to the
     real size of the user-level sigset_t.  */
  ret = INLINE_SYSCALL (rt_sigaction, 5, sig,
                     act ? __ptrvalue (&kact) : 0,
                     oact ? __ptrvalue (&koact) : 0, stub, _NSIG / 8);

  if (oact && ret >= 0)
    {
      oact->sa_handler = koact.k_sa_handler;
      memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
      oact->sa_flags = koact.sa_flags;
      oact->sa_restorer = koact.sa_restorer;
    }

  return ret;
}

Here is the call graph for this function:

static void __rt_sigreturn_stub ( void  ) [static]

Here is the caller graph for this function:

libc_hidden_def ( weak_alias __libc_sigaction)

Definition at line 66 of file sigaction.c.

{
  __asm__ ("mov %0, %%g1\n\t"
          "ta 0x6d\n\t"
          : /* no outputs */
          : "i" (__NR_rt_sigreturn));
}