Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Jun 2001 16:52:16 +0200
From:      Stefan Hoffmeister <freebsd-ml@econos.de>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: libc_r, signal handler ucontext modification
Message-ID:  <if4vht0v8dlrc51kuokta0cs0r5p7flef9@4ax.com>
In-Reply-To: <j5vuhtsb6uoenhdpo23qo2ouerqs0i17lm@4ax.com>
References:  <j5vuhtsb6uoenhdpo23qo2ouerqs0i17lm@4ax.com>

next in thread | previous in thread | raw e-mail | index | archive | help
: On Thu, 07 Jun 2001 15:21:31 +0200, Stefan Hoffmeister wrote:

>I admit that all this is somewhat anecdotal, but I haven't looked in
>detail yet at what happens after the signal handler has returned to
>
>  uthread/uthread_sig.c -> _thread_sig_wrapper

Looking at code in question, I wonder whether in uthread_sig.c this code:

*********************************
static void
thread_sigframe_add(pthread_t thread, int sig, int has_args)
{

...

	if (has_args) {
		/* Copy the signal handler arguments to the signal frame: */
		memcpy(&psf->uc, &_thread_sigq[psf->signo - 1].uc,
		    sizeof(psf->uc));
		memcpy(&psf->siginfo, &_thread_sigq[psf->signo - 1].siginfo,
		    sizeof(psf->siginfo));
	}
...
*********************************

should get matching code

*********************************

void
_thread_sigframe_restore(pthread_t thread, struct pthread_signal_frame
*psf)
{
	thread->ctxtype = psf->ctxtype;
-	memcpy(&thread->ctx.uc, &psf->ctx.uc, sizeof(thread->ctx.uc));
+	if (psf->sig_has_args)
+		memcpy(&thread->ctx.uc, &psf->uc, sizeof(thread->ctx.uc));
+	else
+		memcpy(&thread->ctx.uc, &psf->ctx.uc, sizeof(thread->ctx.uc));

*********************************

or something like that.

The above is completely untested, based on five minutes of staring at the
code, not even compiled, and I have no idea what I am doing :-)

Thoughts?

TIA,
Stefan

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?if4vht0v8dlrc51kuokta0cs0r5p7flef9>