Mercurial > hg > nginx
comparison src/os/unix/ngx_writev_chain.c @ 5854:b63e829621ab
Generalized definitions of the number of preallocated iovec's.
No functional changes.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 13 Aug 2014 15:11:45 +0400 |
parents | a6e83ac70af9 |
children | 6bbad2e73245 |
comparison
equal
deleted
inserted
replaced
5853:a6e83ac70af9 | 5854:b63e829621ab |
---|---|
6 | 6 |
7 | 7 |
8 #include <ngx_config.h> | 8 #include <ngx_config.h> |
9 #include <ngx_core.h> | 9 #include <ngx_core.h> |
10 #include <ngx_event.h> | 10 #include <ngx_event.h> |
11 | |
12 | |
13 #if (IOV_MAX > 64) | |
14 #define NGX_IOVS 64 | |
15 #else | |
16 #define NGX_IOVS IOV_MAX | |
17 #endif | |
18 | 11 |
19 | 12 |
20 ngx_chain_t * | 13 ngx_chain_t * |
21 ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) | 14 ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) |
22 { | 15 { |
26 ngx_uint_t eintr; | 19 ngx_uint_t eintr; |
27 ngx_err_t err; | 20 ngx_err_t err; |
28 ngx_array_t vec; | 21 ngx_array_t vec; |
29 ngx_chain_t *cl; | 22 ngx_chain_t *cl; |
30 ngx_event_t *wev; | 23 ngx_event_t *wev; |
31 struct iovec *iov, iovs[NGX_IOVS]; | 24 struct iovec *iov, iovs[NGX_IOVS_PREALLOCATE]; |
32 | 25 |
33 wev = c->write; | 26 wev = c->write; |
34 | 27 |
35 if (!wev->ready) { | 28 if (!wev->ready) { |
36 return in; | 29 return in; |
55 | 48 |
56 send = 0; | 49 send = 0; |
57 | 50 |
58 vec.elts = iovs; | 51 vec.elts = iovs; |
59 vec.size = sizeof(struct iovec); | 52 vec.size = sizeof(struct iovec); |
60 vec.nalloc = NGX_IOVS; | 53 vec.nalloc = NGX_IOVS_PREALLOCATE; |
61 vec.pool = c->pool; | 54 vec.pool = c->pool; |
62 | 55 |
63 for ( ;; ) { | 56 for ( ;; ) { |
64 prev = NULL; | 57 prev = NULL; |
65 iov = NULL; | 58 iov = NULL; |