From owner-svn-src-stable@FreeBSD.ORG Tue Feb 21 21:21:32 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 545F41065674; Tue, 21 Feb 2012 21:21:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 426D38FC14; Tue, 21 Feb 2012 21:21:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1LLLWLj020378; Tue, 21 Feb 2012 21:21:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1LLLW6l020376; Tue, 21 Feb 2012 21:21:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202212121.q1LLLW6l020376@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 21 Feb 2012 21:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231983 - stable/9/lib/libthr/thread X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 21:21:32 -0000 Author: kib Date: Tue Feb 21 21:21:31 2012 New Revision: 231983 URL: http://svn.freebsd.org/changeset/base/231983 Log: MFC r230430: Use getcontextx(3) internal API instead of getcontext(2) to provide the signal handlers with the context information in the deferrred case. Modified: stable/9/lib/libthr/thread/thr_sig.c Directory Properties: stable/9/lib/libthr/ (props changed) Modified: stable/9/lib/libthr/thread/thr_sig.c ============================================================================== --- stable/9/lib/libthr/thread/thr_sig.c Tue Feb 21 21:20:52 2012 (r231982) +++ stable/9/lib/libthr/thread/thr_sig.c Tue Feb 21 21:21:31 2012 (r231983) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include "un-namespace.h" @@ -314,16 +315,24 @@ check_cancel(struct pthread *curthread, static void check_deferred_signal(struct pthread *curthread) { - ucontext_t uc; + ucontext_t *uc; struct sigaction act; siginfo_t info; if (__predict_true(curthread->deferred_siginfo.si_signo == 0)) return; - getcontext(&uc); + +#if defined(__amd64__) || defined(__i386__) + uc = alloca(__getcontextx_size()); + __fillcontextx((char *)uc); +#else + ucontext_t ucv; + uc = &ucv; + getcontext(uc); +#endif if (curthread->deferred_siginfo.si_signo != 0) { act = curthread->deferred_sigact; - uc.uc_sigmask = curthread->deferred_sigmask; + uc->uc_sigmask = curthread->deferred_sigmask; memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t)); /* remove signal */ curthread->deferred_siginfo.si_signo = 0; @@ -334,7 +343,7 @@ check_deferred_signal(struct pthread *cu tact.sa_handler = SIG_DFL; _sigaction(info.si_signo, &tact, NULL); } - handle_signal(&act, info.si_signo, &info, &uc); + handle_signal(&act, info.si_signo, &info, uc); } }