From owner-svn-src-all@FreeBSD.ORG Sat Jan 21 18:06:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52CE61065686; Sat, 21 Jan 2012 18:06:19 +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 235388FC16; Sat, 21 Jan 2012 18:06:19 +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 q0LI6JW5003337; Sat, 21 Jan 2012 18:06:19 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0LI6J3o003335; Sat, 21 Jan 2012 18:06:19 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201211806.q0LI6J3o003335@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jan 2012 18:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230430 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2012 18:06:19 -0000 Author: kib Date: Sat Jan 21 18:06:18 2012 New Revision: 230430 URL: http://svn.freebsd.org/changeset/base/230430 Log: Use getcontextx(3) internal API instead of getcontext(2) to provide the signal handlers with the context information in the deferrred case. Only enable the use of getcontextx(3) in the deferred signal delivery code on amd64 and i386. Sparc64 seems to have some undetermined issues with interaction of alloca(3) and signal delivery. Tested by: flo (who also provided sparc64 harware access for me), pho Discussed with: marius MFC after: 1 month Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Sat Jan 21 18:00:28 2012 (r230429) +++ head/lib/libthr/thread/thr_sig.c Sat Jan 21 18:06:18 2012 (r230430) @@ -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); } }