> if (fp->f_flags | O_RDONLY) /* readers dont flush */
Not sure if it has any effect, but this doesn't look right. Perhaps
the intention was to use &, but that wouldn't work either since
O_RDONLY happens to be 0.
Typically it would look more like this:
if ((fp->f_flags & O_ACCMODE) == O_RDONLY)
Marc