From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 10 14:27:54 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE070106564A; Tue, 10 Jul 2012 14:27:53 +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 603488FC15; Tue, 10 Jul 2012 14:27:53 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q6AERxKN021974; Tue, 10 Jul 2012 17:27:59 +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.5/8.14.5) with ESMTP id q6AERkmh053337; Tue, 10 Jul 2012 17:27:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q6AERk6p053336; Tue, 10 Jul 2012 17:27:46 +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: Tue, 10 Jul 2012 17:27:46 +0300 From: Konstantin Belousov To: Volodymyr Kostyrko Message-ID: <20120710142746.GD2338@deviant.kiev.zoral.com.ua> References: <4FFC1D2D.4020405@gmail.com> <20120710140203.GA2338@deviant.kiev.zoral.com.ua> <4FFC39D9.6080809@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YTqNa7If1bmePjLb" Content-Disposition: inline In-Reply-To: <4FFC39D9.6080809@gmail.com> 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=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: "freebsd-hackers@freebsd.org" , freebsd-standards@freebsd.org Subject: Re: kern/149857: [kqueue] kqueue not reporting EOF under certain circumstances X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2012 14:27:54 -0000 --YTqNa7If1bmePjLb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 10, 2012 at 05:19:05PM +0300, Volodymyr Kostyrko wrote: > Konstantin Belousov wrote: > >>This PR is rather old. I just had submitted new test case, now in plain= c. > >> > >>It doesn't work exactly like python version, but the result is the same: > >> > >>>clang test.c > >>>cat test.c | ./a.out > >>-1 916 0 0 0 > >>-1 0 32768 0 0 > >>>./a.out< test.c > >>-1 916 0 0 0 > >><- and here we have a complete hang in [kqread]. > > > >And what is your expectation ? > > > >The vnode filter never returns EOF when current file position at the end > >of file. It is documented that read filter returns when file offset if n= ot > >at the end of file, thats all. In fact, EV_EOF is returned on forced=20 > >unmount. > >I do not see a bug in kqueue. > > > >On the other hand, your C code has at least two things that I cannot > >understand. First, EV_EOF is output flag, it makes absolutely no sense > >to set it in command.Second, it is mistery for me what do you check with > > if (kev.flags>> 15 =3D=3D 1) { > >test. >=20 > EV_EOF on line 19 actually slipped by my fault, original source omits=20 > that one. It doesn't change anything. Yes. >=20 > EV_EOF =3D 1 << 15 =3D 32768. And it _is_ returned when file is feed with= =20 > the pipe. >=20 > So you mean this is just my false assumption that EOF _should_ occur on= =20 > stdin? And it actually occurs only if source is a process which can send= =20 > EOF? 'Source' cannot be a process. Read filter on pipes can return EV_EOF. Read filter on vnodes (read: regular files) does not return EV_EOF, except in situation that is created by manual intervention of administrator. It should have been clear from my previous response. --YTqNa7If1bmePjLb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/8O+IACgkQC3+MBN1Mb4ia3gCdFAvD2rv3oCQuQQJ+PyM7H4my YhQAoPKslmosOliJkgVQUOu1TgIJfULV =0aSI -----END PGP SIGNATURE----- --YTqNa7If1bmePjLb--