From owner-freebsd-audit Tue Jun 4 19:31:35 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id C9B1637B413; Tue, 4 Jun 2002 19:31:24 -0700 (PDT) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id MAA14497; Wed, 5 Jun 2002 12:30:45 +1000 Date: Wed, 5 Jun 2002 12:34:34 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "Todd C. Miller" Cc: Garance A Drosihn , Alexander Leidinger , Subject: Re: [PATCH] making dump EINTR resistant In-Reply-To: <200206050110.g551Alpu020379@xerxes.courtesan.com> Message-ID: <20020605121248.U5878-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 4 Jun 2002, Todd C. Miller wrote: > In message > so spake Garance A Drosihn (drosih): > > > Would it be acceptable to add EINTR-type checks to freebsd-ish > > code? There are some sections of lpr/lpd which do not work > > right when compiled on other platforms, unless I add EINTR > > checks at the right places. This would probably be a lot of work. You would have to check for EINTR after every syscall that may set EINTR and somehow handle this non-error. > It would probably be better to just make the code in question to > just use sigaction() if you are concerned about portability. That > way you get consistent handling of syscall restarts. I agree, but not that SA_RESTART wasn't portable until tomorrow (sic), since it is in POSIX.1-2001 but not in older POSIXes (.1-1996 at least). > Alternately, you could #define signal to bsd_signal when compiling > on non-BSD platforms. That is not quite as portable though. POSIX.1-2001 even has bsd_signal() as standard. BTW: (1) stdio doesn't check for EINTR, so it's not clear how it can work right if en application enables EINTR using siginterrupt(3) or sigaction(2). Working right includes restarting writes from deep in fprintf() just like the kernel would do. (2) Interactive applications that catch signals using non-broken signal handlers ought to enable EINTR so that signals can break them out of blocked read(2)'s, etc. Ones that have had their signal handlers fixed to not do unsafe things tend to get this wrong. E.g., top(1) can't be killed by SIGINT when in command mode (you have to enter a newline to finish the read). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message