hastd: hooks run with masked signals

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Oct 16 22:51:16 UTC 2010


On Sat, Oct 16, 2010 at 10:47:21AM +0300, Mikolaj Golub wrote:
> Hi,
> 
> Main hastd process uses sigprocmask(2)/sigtimedwait(2) API. Currently when
> a hook is started it inherits signal mask from the main process, so hooks are
> run with SIGHUP, SIGINT, SIGTERM and SIGCHLD blocked. This is not an issue for
> short living, self exiting processes but if one want to start some daemon by
> hook then there is an issue with terminating it. 
> 
> Here is a hook to reproduce this:
> 
> #!/bin/sh
> 
> #DAEMON=/etc/rc.d/bsnmpd
> DAEMON=/etc/rc.d/lpd
> 
> case $1 in
>     start|connect)
>         ${DAEMON} onestart
>         ;;
>     stop|disconnect)
>         ${DAEMON} onestop
>         ;;
>     status)
>         ${DAEMON} onestatus
>         ;;
>     role)
>         exit 0
>         ;;
>     *)
>         echo "usage: $0 stop|start|status|role|connect|disconnect"
>         exit 1
>         ;;
> esac
> 
> And after connect event we have lpd running with SIGHUP, SIGINT, SIGTERM and
> SIGCHLD blocked:
> 
>  1396 100075 lpd              HUP      -B
>  1396 100075 lpd              INT      -B
>  1396 100075 lpd              TERM     -B
>  1396 100075 lpd              CHLD     -B
> 
> What do you think about the attached patch?

Looks good, I just committed it, thanks!

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- 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-fs/attachments/20101016/77a7dc9a/attachment.pgp


More information about the freebsd-fs mailing list