Back to index

glibc  2.9
Defines | Functions | Variables
signal.h File Reference
#include <signal/signal.h>

Go to the source code of this file.

Defines

#define __sigemptyset(ss)   (__builtin_memset (ss, '\0', sizeof (sigset_t)), 0)

Functions

 libc_hidden_proto (sigemptyset) libc_hidden_proto(sigfillset) libc_hidden_proto(sigaddset) libc_hidden_proto(sigdelset) libc_hidden_proto(sigismember) libc_hidden_proto(__sigpause) libc_hidden_proto(raise) libc_hidden_proto(__libc_current_sigrtmin) libc_hidden_proto(__libc_current_sigrtmax) extern __sighandler_t __bsd_signal(int __sig
int __kill (__pid_t __pid, int __sig)
int __sigaction (int __sig, __const struct sigaction *__restrict __act, struct sigaction *__restrict __oact)
 libc_hidden_proto (__sigaction) extern int __sigblock(int __mask)
int __sigsetmask (int __mask)
int __sigprocmask (int __how, __const sigset_t *__set, sigset_t *__oset)
int __sigsuspend (__const sigset_t *__set)
 libc_hidden_proto (__sigsuspend) extern int __sigsuspend_nocancel(__const sigset_t *__set) attribute_hidden
int __sigwait (__const sigset_t *__set, int *__sig)
 libc_hidden_proto (__sigwait) extern int __sigwaitinfo(__const sigset_t *__set
 libc_hidden_proto (__sigwaitinfo) extern int __sigtimedwait(__const sigset_t *__set
 libc_hidden_proto (__sigtimedwait) extern int __sigqueue(__pid_t __pid
int __sigvec (int __sig, __const struct sigvec *__vec, struct sigvec *__ovec)
int __sigreturn (struct sigcontext *__scp)
int __sigaltstack (__const struct sigaltstack *__ss, struct sigaltstack *__oss)
int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 libc_hidden_proto (__libc_sigaction) extern int __sigpause(int sig_or_mask
int __default_sigpause (int mask)
int __xpg_sigpause (int sig)
int __libc_allocate_rtsig (int __high)

Variables

__sighandler_t __handler
siginfo_t * __info
siginfo_t __const struct timespec__timeout
int __sig
int __const union sigval
int is_sig

Define Documentation

#define __sigemptyset (   ss)    (__builtin_memset (ss, '\0', sizeof (sigset_t)), 0)

Definition at line 56 of file signal.h.


Function Documentation

int __kill ( __pid_t  __pid,
int  __sig 
)

Definition at line 22 of file kill.c.

{
  return kill (pid, sig);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 47 of file pt-allocrtsig.c.

Here is the call graph for this function:

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

Definition at line 74 of file sigaction.c.

{
#ifndef __ASSUME_REALTIME_SIGNALS
  struct old_kernel_sigaction k_sigact, k_osigact;
#endif
  int result;

#ifdef __NR_rt_sigaction
  /* First try the RT signals.  */
# ifndef __ASSUME_REALTIME_SIGNALS
  if (!__libc_missing_rt_sigs)
# endif
    {
      struct kernel_sigaction kact, koact;
# ifndef __ASSUME_REALTIME_SIGNALS
      int saved_errno = errno;
# endif

      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;
# ifdef HAVE_SA_RESTORER
         if (kact.sa_flags & SA_RESTORER)
           kact.sa_restorer = act->sa_restorer;
         else
           {
             kact.sa_restorer = choose_restorer (kact.sa_flags);
             kact.sa_flags |= SA_RESTORER;
           }
# endif
       }

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

# ifndef __ASSUME_REALTIME_SIGNALS
      if (result >= 0 || errno != ENOSYS)
# endif
       {
         if (oact && result >= 0)
           {
             oact->sa_handler = koact.k_sa_handler;
             memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
             oact->sa_flags = koact.sa_flags;
# ifdef HAVE_SA_RESTORER
             oact->sa_restorer = koact.sa_restorer;
# endif
           }
         return result;
       }

# ifndef __ASSUME_REALTIME_SIGNALS
      __set_errno (saved_errno);
      __libc_missing_rt_sigs = 1;
# endif
    }
#endif

#ifndef __ASSUME_REALTIME_SIGNALS
  if (act)
    {
      k_sigact.k_sa_handler = act->sa_handler;
      k_sigact.sa_mask = act->sa_mask.__val[0];
      k_sigact.sa_flags = act->sa_flags;
# ifdef HAVE_SA_RESTORER
      if (k_sigact.sa_flags & SA_RESTORER)
       k_sigact.sa_restorer = act->sa_restorer;
      else
       {
         k_sigact.sa_restorer = choose_restorer (k_sigact.sa_flags);
         k_sigact.sa_flags |= SA_RESTORER;
       }
# endif
    }
  result = INLINE_SYSCALL (sigaction, 3, sig,
                        act ? __ptrvalue (&k_sigact) : NULL,
                        oact ? __ptrvalue (&k_osigact) : NULL);
  if (oact && result >= 0)
    {
      oact->sa_handler = k_osigact.k_sa_handler;
      oact->sa_mask.__val[0] = k_osigact.sa_mask;
      oact->sa_flags = k_osigact.sa_flags;
# ifdef HAVE_SA_RESTORER
      oact->sa_restorer = k_osigact.sa_restorer;
# endif
    }
  return result;
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

int __sigaction ( int  __sig,
__const struct sigaction *__restrict  __act,
struct sigaction *__restrict  __oact 
)
int __sigaltstack ( __const struct sigaltstack __ss,
struct sigaltstack __oss 
)

Here is the caller graph for this function:

int __sigprocmask ( int  __how,
__const sigset_t __set,
sigset_t __oset 
)
int __sigreturn ( struct sigcontext __scp)

Definition at line 26 of file sigreturn.c.

{
  struct hurd_sigstate *ss;
  struct hurd_userlink *link = (void *) &scp[1];
  mach_port_t *reply_port;

  if (scp == NULL || (scp->sc_mask & _SIG_CANT_MASK))
    {
      errno = EINVAL;
      return -1;
    }

  ss = _hurd_self_sigstate ();
  __spin_lock (&ss->lock);

  /* Remove the link on the `active resources' chain added by
     _hurd_setup_sighandler.  Its purpose was to make sure
     that we got called; now we have, it is done.  */
  _hurd_userlink_unlink (link);

  /* Restore the set of blocked signals, and the intr_port slot.  */
  ss->blocked = scp->sc_mask;
  ss->intr_port = scp->sc_intr_port;

  /* Check for pending signals that were blocked by the old set.  */
  if (ss->pending & ~ss->blocked)
    {
      /* There are pending signals that just became unblocked.  Wake up the
        signal thread to deliver them.  But first, squirrel away SCP where
        the signal thread will notice it if it runs another handler, and
        arrange to have us called over again in the new reality.  */
      ss->context = scp;
      __spin_unlock (&ss->lock);
      __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
      /* If a pending signal was handled, sig_post never returned.  */
      __spin_lock (&ss->lock);
      ss->context = NULL;
    }

  if (scp->sc_onstack)
    {
      ss->sigaltstack.ss_flags &= ~SS_ONSTACK; /* XXX threadvars */
      /* XXX cannot unlock until off sigstack */
      abort ();
    }
  else
    __spin_unlock (&ss->lock);

  /* Destroy the MiG reply port used by the signal handler, and restore the
     reply port in use by the thread when interrupted.  */
  reply_port =
    (mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY);
  if (*reply_port)
    {
      mach_port_t port = *reply_port;

      /* Assigning MACH_PORT_DEAD here tells libc's mig_get_reply_port not to
        get another reply port, but avoids mig_dealloc_reply_port trying to
        deallocate it after the receive fails (which it will, because the
        reply port will be bogus, whether we do this or not).  */
      *reply_port = MACH_PORT_DEAD;

      __mach_port_destroy (__mach_task_self (), port);
    }
  *reply_port = scp->sc_reply_port;

  if (scp->sc_coproc_used & SC_COPROC_USE_FPU)
    {
      /* Restore FPU state.  */
#define restore_fpr(n) \
  asm volatile ("l.d $f" #n ",%0" : : "m" (scp->sc_fpr[n]))

      /* Restore floating-point registers. */
#ifdef __mips64
      restore_fpr (0);
      restore_fpr (1);
      restore_fpr (2);
      restore_fpr (3);
      restore_fpr (4);
      restore_fpr (5);
      restore_fpr (6);
      restore_fpr (7);
      restore_fpr (8);
      restore_fpr (9);
      restore_fpr (10);
      restore_fpr (11);
      restore_fpr (12);
      restore_fpr (13);
      restore_fpr (14);
      restore_fpr (15);
      restore_fpr (16);
      restore_fpr (17);
      restore_fpr (18);
      restore_fpr (19);
      restore_fpr (20);
      restore_fpr (21);
      restore_fpr (22);
      restore_fpr (23);
      restore_fpr (24);
      restore_fpr (25);
      restore_fpr (26);
      restore_fpr (27);
      restore_fpr (28);
      restore_fpr (29);
      restore_fpr (30);
      restore_fpr (31);
#else
      restore_fpr (0);
      restore_fpr (2);
      restore_fpr (4);
      restore_fpr (6);
      restore_fpr (8);
      restore_fpr (10);
      restore_fpr (12);
      restore_fpr (14);
      restore_fpr (16);
      restore_fpr (18);
      restore_fpr (20);
      restore_fpr (22);
      restore_fpr (24);
      restore_fpr (26);
      restore_fpr (28);
      restore_fpr (30);
#endif

      /* Restore the floating-point control/status register ($f31).  */
      asm volatile ("ctc1 %0,$f31" : : "r" (scp->sc_fpcsr));
    }

  /* Load all the registers from the sigcontext.  */
#ifdef __mips64
#define restore_gpr(n) \
  asm volatile ("ld $" #n ",%0" : : "m" (scpreg->sc_gpr[n - 1]))
#else
#define restore_gpr(n) \
  asm volatile ("lw $" #n ",%0" : : "m" (scpreg->sc_gpr[n - 1]))
#endif

  {
    register const struct sigcontext *const scpreg asm ("$1") = scp;
    register int *at asm ("$1");

    /* First restore the multiplication result registers.  The compiler
       will use some temporary registers, so we do this before restoring
       the general registers.  */
    asm volatile ("mtlo %0" : : "r" (scpreg->sc_mdlo));
    asm volatile ("mthi %0" : : "r" (scpreg->sc_mdhi));

    /* In the word after the saved PC, store the saved $1 value.  */
    (&scpreg->sc_pc)[1] = scpreg->sc_gpr[0];

    asm volatile (".set noreorder; .set noat;");

    /* Restore the normal registers.  */
    restore_gpr (2);
    restore_gpr (3);
    restore_gpr (4);
    restore_gpr (5);
    restore_gpr (6);
    restore_gpr (7);
    restore_gpr (8);
    restore_gpr (9);
    restore_gpr (10);
    restore_gpr (11);
    restore_gpr (12);
    restore_gpr (13);
    restore_gpr (14);
    restore_gpr (15);
    restore_gpr (16);
    restore_gpr (17);
    restore_gpr (18);
    restore_gpr (19);
    restore_gpr (20);
    restore_gpr (21);
    restore_gpr (22);
    restore_gpr (23);
    restore_gpr (24);
    restore_gpr (25);
    /* Registers 26-27 are kernel-only.  */
    restore_gpr (28);
    restore_gpr (29);              /* Stack pointer.  */
    restore_gpr (30);              /* Frame pointer.  */
    restore_gpr (31);              /* Return address.  */

    at = &scpreg->sc_pc;
    /* This is an emulated instruction that will find at the address in $1
       two words: the PC value to restore, and the $1 value to restore.  */
    asm volatile (".word %0" : : "i" (op_sigreturn));
    asm volatile (".set reorder; .set at;");
    /* NOTREACHED */
    return at;              /* To prevent optimization.  */
  }

  /* NOTREACHED */
  return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int __sigsetmask ( int  __mask)

Definition at line 23 of file sigsetmask.c.

{
  __set_errno (ENOSYS);
  return -1;
}

Here is the caller graph for this function:

Here is the caller graph for this function:

int __sigvec ( int  __sig,
__const struct sigvec __vec,
struct sigvec __ovec 
)

Here is the caller graph for this function:

int __sigwait ( __const sigset_t __set,
int __sig 
)

Here is the caller graph for this function:


Variable Documentation

Definition at line 18 of file signal.h.

siginfo_t * __info

Definition at line 34 of file signal.h.

Definition at line 39 of file signal.h.

siginfo_t __const struct timespec* __timeout

Definition at line 37 of file signal.h.

Definition at line 50 of file signal.h.

Definition at line 40 of file signal.h.