comparison src/http/ngx_http_file_cache.c @ 2611:2bce3f6416c6

improve ngx_slab_alloc() error logging
author Igor Sysoev <igor@sysoev.ru>
date Fri, 27 Mar 2009 17:00:42 +0000
parents fd387fbb28c6
children d19979e0d980
comparison
equal deleted inserted replaced
2610:3a9b22405138 2611:2bce3f6416c6
31 static ngx_int_t 31 static ngx_int_t
32 ngx_http_file_cache_init(ngx_shm_zone_t *shm_zone, void *data) 32 ngx_http_file_cache_init(ngx_shm_zone_t *shm_zone, void *data)
33 { 33 {
34 ngx_http_file_cache_t *ocache = data; 34 ngx_http_file_cache_t *ocache = data;
35 35
36 size_t len;
36 ngx_rbtree_node_t *sentinel; 37 ngx_rbtree_node_t *sentinel;
37 ngx_http_file_cache_t *cache; 38 ngx_http_file_cache_t *cache;
38 39
39 cache = shm_zone->data; 40 cache = shm_zone->data;
40 41
76 if (cache->queue == NULL) { 77 if (cache->queue == NULL) {
77 return NGX_ERROR; 78 return NGX_ERROR;
78 } 79 }
79 80
80 ngx_queue_init(cache->queue); 81 ngx_queue_init(cache->queue);
82
83 len = sizeof(" in cache keys zone \"\"") + shm_zone->name.len;
84
85 cache->shpool->log_ctx = ngx_slab_alloc(cache->shpool, len);
86 if (cache->shpool->log_ctx == NULL) {
87 return NGX_ERROR;
88 }
89
90 ngx_sprintf(cache->shpool->log_ctx, " in cache keys zone \"%V\"%Z",
91 &shm_zone->name);
81 92
82 cache->created = ngx_time(); 93 cache->created = ngx_time();
83 94
84 return NGX_OK; 95 return NGX_OK;
85 } 96 }