From owner-freebsd-hackers Thu Jun 7 7:53:42 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from post.webmailer.de (natpost.webmailer.de [192.67.198.65]) by hub.freebsd.org (Postfix) with ESMTP id 8CB3B37B403 for ; Thu, 7 Jun 2001 07:53:19 -0700 (PDT) (envelope-from freebsd-ml@econos.de) Received: from stefan-bt (pD95024D6.dip.t-dialin.net [217.80.36.214]) by post.webmailer.de (8.9.3/8.8.7) with SMTP id QAA14692 for ; Thu, 7 Jun 2001 16:53:14 +0200 (MET DST) From: Stefan Hoffmeister To: freebsd-hackers@FreeBSD.ORG Subject: Re: libc_r, signal handler ucontext modification Date: Thu, 07 Jun 2001 16:52:16 +0200 Organization: Econos Message-ID: References: In-Reply-To: X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG : 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