Date: Wed, 24 Aug 2011 22:07:03 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Slawa Olhovchenkov <slw@zxy.spb.ru> Cc: freebsd-stable@freebsd.org Subject: Re: sigwait return 4 Message-ID: <20110824190703.GY17489@deviant.kiev.zoral.com.ua> In-Reply-To: <20110824181907.GA48394@zxy.spb.ru> References: <20110824181907.GA48394@zxy.spb.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
--8hWk1bP476InP7gd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 mask=3D= 0x4003 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 invalid si= gnal > numbers. >=20 > [EFAULT] Any arguments point outside the allocated address > 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 sigwait= must=20 > be called with timeout =3D=3D NULL... >=20 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. So I think that we have a bug in the man page. diff --git a/lib/libc/sys/sigwait.2 b/lib/libc/sys/sigwait.2 index 8c00cf4..b462201 100644 --- a/lib/libc/sys/sigwait.2 +++ b/lib/libc/sys/sigwait.2 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 11, 2005 +.Dd August 24, 2011 .Dt SIGWAIT 2 .Os .Sh NAME @@ -94,6 +94,8 @@ The .Fn sigwait system call will fail if: .Bl -tag -width Er +.It Bq Er EINTR +The system call was interrupted by an unblocked, caught signal. .It Bq Er EINVAL The .Fa set --8hWk1bP476InP7gd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk5VS9YACgkQC3+MBN1Mb4jiVACgr3FuAcrc2hblZhSSOh+uRgLB TysAoMcyZCl0Q1QZfFu5iPKnMMKUD01a =3+IN -----END PGP SIGNATURE----- --8hWk1bP476InP7gd--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110824190703.GY17489>