From owner-freebsd-audit Wed Jun 5 1:36:47 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mailout08.sul.t-online.com (mailout08.sul.t-online.com [194.25.134.20]) by hub.freebsd.org (Postfix) with ESMTP id 5743737B406 for ; Wed, 5 Jun 2002 01:36:43 -0700 (PDT) Received: from fwd00.sul.t-online.de by mailout08.sul.t-online.com with smtp id 17FWHZ-00083U-0C; Wed, 05 Jun 2002 10:36:41 +0200 Received: from Magelan.Leidinger.net (520065502893-0001@[80.131.127.20]) by fmrl00.sul.t-online.com with esmtp id 17FWHT-1zzxLsC; Wed, 5 Jun 2002 10:36:35 +0200 Received: from Leidinger.net (netchild@localhost [127.0.0.1]) by Magelan.Leidinger.net (8.12.3/8.12.3) with ESMTP id g558c0PP000854; Wed, 5 Jun 2002 10:38:04 +0200 (CEST) (envelope-from netchild@Leidinger.net) Message-Id: <200206050838.g558c0PP000854@Magelan.Leidinger.net> Date: Wed, 5 Jun 2002 10:38:00 +0200 (CEST) From: Alexander Leidinger Subject: Re: [PATCH] making dump EINTR resistant To: bde@zeta.org.au Cc: Todd.Miller@courtesan.com, drosih@rpi.edu, audit@FreeBSD.ORG In-Reply-To: <20020605121248.U5878-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Sender: 520065502893-0001@t-dialin.net 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 5 Jun, Bruce Evans wrote: >> 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). Stevens uses this as a portable example for a signal() with restartable syscalls: ---snip--- #include typedef void Sigfunc(int); Sigfunc * signal(int signo, Sigfunc *func) { struct sigaction act, oact; act.sa_handler = func; sigemptyset(&act.sa_mask); act.sa_flags = 0; if (signo == SIGALRM) { #ifdef SA_INTERRUPT act.sa_flags |= SA_INTERRUPT; /* SunOS */ #endif } else { #ifdef SA_RESTART act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */ #endif } if (sigaction(signo, &act, &oact) < 0) return(SIG_ERR); return (oact.sa_handler); } ---snip--- He doesn't want restartable syscalls for SIGALRM to allow to set a time out for I/O operations. Bye, Alexander. -- Give a man a fish and you feed him for a day; teach him to use the Net and he won't bother you for weeks. http://www.Leidinger.net Alexander @ Leidinger.net GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message