[patch/rfa]: Add _setjmp/_longjmp macros

Corinna Vinschen vinschen@redhat.com
Mon Jan 14 18:21:00 GMT 2008


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.

Ok to apply?


Thanks,
Corinna


	* libc/include/machine/setjmp.h (_setjmp): Define as macro.
	(_longjmp): Ditto.


Index: libc/include/machine/setjmp.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/machine/setjmp.h,v
retrieving revision 1.34
diff -u -p -r1.34 setjmp.h
--- libc/include/machine/setjmp.h	7 Nov 2007 21:42:24 -0000	1.34
+++ libc/include/machine/setjmp.h	13 Jan 2008 16:32:35 -0000
@@ -301,6 +301,12 @@ typedef int sigjmp_buf[_JBLEN+2];
 
 #endif
 
+/* POSIX _setjmp/_longjmp macros, maintained for XSI compatibility.  These
+   are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
+   New applications should use sigsetjmp/siglongjmp instead. */
+#define _setjmp(env)		sigsetjmp ((env), 0)
+#define _longjmp(env, val)	siglongjmp ((env), (val))
+
 #ifdef __cplusplus
 }
 #endif


-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat



More information about the Newlib mailing list