[vlc-devel] [PATCH] In SigThread, handle sigwait() failures gracefully.

Rémi Denis-Courmont remi at remlab.net
Sat Jul 11 16:00:54 CEST 2009

Le samedi 11 juillet 2009 16:46:44 Fabian Keil, vous avez écrit :
> > Fabian, what is the failure errno on FreeBSD ?
> It's 4 which should be EINTR.
> FreeBSD's sigwait() man page only explicitly mentions
> EINVAL and EFAULT as return codes, so I'm not sure which
> system call might have failed or if interpreting return
> code 4 as EINTR in this case is even correct.

EINTR and EFAULT are both implicitly allowed, because they are not explicitly 
forbidden for sigwait(). I think EFAULT cannot happen however in the VLC 
signal interface since the sigset_t parameter is always on the stack.

> Changing SigThread() to only ignore sigwait() failures
> in case of EINTR should work too, and would have less
> risk of masking other problems, but of course it might
> still be considered a workaround.

IMHO, POSIX should forbid EINTR from sigwait()... but it does not. So we 
cannot blame FreeBSD here, *unless* EINTR is caused by pthread_cancel() - in 
which case sigwait() should not even return. Rather we should blame whatever 
is sending a signal.

Rémi Denis-Courmont

More information about the vlc-devel mailing list