[PATCH] network_write_chunkqueue_writev repeatedly calls sysctl to look up iov_max
On systems with sysconf(_SC_IOV_MAX), network_write_chunkqueue_writev prefers that over other options. On FreeBSD, sysconf is implemented by doing a sysctl lookup of kern.iov_max each time it's called. This has the full weight of a syscall, and is happening once every time through the for() loop.
The patch below checks the max_chunks value only once and remembers it, cutting the number of syscalls network_write_chunkqueue_writev makes in half. Also changes the error message if no way of looking up max_chunks is found to file a bug here instead of annoying Jan by email.
Also available in: Atom