Subject: kqueue, NOTE_EOF
To: None <,,>
From: marius aamodt eriksen <>
List: tech-kern
Date: 11/10/2003 12:41:09
hi - 

in order to be able to preserve consistent semantics across poll,
select, and kqueue (EVFILT_READ), i propose the following change: on
EVFILT_READ, add an fflag NOTE_EOF which will return when the file
pointer *is* at the end of the file (effectively always returning on
EVFILT_READ, but setting the NOTE_EOF flag when it is at the end).

specifically, this allows libevent[1] to behave consistently across
underlying polling infrastructures (this has become a practical

in openbsd, this was a trivial change in filt_ufsread():

 kn->kn_data = ip->i_ffs_size - kn->kn_fp->f_offset;
+if (kn->kn_data == 0 && kn->kn_sfflags & NOTE_EOF) {
+	kn->kn_fflags |= NOTE_EOF;
+	return (1);
 return (kn->kn_data != 0);

(and adding NOTE_EOF to event.h, of course)

what do you think about this?  can it be integrated into netbsd and
freebsd as well?  i have discussed this with provos@, and we seem to
agree this is a viable solution.




> >