From owner-freebsd-threads@FreeBSD.ORG Tue Sep 7 09:42:55 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E016A10656CB; Tue, 7 Sep 2010 09:42:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5DCF98FC0C; Tue, 7 Sep 2010 09:42:54 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o879gnDJ037240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Sep 2010 12:42:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o879gnuD052117; Tue, 7 Sep 2010 12:42:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o879gntI052108; Tue, 7 Sep 2010 12:42:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 7 Sep 2010 12:42:49 +0300 From: Kostik Belousov To: David Xu Message-ID: <20100907094249.GA2465@deviant.kiev.zoral.com.ua> References: <20100906220041.GA4729@stack.nl> <4C86787E.6070908@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <4C86787E.6070908@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 09:42:56 -0000 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 07, 2010 at 05:38:06PM +0000, David Xu wrote: > Jilles Tjoelker wrote: > >Our sigwait() implementation may not be POSIX-compliant as it returns > >EINTR when it is interrupted by a caught signal. (Unfortunately I can > >only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, > >Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH > >does not list an [EINTR] error condition, but does not prohibit one > >either like pthread_mutex_lock() and various others do.) > > > >However, libthr's wrapper for sigwait() relies on EINTR. To keep > >the possibility of changing this to be what POSIX intends, it would be > >nice to remove this dependency. > > > >One way is to include SIGCANCEL in the set of waited signals, but this > >requires two additional syscalls to mask/unmask SIGCANCEL. > > > >Another way is to use sigwaitinfo() in the wrapper, which is permitted > >to return [EINTR]. If [EINTR] is removed from the kernel sigwait(), > >looping on [EINTR] can then be implemented in the wrapper. > > > >Calling pthread_exit from the SIGCANCEL handler is not possible as this > >leaves the program in doubt about any signal consumed by sigwait(). > > > I have worked out a patch: >=20 > http://people.freebsd.org/~davidxu/patch/sigwait.diff Isn't __sys_sigwait() supposed to return -1 and set errno ? --EVF5PPMfhYS0aIcm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyGCRkACgkQC3+MBN1Mb4h+OACg7hfjTQxIBo51l48MFze1jB53 togAoMLB2WBbXhiK3kze065He7fIGl05 =AZkA -----END PGP SIGNATURE----- --EVF5PPMfhYS0aIcm--