sigwait return 4

Kostik Belousov kostikbel at gmail.com
Wed Aug 24 19:32:06 UTC 2011


On Wed, Aug 24, 2011 at 11:24:46PM +0400, Slawa Olhovchenkov wrote:
> On Wed, Aug 24, 2011 at 10:07:03PM +0300, Kostik Belousov wrote:
> 
> > On Wed, Aug 24, 2011 at 10:19:07PM +0400, Slawa Olhovchenkov wrote:
> > > System is 8.2-RELEASE (GENERIC), amd64.
> > > Application -- i386 for freebsd7.
> > > 
> > > In ktrace dump I find some strange result:
> > > 
> > >  22951 100556 kas-milter CALL  sigwait(0xffdfdf80,0xffdfdf7c)
> > >  22951 100556 kas-milter RET   sigwait 4
> > >  22951 100556 kas-milter PSIG  SIGUSR2 caught handler=0x804c0f0 mask=0x4003 code=0x0
> > > 
> > > RET   sigwait 4 confused me, and, I think, confused application too.
> > > 
> > > man sigwait:
> > > 
> > > ERRORS
> > >      The sigwait() system call will fail if:
> > > 
> > >      [EINVAL]           The set argument specifies one or more invalid signal
> > >                         numbers.
> > > 
> > >      [EFAULT]           Any arguments point outside the allocated address
> > >                         space or there is a memory protection fault.
> > > 
> > > 
> > > How sigwait can return '4'?
> > > May be EINTR, converted from ERESTART? But kern_sigtimedwait from sigwait must 
> > > be called with timeout == NULL...
> > > 
> > 
> > What should the system do for a delivered signal not present in the set ?
> > I guess this is the case of your ktrace.
> > 
> > Looking at the SUSv4, I see no mention of the situation, but in Oracle
> > SunOS 5.10 man page for sigwait(2), it is said explicitely
> > EINTR The wait was interrupted by an unblocked, caught signal.
> 
> I don't think you right in this case.
> This is kas-milter and in this thread (this is multi-thread
> application) kas-milter wait for USR2 for reload config.
> 
> System return from sigwait only on USR2, but not each return w/
> non-zero return code.
> 
> On freebsd7 this application don't complain about sigwait's return value.

Could it be that some other thread has the signal unblocked ?
(You can verify this with procstat -j).

Can you write the self-contained test case that demonstrates the behaviour ?
-------------- 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-stable/attachments/20110824/1a1a5de2/attachment.pgp


More information about the freebsd-stable mailing list