From owner-svn-src-all@FreeBSD.ORG Tue Feb 15 21:42:48 2011 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 CC222106564A; Tue, 15 Feb 2011 21:42:48 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B96278FC13; Tue, 15 Feb 2011 21:42:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1FLgmJP046231; Tue, 15 Feb 2011 21:42:48 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1FLgm0P046229; Tue, 15 Feb 2011 21:42:48 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201102152142.p1FLgm0P046229@svn.freebsd.org> From: Dmitry Chagin Date: Tue, 15 Feb 2011 21:42:48 +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: r218719 - head/sys/compat/linux 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: Tue, 15 Feb 2011 21:42:48 -0000 Author: dchagin Date: Tue Feb 15 21:42:48 2011 New Revision: 218719 URL: http://svn.freebsd.org/changeset/base/218719 Log: Make a linux_rt_sigtimedwait() system call is actually working. 1) Translate the native signal number in the appropriate Linux signal. 2) Remove bogus code, which can lead to a panic as it calls kern_sigtimedwait with same ksiginfo. 3) Return the corresponding signal number. Modified: head/sys/compat/linux/linux_signal.c Modified: head/sys/compat/linux/linux_signal.c ============================================================================== --- head/sys/compat/linux/linux_signal.c Tue Feb 15 21:24:50 2011 (r218718) +++ head/sys/compat/linux/linux_signal.c Tue Feb 15 21:42:48 2011 (r218719) @@ -431,7 +431,7 @@ int linux_rt_sigtimedwait(struct thread *td, struct linux_rt_sigtimedwait_args *args) { - int error; + int error, sig; l_timeval ltv; struct timeval tv; struct timespec ts, *tsa; @@ -495,19 +495,15 @@ linux_rt_sigtimedwait(struct thread *td, if (error) return (error); + sig = BSD_TO_LINUX_SIGNAL(info.ksi_signo); + if (args->ptr) { memset(&linfo, 0, sizeof(linfo)); - linfo.lsi_signo = info.ksi_signo; + ksiginfo_to_lsiginfo(&info, &linfo, sig); error = copyout(&linfo, args->ptr, sizeof(linfo)); } - - /* Repost if we got an error. */ - if (error && info.ksi_signo) { - PROC_LOCK(td->td_proc); - tdksignal(td, info.ksi_signo, &info); - PROC_UNLOCK(td->td_proc); - } else - td->td_retval[0] = info.ksi_signo; + if (error == 0) + td->td_retval[0] = sig; return (error); }