[patch/rfa]: Add _setjmp/_longjmp macros
Joel Sherrill
joel.sherrill@oarcorp.com
Tue Jun 24 02:34:00 GMT 2008
Corinna Vinschen wrote:
> On Jan 13 17:32, Corinna Vinschen wrote:
>
>> Hi,
>>
>> SUSv3 defines a _setjmp/_longjmp pair of functions, which are equivalent
>> to setjmp/longjmp, except that they shall never manipulate the signal
>> mask:
>>
>> http://www.opengroup.org/onlinepubs/009695399/functions/_setjmp.html
>>
>> The below patch adds _setjmp and _longjmp as macros calling
>> sigsetjmp/siglongjmp.
>>
>
> I applied the below additional patch as obvious. It defines both
> interfaces as functions when building for Cygwin.
>
>
Would you mind making them available for RTEMS also?
We try to follow SYSv3 as much as is possible in a single process,
multithreaded environment (PSE52).
It should just require doing an "|| defined(__rtems__)"
Thanks.
--joel
> Corinna
>
>
> * libc/include/machine/setjmp.h (_longjmp): Define as function on
> Cygwin.
> (_setjmp): Ditto.
>
>
> Index: libc/include/machine/setjmp.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/include/machine/setjmp.h,v
> retrieving revision 1.35
> diff -u -p -r1.35 setjmp.h
> --- libc/include/machine/setjmp.h 15 Jan 2008 09:41:06 -0000 1.35
> +++ libc/include/machine/setjmp.h 21 Jun 2008 18:45:53 -0000
> @@ -307,11 +307,16 @@ typedef int sigjmp_buf[_JBLEN+2];
>
> #endif
>
> -/* POSIX _setjmp/_longjmp macros, maintained for XSI compatibility. These
> +/* POSIX _setjmp/_longjmp, maintained for XSI compatibility. These
> are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
> New applications should use sigsetjmp/siglongjmp instead. */
> +#ifdef __CYGWIN__
> +extern void _longjmp(jmp_buf, int);
> +extern int _setjmp(jmp_buf);
> +#else
> #define _setjmp(env) sigsetjmp ((env), 0)
> #define _longjmp(env, val) siglongjmp ((env), (val))
> +#endif
>
> #ifdef __cplusplus
> }
>
> --
> Corinna Vinschen
> Cygwin Project Co-Leader
> Red Hat
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the Newlib
mailing list