From owner-svn-src-head@freebsd.org Sun Jun 26 04:18:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AF55A79F41; Sun, 26 Jun 2016 04:18:45 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 405E71FAF; Sun, 26 Jun 2016 04:18:44 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id H1WqbR9OyEWlrH1WrbLZUs; Sat, 25 Jun 2016 22:18:43 -0600 X-Authority-Analysis: v=2.2 cv=P7p4vWIu c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pD_ry4oyNxEA:10 a=NEAV23lmAAAA:8 a=KqpIfyakAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=lFXPonph261V7IbAemoA:9 a=Bn2pgwyD2vrAyMmN8A2t:22 a=gdFSoX5FBteAPHjtcXXc:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 3ECE113753; Sat, 25 Jun 2016 21:18:40 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u5Q4Ico4060230; Sat, 25 Jun 2016 21:18:39 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201606260418.u5Q4Ico4060230@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jilles Tjoelker cc: Konstantin Belousov , Daniel Eischen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread In-Reply-To: Message from Jilles Tjoelker of "Sun, 26 Jun 2016 00:33:38 +0200." <20160625223338.GA22802@stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 25 Jun 2016 21:18:38 -0700 X-CMAE-Envelope: MS4wfGEg4iAgLr0LR+uL00awXkjT+GtycOUFPfTEpIE6aMAhzhIzp4SNmhQT+NgM36di8QrpT/dXaKYLjbJVpFD0Y/DVqhrzKlpK+2bt78rmW4ieaboqIcXN YZ+dOy3G0CPi5RJRjxH8TEcqPcbGmEh4QFanu+xocVK27vcGl5oTlI3PHyRLj1qD71giVLhB3kpyYL49N+kEk2VmtVU37ZV/3WmzXZOKfI5TE35p8bL1qzHZ SPuBhz60mkzXaVUo6SYGTKSli/I7baiohPZXx6jGX+DRPjD3PXeatUfOviV/QBGVMr6ITjWYA5KX8zHmVvTFo0gLYa8V4SJWMj9Xkxv8cJIMEoSCgoGdXCij 5MbKvBqM X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2016 04:18:45 -0000 In message <20160625223338.GA22802@stack.nl>, Jilles Tjoelker writes: > On Sat, Jun 25, 2016 at 08:29:56PM +0300, Konstantin Belousov wrote: > > I already asked re for approval of the reversal and got it. But I am still > > hesitating doing the revert vs. returning EDEADLK for error-checking > > mutexes. > > > My initial mistake was reading the statement about PTHREAD_MUTEX_ERRORCHECK > > returning EDEADLK as the requirement for both functions. It was induced > > by reading the following code in samba: > > https://github.com/samba-team/samba/blob/master/lib/tdb/common/mutex.c#L928 > > I did extracted this into stand-alone test and checked that glibc does > > return EDEADLK in this case. BTW, if somebody has Solaris machine availabl > e > > to test this, I would be grateful. Code is available at > > https://www.kib.kiev.ua/kib/pshared/pthread_samba.c > > > I.e., plain revert would disable the only known to me consumer of the > > robust mutexes. The patch which I mailed last time, returns EDEADLK for > > trylock on ERRORCHECKed mutexes only. And I am tending toward glibc > > compatibility there, over the literal POSIX compliance, but I want to > > see the confirmation from the Klimenko' test first. > > To be bug-compatible with glibc, you'd need to return the wrong > [EDEADLK] error for robust errorcheck mutexes only. Robust > non-errorcheck and non-robust errorcheck mutexes return the correct > [EBUSY]. I have not checked PI and PP mutexes which probably use a > different code path. > > I'm not sure whether we should copy glibc's bug, but if we do it must be > documented in the man page. I'm not happy with it because the bug may > break applications written to the standard; at least, Samba developers > should be contacted first. I think there are advantages both in POSIX and glibc compatibility however I think it more important to be POSIX compatible. Having said that, there may be a compromise. Either setting an environment variable and/or setting a global variable (or call a function) to invoke a glibc-bug emulation mode. Thus linux-only applications could be ported with minimally invasive alterations. Either we break POSIX compatibility (and some existing applications) or we can implement the above which may satisfy both camps. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.