readv: parallel or sequential?
des at des.no
Fri Dec 7 04:54:09 PST 2007
"Vlad GALU" <dudu at dudu.ro> writes:
> Ivan Voras <ivoras at freebsd.org> writes:
> > Does this mean that, in effect, readv() is just a loop of read()
> > calls (minus syscall overhead)?
> read() is just a particular case of readv() (with only one iovec
> struct, plus the full buffer size), they both call kern_readv(), so
> the effect is the same. I assume the manpage means that the iovec
> structures are filled sequentially rather than in parallel.
Interestingly, Linux does it the other way around - a device driver can
implement readv() and writev(), but if it doesn't, the kernel will fall
back to a default implementation which calls the driver's read() or
write() method once for each iov.
But to return to what Ivan was asking, I think what the man page is
trying to say is that you can't use readv() to e.g. read individual
network packets into separate buffers (unless each packet just happens
to fit exactly within each buffer).
Dag-Erling Smørgrav - des at des.no
More information about the freebsd-fs