From 22465796edbfd6f156ca2930f56b3345cc54b164 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 19 Jun 2015 15:58:23 +0200 Subject: Preliminary infrastructure to implement alternate stack * libc/include/sys/signal.h: Define SS_ONSTACK and SS_DISABLE unconditionally. (sigaltstack): Enable prototype on Cygwin. * common.din (sigaltstack): Export. * cygtls.cc (_cygtls::init_thread): Initialize altstack. * cygtls.h (__tlsstack_t): Rename from __stack_t to distinguish more clearly from stack_t. Accommodate throughout. (_cygtls): Add altstack member. * exceptions.cc (exception::handle): Set SIGSEGV handler to SIG_DFL if we encounter a stack overflow, and no alternate stack has been defined. * include/cygwin/signal.h (MINSIGSTKSZ): Define (SIGSTKSZ): Define. (SA_ONSTACK): Define. * signal.cc (sigaltstack): New function. * tlsoffset.h: Regenerate. * tlsoffset64.h: Ditto. Signed-off-by: Corinna Vinschen --- newlib/libc/include/sys/signal.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'newlib/libc/include/sys/signal.h') diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h index 6ff758ce7..f2087fe62 100644 --- a/newlib/libc/include/sys/signal.h +++ b/newlib/libc/include/sys/signal.h @@ -120,11 +120,6 @@ struct sigaction { #define SIGSTKSZ 8192 #endif -/* - * Possible values for ss_flags in stack_t below. - */ -#define SS_ONSTACK 0x1 -#define SS_DISABLE 0x2 #endif #elif defined(__CYGWIN__) @@ -142,6 +137,12 @@ struct sigaction }; #endif /* defined(__rtems__) */ +/* + * Possible values for ss_flags in stack_t below. + */ +#define SS_ONSTACK 0x1 +#define SS_DISABLE 0x2 + /* * Structure used in sigaltstack call. */ @@ -196,7 +197,7 @@ int _EXFUN(sigpending, (sigset_t *)); int _EXFUN(sigsuspend, (const sigset_t *)); int _EXFUN(sigpause, (int)); -#ifdef __rtems__ +#if defined(__CYGWIN__) || defined(__rtems__) #if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict)); #endif -- cgit v1.2.3