2 ms·
A nice trick! An alternative API, if you are using a circular buffer that is just being read() into or write() out of, is to make the I/O parts of your code us
by joosters 12y ago
A nice trick!
An alternative API, if you are using a circular buffer that is just being read() into or write() out of, is to make the I/O parts of your code use readv() and writev() instead. The circular buffer call then returns either one or two memory ranges depending on whether the range crosses the end of the buffer or not. Then you achieve the same thing as the mmap trick, full reads and writes with one syscal.