kern/149857: [kqueue] kqueue not reporting EOF under certain circumstances

Konstantin Belousov kostikbel at gmail.com
Tue Jul 10 14:27:54 UTC 2012


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 not
> >at the end of file, thats all. In fact, EV_EOF is returned on forced 
> >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 == 1) {
> >test.
> 
> EV_EOF on line 19 actually slipped by my fault, original source omits 
> that one. It doesn't change anything.
Yes.

> 
> EV_EOF = 1 << 15 = 32768. And it _is_ returned when file is feed with 
> the pipe.
> 
> So you mean this is just my false assumption that EOF _should_ occur on 
> stdin? And it actually occurs only if source is a process which can send 
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-standards/attachments/20120710/5c7c4181/attachment.pgp


More information about the freebsd-standards mailing list