Date: Thu, 18 Apr 2013 05:56:01 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249606 - head/lib/libthr/thread Message-ID: <201304180556.r3I5u1Yd021809@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davidxu Date: Thu Apr 18 05:56:00 2013 New Revision: 249606 URL: http://svnweb.freebsd.org/changeset/base/249606 Log: Avoid copying memory if SIGCANCEL is not masked. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Thu Apr 18 05:34:33 2013 (r249605) +++ head/lib/libthr/thread/thr_sig.c Thu Apr 18 05:56:00 2013 (r249606) @@ -732,8 +732,12 @@ _setcontext(const ucontext_t *ucp) { ucontext_t uc; + if (ucp == NULL) + return (EINVAL); + if (!SIGISMEMBER(uc.uc_sigmask, SIGCANCEL)) + return __sys_setcontext(ucp); (void) memcpy(&uc, ucp, sizeof(uc)); - remove_thr_signals(&uc.uc_sigmask); + SIGDELSET(uc.uc_sigmask, SIGCANCEL); return __sys_setcontext(&uc); } @@ -743,7 +747,13 @@ _swapcontext(ucontext_t *oucp, const uco { ucontext_t uc; - (void) memcpy(&uc, ucp, sizeof(uc)); - remove_thr_signals(&uc.uc_sigmask); - return __sys_swapcontext(oucp, &uc); + if (oucp == NULL || ucp == NULL) + return (EINVAL); + if (SIGISMEMBER(ucp->uc_sigmask, SIGCANCEL)) { + stdout_debug("remove SIGCANCEL\n"); + (void) memcpy(&uc, ucp, sizeof(uc)); + SIGDELSET(uc.uc_sigmask, SIGCANCEL); + ucp = &uc; + } + return __sys_swapcontext(oucp, ucp); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304180556.r3I5u1Yd021809>