nginx/src/core/ngx_slab.c


/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */

#include <ngx_config.h>
#include <ngx_core.h>


#define NGX_SLAB_PAGE_MASK
#define NGX_SLAB_PAGE
#define NGX_SLAB_BIG
#define NGX_SLAB_EXACT
#define NGX_SLAB_SMALL

#if (NGX_PTR_SIZE == 4)

#define NGX_SLAB_PAGE_FREE
#define NGX_SLAB_PAGE_BUSY
#define NGX_SLAB_PAGE_START

#define NGX_SLAB_SHIFT_MASK
#define NGX_SLAB_MAP_MASK
#define NGX_SLAB_MAP_SHIFT

#define NGX_SLAB_BUSY

#else /* (NGX_PTR_SIZE == 8) */

#define NGX_SLAB_PAGE_FREE
#define NGX_SLAB_PAGE_BUSY
#define NGX_SLAB_PAGE_START

#define NGX_SLAB_SHIFT_MASK
#define NGX_SLAB_MAP_MASK
#define NGX_SLAB_MAP_SHIFT

#define NGX_SLAB_BUSY

#endif


#define ngx_slab_slots(pool)

#define ngx_slab_page_type(page)

#define ngx_slab_page_prev(page)

#define ngx_slab_page_addr(pool, page)


#if (NGX_DEBUG_MALLOC)

#define ngx_slab_junk

#elif (NGX_HAVE_DEBUG_MALLOC)

#define ngx_slab_junk

#else

#define ngx_slab_junk(p, size)

#endif

static ngx_slab_page_t *ngx_slab_alloc_pages(ngx_slab_pool_t *pool,
    ngx_uint_t pages);
static void ngx_slab_free_pages(ngx_slab_pool_t *pool, ngx_slab_page_t *page,
    ngx_uint_t pages);
static void ngx_slab_error(ngx_slab_pool_t *pool, ngx_uint_t level,
    char *text);


static ngx_uint_t  ngx_slab_max_size;
static ngx_uint_t  ngx_slab_exact_size;
static ngx_uint_t  ngx_slab_exact_shift;


void
ngx_slab_sizes_init(void)
{}


void
ngx_slab_init(ngx_slab_pool_t *pool)
{}


void *
ngx_slab_alloc(ngx_slab_pool_t *pool, size_t size)
{}


void *
ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)
{}


void *
ngx_slab_calloc(ngx_slab_pool_t *pool, size_t size)
{}


void *
ngx_slab_calloc_locked(ngx_slab_pool_t *pool, size_t size)
{}


void
ngx_slab_free(ngx_slab_pool_t *pool, void *p)
{}


void
ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
{}


static ngx_slab_page_t *
ngx_slab_alloc_pages(ngx_slab_pool_t *pool, ngx_uint_t pages)
{}


static void
ngx_slab_free_pages(ngx_slab_pool_t *pool, ngx_slab_page_t *page,
    ngx_uint_t pages)
{}


static void
ngx_slab_error(ngx_slab_pool_t *pool, ngx_uint_t level, char *text)
{}