comparison src/core/ngx_slab.c @ 260:0effe91f6083 NGINX_0_5_0

nginx 0.5.0 *) Change: the parameters in the "%name" form in the "log_format" directive are not supported anymore. *) Change: the "proxy_upstream_max_fails", "proxy_upstream_fail_timeout", "fastcgi_upstream_max_fails", "fastcgi_upstream_fail_timeout", "memcached_upstream_max_fails", and "memcached_upstream_fail_timeout" directives are not supported anymore. *) Feature: the "server" directive in the "upstream" context supports the "max_fails", "fail_timeout", and "down" parameters. *) Feature: the "ip_hash" directive inside the "upstream" block. *) Feature: the WAIT status in the "Auth-Status" header line of the IMAP/POP3 proxy authentication server response. *) Bugfix: nginx could not be built on 64-bit platforms; bug appeared in 0.4.14.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Dec 2006 00:00:00 +0300
parents 6ae1357b7b7c
children 29a6403156b0
comparison
equal deleted inserted replaced
259:c68f18041059 260:0effe91f6083
147 147
148 void * 148 void *
149 ngx_slab_alloc(ngx_slab_pool_t *pool, size_t size) 149 ngx_slab_alloc(ngx_slab_pool_t *pool, size_t size)
150 { 150 {
151 size_t s; 151 size_t s;
152 uintptr_t p, mask, *bitmap; 152 uintptr_t p, n, m, mask, *bitmap;
153 ngx_uint_t i, n, m, slot, shift, map; 153 ngx_uint_t i, slot, shift, map;
154 ngx_slab_page_t *page, *prev, *slots; 154 ngx_slab_page_t *page, *prev, *slots;
155 155
156 ngx_shmtx_lock(&pool->mutex); 156 ngx_shmtx_lock(&pool->mutex);
157 157
158 if (size >= ngx_slab_max_size) { 158 if (size >= ngx_slab_max_size) {
285 mask = n << NGX_SLAB_MAP_SHIFT; 285 mask = n << NGX_SLAB_MAP_SHIFT;
286 286
287 do { 287 do {
288 if ((page->slab & NGX_SLAB_MAP_MASK) != mask) { 288 if ((page->slab & NGX_SLAB_MAP_MASK) != mask) {
289 289
290 for (m = 1 << NGX_SLAB_MAP_SHIFT, i = 0; 290 for (m = (uintptr_t) 1 << NGX_SLAB_MAP_SHIFT, i = 0;
291 m & mask; 291 m & mask;
292 m <<= 1, i++) 292 m <<= 1, i++)
293 { 293 {
294 if ((page->slab & m)) { 294 if ((page->slab & m)) {
295 continue; 295 continue;
367 367
368 goto done; 368 goto done;
369 369
370 } else { /* size < ngx_pagesize */ 370 } else { /* size < ngx_pagesize */
371 371
372 page->slab = (1 << NGX_SLAB_MAP_SHIFT) | shift; 372 page->slab = ((uintptr_t) 1 << NGX_SLAB_MAP_SHIFT) | shift;
373 page->next = &slots[slot]; 373 page->next = &slots[slot];
374 page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_BIG; 374 page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_BIG;
375 375
376 slots[slot].next = page; 376 slots[slot].next = page;
377 377