1
/* sigaltstack.c - Generic sigaltstack implementation.
2
Copyright (C) 2008 Free Software Foundation, Inc.
3
Written by Neal H. Walfield <neal@gnu.org>.
5
This file is part of the GNU Hurd.
7
The GNU Hurd is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public License
9
as published by the Free Software Foundation; either version 3 of
10
the License, or (at your option) any later version.
12
The GNU Hurd is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public
18
License along with this program. If not, see
19
<http://www.gnu.org/licenses/>. */
21
#include "sig-internal.h"
22
#include "pt-internal.h"
25
sigaltstack (const stack_t *restrict stack, stack_t *restrict old)
28
struct signal_state *ss = &_pthread_self ()->ss;
30
pthread_mutex_lock (&ss->lock);
37
if (stack->ss_size < MINSIGSTKSZ)
43
if ((stack->ss_flags & ~(SS_DISABLE)))
44
/* Flags contains a value other than SS_DISABLE. */
50
if ((ss->stack.ss_flags & SS_ONSTACK))
61
pthread_mutex_unlock (&ss->lock);