This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
setcontext in a signal handler
- From: Will Newton <will dot newton at linaro dot org>
- To: Michael Kerrisk-manpages <mtk dot manpages at gmail dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Tue, 4 Mar 2014 10:46:37 +0800
- Subject: setcontext in a signal handler
- Authentication-results: sourceware.org; auth=none
Hi Michael,
The current getcontext(3) manpage has the following wording:
"Do not leave the handler using longjmp(3): it is undefined what
would happen with contexts. Use siglongjmp(3) or setcontext()
instead."
However the glibc documentation[1] has this:
" It is not allowed to do the context switching from the signal
handler directly since neither setcontext nor swapcontext are
functions which can be called from a signal handler."
It's not clear to me that there is any standard that mandates that
setcontext cannot be called from a signal handler or whether it is an
implementation detail of glibc. Does anybody know of any historical
reasons for this being the case?
Thanks,
[1] http://www.gnu.org/software/libc/manual/html_node/System-V-contexts.html
--
Will Newton
Toolchain Working Group, Linaro