Back to index

glibc  2.9
Functions
sigprocmask.c File Reference
#include <errno.h>
#include <signal.h>
#include <hurd.h>
#include <hurd/signal.h>
#include <hurd/msg.h>

Go to the source code of this file.

Functions

int __sigprocmask (int how, const sigset_t *set, sigset_t *oset)

Function Documentation

int __sigprocmask ( int  how,
const sigset_t set,
sigset_t oset 
)

Definition at line 29 of file sigprocmask.c.

{
  struct hurd_sigstate *ss;
  sigset_t old, new;
  sigset_t pending;

  if (set != NULL)
    new = *set;

  ss = _hurd_self_sigstate ();

  __spin_lock (&ss->lock);

  old = ss->blocked;

  if (set != NULL)
    {
      switch (how)
       {
       case SIG_BLOCK:
         __sigorset (&ss->blocked, &ss->blocked, &new);
         break;

       case SIG_UNBLOCK:
         ss->blocked &= ~new;
         break;

       case SIG_SETMASK:
         ss->blocked = new;
         break;

       default:
         __spin_unlock (&ss->lock);
         errno = EINVAL;
         return -1;
       }

      ss->blocked &= ~_SIG_CANT_MASK;
    }

  pending = ss->pending & ~ss->blocked;

  __spin_unlock (&ss->lock);

  if (oset != NULL)
    *oset = old;

  if (pending)
    /* Send a message to the signal thread so it
       will wake up and check for pending signals.  */
    __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());

  return 0;
}

Here is the call graph for this function: