Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.15.12 ]​[ nginx-1.16.0 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #ifndef _NGX_SLAB_H_INCLUDED_
0009 #define _NGX_SLAB_H_INCLUDED_
0010 
0011 
0012 #include <ngx_config.h>
0013 #include <ngx_core.h>
0014 
0015 
0016 typedef struct ngx_slab_page_s  ngx_slab_page_t;
0017 
0018 struct ngx_slab_page_s {
0019     uintptr_t         slab;
0020     ngx_slab_page_t  *next;
0021     uintptr_t         prev;
0022 };
0023 
0024 
0025 typedef struct {
0026     ngx_uint_t        total;
0027     ngx_uint_t        used;
0028 
0029     ngx_uint_t        reqs;
0030     ngx_uint_t        fails;
0031 } ngx_slab_stat_t;
0032 
0033 
0034 typedef struct {
0035     ngx_shmtx_sh_t    lock;
0036 
0037     size_t            min_size;
0038     size_t            min_shift;
0039 
0040     ngx_slab_page_t  *pages;
0041     ngx_slab_page_t  *last;
0042     ngx_slab_page_t   free;
0043 
0044     ngx_slab_stat_t  *stats;
0045     ngx_uint_t        pfree;
0046 
0047     u_char           *start;
0048     u_char           *end;
0049 
0050     ngx_shmtx_t       mutex;
0051 
0052     u_char           *log_ctx;
0053     u_char            zero;
0054 
0055     unsigned          log_nomem:1;
0056 
0057     void             *data;
0058     void             *addr;
0059 } ngx_slab_pool_t;
0060 
0061 
0062 void ngx_slab_sizes_init(void);
0063 void ngx_slab_init(ngx_slab_pool_t *pool);
0064 void *ngx_slab_alloc(ngx_slab_pool_t *pool, size_t size);
0065 void *ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size);
0066 void *ngx_slab_calloc(ngx_slab_pool_t *pool, size_t size);
0067 void *ngx_slab_calloc_locked(ngx_slab_pool_t *pool, size_t size);
0068 void ngx_slab_free(ngx_slab_pool_t *pool, void *p);
0069 void ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p);
0070 
0071 
0072 #endif /* _NGX_SLAB_H_INCLUDED_ */