Mercurial > hg > nginx
comparison src/os/unix/ngx_readv_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 | 43512a33e8f2 |
children | a0a14319968b |
comparison
equal
deleted
inserted
replaced
5853:a6e83ac70af9 | 5854:b63e829621ab |
---|---|
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 | 11 |
12 | 12 |
13 #if (IOV_MAX > 64) | |
14 #define NGX_IOVS 64 | |
15 #else | |
16 #define NGX_IOVS IOV_MAX | |
17 #endif | |
18 | |
19 | |
20 ssize_t | 13 ssize_t |
21 ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) | 14 ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) |
22 { | 15 { |
23 u_char *prev; | 16 u_char *prev; |
24 ssize_t n, size; | 17 ssize_t n, size; |
25 ngx_err_t err; | 18 ngx_err_t err; |
26 ngx_array_t vec; | 19 ngx_array_t vec; |
27 ngx_event_t *rev; | 20 ngx_event_t *rev; |
28 struct iovec *iov, iovs[NGX_IOVS]; | 21 struct iovec *iov, iovs[NGX_IOVS_PREALLOCATE]; |
29 | 22 |
30 rev = c->read; | 23 rev = c->read; |
31 | 24 |
32 #if (NGX_HAVE_KQUEUE) | 25 #if (NGX_HAVE_KQUEUE) |
33 | 26 |
65 size = 0; | 58 size = 0; |
66 | 59 |
67 vec.elts = iovs; | 60 vec.elts = iovs; |
68 vec.nelts = 0; | 61 vec.nelts = 0; |
69 vec.size = sizeof(struct iovec); | 62 vec.size = sizeof(struct iovec); |
70 vec.nalloc = NGX_IOVS; | 63 vec.nalloc = NGX_IOVS_PREALLOCATE; |
71 vec.pool = c->pool; | 64 vec.pool = c->pool; |
72 | 65 |
73 /* coalesce the neighbouring bufs */ | 66 /* coalesce the neighbouring bufs */ |
74 | 67 |
75 while (chain) { | 68 while (chain) { |