bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: sigaction module


From: Paul Eggert
Subject: Re: RFC: sigaction module
Date: Mon, 16 Jun 2008 16:01:11 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Thanks for doing that.  A few minor comments:

Eric Blake <address@hidden> writes:

> +/* We assume that a platform without POSIX sigaction implements SysV
> +   semantics in signal() (ie. the handler is uninstalled before it is
> +   invoked).  This is an inherent data race, but there's nothing we
> +   can do about it.  We assume that SIGCHLD is not defined, so we
> +   don't implement SA_NOCLDSTOP or SA_NOCLDWAIT.  We assume that
> +   sigaltstack() is not present, so we don't implement SA_ONSTACK.  We
> +   assume siginterrupt() is not present, so we don't implement
> +   SA_RESTART.  Supporting SA_SIGINFO is impossible to do portably.
> +   These points are true for Woe32 platforms.

Some of these assumptions can be checked at compile-time.  Perhaps
they should be, if it's cheap?  E.g.:

#ifdef SIGCHLD
 #error "We assume SIGCHLD is not defined."
#endif

> +          /* This opens a slight window where an async signal can call
> +             wrong handler.  Oh well.  */
> +          oact->sa_handler = signal (sig, SIG_DFL);


Isn't it easy to close this window when oact and act are both nonnull?
In that case, you can invoke 'signal' once, without opening this
particular race condition.

More generally, can't you use sigprocmask to avoid this class of race
conditions within sigaction?  (I don't know the platform.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]