Date: Wed, 5 Jun 2002 10:38:00 +0200 (CEST) From: Alexander Leidinger <Alexander@Leidinger.net> To: bde@zeta.org.au Cc: Todd.Miller@courtesan.com, drosih@rpi.edu, audit@FreeBSD.ORG Subject: Re: [PATCH] making dump EINTR resistant Message-ID: <200206050838.g558c0PP000854@Magelan.Leidinger.net> In-Reply-To: <20020605121248.U5878-100000@gamplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <signal.h>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206050838.g558c0PP000854>
