Add sigaltstack() prototype - Round 2
Corinna Vinschen
vinschen@redhat.com
Fri Aug 15 20:34:00 GMT 2014
On Aug 15 11:04, Joel Sherrill wrote:
> On 8/15/2014 9:32 AM, Corinna Vinschen wrote:
> > POSIX also defines SIGSTKSZ and MINSIGSTKSZ.
> And checking the signal.h Open Group page, there is also SA_ONSTACK. The
> SA_xxx constants are in OS specific sections so I added this only to the
> RTEMS section with the same guards.
> > I'm wondering if we
> > shouldn't add default values here if the variables aren't already
> > defined. Or would that rather be something for the target specific
> > config?
> They should be target specific but we could default them if not defined
> in <sys/features.h>. <sys/features.h> is already included so that is already
> a dependency.
>
> My CentOS 6.x defines them in <asm/signal.h> to this:
>
> #define MINSIGSTKSZ 2048
> #define SIGSTKSZ 8192
>
> Those seem reasonable enough as defaults the target can override.
Indeed.
> Attached is another revision. Don't fret over catching my mistakes. It
> is part of the process.
:)
Patch looks good now. Please apply.
Thanks,
Corinna
> Index: newlib/libc/include/sys/signal.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/include/sys/signal.h,v
> retrieving revision 1.22
> diff -u -r1.22 signal.h
> --- newlib/libc/include/sys/signal.h 26 Oct 2012 09:23:46 -0000 1.22
> +++ newlib/libc/include/sys/signal.h 15 Aug 2014 16:03:12 -0000
> @@ -71,9 +71,12 @@
>
> /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
>
> -#define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */
> -#define SA_SIGINFO 2 /* Invoke the signal catching function with */
> - /* three arguments instead of one. */
> +#define SA_NOCLDSTOP 0x1 /* Do not generate SIGCHLD when children stop */
> +#define SA_SIGINFO 0x2 /* Invoke the signal catching function with */
> + /* three arguments instead of one. */
> +#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
> +#define SA_ONSTACK 0x4 /* Signal delivery will be on a separate stack. */
> +#endif
>
> /* struct sigaction notes from POSIX:
> *
> @@ -104,6 +107,34 @@
> #define sa_sigaction _signal_handlers._sigaction
> #endif
>
> +#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
> +/*
> + * Minimum and default signal stack constants. Allow for target overrides
> + * from <sys/features.h>.
> + */
> +#ifndef MINSIGSTKSZ
> +#define MINSIGSTKSZ 2048
> +#endif
> +#ifndef SIGSTKSZ
> +#define SIGSTKSZ 8192
> +#endif
> +
> +/*
> + * Possible values for ss_flags in stack_t below.
> + */
> +#define SS_ONSTACK 0x1
> +#define SS_DISABLE 0x2
> +
> +/*
> + * Structure used in sigaltstack call.
> + */
> +typedef struct sigaltstack {
> + void *ss_sp; /* Stack base or pointer. */
> + int ss_flags; /* Flags. */
> + size_t ss_size; /* Stack size. */
> +} stack_t;
> +#endif
> +
> #elif defined(__CYGWIN__)
> #include <cygwin/signal.h>
> #else
> @@ -161,6 +192,11 @@
> int _EXFUN(sigsuspend, (const sigset_t *));
> int _EXFUN(sigpause, (int));
>
> +
> +#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
> +int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
> +#endif
> +
> #if defined(_POSIX_THREADS)
> #ifdef __CYGWIN__
> # ifndef _CYGWIN_TYPES_H
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20140815/56007955/attachment.sig>
More information about the Newlib
mailing list