From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6689 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 09:32:23 -0500 Message-ID: <20141208143223.GB4574@brightrain.aerifal.cx> References: <20141208141039.GA4574@brightrain.aerifal.cx> <5485B5E1.90602@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 1418049168 24450 80.91.229.3 (8 Dec 2014 14:32:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2014 14:32:48 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6702-gllmg-musl=m.gmane.org@lists.openwall.com Mon Dec 08 15:32:38 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 1XxzMb-00042g-Om for gllmg-musl@m.gmane.org; Mon, 08 Dec 2014 15:32:37 +0100 Original-Received: (qmail 19461 invoked by uid 550); 8 Dec 2014 14:32:36 -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 18426 invoked from network); 8 Dec 2014 14:32:35 -0000 Content-Disposition: inline In-Reply-To: <5485B5E1.90602@skarnet.org> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:6689 Archived-At: On Mon, Dec 08, 2014 at 03:29:53PM +0100, Laurent Bercot wrote: > On 08/12/2014 15:10, Rich Felker wrote: > > >I don't see what problem you're trying to solve. EINTR does not happen > >unless you intentionally request it by setting up an interrupting > >signal handler, using sigaction() with the SA_RESTART flag clear. > > What about SIGSTOP, and its cousins SIGTSTP, SIGTTIN and SIGTTOU ? > Even when you don't request anything, you can receive them. They > stop the process, they don't kill it. What happens when the process > resumes, if it was interrupted in the middle of an interruptible > system call ? The system call restarts (or, formally, it's as if it were never interrupted; EINTR only applies to signal _handlers_). > >Retry-on-EINTR loops are generally misguided unless they're in code > >that's intended to be using in programs which use interrupting signal > >handlers, but which need to reliably complete an operation even if > >interrupted. > > And that happens all the time in asynchronous event loops where you > handle signals with a self-pipe. ;) Only if you have installed interrupting signal handlers. Rich