Back to index

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

Go to the source code of this file.

Functions

int __sigaltstack (struct sigaltstack *argss, struct sigaltstack *oss) const

Function Documentation

int __sigaltstack ( struct sigaltstack argss,
struct sigaltstack oss 
) const

Definition at line 26 of file sigaltstack.c.

{
  struct hurd_sigstate *s;
  struct sigaltstack ss, old;

  /* Fault before taking any locks.  */
  if (argss != NULL)
    ss = *argss;
  if (oss != NULL)
    *(volatile struct sigaltstack *) oss = *oss;

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

  if (argss != NULL &&
      (ss.ss_flags & SS_DISABLE) && (s->sigaltstack.ss_flags & SS_ONSTACK))
    {
      /* Can't disable a stack that is in use.  */
      __spin_unlock (&s->lock);
      errno = EINVAL;
      return -1;
    }

  old = s->sigaltstack;

  if (argss != NULL)
    s->sigaltstack = ss;

  __spin_unlock (&s->lock);

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

  return 0;
}

Here is the call graph for this function: