Klaus Demo nginx / ae0e919
Microoptimization of sendfile(2) usage under FreeBSD. FreeBSD kernel checks headers/trailers pointer against NULL, not corresponding count. Passing NULL if there are no headers/trailers helps to avoid unneeded work in kernel, as well as unexpected 0 bytes GIO in traces. Maxim Dounin 10 years ago
1 changed file(s) with 7 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
245245 }
246246 }
247247
248 hdtr.headers = (struct iovec *) header.elts;
248 /*
249 * sendfile() does unneeded work if sf_hdtr's count is 0,
250 * but corresponding pointer is not NULL
251 */
252
253 hdtr.headers = header.nelts ? (struct iovec *) header.elts: NULL;
249254 hdtr.hdr_cnt = header.nelts;
250 hdtr.trailers = (struct iovec *) trailer.elts;
255 hdtr.trailers = trailer.nelts ? (struct iovec *) trailer.elts: NULL;
251256 hdtr.trl_cnt = trailer.nelts;
252257
253258 /*