* libc/include/machine/setjmp.h (__SIGMASK_FUNC): Define as
pthread_sigmask or sigprocmask depending on _POSIX_THREADS. (sigsetjmp): Use __SIGMASK_FUNC. (siglongjmp): Ditto. (_setjmp): Define as macro. (_longjmp): Ditto.
This commit is contained in:
parent
2652ae1036
commit
12df8a5b53
@ -1,3 +1,12 @@
|
|||||||
|
2008-01-15 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* libc/include/machine/setjmp.h (__SIGMASK_FUNC): Define as
|
||||||
|
pthread_sigmask or sigprocmask depending on _POSIX_THREADS.
|
||||||
|
(sigsetjmp): Use __SIGMASK_FUNC.
|
||||||
|
(siglongjmp): Ditto.
|
||||||
|
(_setjmp): Define as macro.
|
||||||
|
(_longjmp): Ditto.
|
||||||
|
|
||||||
2008-01-11 Eric Blake <ebb9@byu.net>
|
2008-01-11 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
Make strstr and strcasestr O(n), not O(n^2); add memmem.
|
Make strstr and strcasestr O(n), not O(n^2); add memmem.
|
||||||
|
@ -268,6 +268,12 @@ typedef int sigjmp_buf[_JBLEN+2];
|
|||||||
# define _CYGWIN_WORKING_SIGSETJMP
|
# define _CYGWIN_WORKING_SIGSETJMP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _POSIX_THREADS
|
||||||
|
#define __SIGMASK_FUNC pthread_sigmask
|
||||||
|
#else
|
||||||
|
#define __SIGMASK_FUNC sigprocmask
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
|
||||||
#define sigsetjmp(env, savemask) \
|
#define sigsetjmp(env, savemask) \
|
||||||
@ -275,7 +281,7 @@ typedef int sigjmp_buf[_JBLEN+2];
|
|||||||
({ \
|
({ \
|
||||||
sigjmp_buf *_sjbuf = &(env); \
|
sigjmp_buf *_sjbuf = &(env); \
|
||||||
((*_sjbuf)[_SAVEMASK] = savemask,\
|
((*_sjbuf)[_SAVEMASK] = savemask,\
|
||||||
sigprocmask (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
|
__SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
|
||||||
setjmp (*_sjbuf)); \
|
setjmp (*_sjbuf)); \
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -284,7 +290,7 @@ typedef int sigjmp_buf[_JBLEN+2];
|
|||||||
({ \
|
({ \
|
||||||
sigjmp_buf *_sjbuf = &(env); \
|
sigjmp_buf *_sjbuf = &(env); \
|
||||||
((((*_sjbuf)[_SAVEMASK]) ? \
|
((((*_sjbuf)[_SAVEMASK]) ? \
|
||||||
sigprocmask (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
|
__SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
|
||||||
: 0), \
|
: 0), \
|
||||||
longjmp (*_sjbuf, val)); \
|
longjmp (*_sjbuf, val)); \
|
||||||
})
|
})
|
||||||
@ -292,15 +298,21 @@ typedef int sigjmp_buf[_JBLEN+2];
|
|||||||
#else /* !__GNUC__ */
|
#else /* !__GNUC__ */
|
||||||
|
|
||||||
#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
|
#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
|
||||||
sigprocmask (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
|
__SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
|
||||||
setjmp (env))
|
setjmp (env))
|
||||||
|
|
||||||
#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
|
#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
|
||||||
sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
|
__SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
|
||||||
longjmp (env, val))
|
longjmp (env, val))
|
||||||
|
|
||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user