From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 8 10:55:43 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B28E106566B for ; Thu, 8 Oct 2009 10:55:43 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: from mail-bw0-f227.google.com (mail-bw0-f227.google.com [209.85.218.227]) by mx1.freebsd.org (Postfix) with ESMTP id B68FD8FC17 for ; Thu, 8 Oct 2009 10:55:42 +0000 (UTC) Received: by bwz27 with SMTP id 27so4578125bwz.43 for ; Thu, 08 Oct 2009 03:55:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.25.27 with SMTP id x27mr297143fab.7.1254997437520; Thu, 08 Oct 2009 03:23:57 -0700 (PDT) In-Reply-To: <20091008100209.GG2259@deviant.kiev.zoral.com.ua> References: <6300771b0910071753s6580c099i8c348824a6fe1a72@mail.gmail.com> <20091008100209.GG2259@deviant.kiev.zoral.com.ua> From: Vlad Galu Date: Thu, 8 Oct 2009 13:23:37 +0300 Message-ID: To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: Stephen Hocking , hackers@freebsd.org Subject: Re: sigwait - differences between Linux & FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Oct 2009 10:55:43 -0000 On Thu, Oct 8, 2009 at 1:02 PM, Kostik Belousov wrote: > On Thu, Oct 08, 2009 at 11:53:21AM +1100, Stephen Hocking wrote: >> Hi all, >> >> In my efforts to make the xrdp port more robust under FreeBSD, I have >> discovered that sigwait (kind of an analogue to select(2), but for >> signals rather than I/O) re-enables ignored signals in its list under >> Linux, but not FreeBSD. The sesman daemon uses SIGCHLD to clean up >> after a session has exited. Under Linux this works OK, under FreeSBD >> it doesn't. I have worked around it in a very hackish manner (define a >> dummy signal handler and enable it using signal, which means that the >> sigwait call can then be unblocked by it), but am wondering if anyone >> else has run across the same problem, and if so, if they fixed it in >> an elegant manner. Also, does anyone know the correct semantics of >> sigwait under this situation? > > ports@ is the wrong list to discuss the issue in the base system. > > Solaris 10 sigwait(2) manpage says the following: > If sigwait() is called on an ignored signal, then the occurrence of the > signal will be ignored, unless sigaction() changes the disposition. > > We have the same behaviour as Solaris, ingored signals are not queued or > recorded regardeless of the presence of sigwaiting thread. > This is a bit confusing. sigwait(2) says: "The signals specified by set should be blocked at the time of the call to sigwait()."...