From owner-freebsd-fs@FreeBSD.ORG Sat Oct 16 22:51:16 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 434641065672 for ; Sat, 16 Oct 2010 22:51:16 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id DA1C48FC1F for ; Sat, 16 Oct 2010 22:51:15 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 482CA45E6F; Sun, 17 Oct 2010 00:51:14 +0200 (CEST) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id CF52345683; Sun, 17 Oct 2010 00:51:08 +0200 (CEST) Date: Sun, 17 Oct 2010 00:50:37 +0200 From: Pawel Jakub Dawidek To: Mikolaj Golub Message-ID: <20101016225037.GB6765@garage.freebsd.pl> References: <86eibq60l2.fsf@kopusha.home.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RASg3xLB4tUQ4RcS" Content-Disposition: inline In-Reply-To: <86eibq60l2.fsf@kopusha.home.net> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: freebsd-fs@freebsd.org Subject: Re: hastd: hooks run with masked signals X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 22:51:16 -0000 --RASg3xLB4tUQ4RcS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Oct 16, 2010 at 10:47:21AM +0300, Mikolaj Golub wrote: > Hi, >=20 > 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 issu= e for > short living, self exiting processes but if one want to start some daemon= by > hook then there is an issue with terminating it.=20 >=20 > Here is a hook to reproduce this: >=20 > #!/bin/sh >=20 > #DAEMON=3D/etc/rc.d/bsnmpd > DAEMON=3D/etc/rc.d/lpd >=20 > 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 >=20 > And after connect event we have lpd running with SIGHUP, SIGINT, SIGTERM = and > SIGCHLD blocked: >=20 > 1396 100075 lpd HUP -B > 1396 100075 lpd INT -B > 1396 100075 lpd TERM -B > 1396 100075 lpd CHLD -B >=20 > What do you think about the attached patch? Looks good, I just committed it, thanks! --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --RASg3xLB4tUQ4RcS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAky6LD0ACgkQForvXbEpPzScGwCg0BmKJgtptI7fEWUwaAcMYFRp bhwAoL1NTTQcvA1aqOmgSeU3oxOP67jA =kycR -----END PGP SIGNATURE----- --RASg3xLB4tUQ4RcS--