aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/i386/trampoline.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-04-02 22:08:59 +0000
committerRoland McGrath <roland@gnu.org>1995-04-02 22:08:59 +0000
commite607b492e56e2fc3c08e72d5a58349354a584cf2 (patch)
tree8e48c89250656dd4322f32248c3d5497ae148951 /sysdeps/mach/hurd/i386/trampoline.c
parent193ce8dcd6c1eea5c68e6d4d8db2002c0085925b (diff)
downloadglibc-e607b492e56e2fc3c08e72d5a58349354a584cf2.tar
glibc-e607b492e56e2fc3c08e72d5a58349354a584cf2.tar.gz
glibc-e607b492e56e2fc3c08e72d5a58349354a584cf2.tar.bz2
glibc-e607b492e56e2fc3c08e72d5a58349354a584cf2.zip
Sun Apr 2 13:13:52 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/mach/hurd/i386/trampoline.c: Add a link to SS->active_resources, so that _hurdsig_longjmp_from_handler will be called when a longjmp unwinds the signal frame. * sysdeps/mach/hurd/i386/sigreturn.c: Remove the link on the SS->active_resources chain added by _hurd_setup_sighandler. * hurd/sigunwind.c: New file. * hurd/Makefile (sig): Add sigunwind. * Makerules (lib%.so: lib%_pic.a): Remove dir name from $*. * MakeTAGS (tags-sources): Include $(all-dist). [subdir] (all-dist): Define to $(distribute).
Diffstat (limited to 'sysdeps/mach/hurd/i386/trampoline.c')
-rw-r--r--sysdeps/mach/hurd/i386/trampoline.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/i386/trampoline.c b/sysdeps/mach/hurd/i386/trampoline.c
index a83a8a8e7d..5f3361b97e 100644
--- a/sysdeps/mach/hurd/i386/trampoline.c
+++ b/sysdeps/mach/hurd/i386/trampoline.c
@@ -18,6 +18,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <hurd/signal.h>
+#include <hurd/userlink.h>
#include "thread_state.h"
#include <assert.h>
#include <errno.h>
@@ -55,6 +56,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
void *sigreturn_returns_here;
struct sigcontext *return_scp; /* Same; arg to sigreturn. */
struct sigcontext ctx;
+ struct hurd_userlink link;
} *stackframe;
if (ss->context)
@@ -118,6 +120,24 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
{
int ok;
+ extern void _hurdsig_longjmp_from_handler (void *, jmp_buf, int);
+
+ /* Add a link to the thread's active-resources list. We mark this as
+ the only user of the "resource", so the cleanup function will be
+ called by any longjmp which is unwinding past the signal frame.
+ The cleanup function (in sigunwind.c) will make sure that all the
+ appropriate cleanups done by sigreturn are taken care of. */
+ stackframe->link.cleanup = &_hurdsig_longjmp_from_handler;
+ stackframe->link.cleanup_data = &stackframe->ctx;
+ stackframe->link.resource.next = NULL;
+ stackframe->link.resource.prevp = NULL;
+ stackframe->link.thread.next = ss->active_resources;
+ stackframe->link.thread.prevp = &ss->active_resources;
+ if (stackframe->link.thread.next)
+ stackframe->link.thread.next->thread.prevp
+ = &stackframe->link.thread.next;
+ ss->active_resources = &stackframe->link;
+
/* Set up the arguments for the signal handler. */
stackframe->signo = signo;
stackframe->sigcode = sigcode;