Subject: Re: kern/33752: Bug in kqueue VNODE handling
To: None <jdolecek@NetBSD.org, gnats-admin@netbsd.org,>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: netbsd-bugs
Date: 06/17/2006 09:00:05
The following reply was made to PR kern/33752; it has been noted by GNATS.

From: Jaromir Dolecek <jdolecek@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/33752: Bug in kqueue VNODE handling
Date: Sat, 17 Jun 2006 10:47:17 +0200

 --CE+1k2dSO48ffgeK
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Fri, Jun 16, 2006 at 02:30:00PM +0000, mahendra.m@gmail.com wrote:
 > 2. Now, if you specify EV_ONESHOT, as per documentation, after the first =
 occurance of the event, the event should be deleted from kqueue. This does =
 not happen. After the first occurance of the event, the event is still resi=
 dent on the kqueue and waits till the file attributes change again. ( Ideal=
 ly this behaviour should have been observed in the previous case ).
 
 2) is actually bug in you code. You supply &change in each
 call to kevent(), effectively re-introducing the kevent in each
 call.
 
 It should be coded like this:
 
 EV_SET(...)
 nev =3D kevent(kq, &change, 1, NULL, 0, NULL);
 
 for(;;) {
 	nev =3D kevent(kq, NULL, 0, &event, 1, NULL);
 	...
 }
 
 I've just checked this and this does fix the problem when using ONESHOT
 (the kevent() call blocks on second invocation, i.e. the original
 kevent is no longer triggered).
 
 I'm still investigating 1) - I have to double check what the intended
 interface really is, to figure if it's a bug or feature.
 
 Jaromir
 --=20
 Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
 -=3D- We can walk our road together if our goals are all the same;     -=3D-
 -=3D- We can run alone and free if we pursue a different aim.          -=3D-
 
 --CE+1k2dSO48ffgeK
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: PGPfreeware 5.0i for non-commercial use
 MessageID: yQtI/m/6sgYxYx1NRjt3RjVOxTgfd9nn
 
 iQCVAwUBRJPBlbZjOQfIPRaZAQHBYgQAhyeSVADayqylymJHaK104KrMT3zX8E+J
 vPpzlU/nCiL70ulwbDLjDJ3auQj0YcD+JcQV5fuQur7HhvQ4kXtkw4xmUAbFcg7E
 YEuREKGA2aTFxvYujU4XJ4vMQ7uQEdOuvKf+QRoZKcemTvA5yxpB7wxTPTKO4V92
 bbG2UE/pnyE=
 =BqV0
 -----END PGP SIGNATURE-----
 
 --CE+1k2dSO48ffgeK--