From owner-freebsd-arch Mon Feb 5 22:49:28 2001 Delivered-To: freebsd-arch@freebsd.org Received: from smtp10.phx.gblx.net (smtp10.phx.gblx.net [206.165.6.140]) by hub.freebsd.org (Postfix) with ESMTP id 421A337B503; Mon, 5 Feb 2001 22:49:11 -0800 (PST) Received: (from daemon@localhost) by smtp10.phx.gblx.net (8.9.3/8.9.3) id XAA25964; Mon, 5 Feb 2001 23:48:36 -0700 Received: from usr08.primenet.com(206.165.6.208) via SMTP by smtp10.phx.gblx.net, id smtpddhzwEa; Mon Feb 5 23:48:32 2001 Received: (from tlambert@localhost) by usr08.primenet.com (8.8.5/8.8.5) id XAA12348; Mon, 5 Feb 2001 23:49:04 -0700 (MST) From: Terry Lambert Message-Id: <200102060649.XAA12348@usr08.primenet.com> Subject: Re: nonblocking sockets and EINTR (kevent does not observe SA_RESTART?) To: bright@wintelcom.net (Alfred Perlstein) Date: Tue, 6 Feb 2001 06:49:02 +0000 (GMT) Cc: jlemon@flugsvamp.com (Jonathan Lemon), jonathan@graehl.org (Jonathan Graehl), freebsd-arch@FreeBSD.ORG, jlemon@FreeBSD.ORG (Jonathan Lemon) In-Reply-To: <20010205220804.M26076@fw.wintelcom.net> from "Alfred Perlstein" at Feb 05, 2001 10:08:04 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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