On Thu, Oct 31, 2019 at 8:16 AM David Howells [off-list ref] wrote:
Konstantin Khlebnikov [off-list ref] wrote:
quoted
Similar synchronization is required for reusing memory after vmsplice()?
I don't see other way how sender could safely change these pages.
Sounds like a point - if you have multiple parallel contributors to the pipe
via vmsplice(), then FIONREAD is of no use. To use use FIONREAD, you have to
let the pipe become empty before you can be sure.
Well, the rules for vmsplice is simply to not change the source pages.
It's zero-copy, after all.
If you want to change the source pages, you need to just use write() instead.
That said, even then the right model isn't fsync(). If you really want
to have something like "notify me when this buffer has been used", it
should be some kind of sequence count thing, not a "wait for empty".
Which might be useful in theory, but would be something quite
different (and honestly, I wouldn't expect it to find all that
widespread use)
Linus