Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Feb 2001 06:49:02 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        bright@wintelcom.net (Alfred Perlstein)
Cc:        jlemon@flugsvamp.com (Jonathan Lemon), jonathan@graehl.org (Jonathan Graehl), freebsd-arch@FreeBSD.ORG, jlemon@FreeBSD.ORG (Jonathan Lemon)
Subject:   Re: nonblocking sockets and EINTR (kevent does not observe SA_RESTART?)
Message-ID:  <200102060649.XAA12348@usr08.primenet.com>
In-Reply-To: <20010205220804.M26076@fw.wintelcom.net> from "Alfred Perlstein" at Feb 05, 2001 10:08:04 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> I'm pretty sure select() and poll() do not respect SA_RESTART
> either, so it's probably best that kevent doesn't as well.

Historically, select() has respected SA_RESTART; all system
calls respected it; it was the default behaviour for 4.2,
and until the introduction of siginterrupt(), which was
obtained from DEC Ultrix.

The standard way that was used prior to that of causing a
signal handler to actually interrupt a call was to longjmp()
out of the signal handler, with a setjmp() wrapper around
the call being aborted.

It was only after the introduction of POSIX signals, which
have made life hell for wrapping system calls safely, that
the default changed to the POSIX (SVR4) behaviour.

Actually, I don't really see any problem with select() being
restarted, since it's trivial to set the bitmap.  If the call
is interrupted, the bitmap should be unmodified (ready to call
select() and go); if the bitmap was changed, then the bits
which are set are valid, so returning them isn't a problem:
the call has completed, but triggered the trampoline.

The poll() call might be more of a problem, particularly if
we are relying on SIGPOLL to signal pollable events pending
being reaped via a subsequent poll() call.  Otherwise, the
poll() interface is better for restarting than select() is.

Although I doubt we will return to the default-restart of
4.2 and 4.3 (even though it would make a threads library a
trivial thing to write, with all of the signal masking and
unmasking calls being dropped from the overhead), I think
that it would not be impossible to make SA_RESTART work like
POSIX says it should (at least one of the approaches that
has been suggested will work, I think); it's probably worth
the effort to think about how to fix kevent().


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102060649.XAA12348>