Mercurial > hg > nginx
annotate src/core/ngx_palloc.h @ 4104:84f34973684c
Version bump.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 14 Sep 2011 15:20:01 +0000 |
parents | d788521e4b0e |
children | d620f497c50f |
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 |
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
|
4 */ |
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 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
7 #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
|
8 #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
|
9 |
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 #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
|
12 #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
|
13 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
15 /* |
589 | 16 * 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
|
17 * 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
|
18 */ |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
19 #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
|
20 |
1200 | 21 #define NGX_DEFAULT_POOL_SIZE (16 * 1024) |
3388 | 22 |
23 #define NGX_POOL_ALIGNMENT 16 | |
1200 | 24 #define NGX_MIN_POOL_SIZE \ |
3388 | 25 ngx_align((sizeof(ngx_pool_t) + 2 * sizeof(ngx_pool_large_t)), \ |
26 NGX_POOL_ALIGNMENT) | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
27 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 |
509 | 29 typedef void (*ngx_pool_cleanup_pt)(void *data); |
30 | |
31 typedef struct ngx_pool_cleanup_s ngx_pool_cleanup_t; | |
32 | |
33 struct ngx_pool_cleanup_s { | |
34 ngx_pool_cleanup_pt handler; | |
35 void *data; | |
36 ngx_pool_cleanup_t *next; | |
37 }; | |
38 | |
39 | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 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
|
41 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
42 struct ngx_pool_large_s { |
509 | 43 ngx_pool_large_t *next; |
44 void *alloc; | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
45 }; |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
47 |
2049 | 48 typedef struct { |
509 | 49 u_char *last; |
50 u_char *end; | |
2049 | 51 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
|
52 ngx_uint_t failed; |
2049 | 53 } ngx_pool_data_t; |
54 | |
55 | |
56 struct ngx_pool_s { | |
57 ngx_pool_data_t d; | |
58 size_t max; | |
581 | 59 ngx_pool_t *current; |
509 | 60 ngx_chain_t *chain; |
61 ngx_pool_large_t *large; | |
62 ngx_pool_cleanup_t *cleanup; | |
63 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
|
64 }; |
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 |
509 | 67 typedef struct { |
68 ngx_fd_t fd; | |
69 u_char *name; | |
70 ngx_log_t *log; | |
71 } ngx_pool_cleanup_file_t; | |
72 | |
73 | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
74 void *ngx_alloc(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
|
75 void *ngx_calloc(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 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
77 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
|
78 void ngx_destroy_pool(ngx_pool_t *pool); |
2337 | 79 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
|
80 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
81 void *ngx_palloc(ngx_pool_t *pool, size_t size); |
2049 | 82 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
|
83 void *ngx_pcalloc(ngx_pool_t *pool, size_t size); |
2129 | 84 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
|
85 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
|
86 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
87 |
563 | 88 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
|
89 void ngx_pool_run_cleanup_file(ngx_pool_t *p, ngx_fd_t fd); |
509 | 90 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
|
91 void ngx_pool_delete_file(void *data); |
509 | 92 |
93 | |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
94 #endif /* _NGX_PALLOC_H_INCLUDED_ */ |