From owner-freebsd-bugs@FreeBSD.ORG Mon Feb 4 18:04:39 2013 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2EEEEAF6; Mon, 4 Feb 2013 18:04:39 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id DD36FFF5; Mon, 4 Feb 2013 18:04:38 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 6D348359308; Mon, 4 Feb 2013 19:04:36 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 4C4AB2848C; Mon, 4 Feb 2013 19:04:36 +0100 (CET) Date: Mon, 4 Feb 2013 19:04:36 +0100 From: Jilles Tjoelker To: Bruce Evans Subject: Re: kern/175674: sem_open() should use O_EXLOCK with open() instead of a separate flock() call Message-ID: <20130204180435.GA21245@stack.nl> References: <201302032100.r13L01PG044439@freefall.freebsd.org> <20130204173830.K1078@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130204173830.K1078@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Eitan Adler , freebsd-bugs@FreeBSD.org, Giorgos Keramidas X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 18:04:39 -0000 On Mon, Feb 04, 2013 at 05:45:40PM +1100, Bruce Evans wrote: > On Sun, 3 Feb 2013, Eitan Adler wrote: > > On 3 February 2013 16:00, Giorgos Keramidas wrote: > >> The following reply was made to PR kern/175674; it has been noted by GNATS. > >> > The best way to fix this is in kern_openat() in the kernel but this > >> > might cause compatibility issues. > >> Not sure if there would be serious compatibility problems if > >> open() would automatically restart instead of returning EINTR. It > >> definitely seems a rather intrusive change though. > > I can not see major application breakage should open(3) be changed. > > That said, I am confused by jilles' comment: > > http://pubs.opengroup.org/onlinepubs/000095399/functions/open.html > > open(3) is permitted to return EINTR. > Actually, open(3) is _required_ to return EINTR (if a signal occurs). > This hasn't changed since the old (2001) POSIX draft that I quoted in a > more detailed reply. The wording is "shall fail...[with EINTR] if a > signal was caught during open()". Only a perverse implementation of > weaselnix would justify not returning EINTR by not catching signals. Many more functions have an [EINTR] error condition specified and SA_RESTART is usually not mentioned. This is because SA_RESTART is specified in the sigaction() page to override the [EINTR] error unless explicitly specified otherwise (for example, read(), write(), sleep(), select() and pselect()). There is a change in POSIX.1-2008 for functions with timeouts. -- Jilles Tjoelker