Sword nginx slab源码解析一
2022/7/24 5:24:02
本文主要是介绍Sword nginx slab源码解析一,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
/* * Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. */ #ifndef _NGX_SLAB_H_INCLUDED_ #define _NGX_SLAB_H_INCLUDED_ #include <ngx_config.h> #include <ngx_core.h> typedef struct ngx_slab_page_s ngx_slab_page_t; struct ngx_slab_page_s { uintptr_t slab; ngx_slab_page_t *next; uintptr_t prev; }; typedef struct { ngx_uint_t total; ngx_uint_t used; ngx_uint_t reqs; ngx_uint_t fails; } ngx_slab_stat_t; typedef struct { ngx_shmtx_sh_t lock; size_t min_size; size_t min_shift; ngx_slab_page_t *pages; ngx_slab_page_t *last; ngx_slab_page_t free; ngx_slab_stat_t *stats; ngx_uint_t pfree; // 记录空闲页数 u_char *start; u_char *end; ngx_shmtx_t mutex; u_char *log_ctx; u_char zero; unsigned log_nomem:1; void *data; void *addr; } ngx_slab_pool_t; 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); #endif /* _NGX_SLAB_H_INCLUDED_ */
这篇关于Sword nginx slab源码解析一的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-29Nginx发布学习:从入门到实践的简单教程
- 2024-10-28Nginx发布:新手入门教程
- 2024-10-21nginx 怎么设置文件上传最大20M限制-icode9专业技术文章分享
- 2024-10-17关闭 nginx的命令是什么?-icode9专业技术文章分享
- 2024-09-17Nginx实用篇:实现负载均衡、限流与动静分离
- 2024-08-21宝塔nginx新增8022端口方法步骤-icode9专业技术文章分享
- 2024-08-21nginx配置,让ws升级为wss访问的方法步骤-icode9专业技术文章分享
- 2024-08-15nginx ws代理配置方法步骤-icode9专业技术文章分享
- 2024-08-14nginx 让访问带有/relid的地址返回404 ,例子 /relid-x-0.36-y-131.html-icode9专业技术文章分享
- 2024-08-14nginx 判断地址有/statics/的路径,指向到/home/html/statics/目录-icode9专业技术文章分享