diff options
author | Igor Sysoev <igor@sysoev.ru> | 2002-09-02 14:48:24 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2002-09-02 14:48:24 +0000 |
commit | a58e3ca14300fce97b2124233afe140c8d59199f (patch) | |
tree | d24eff379cc7dfb5c6952f1bb15735cd63ba2179 /src/core | |
parent | 016b85270268989d769bade2004a7c628a47d726 (diff) | |
download | nginx-a58e3ca14300fce97b2124233afe140c8d59199f.tar.gz nginx-a58e3ca14300fce97b2124233afe140c8d59199f.zip |
nginx-0.0.1-2002-09-02-18:48:24 import
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/nginx.c | 4 | ||||
-rw-r--r-- | src/core/ngx_config.h | 5 | ||||
-rw-r--r-- | src/core/ngx_connection.h | 4 | ||||
-rw-r--r-- | src/core/ngx_file.h | 16 | ||||
-rw-r--r-- | src/core/ngx_hunk.c | 24 | ||||
-rw-r--r-- | src/core/ngx_hunk.h | 12 | ||||
-rw-r--r-- | src/core/ngx_log.c | 4 | ||||
-rw-r--r-- | src/core/ngx_log.h | 2 |
8 files changed, 52 insertions, 19 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c index 748b44314..b2f3f5fba 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -36,8 +36,6 @@ ngx_array_t *ngx_listening_sockets; int main(int argc, char *const *argv) { - int i; - /* STUB */ ngx_log.log_level = NGX_LOG_DEBUG; @@ -68,6 +66,8 @@ int main(int argc, char *const *argv) /* STUB */ ngx_worker(&ngx_log); + + return 0; } static void ngx_open_listening_sockets(ngx_log_t *log) diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h index 88f374ac3..f7223fa45 100644 --- a/src/core/ngx_config.h +++ b/src/core/ngx_config.h @@ -18,6 +18,7 @@ #include <winsock2.h> #include <mswsock.h> +#include <stddef.h> /* offsetof */ #include <stdio.h> #include <stdarg.h> @@ -88,6 +89,10 @@ #endif +#ifndef HAVE_SELECT +#define HAVE_SELECT 1 +#endif + #ifdef __FreeBSD__ diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h index cdd72bb92..f275f9156 100644 --- a/src/core/ngx_connection.h +++ b/src/core/ngx_connection.h @@ -21,6 +21,8 @@ struct ngx_connection_s { ngx_event_t *write; #endif + off_t sent; + ngx_log_t *log; int (*handler)(ngx_connection_t *c); ngx_server_t *server; @@ -35,6 +37,8 @@ struct ngx_connection_s { size_t addr_textlen; unsigned int post_accept_timeout; + + unsigned unexpected_eof:1; }; diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h new file mode 100644 index 000000000..0d6838686 --- /dev/null +++ b/src/core/ngx_file.h @@ -0,0 +1,16 @@ +#ifndef _NGX_FILE_H_INCLUDED_ +#define _NGX_FILE_H_INCLUDED_ + + +#include <ngx_files.h> +#include <ngx_log.h> + +typedef struct ngx_file_s ngx_file_t; + +struct ngx_file_s { + ngx_fd_t fd; + ngx_log_t *log; +}; + + +#endif _NGX_FILE_H_INCLUDED_ diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c index f829b7e48..79a8ad748 100644 --- a/src/core/ngx_hunk.c +++ b/src/core/ngx_hunk.c @@ -1,13 +1,13 @@ -#include <ngx_file.h> #include <ngx_hunk.h> -ngx_hunk_t *ngx_get_hunk(ngx_pool_t *pool, int size, int before, int after) +ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size, + int before, int after) { ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t)); -#ifndef OFF_EQUAL_PTR +#if !(HAVE_OFFSET_EQUAL_PTR) h->pos.file = h->last.file = 0; #endif @@ -18,16 +18,16 @@ ngx_hunk_t *ngx_get_hunk(ngx_pool_t *pool, int size, int before, int after) h->type = NGX_HUNK_TEMP; h->tag = 0; - h->fd = (ngx_fd_t) -1; + h->file = NULL; return h; } -ngx_hunk_t *ngx_get_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) +ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) { ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t)); -#ifndef OFF_EQUAL_PTR +#if !(HAVE_OFFSET_EQUAL_PTR) h->pos.file = h->last.file = 0; #endif @@ -39,7 +39,7 @@ ngx_hunk_t *ngx_get_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) h->type = NGX_HUNK_TEMP; h->tag = 0; - h->fd = (ngx_fd_t) -1; + h->file = NULL; } else { h->pre_start = h->start = h->pos.mem = h->last.mem @@ -48,17 +48,17 @@ ngx_hunk_t *ngx_get_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) h->type = NGX_HUNK_TEMP; h->tag = 0; - h->fd = (ngx_fd_t) -1; + h->file = NULL; } return h; } -ngx_hunk_t *ngx_get_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) +ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) { ngx_hunk_t *h = ngx_palloc(pool, sizeof(ngx_hunk_t)); -#ifndef OFF_EQUAL_PTR +#if !(HAVE_OFFSET_EQUAL_PTR) h->pos.file = h->last.file = 0; #endif @@ -71,7 +71,7 @@ ngx_hunk_t *ngx_get_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) hunk->last.mem; h->type = NGX_HUNK_TEMP; h->tag = 0; - h->fd = (ngx_fd_t) -1; + h->file = NULL; } else { h->pre_start = h->start = h->pos.mem = h->last.mem = @@ -80,7 +80,7 @@ ngx_hunk_t *ngx_get_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size) h->type = NGX_HUNK_TEMP; h->tag = 0; - h->fd = (ngx_fd_t) -1; + h->file = NULL; } return h; diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h index 3703db456..75aaef132 100644 --- a/src/core/ngx_hunk.h +++ b/src/core/ngx_hunk.h @@ -27,6 +27,8 @@ /* can be used with NGX_HUNK_LAST only */ #define NGX_HUNK_SHUTDOWN 0x0400 +#define NGX_HUNK_RECYCLED 0x0800 + #define NGX_HUNK_IN_MEMORY (NGX_HUNK_TEMP|NGX_HUNK_MEMORY|NGX_HUNK_MMAP) @@ -48,7 +50,7 @@ struct ngx_hunk_s { char *pre_start; /* start of pre-allocated hunk */ char *post_end; /* end of post-allocated hunk */ int tag; - ngx_fd_t fd; + ngx_file_t *file; }; typedef struct ngx_chain_s ngx_chain_t; @@ -57,8 +59,11 @@ struct ngx_chain_s { ngx_chain_t *next; }; -#define ngx_create_temp_hunk(pool, size, before, after) \ - ngx_get_hunk(pool, size, before, after) + +ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size, + int before, int after); + +#define ngx_create_chain_entry(pool) ngx_palloc(pool, sizeof(ngx_chain_t)) #define ngx_add_hunk_to_chain(chain, h, pool, error) \ do { \ @@ -70,7 +75,6 @@ struct ngx_chain_s { -ngx_hunk_t *ngx_get_hunk(ngx_pool_t *pool, int size, int before, int after); #endif /* _NGX_CHUNK_H_INCLUDED_ */ diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c index bed628aed..6a6835802 100644 --- a/src/core/ngx_log.c +++ b/src/core/ngx_log.c @@ -45,7 +45,11 @@ void ngx_log_error_core(int level, ngx_log_t *log, ngx_err_t err, " [%s] ", err_levels[level]); len += ngx_snprintf(errstr + len, sizeof(errstr) - len - 1, +#if (WIN32) + "%d#%d: ", 0, 0); +#else "%d#%d: ", getpid(), 0); +#endif #if (HAVE_VARIADIC_MACROS) va_start(args, fmt); diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h index f1e49ebd4..d79237ef0 100644 --- a/src/core/ngx_log.h +++ b/src/core/ngx_log.h @@ -3,7 +3,7 @@ #include <ngx_errno.h> -#include <ngx_file.h> +#include <ngx_files.h> typedef enum { NGX_LOG_EMERG = 0, |