[Mono-dev] [PATCH] Incorrect signal handling for Sys V signal handler

Burkhard Linke blinke at cebitec.uni-bielefeld.de
Mon Jan 31 08:33:56 EST 2011


Hi,

On Thursday 27 January 2011 19:11:13 Miguel de Icaza wrote:
> Hello,
>
>     I have other concerns about this use of signal.   Perhaps it
> should be using sigaction with the proper flags to configure how we
> want signals to be delivered instead.
>
> Miguel
>
> On Thu, Jan 27, 2011 at 12:52 PM, Jonathan Pryor <jonpryor at vt.edu> wrote:
> > I can't speak to the rest of the patch, but the mono/support patch can't
> > go in as-is, as mono/support/signal.c is also built for Windows (it's
> > part of MPH_C_SOURCE in mono/support/Makefile.am, which is included in
> > the HOST_WIN32 build).
> >
> > MSVCRT.DLL DOES contain signal(3); it does NOT contain sigset(3), and
> > thus this would break the Windows build.
> >
> > Furthermore, OSX doesn't provide sigset(3) either, so this would break
> > the OSX build as well.
> >
> > You should patch configure.in to check for sigset, and wrap the sigset
> > calls with HAVE_SIGSET, otherwise keep the existing signal calls.

You're right, checking for sigset should be done. I assumed it is part of 
POSIX. The applied patch adds the check to configure.in and selects sigset or 
signal, depending on the check's result.

Concerning sigaction:

I was thinking about using a helper function that does "the right thing"[tm], 
using sigaction if available, with a fallback to sigset and signal. A unified 
function that may be used in other parts of the code is probably not 
possible, since sigaction allows a number of flags that influence the signal 
disposition and signal handling. I'm not sure whether a default set of flags 
works for all use cases (e.g. syscall restarting yes/no, alternate signal 
stack). Since signals are modified in a number of source files, a central 
place to handle signals is probably the best way to go.

With best regards,
Burkhard Linke
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mono_sigset2.diff
Type: text/x-diff
Size: 3194 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110131/f9db84b6/attachment.bin 


More information about the Mono-devel-list mailing list