Mercurial > hg > nginx-quic
annotate src/core/ngx_palloc.h @ 8523:0c5e84096d99
Core: added the ngx_rbtree_data() macro.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Mon, 21 Jun 2021 09:42:43 +0300 |
parents | ef935cd7ed8d |
children |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
436
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
436
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
436
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
436
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
436
diff
changeset
|
7 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
8 #ifndef _NGX_PALLOC_H_INCLUDED_ |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
9 #define _NGX_PALLOC_H_INCLUDED_ |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 #include <ngx_config.h> |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
13 #include <ngx_core.h> |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
16 /* |
589 | 17 * NGX_MAX_ALLOC_FROM_POOL should be (ngx_pagesize - 1), i.e. 4095 on x86. |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
18 * On Windows NT it decreases a number of locked pages in a kernel. |
78
9f81437e0ad3
nginx-0.0.1-2003-04-21-18:55:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
19 */ |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
20 #define NGX_MAX_ALLOC_FROM_POOL (ngx_pagesize - 1) |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 |
1200 | 22 #define NGX_DEFAULT_POOL_SIZE (16 * 1024) |
3388 | 23 |
24 #define NGX_POOL_ALIGNMENT 16 | |
1200 | 25 #define NGX_MIN_POOL_SIZE \ |
3388 | 26 ngx_align((sizeof(ngx_pool_t) + 2 * sizeof(ngx_pool_large_t)), \ |
27 NGX_POOL_ALIGNMENT) | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 |
509 | 30 typedef void (*ngx_pool_cleanup_pt)(void *data); |
31 | |
32 typedef struct ngx_pool_cleanup_s ngx_pool_cleanup_t; | |
33 | |
34 struct ngx_pool_cleanup_s { | |
35 ngx_pool_cleanup_pt handler; | |
36 void *data; | |
37 ngx_pool_cleanup_t *next; | |
38 }; | |
39 | |
40 | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
41 typedef struct ngx_pool_large_s ngx_pool_large_t; |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
42 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 struct ngx_pool_large_s { |
509 | 44 ngx_pool_large_t *next; |
45 void *alloc; | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 }; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
47 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
48 |
2049 | 49 typedef struct { |
509 | 50 u_char *last; |
51 u_char *end; | |
2049 | 52 ngx_pool_t *next; |
2920
cb7d05c097db
do not test a pool block space if we can not allocated from the block 4 times
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
53 ngx_uint_t failed; |
2049 | 54 } ngx_pool_data_t; |
55 | |
56 | |
57 struct ngx_pool_s { | |
58 ngx_pool_data_t d; | |
59 size_t max; | |
581 | 60 ngx_pool_t *current; |
509 | 61 ngx_chain_t *chain; |
62 ngx_pool_large_t *large; | |
63 ngx_pool_cleanup_t *cleanup; | |
64 ngx_log_t *log; | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
65 }; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
66 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
67 |
509 | 68 typedef struct { |
69 ngx_fd_t fd; | |
70 u_char *name; | |
71 ngx_log_t *log; | |
72 } ngx_pool_cleanup_file_t; | |
73 | |
74 | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
75 ngx_pool_t *ngx_create_pool(size_t size, ngx_log_t *log); |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
76 void ngx_destroy_pool(ngx_pool_t *pool); |
2337 | 77 void ngx_reset_pool(ngx_pool_t *pool); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
78 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
79 void *ngx_palloc(ngx_pool_t *pool, size_t size); |
2049 | 80 void *ngx_pnalloc(ngx_pool_t *pool, size_t size); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
81 void *ngx_pcalloc(ngx_pool_t *pool, size_t size); |
2129 | 82 void *ngx_pmemalign(ngx_pool_t *pool, size_t size, size_t alignment); |
436
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
354
diff
changeset
|
83 ngx_int_t ngx_pfree(ngx_pool_t *pool, void *p); |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
84 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
85 |
563 | 86 ngx_pool_cleanup_t *ngx_pool_cleanup_add(ngx_pool_t *p, size_t size); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2414
diff
changeset
|
87 void ngx_pool_run_cleanup_file(ngx_pool_t *p, ngx_fd_t fd); |
509 | 88 void ngx_pool_cleanup_file(void *data); |
1075
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
89 void ngx_pool_delete_file(void *data); |
509 | 90 |
91 | |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
92 #endif /* _NGX_PALLOC_H_INCLUDED_ */ |