nginx-0.0.1-2003-11-21-09:30:49 import
diff --git a/src/core/nginx.c b/src/core/nginx.c
index ca056bd..26db6f8 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -230,7 +230,7 @@
cycle = ngx_init_cycle(cycle, cycle->log);
if (cycle == NULL) {
- cycle = (ngx_cycle_t*) ngx_cycle;
+ cycle = (ngx_cycle_t *) ngx_cycle;
continue;
}
diff --git a/src/core/ngx_alloc.c b/src/core/ngx_alloc.c
index 32aa25c..dff0593 100644
--- a/src/core/ngx_alloc.c
+++ b/src/core/ngx_alloc.c
@@ -5,10 +5,9 @@
void *ngx_alloc(size_t size, ngx_log_t *log)
{
- void *p;
+ void *p;
- p = malloc(size);
- if (p == NULL) {
+ if (!(p = malloc(size))) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
"malloc() %d bytes failed", size);
}
@@ -23,7 +22,7 @@
void *ngx_calloc(size_t size, ngx_log_t *log)
{
- void *p;
+ void *p;
p = ngx_alloc(size, log);
if (p) {
@@ -36,9 +35,11 @@
ngx_pool_t *ngx_create_pool(size_t size, ngx_log_t *log)
{
- ngx_pool_t *p;
+ ngx_pool_t *p;
- ngx_test_null(p, ngx_alloc(size, log), NULL);
+ if (!(p = ngx_alloc(size, log))) {
+ return NULL;
+ }
p->last = (char *) p + sizeof(ngx_pool_t);
p->end = (char *) p + size;
@@ -115,7 +116,10 @@
/* alloc a new pool block */
- ngx_test_null(n, ngx_create_pool(p->end - (char *) p, p->log), NULL);
+ if (!(n = ngx_create_pool((size_t) (p->end - (char *) p), p->log))) {
+ return NULL;
+ }
+
p->next = n;
m = n->last;
n->last += size;
@@ -143,11 +147,16 @@
}
if (large == NULL) {
- ngx_test_null(large, ngx_palloc(pool, sizeof(ngx_pool_large_t)), NULL);
+ if (!(large = ngx_palloc(pool, sizeof(ngx_pool_large_t)))) {
+ return NULL;
+ }
+
large->next = NULL;
}
- ngx_test_null(p, ngx_alloc(size, pool->log), NULL);
+ if (!(p = ngx_alloc(size, pool->log))) {
+ return NULL;
+ }
if (pool->large == NULL) {
pool->large = large;
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 5ea364b..fd30216 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -315,12 +315,12 @@
}
if (h->pos - start) {
- ngx_memcpy(h->start, start, h->pos - start);
+ ngx_memcpy(h->start, start, (size_t) (h->pos - start));
}
n = ngx_read_file(&cf->conf_file->file,
h->start + (h->pos - start),
- h->end - (h->start + (h->pos - start)),
+ (size_t) (h->end - (h->start + (h->pos - start))),
cf->conf_file->file.offset);
if (n == NGX_ERROR) {
@@ -462,7 +462,8 @@
if (found) {
ngx_test_null(word, ngx_push_array(cf->args), NGX_ERROR);
ngx_test_null(word->data,
- ngx_palloc(cf->pool, h->pos - start + 1),
+ ngx_palloc(cf->pool,
+ (size_t) (h->pos - start + 1)),
NGX_ERROR);
for (dst = word->data, src = start, len = 0;
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index da6f37a..9312fba 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -28,8 +28,8 @@
ngx_log_t *log;
int backlog;
- int pool_size;
- int post_accept_buffer_size; /* should be here because
+ size_t pool_size;
+ size_t post_accept_buffer_size; /* should be here because
of the AcceptEx() preread */
time_t post_accept_timeout; /* should be here because
of the deferred accept */
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index ee4c653..4ae5378 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -105,7 +105,8 @@
void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path)
{
- int i, name, pos, level;
+ int i, name, pos;
+ size_t level;
name = file->name.len;
pos = path->name.len + 1;
@@ -192,7 +193,7 @@
{
char *p = conf;
- int i, n;
+ int i, n, level;
ngx_str_t *value;
ngx_path_t *path, **pp;
@@ -219,12 +220,12 @@
path->len = 0;
for (i = 0, n = 2; n < cf->args->nelts; i++, n++) {
- path->level[i] = ngx_atoi(value[n].data, value[n].len);
- if (path->level[i] == NGX_ERROR || path->level[i] == 0) {
+ level = ngx_atoi(value[n].data, value[n].len);
+ if (level == NGX_ERROR || level == 0) {
return "invalid value";
}
- path->len += path->level[i] + 1;
+ path->len += path->level[i] + level + 1;
}
while (i < 3) {
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index b1e5fb8..9042c61 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -27,8 +27,8 @@
struct ngx_path_s {
ngx_str_t name;
- int len;
- int level[3];
+ u_int len;
+ u_int level[3];
ngx_gc_handler_pt gc_handler;
};
diff --git a/src/core/ngx_garbage_collector.c b/src/core/ngx_garbage_collector.c
index e673acd..f60fae9 100644
--- a/src/core/ngx_garbage_collector.c
+++ b/src/core/ngx_garbage_collector.c
@@ -70,8 +70,9 @@
static int ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level)
{
- int rc, len;
+ int rc;
char *last;
+ size_t len;
ngx_err_t err;
ngx_str_t fname, buf;
ngx_dir_t dir;
diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c
index de57a5d..2785c39 100644
--- a/src/core/ngx_hunk.c
+++ b/src/core/ngx_hunk.c
@@ -3,7 +3,7 @@
#include <ngx_core.h>
-ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size)
+ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, size_t size)
{
ngx_hunk_t *h;
diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h
index 2c6664b..7dc0f0c 100644
--- a/src/core/ngx_hunk.h
+++ b/src/core/ngx_hunk.h
@@ -124,7 +124,7 @@
(size_t) (h->file_last - h->file_pos))
-ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size);
+ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, size_t size);
#define ngx_alloc_hunk(pool) ngx_palloc(pool, sizeof(ngx_hunk_t))
#define ngx_calloc_hunk(pool) ngx_pcalloc(pool, sizeof(ngx_hunk_t))
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index f196937..46deab4 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -10,14 +10,13 @@
ngx_inline static int ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx,
ngx_hunk_t *hunk);
static int ngx_output_chain_copy_hunk(ngx_hunk_t *dst, ngx_hunk_t *src,
- int sendfile);
+ u_int sendfile);
int ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
{
int rc, last;
- size_t hsize;
- ssize_t size;
+ size_t size, hsize;
ngx_chain_t *cl, *out, **last_out;
/*
@@ -191,13 +190,14 @@
static int ngx_output_chain_copy_hunk(ngx_hunk_t *dst, ngx_hunk_t *src,
- int sendfile)
+ u_int sendfile)
{
- ssize_t n, size;
+ size_t size;
+ ssize_t n;
size = ngx_hunk_size(src);
- if (size > (dst->end - dst->pos)) {
+ if (size > (size_t) (dst->end - dst->pos)) {
size = dst->end - dst->pos;
}
@@ -233,7 +233,7 @@
}
#endif
- if (n != size) {
+ if ((size_t) n != size) {
ngx_log_error(NGX_LOG_ALERT, src->file->log, 0,
ngx_read_file_n " reads only %d of %d from file",
n, size);
diff --git a/src/core/ngx_parse.c b/src/core/ngx_parse.c
index 213b2f6..6a1f54b 100644
--- a/src/core/ngx_parse.c
+++ b/src/core/ngx_parse.c
@@ -5,8 +5,9 @@
int ngx_parse_size(ngx_str_t *line)
{
- int len, scale, size;
- char last;
+ int scale, size;
+ char last;
+ size_t len;
len = line->len;
last = line->data[len - 1];
@@ -41,8 +42,9 @@
int ngx_parse_time(ngx_str_t *line, int sec)
{
- int value, total, len, scale;
+ int value, total, scale;
u_int max, i;
+ size_t len;
char *start, last;
enum {
st_start = 0,
diff --git a/src/event/modules/ngx_devpoll_module.c b/src/event/modules/ngx_devpoll_module.c
index c8f3684..08aff29 100644
--- a/src/event/modules/ngx_devpoll_module.c
+++ b/src/event/modules/ngx_devpoll_module.c
@@ -101,7 +101,7 @@
static int ngx_devpoll_init(ngx_cycle_t *cycle)
{
- int n;
+ size_t n;
ngx_devpoll_conf_t *dpcf;
dpcf = ngx_event_get_conf(cycle->conf_ctx, ngx_devpoll_module);
@@ -122,7 +122,7 @@
if (max_changes < dpcf->changes) {
if (nchanges) {
n = nchanges * sizeof(struct pollfd);
- if (write(dp, change_list, n) != n) {
+ if ((size_t) write(dp, change_list, n) != n) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"write(/dev/poll) failed");
return NGX_ERROR;
@@ -271,7 +271,7 @@
static int ngx_devpoll_set_event(ngx_event_t *ev, int event, u_int flags)
{
- int n;
+ size_t n;
ngx_connection_t *c;
c = ev->data;
@@ -286,7 +286,7 @@
"/dev/pool change list is filled up");
n = nchanges * sizeof(struct pollfd);
- if (write(dp, change_list, n) != n) {
+ if ((size_t) write(dp, change_list, n) != n) {
ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno,
"write(/dev/poll) failed");
return NGX_ERROR;
@@ -306,7 +306,7 @@
if (flags & NGX_CLOSE_EVENT) {
n = nchanges * sizeof(struct pollfd);
- if (write(dp, change_list, n) != n) {
+ if ((size_t) write(dp, change_list, n) != n) {
ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno,
"write(/dev/poll) failed");
return NGX_ERROR;
@@ -321,7 +321,8 @@
int ngx_devpoll_process_events(ngx_log_t *log)
{
- int events, n, i, j;
+ int events, i, j;
+ size_t n;
ngx_msec_t timer;
ngx_err_t err;
ngx_cycle_t **cycle;
@@ -337,7 +338,7 @@
delta = tv.tv_sec * 1000 + tv.tv_usec / 1000;
} else {
- timer = INFTIM;
+ timer = (ngx_msec_t) INFTIM;
delta = 0;
}
@@ -347,7 +348,7 @@
if (nchanges) {
n = nchanges * sizeof(struct pollfd);
- if (write(dp, change_list, n) != n) {
+ if ((size_t) write(dp, change_list, n) != n) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
"write(/dev/poll) failed");
return NGX_ERROR;
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 2590548..f51886e 100644
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -11,8 +11,8 @@
typedef struct {
- u_int changes;
- u_int events;
+ int changes;
+ int events;
} ngx_kqueue_conf_t;
@@ -30,7 +30,7 @@
int ngx_kqueue = -1;
static struct kevent *change_list, *event_list;
-static u_int max_changes, nchanges, nevents;
+static int max_changes, nchanges, nevents;
static ngx_str_t kqueue_name = ngx_string("kqueue");
@@ -196,8 +196,9 @@
ev->oneshot = (flags & NGX_ONESHOT_EVENT) ? 1 : 0;
if (nchanges > 0
- && ev->index < nchanges
- && (void *) ((uintptr_t) change_list[ev->index].udata & ~1) == ev)
+ && ev->index < (u_int) nchanges
+ && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1)
+ == (uintptr_t) ev)
{
c = ev->data;
ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
@@ -206,7 +207,7 @@
return NGX_ERROR;
}
- return ngx_kqueue_set_event(ev, event, EV_ADD | flags);
+ return ngx_kqueue_set_event(ev, event, EV_ADD|flags);
}
@@ -217,8 +218,9 @@
ev->active = 0;
if (nchanges > 0
- && ev->index < nchanges
- && (void *) ((uintptr_t) change_list[ev->index].udata & ~1) == ev)
+ && ev->index < (u_int) nchanges
+ && ((uintptr_t) change_list[ev->index].udata & (uintptr_t) ~1)
+ == (uintptr_t) ev)
{
#if (NGX_DEBUG_EVENT)
ngx_connection_t *c = (ngx_connection_t *) ev->data;
@@ -228,7 +230,7 @@
/* if the event is still not passed to a kernel we will not pass it */
- if (ev->index < --nchanges) {
+ if (ev->index < (u_int) --nchanges) {
e = (ngx_event_t *) change_list[nchanges].udata;
change_list[ev->index] = change_list[nchanges];
e->index = ev->index;
@@ -247,7 +249,8 @@
return NGX_OK;
}
- return ngx_kqueue_set_event(ev, event, EV_DELETE);
+ return ngx_kqueue_set_event(ev, event,
+ flags & NGX_DISABLE_EVENT ? EV_DISABLE : EV_DELETE);
}
@@ -420,7 +423,7 @@
case EVFILT_WRITE:
instance = (uintptr_t) ev & 1;
- ev = (void *) ((uintptr_t) ev & ~1);
+ ev = (ngx_event_t *) ((uintptr_t) ev & (uintptr_t) ~1);
/*
* it's a stale event from a file descriptor
@@ -486,8 +489,8 @@
{
ngx_kqueue_conf_t *kcf = conf;
- ngx_conf_init_unsigned_value(kcf->changes, 512);
- ngx_conf_init_unsigned_value(kcf->events, 512);
+ ngx_conf_init_value(kcf->changes, 512);
+ ngx_conf_init_value(kcf->events, 512);
return NGX_CONF_OK;
}
diff --git a/src/event/modules/ngx_poll_module.c b/src/event/modules/ngx_poll_module.c
index e771e92..4bd4177 100644
--- a/src/event/modules/ngx_poll_module.c
+++ b/src/event/modules/ngx_poll_module.c
@@ -17,7 +17,7 @@
static struct pollfd *event_list;
-static u_int nevents;
+static int nevents;
static ngx_event_t **event_index;
static ngx_event_t **ready_index;
@@ -203,7 +203,7 @@
#endif
if (e == NULL || e->index == NGX_INVALID_INDEX) {
- if (ev->index < --nevents) {
+ if (ev->index < (u_int) --nevents) {
event_list[ev->index] = event_list[nevents];
event_index[ev->index] = event_index[nevents];
event_index[ev->index]->index = ev->index;
@@ -222,8 +222,7 @@
static int ngx_poll_process_events(ngx_log_t *log)
{
- int ready, found, j;
- u_int nready, i;
+ int i, j, ready, nready, found;
ngx_msec_t timer;
ngx_err_t err;
ngx_cycle_t **cycle;
@@ -239,7 +238,7 @@
delta = tv.tv_sec * 1000 + tv.tv_usec / 1000;
} else {
- timer = INFTIM;
+ timer = (ngx_msec_t) INFTIM;
delta = 0;
}
@@ -252,7 +251,7 @@
ngx_log_debug(log, "poll timer: %d" _ timer);
#endif
- ready = poll(event_list, nevents, timer);
+ ready = poll(event_list, (u_int) nevents, (int) timer);
if (ready == -1) {
err = ngx_errno;
diff --git a/src/event/modules/ngx_select_module.c b/src/event/modules/ngx_select_module.c
index 9e7a08f..52c30dd 100644
--- a/src/event/modules/ngx_select_module.c
+++ b/src/event/modules/ngx_select_module.c
@@ -30,7 +30,7 @@
static int max_fd;
#endif
-static u_int nevents;
+static int nevents;
static ngx_event_t **event_index;
static ngx_event_t **ready_index;
@@ -233,7 +233,7 @@
#endif
- if (ev->index < --nevents) {
+ if (ev->index < (u_int) --nevents) {
event_index[ev->index] = event_index[nevents];
event_index[ev->index]->index = ev->index;
}
@@ -247,8 +247,7 @@
static int ngx_select_process_events(ngx_log_t *log)
{
- int ready, found;
- u_int i, nready;
+ int i, ready, nready,found;
ngx_err_t err;
ngx_msec_t timer;
ngx_event_t *ev;
diff --git a/src/event/ngx_event.h b/src/event/ngx_event.h
index e539d7f..48ef29b 100644
--- a/src/event/ngx_event.h
+++ b/src/event/ngx_event.h
@@ -6,7 +6,7 @@
#include <ngx_core.h>
-#define NGX_INVALID_INDEX 0x80000000
+#define NGX_INVALID_INDEX 0xd0d0d0d0
#if (HAVE_IOCP)
@@ -28,7 +28,7 @@
void *context;
char *action;
- unsigned int index;
+ u_int index;
/* queue in mutex(), aio_read(), aio_write() */
ngx_event_t *prev;
@@ -230,8 +230,9 @@
#define NGX_CLOSE_EVENT 1
-/* this flag has meaning only for kqueue */
+/* these flags have a meaning only for kqueue */
#define NGX_LOWAT_EVENT 0
+#define NGX_DISABLE_EVENT 0
#if (HAVE_KQUEUE)
@@ -256,6 +257,9 @@
#define NGX_ONESHOT_EVENT EV_ONESHOT
#define NGX_CLEAR_EVENT EV_CLEAR
+#undef NGX_DISABLE_EVENT
+#define NGX_DISABLE_EVENT EV_DISABLE
+
#elif (HAVE_POLL)
@@ -362,7 +366,7 @@
-ngx_inline static int ngx_handle_read_event(ngx_event_t *rev, int flags)
+ngx_inline static int ngx_handle_read_event(ngx_event_t *rev, u_int flags)
{
if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
@@ -432,7 +436,7 @@
}
-ngx_inline static int ngx_handle_write_event(ngx_event_t *wev, int flags)
+ngx_inline static int ngx_handle_write_event(ngx_event_t *wev, u_int flags)
{
if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
diff --git a/src/event/ngx_event_connect.c b/src/event/ngx_event_connect.c
index 1a61ef7..7884cd8 100644
--- a/src/event/ngx_event_connect.c
+++ b/src/event/ngx_event_connect.c
@@ -9,7 +9,8 @@
int ngx_event_connect_peer(ngx_peer_connection_t *pc)
{
- int rc, instance, event;
+ int rc, instance;
+ u_int event;
time_t now;
ngx_err_t err;
ngx_peer_t *peer;
diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c
index dddf2cf..5696cbc 100644
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -19,7 +19,7 @@
int ngx_event_pipe(ngx_event_pipe_t *p, int do_write)
{
- int flags;
+ u_int flags;
ngx_event_t *rev, *wev;
for ( ;; ) {
diff --git a/src/http/modules/proxy/ngx_http_proxy_parse.c b/src/http/modules/proxy/ngx_http_proxy_parse.c
index 1729542..a697958 100644
--- a/src/http/modules/proxy/ngx_http_proxy_parse.c
+++ b/src/http/modules/proxy/ngx_http_proxy_parse.c
@@ -185,6 +185,10 @@
return NGX_HTTP_PROXY_PARSE_NO_HEADER;
}
break;
+
+ /* suppress warning */
+ case sw_done:
+ break;
}
}
diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c
index 9d442cd..1b1ca44 100644
--- a/src/http/modules/proxy/ngx_http_proxy_upstream.c
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -936,6 +936,14 @@
p->header_sent = 1;
+ if (p->cache && p->cache->ctx.file.fd != NGX_INVALID_FILE) {
+ if (ngx_close_file(p->cache->ctx.file.fd) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
+ ngx_close_file_n " \"%s\" failed",
+ p->cache->ctx.file.name.data);
+ }
+ }
+
if (p->cachable) {
header = (ngx_http_cache_header_t *) p->header_in->start;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index e06198e..086e57d 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -662,7 +662,7 @@
return rv;
}
- ngx_qsort(cscf->locations.elts, cscf->locations.nelts,
+ ngx_qsort(cscf->locations.elts, (size_t) cscf->locations.nelts,
sizeof(void *), ngx_cmp_locations);
return rv;
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
index fa037dd..07da10d 100644
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -392,6 +392,10 @@
return NGX_HTTP_PARSE_INVALID_REQUEST;
}
break;
+
+ /* suppress warning */
+ case sw_done:
+ break;
}
}
@@ -595,6 +599,11 @@
return NGX_HTTP_PARSE_INVALID_HEADER;
}
break;
+
+ /* suppress warning */
+ case sw_done:
+ case sw_header_done:
+ break;
}
}
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index ccaa73f..1a6485f 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1116,10 +1116,20 @@
wev = c->write;
wev->event_handler = ngx_http_empty_handler;
- if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && wev->active) {
- if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
- ngx_http_close_connection(c);
- return;
+ if (wev->active) {
+ if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) {
+ if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_DISABLE_EVENT)
+ == NGX_ERROR)
+ {
+ ngx_http_close_connection(c);
+ return;
+ }
+
+ } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {
+ if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
+ ngx_http_close_connection(c);
+ return;
+ }
}
}
@@ -1218,11 +1228,20 @@
wev = c->write;
wev->event_handler = ngx_http_empty_handler;
- if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && wev->active) {
- if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
- ngx_http_close_request(r, 0);
- ngx_http_close_connection(c);
- return;
+ if (wev->active) {
+ if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) {
+ if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_DISABLE_EVENT)
+ == NGX_ERROR)
+ {
+ ngx_http_close_connection(c);
+ return;
+ }
+
+ } else if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {
+ if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
+ ngx_http_close_connection(c);
+ return;
+ }
}
}
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index 651113d..7563009 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -118,7 +118,8 @@
if (cl->next == NULL) {
return ngx_write_file(file, cl->hunk->pos,
- cl->hunk->last - cl->hunk->pos, offset);
+ (size_t) (cl->hunk->last - cl->hunk->pos),
+ offset);
}
prev = NULL;
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h
index 09fc856..51cba70 100644
--- a/src/os/unix/ngx_files.h
+++ b/src/os/unix/ngx_files.h
@@ -82,7 +82,7 @@
#define ngx_read_dir_n "readdir()"
-#define ngx_create_dir(name) mkdir(name, 0700)
+#define ngx_create_dir(name) mkdir(name, (mode_t) 0700)
#define ngx_create_dir_n "mkdir()"
diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h
index 8a2f55e..a8014ec 100644
--- a/src/os/unix/ngx_freebsd_config.h
+++ b/src/os/unix/ngx_freebsd_config.h
@@ -31,13 +31,19 @@
/* TODO: autoconf */
#if (i386)
+#if 0
#define OFF_FMT "%lld"
+#endif
+
#define SIZE_FMT "%d"
#define SIZEX_FMT "%x"
#else /* amd64, alpha, sparc64, ia64 */
+#if 0
#define OFF_FMT "%ld"
+#endif
+
#define SIZE_FMT "%ld"
#define SIZEX_FMT "%lx"
diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c
index 71368c7..610c7d7 100644
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -25,7 +25,7 @@
int rc, eintr, eagain;
char *prev;
off_t sent, fprev;
- ssize_t hsize, fsize, size;
+ size_t hsize, fsize, size;
struct iovec *iov;
struct sf_hdtr hdtr;
ngx_err_t err;