sigwait - differences between Linux & FreeBSD

Kostik Belousov kostikbel at gmail.com
Thu Oct 8 10:27:30 UTC 2009


On Thu, Oct 08, 2009 at 01:23:37PM +0300, Vlad Galu wrote:
> On Thu, Oct 8, 2009 at 1:02 PM, Kostik Belousov <kostikbel at gmail.com> wrote:
> > On Thu, Oct 08, 2009 at 11:53:21AM +1100, Stephen Hocking wrote:
> >> Hi all,
> >>
> >> In my efforts to make the xrdp port more robust under FreeBSD, I have
> >> discovered that sigwait (kind of an analogue to select(2), but for
> >> signals rather than I/O) re-enables ignored signals in its list under
> >> Linux, but not FreeBSD. The sesman daemon uses SIGCHLD to clean up
> >> after a session has exited. Under Linux this works OK, under FreeSBD
> >> it doesn't. I have worked around it in a very hackish manner (define a
> >> dummy signal handler and enable it using signal, which means that the
> >> sigwait call can then be unblocked by it), but am wondering if anyone
> >> else has run across the same problem, and if so, if they fixed it in
> >> an elegant manner. Also, does anyone know the correct semantics of
> >> sigwait under this situation?
> >
> > ports@ is the wrong list to discuss the issue in the base system.
> >
> > Solaris 10 sigwait(2) manpage says the following:
> > If sigwait() is called on an ignored signal, then the occurrence of the
> > signal will be ignored, unless sigaction() changes the disposition.
> >
> > We have the same behaviour as Solaris, ingored signals are not queued or
> > recorded regardeless of the presence of sigwaiting thread.
> >
> 
> This is a bit confusing. sigwait(2) says: "The signals specified by
> set should be blocked at the time of the call to sigwait()."...

Blocked and ignored are different attributes of signal.

Ignored means that signal disposition is SIG_IGN, that causes the signal
delivery event to be ignored.

Blocked means that regardeless of signal disposition, signal is not
delivered, but it is recorded somewhere and delivery happen when it
unblocked.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20091008/9e83c612/attachment.pgp


More information about the freebsd-hackers mailing list