summaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_config.h10
-rw-r--r--src/core/ngx_connection.c2
-rw-r--r--src/core/ngx_connection.h1
-rw-r--r--src/core/ngx_core.h1
-rw-r--r--src/core/ngx_palloc.c (renamed from src/core/ngx_alloc.c)60
-rw-r--r--src/core/ngx_palloc.h (renamed from src/core/ngx_alloc.h)13
6 files changed, 37 insertions, 50 deletions
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 448e63ab6..02983151a 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -40,19 +40,9 @@
/* STUB: autoconf */
typedef int ngx_int_t;
typedef u_int ngx_uint_t;
-
-
typedef int ngx_flag_t;
-#ifndef NGX_SERVER_ROOT
-#define NGX_SERVER_ROOT "./"
-#if 0
-#define NGX_SERVER_ROOT "/usr/local/nginx/"
-#endif
-#endif
-
-
#if !(WIN32)
#define ngx_signal_helper(n) SIG##n
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 6382ec10c..d5de07675 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -228,7 +228,7 @@ void ngx_close_listening_sockets(ngx_cycle_t *cycle)
fd /= 4;
#endif
- if (ngx_event_flags & NGX_USE_SIGIO_EVENT) {
+ if (ngx_event_flags & NGX_USE_RTSIG_EVENT) {
if (cycle->connections[fd].read->active) {
ngx_del_conn(&cycle->connections[fd], NGX_CLOSE_EVENT);
}
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index ecd3c8bc4..8dbc4e49f 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -103,6 +103,7 @@ struct ngx_connection_s {
unsigned pipeline:1;
unsigned unexpected_eof:1;
+ unsigned timedout:1;
signed tcp_nopush:2;
#if (HAVE_IOCP)
unsigned accept_context_updated:1;
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
index ccb357bfe..1e194e719 100644
--- a/src/core/ngx_core.h
+++ b/src/core/ngx_core.h
@@ -26,6 +26,7 @@ typedef struct ngx_connection_s ngx_connection_t;
#include <ngx_parse.h>
#include <ngx_log.h>
#include <ngx_alloc.h>
+#include <ngx_palloc.h>
#include <ngx_buf.h>
#include <ngx_array.h>
#include <ngx_table.h>
diff --git a/src/core/ngx_alloc.c b/src/core/ngx_palloc.c
index de583fc09..65e2eed66 100644
--- a/src/core/ngx_alloc.c
+++ b/src/core/ngx_palloc.c
@@ -3,35 +3,6 @@
#include <ngx_core.h>
-void *ngx_alloc(size_t size, ngx_log_t *log)
-{
- void *p;
-
- if (!(p = malloc(size))) {
- ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
- "malloc() " SIZE_T_FMT " bytes failed", size);
- }
-
- ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
- "malloc: " PTR_FMT ":" SIZE_T_FMT, p, size);
-
- return p;
-}
-
-
-void *ngx_calloc(size_t size, ngx_log_t *log)
-{
- void *p;
-
- p = ngx_alloc(size, log);
- if (p) {
- ngx_memzero(p, size);
- }
-
- return p;
-}
-
-
ngx_pool_t *ngx_create_pool(size_t size, ngx_log_t *log)
{
ngx_pool_t *p;
@@ -99,7 +70,7 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size)
ngx_pool_t *p, *n;
ngx_pool_large_t *large, *last;
- if (size <= NGX_MAX_ALLOC_FROM_POOL) {
+ if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL) {
for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
m = ngx_align(p->last);
@@ -155,7 +126,7 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size)
large->next = NULL;
}
- if (!(p = ngx_alloc(size, pool->log))) {
+ if (!(p = ngx_memalign(ngx_pagesize, size, pool->log))) {
return NULL;
}
@@ -198,3 +169,30 @@ void *ngx_pcalloc(ngx_pool_t *pool, size_t size)
return p;
}
+
+#if 0
+
+static void *ngx_get_cached_block(size_t size)
+{
+ void *p;
+ ngx_cached_block_slot_t *slot;
+
+ if (ngx_cycle->cache == NULL) {
+ return NULL;
+ }
+
+ slot = &ngx_cycle->cache[(size + ngx_pagesize - 1) / ngx_pagesize];
+
+ slot->tries++;
+
+ if (slot->number) {
+ p = slot->block;
+ slot->block = slot->block->next;
+ slot->number--;
+ return p;
+ }
+
+ return NULL;
+}
+
+#endif
diff --git a/src/core/ngx_alloc.h b/src/core/ngx_palloc.h
index e64f84f4a..7774d356c 100644
--- a/src/core/ngx_alloc.h
+++ b/src/core/ngx_palloc.h
@@ -1,5 +1,5 @@
-#ifndef _NGX_ALLOC_H_INCLUDED_
-#define _NGX_ALLOC_H_INCLUDED_
+#ifndef _NGX_PALLOC_H_INCLUDED_
+#define _NGX_PALLOC_H_INCLUDED_
#include <ngx_config.h>
@@ -7,11 +7,11 @@
/*
- * NGX_MAX_ALLOC_FROM_POOL should be (NGX_PAGE_SIZE - 1), i.e. 4095 on x86.
+ * NGX_MAX_ALLOC_FROM_POOL should be (ngx_page_size - 1), i.e. 4095 on x86.
* On FreeBSD 5.x it allows to use zero copy send.
* On Windows NT it decreases a number of locked pages in a kernel.
*/
-#define NGX_MAX_ALLOC_FROM_POOL 4095
+#define NGX_MAX_ALLOC_FROM_POOL (ngx_pagesize - 1)
#define NGX_DEFAULT_POOL_SIZE (16 * 1024)
@@ -48,7 +48,4 @@ void *ngx_pcalloc(ngx_pool_t *pool, size_t size);
void ngx_pfree(ngx_pool_t *pool, void *p);
-#define ngx_free free
-
-
-#endif /* _NGX_ALLOC_H_INCLUDED_ */
+#endif /* _NGX_PALLOC_H_INCLUDED_ */