Re: [PATCH] making dump EINTR resistant

Alexander Leidinger <[email protected]>
Newsgroups gmane.os.freebsd.devel.audit
Message-ID <[email protected]>
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 [email protected]
with "unsubscribe freebsd-audit" in the body of the message
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.