Konstantin Belousov wrote:
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.

This keeps me puzzled. How then I can tell that file at stdin is already at EOF? You mean I should treat stdin like normal vnode-backed file?

  off_t pos = 0, endpos;

  lseek(fileno(stdin), 0, SEEK_END);
  endpos = ftell(stdin);
  lseek(fileno(stdin), 0, SEEK_SET);

... and then later check it with:

      if(endpos != -1) {
        pos += kev.data;
        if(pos >= endpos) {
          printf("end reached\n");
          return(0);
        }
      }

Is this a correct way to detect EOF? I'm letting besides that I should also detect vnode changes and update max file size accordingly.

It should have been clear from my previous response.

Please excuse me, I'm a bit new to this things...

--
Sphinx of black quartz judge my vow.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"

Reply via email to