From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6698 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [RFC] EINTR and PC loser-ing library design Date: Mon, 8 Dec 2014 11:00:10 -0500 Message-ID: <20141208160010.GH4574@brightrain.aerifal.cx> References: <20141208141039.GA4574@brightrain.aerifal.cx> <5485B5E1.90602@skarnet.org> <20141208143223.GB4574@brightrain.aerifal.cx> <5485B98D.4010603@skarnet.org> <20141208152844.GF4574@brightrain.aerifal.cx> <5485C86C.4090407@skarnet.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1418054438 17428 80.91.229.3 (8 Dec 2014 16:00:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2014 16:00:38 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6711-gllmg-musl=m.gmane.org@lists.openwall.com Mon Dec 08 17:00:31 2014 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Xy0jZ-0005OQ-Cd for gllmg-musl@m.gmane.org; Mon, 08 Dec 2014 17:00:25 +0100 Original-Received: (qmail 1989 invoked by uid 550); 8 Dec 2014 16:00:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 1979 invoked from network); 8 Dec 2014 16:00:22 -0000 Content-Disposition: inline In-Reply-To: <5485C86C.4090407@skarnet.org> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:6698 Archived-At: On Mon, Dec 08, 2014 at 04:49:00PM +0100, Laurent Bercot wrote: > On 08/12/2014 16:28, Rich Felker wrote: > >The only such exception I'm aware of is that POSIX allows, but does > >not require, select to fail with EINTR even when SA_RESTART is used. > > What do you say of poll ? > The poll() function shall fail if: > [EINTR] > A signal was caught during poll(). > > Note that it is "shall", not "may". > > One may argue that the SA_RESTART behaviour has priority over "poll() shall > fail with EINTR if a signal is caught", as with other functions such as > read(), but one may also argue that, just as with select(), it makes perfect > sense to *not* restart poll() when a signal is caught, since time has elapsed > since the original call and the application may want to update the timeout > values, so the exception that applies to select should also apply to poll. Since poll does not have explicit text overriding the text on SA_RESTART, my understanding is that it's required to obey SA_RESTART. However it's unclear because most functions which have EINTR as a specified error use the phrase "the function was interrupted [before]..." (in particular, the word "interrupted" appears) whereas the text for poll merely says "a signal was caught". This should probably be clarified. Note that the Linux behavior is that poll restarts automatically. I'm not sure about select. Rich