linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Hockin <thockin@isunix.it.ilstu.edu>
To: george@brain.moberg.com (George Talbot)
Cc: tytso@MIT.EDU (Theodore Y. Ts'o), linux-kernel@vger.kernel.org
Subject: Re: Can EINTR be handled the way BSD handles it? -- a plea from a
Date: Mon, 6 Nov 2000 11:50:29 -0600 (CST)	[thread overview]
Message-ID: <200011061750.LAA10260@isunix.it.ilstu.edu> (raw)
In-Reply-To: <Pine.LNX.4.21.0011060824000.4984-100000@brain.moberg.com> from "George Talbot" at Nov 06, 2000 09:05:52 AM

> 	"THIS CHANGE CAUSED PROBLEMS FOR SOME APPLICATION CODE."
> 
> 	_Which_ applications?
> 
> 	_Why_ did they have a problem?  Was this due to a bug or were they
> 	designed to do stuff this way?

I, for one, have an app that relies on syscalls not being restarted:
	app goes into a blocking read on a socket
	signal interrupts blocking read
		signal handler sets a global flag
	read returns interrupted
	flag is checked - action may be taken

Now, this could be redone to use a select() with a small timeout (busy
loop), but the blocking read is more convenient, as there may be many
instances of this app running.  

> 	How hard would it be to change these programs to use
> 	sigaction() to enable the EINTR behavior?  We've got the source

Actually, you already have to specifically call sigaction to get the EINTR
behavior - glibc signal() (obsolete) sets SA_RESTART by default.  What this
suggests is that something in pthreads is unsetting SA_RESTART, or calling
sigaction without it.  grep?

> Moreover, I'm willing to bet money that a large percentage of user-land
> programmers aren't even _aware_ of the EINTR issue.  The Netscape people
> certainly weren't for Netscape 4.x.  Don't know if the Mozilla people are.

Then they have never read a decent UNIX programming text.  Page 275 of
"Advanced Programming in the UNIX Environment", W. Richard Stevens (a de
facto standard for texts in this area).  An entire section of the chapter
is spent on interrupted syscalls.  If I were the manager of a team of
people who didn't handle it, I'd be very disappointed.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-11-06 18:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200011031841.MAA07209@isunix.it.ilstu.edu>
2000-11-03 19:44 ` Can EINTR be handled the way BSD handles it? -- a plea from a user-land george
2000-11-03 21:27   ` H. Peter Anvin
2000-11-04  4:23   ` Theodore Y. Ts'o
2000-11-06 14:05     ` George Talbot
2000-11-06 15:30       ` Davide Libenzi
2000-11-06 17:50       ` Tim Hockin [this message]
2000-11-06 14:17     ` George Talbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200011061750.LAA10260@isunix.it.ilstu.edu \
    --to=thockin@isunix.it.ilstu.edu \
    --cc=george@brain.moberg.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@MIT.EDU \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).