--On Monday, September 26, 2005 7:58 PM -0500 Jon Roma roma@uiuc.edu wrote:
The Linux man page for writev(2) says that the vector count must be between 0 and MAX_IOVEC. MAX_IOVEC is defined as 10 in
, which doesn't seem a logical place for it. Anyway, on RHEL 3, UIO_MAXIOV is defined in and and IOV_MAX is defined in -- and is defined as 1024 in these definitions. There's also a _POSIX_UIO_MAXIOV defined at 16 in . My suspicion is that the Linux man page is wrong with respect to the preprocessor variable that matters.
I poked around in glibc and kernel sources (FC2) and found UIO_MAXIOV and IOV_MAX are the two symbols in use and are set to 1024. Googling for these two symbols together turned up this interesting nugget:
http://lists.freebsd.org/pipermail/freebsd-standards/2004-February/000399.ht...
The search:
http://www.google.com/search?num=100&hl=en&lr=&safe=off&c2coff=1&q=uio_maxiov+iov_max&btnG=Search
The glibc code looks like in some circumstances it mallocs a temporary buffer to assemble the write and then issues a write() on the temporary. Additionally, each filesystem driver gets a chance to independently choose how to implement writev, with many passing it to a generic version of the function.