From owner-freebsd-stable@FreeBSD.ORG Wed Aug 24 19:32:06 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1062B106566C for ; Wed, 24 Aug 2011 19:32:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A25CC8FC1D for ; Wed, 24 Aug 2011 19:32:05 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p7OJW29u074072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Aug 2011 22:32:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p7OJW2BU079604; Wed, 24 Aug 2011 22:32:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p7OJW21o079603; Wed, 24 Aug 2011 22:32:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 24 Aug 2011 22:32:02 +0300 From: Kostik Belousov To: Slawa Olhovchenkov Message-ID: <20110824193202.GZ17489@deviant.kiev.zoral.com.ua> References: <20110824181907.GA48394@zxy.spb.ru> <20110824190703.GY17489@deviant.kiev.zoral.com.ua> <20110824192446.GB48394@zxy.spb.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HObwSN71pq3vUoaj" Content-Disposition: inline In-Reply-To: <20110824192446.GB48394@zxy.spb.ru> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-stable@freebsd.org Subject: Re: sigwait return 4 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2011 19:32:06 -0000 --HObwSN71pq3vUoaj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: >=20 > > On Wed, Aug 24, 2011 at 10:19:07PM +0400, Slawa Olhovchenkov wrote: > > > System is 8.2-RELEASE (GENERIC), amd64. > > > Application -- i386 for freebsd7. > > >=20 > > > In ktrace dump I find some strange result: > > >=20 > > > 22951 100556 kas-milter CALL sigwait(0xffdfdf80,0xffdfdf7c) > > > 22951 100556 kas-milter RET sigwait 4 > > > 22951 100556 kas-milter PSIG SIGUSR2 caught handler=3D0x804c0f0 mas= k=3D0x4003 code=3D0x0 > > >=20 > > > RET sigwait 4 confused me, and, I think, confused application too. > > >=20 > > > man sigwait: > > >=20 > > > ERRORS > > > The sigwait() system call will fail if: > > >=20 > > > [EINVAL] The set argument specifies one or more invali= d signal > > > numbers. > > >=20 > > > [EFAULT] Any arguments point outside the allocated add= ress > > > space or there is a memory protection fault. > > >=20 > > >=20 > > > How sigwait can return '4'? > > > May be EINTR, converted from ERESTART? But kern_sigtimedwait from sig= wait must=20 > > > be called with timeout =3D=3D NULL... > > >=20 > >=20 > > What should the system do for a delivered signal not present in the set= ? > > I guess this is the case of your ktrace. > >=20 > > 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. >=20 > 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. >=20 > System return from sigwait only on USR2, but not each return w/ > non-zero return code. >=20 > 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 ? --HObwSN71pq3vUoaj Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk5VUbIACgkQC3+MBN1Mb4ji3ACfUNBxLk0D8CypSdqePKjYZd/O PKIAoK+vnfxFTMMG+iBPjeOGz2GdGNq1 =IHXv -----END PGP SIGNATURE----- --HObwSN71pq3vUoaj--