summaryrefslogtreecommitdiffhomepage
path: root/src/os
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-11-20 19:52:20 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-11-20 19:52:20 +0000
commitd43bee8ee939992404d59ae0fec248ce46abecb0 (patch)
tree6eb79a6902f147bedb8c85350cbdc68543115907 /src/os
parent13376e1538e2b29e436805c626f6837b34a482c5 (diff)
downloadnginx-release-0.1.8.tar.gz
nginx-release-0.1.8.tar.bz2
nginx-0.1.8-RELEASE importrelease-0.1.8
*) Bugfix: in the ngx_http_autoindex_module if the long file names were in the listing. *) Feature: the "^~" modifier in the location directive. *) Feature: the proxy_max_temp_file_size directive.
Diffstat (limited to '')
-rw-r--r--src/os/unix/ngx_errno.h1
-rw-r--r--src/os/unix/ngx_files.c4
-rw-r--r--src/os/unix/ngx_files.h4
-rw-r--r--src/os/unix/ngx_freebsd_config.h26
-rw-r--r--src/os/unix/ngx_linux_config.h10
-rw-r--r--src/os/unix/ngx_linux_init.c17
-rw-r--r--src/os/unix/ngx_posix_config.h17
-rw-r--r--src/os/unix/ngx_process_cycle.c323
-rw-r--r--src/os/unix/ngx_shared.c5
-rw-r--r--src/os/unix/ngx_solaris_config.h8
-rw-r--r--src/os/unix/ngx_time.h1
-rw-r--r--src/os/win32/nginx.icobin518 -> 518 bytes
-rw-r--r--src/os/win32/ngx_errno.h3
-rw-r--r--src/os/win32/ngx_files.c25
-rw-r--r--src/os/win32/ngx_files.h11
-rw-r--r--src/os/win32/ngx_socket.h2
-rw-r--r--src/os/win32/tray.icobin198 -> 198 bytes
17 files changed, 278 insertions, 179 deletions
diff --git a/src/os/unix/ngx_errno.h b/src/os/unix/ngx_errno.h
index 9a392f822..e87ec5f6f 100644
--- a/src/os/unix/ngx_errno.h
+++ b/src/os/unix/ngx_errno.h
@@ -34,6 +34,7 @@ typedef int ngx_err_t;
#define NGX_ETIMEDOUT ETIMEDOUT
#define NGX_ECONNREFUSED ECONNREFUSED
#define NGX_EHOSTUNREACH EHOSTUNREACH
+#define NGX_ENOSYS ENOSYS
#define NGX_ECANCELED ECANCELED
#define NGX_ENOMOREFILES 0
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index 7bf5ad124..52aa9b62a 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -109,7 +109,7 @@ ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
}
-int ngx_open_tempfile(u_char *name, ngx_uint_t persistent)
+ngx_fd_t ngx_open_tempfile(u_char *name, ngx_uint_t persistent)
{
ngx_fd_t fd;
@@ -216,7 +216,7 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl,
}
-int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
+ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
{
dir->dir = opendir((const char *) name->data);
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h
index b789d6184..03de946a3 100644
--- a/src/os/unix/ngx_files.h
+++ b/src/os/unix/ngx_files.h
@@ -37,7 +37,7 @@
#define ngx_delete_file_n "unlink()"
-int ngx_open_tempfile(u_char *name, ngx_uint_t persistent);
+ngx_fd_t ngx_open_tempfile(u_char *name, ngx_uint_t persistent);
#define ngx_open_tempfile_n "open()"
@@ -77,7 +77,7 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce,
#define NGX_DIR_MASK_LEN 0
-int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
+ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
#define ngx_open_dir_n "opendir()"
diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h
index 4840a9970..7f3b286c3 100644
--- a/src/os/unix/ngx_freebsd_config.h
+++ b/src/os/unix/ngx_freebsd_config.h
@@ -60,41 +60,23 @@
#include <ngx_auto_config.h>
-#ifndef HAVE_SELECT
-#define HAVE_SELECT 1
-#endif
-
-
-#ifndef HAVE_POLL
-#define HAVE_POLL 1
-#endif
#if (HAVE_POLL)
#include <poll.h>
#endif
- /* FreeBSD aio supported via kqueue */
-
-#if (__FreeBSD__ == 4 && __FreeBSD_version >= 430000) \
- || __FreeBSD_version >= 500014
-
-#ifndef HAVE_AIO
-#define HAVE_AIO 1
-#endif
-
-#endif
#if (HAVE_AIO)
#include <aio.h>
#endif
-#if defined SO_ACCEPTFILTER && !defined HAVE_DEFERRED_ACCEPT
-#define HAVE_DEFERRED_ACCEPT 1
+#if (HAVE_KQUEUE)
+#include <sys/event.h>
#endif
-#if (HAVE_KQUEUE)
-#include <sys/event.h>
+#if defined SO_ACCEPTFILTER && !defined HAVE_DEFERRED_ACCEPT
+#define HAVE_DEFERRED_ACCEPT 1
#endif
diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h
index fb2cbc892..57ee5057e 100644
--- a/src/os/unix/ngx_linux_config.h
+++ b/src/os/unix/ngx_linux_config.h
@@ -63,19 +63,11 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
#endif
-
-#ifndef HAVE_SELECT
-#define HAVE_SELECT 1
-#endif
-
-
-#ifndef HAVE_POLL
-#define HAVE_POLL 1
-#endif
#if (HAVE_POLL)
#include <poll.h>
#endif
+
#if (HAVE_EPOLL)
#include <sys/epoll.h>
#endif /* HAVE_EPOLL */
diff --git a/src/os/unix/ngx_linux_init.c b/src/os/unix/ngx_linux_init.c
index 3c7d34483..397d342f0 100644
--- a/src/os/unix/ngx_linux_init.c
+++ b/src/os/unix/ngx_linux_init.c
@@ -30,8 +30,9 @@ ngx_os_io_t ngx_os_io = {
ngx_int_t ngx_os_init(ngx_log_t *log)
{
- int name[2];
- size_t len;
+ int name[2];
+ size_t len;
+ ngx_err_t err;
name[0] = CTL_KERN;
name[1] = KERN_OSTYPE;
@@ -58,10 +59,16 @@ ngx_int_t ngx_os_init(ngx_log_t *log)
name[1] = KERN_RTSIGMAX;
len = sizeof(ngx_linux_rtsig_max);
if (sysctl(name, sizeof(name), &ngx_linux_rtsig_max, &len, NULL, 0) == -1) {
- ngx_log_error(NGX_LOG_INFO, log, ngx_errno,
- "sysctl(KERN_RTSIGMAX) failed");
- ngx_linux_rtsig_max = 0;
+ err = ngx_errno;
+
+ if (err != NGX_ENOTDIR) {
+ ngx_log_error(NGX_LOG_ALERT, log, err,
+ "sysctl(KERN_RTSIGMAX) failed");
+ return NGX_ERROR;
+ }
+
+ ngx_linux_rtsig_max = 0;
}
ngx_init_setproctitle(log);
diff --git a/src/os/unix/ngx_posix_config.h b/src/os/unix/ngx_posix_config.h
index bac02f7dd..b187236e9 100644
--- a/src/os/unix/ngx_posix_config.h
+++ b/src/os/unix/ngx_posix_config.h
@@ -14,6 +14,11 @@
#endif
+#if 0
+#define _REENTRANT
+#endif
+
+
#include <sys/types.h>
#include <sys/time.h>
#if (NGX_HAVE_UNISTD_H)
@@ -65,14 +70,6 @@
#include <ngx_auto_config.h>
-#ifndef HAVE_SELECT
-#define HAVE_SELECT 1
-#endif
-
-
-#ifndef HAVE_POLL
-#define HAVE_POLL 1
-#endif
#if (HAVE_POLL)
#include <poll.h>
#endif
@@ -104,7 +101,11 @@
#endif
+#if (NGX_HAVE_SETPROCTITLE)
+#define ngx_setproctitle setproctitle
+#else
#define ngx_setproctitle(title)
+#endif
#define NGX_POSIX_IO 1
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 0447bc4ec..37b2ef193 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -12,15 +12,18 @@
static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n,
ngx_int_t type);
+static void ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type);
static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo);
static ngx_uint_t ngx_reap_childs(ngx_cycle_t *cycle);
static void ngx_master_exit(ngx_cycle_t *cycle);
static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data);
+static void ngx_worker_process_init(ngx_cycle_t *cycle);
static void ngx_channel_handler(ngx_event_t *ev);
#if (NGX_THREADS)
static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle);
static void *ngx_worker_thread_cycle(void *data);
#endif
+static void ngx_garbage_collector_cycle(ngx_cycle_t *cycle, void *data);
ngx_uint_t ngx_process;
@@ -109,6 +112,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle)
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_RESPAWN);
+ ngx_start_garbage_collector(cycle, NGX_PROCESS_RESPAWN);
ngx_new_binary = 0;
delay = 0;
@@ -179,6 +183,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle)
if (!ngx_noaccepting) {
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_JUST_RESPAWN);
+ ngx_start_garbage_collector(cycle, NGX_PROCESS_JUST_RESPAWN);
live = 1;
ngx_signal_worker_processes(cycle,
ngx_signal_value(NGX_SHUTDOWN_SIGNAL));
@@ -193,6 +198,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle)
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_RESPAWN);
+ ngx_start_garbage_collector(cycle, NGX_PROCESS_RESPAWN);
ngx_noaccepting = 0;
continue;
@@ -211,6 +217,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle)
ngx_core_module);
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_JUST_RESPAWN);
+ ngx_start_garbage_collector(cycle, NGX_PROCESS_JUST_RESPAWN);
live = 1;
ngx_signal_worker_processes(cycle,
ngx_signal_value(NGX_SHUTDOWN_SIGNAL));
@@ -220,6 +227,7 @@ void ngx_master_process_cycle(ngx_cycle_t *cycle)
ngx_restart = 0;
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_RESPAWN);
+ ngx_start_garbage_collector(cycle, NGX_PROCESS_RESPAWN);
live = 1;
}
@@ -352,6 +360,47 @@ static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n,
}
+static void ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type)
+{
+ ngx_int_t i;
+ ngx_channel_t ch;
+
+ return;
+
+ ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "start garbage collector");
+
+ ch.command = NGX_CMD_OPEN_CHANNEL;
+
+ ngx_spawn_process(cycle, ngx_garbage_collector_cycle, NULL,
+ "garbage collector", type);
+
+ ch.pid = ngx_processes[ngx_process_slot].pid;
+ ch.slot = ngx_process_slot;
+ ch.fd = ngx_processes[ngx_process_slot].channel[0];
+
+ for (i = 0; i < ngx_last_process; i++) {
+
+ if (i == ngx_process_slot
+ || ngx_processes[i].pid == -1
+ || ngx_processes[i].channel[0] == -1)
+ {
+ continue;
+ }
+
+ ngx_log_debug6(NGX_LOG_DEBUG_CORE, cycle->log, 0,
+ "pass channel s:%d pid:%P fd:%d to s:%i pid:%P fd:%d",
+ ch.slot, ch.pid, ch.fd,
+ i, ngx_processes[i].pid,
+ ngx_processes[i].channel[0]);
+
+ /* TODO: NGX_AGAIN */
+
+ ngx_write_channel(ngx_processes[i].channel[0],
+ &ch, sizeof(ngx_channel_t), cycle->log);
+ }
+}
+
+
static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
{
ngx_int_t i;
@@ -558,15 +607,119 @@ static void ngx_master_exit(ngx_cycle_t *cycle)
static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
{
+ ngx_worker_process_init(cycle);
+
+ ngx_setproctitle("worker process");
+
+#if (NGX_THREADS)
+
+ if (ngx_time_mutex_init(cycle->log) == NGX_ERROR) {
+ /* fatal */
+ exit(2);
+ }
+
+ if (ngx_threads_n) {
+ if (ngx_init_threads(ngx_threads_n,
+ ccf->thread_stack_size, cycle) == NGX_ERROR)
+ {
+ /* fatal */
+ exit(2);
+ }
+
+ err = ngx_thread_key_create(&ngx_core_tls_key);
+ if (err != 0) {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
+ ngx_thread_key_create_n " failed");
+ /* fatal */
+ exit(2);
+ }
+
+ for (n = 0; n < ngx_threads_n; n++) {
+
+ if (!(ngx_threads[n].cv = ngx_cond_init(cycle->log))) {
+ /* fatal */
+ exit(2);
+ }
+
+ if (ngx_create_thread((ngx_tid_t *) &ngx_threads[n].tid,
+ ngx_worker_thread_cycle,
+ (void *) &ngx_threads[n], cycle->log) != 0)
+ {
+ /* fatal */
+ exit(2);
+ }
+ }
+ }
+
+#endif
+
+ for ( ;; ) {
+ if (ngx_exiting
+ && ngx_event_timer_rbtree == &ngx_event_timer_sentinel)
+ {
+ ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting");
+
+
+#if (NGX_THREADS)
+ ngx_terminate = 1;
+
+ ngx_wakeup_worker_threads(cycle);
+#endif
+
+ /*
+ * we do not destroy cycle->pool here because a signal handler
+ * that uses cycle->log can be called at this point
+ */
+ exit(0);
+ }
+
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle");
+
+ ngx_process_events(cycle);
+
+ if (ngx_terminate) {
+ ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting");
+
+#if (NGX_THREADS)
+ ngx_wakeup_worker_threads(cycle);
+#endif
+
+ /*
+ * we do not destroy cycle->pool here because a signal handler
+ * that uses cycle->log can be called at this point
+ */
+ exit(0);
+ }
+
+ if (ngx_quit) {
+ ngx_quit = 0;
+ ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
+ "gracefully shutting down");
+ ngx_setproctitle("worker process is shutting down");
+
+ if (!ngx_exiting) {
+ ngx_close_listening_sockets(cycle);
+ ngx_exiting = 1;
+ }
+ }
+
+ if (ngx_reopen) {
+ ngx_reopen = 0;
+ ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopen logs");
+ ngx_reopen_files(cycle, -1);
+ }
+ }
+}
+
+
+static void ngx_worker_process_init(ngx_cycle_t *cycle)
+{
sigset_t set;
- ngx_err_t err;
ngx_int_t n;
ngx_uint_t i;
struct timeval tv;
- ngx_listening_t *ls;
ngx_core_conf_t *ccf;
- ngx_connection_t *c;
-
+ ngx_listening_t *ls;
ngx_gettimeofday(&tv);
@@ -649,13 +802,13 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
if (close(ngx_processes[n].channel[1]) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
- "close() failed");
+ "close() channel failed");
}
}
if (close(ngx_processes[ngx_process_slot].channel[0]) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
- "close() failed");
+ "close() channel failed");
}
#if 0
@@ -668,107 +821,6 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
/* fatal */
exit(2);
}
-
- ngx_setproctitle("worker process");
-
-#if (NGX_THREADS)
-
- if (ngx_time_mutex_init(cycle->log) == NGX_ERROR) {
- /* fatal */
- exit(2);
- }
-
- if (ngx_threads_n) {
- if (ngx_init_threads(ngx_threads_n,
- ccf->thread_stack_size, cycle) == NGX_ERROR)
- {
- /* fatal */
- exit(2);
- }
-
- err = ngx_thread_key_create(&ngx_core_tls_key);
- if (err != 0) {
- ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
- ngx_thread_key_create_n " failed");
- /* fatal */
- exit(2);
- }
-
- for (n = 0; n < ngx_threads_n; n++) {
-
- if (!(ngx_threads[n].cv = ngx_cond_init(cycle->log))) {
- /* fatal */
- exit(2);
- }
-
- if (ngx_create_thread((ngx_tid_t *) &ngx_threads[n].tid,
- ngx_worker_thread_cycle,
- (void *) &ngx_threads[n], cycle->log) != 0)
- {
- /* fatal */
- exit(2);
- }
- }
- }
-
-#endif
-
- for ( ;; ) {
- if (ngx_exiting
- && ngx_event_timer_rbtree == &ngx_event_timer_sentinel)
- {
- ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting");
-
-
-#if (NGX_THREADS)
- ngx_terminate = 1;
-
- ngx_wakeup_worker_threads(cycle);
-#endif
-
- /*
- * we do not destroy cycle->pool here because a signal handler
- * that uses cycle->log can be called at this point
- */
- exit(0);
- }
-
- ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle");
-
- ngx_process_events(cycle);
-
- if (ngx_terminate) {
- ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting");
-
-#if (NGX_THREADS)
- ngx_wakeup_worker_threads(cycle);
-#endif
-
- /*
- * we do not destroy cycle->pool here because a signal handler
- * that uses cycle->log can be called at this point
- */
- exit(0);
- }
-
- if (ngx_quit) {
- ngx_quit = 0;
- ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
- "gracefully shutting down");
- ngx_setproctitle("worker process is shutting down");
-
- if (!ngx_exiting) {
- ngx_close_listening_sockets(cycle);
- ngx_exiting = 1;
- }
- }
-
- if (ngx_reopen) {
- ngx_reopen = 0;
- ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopen logs");
- ngx_reopen_files(cycle, -1);
- }
- }
}
@@ -778,6 +830,11 @@ static void ngx_channel_handler(ngx_event_t *ev)
ngx_channel_t ch;
ngx_connection_t *c;
+ if (ev->timedout) {
+ ev->timedout = 0;
+ return;
+ }
+
c = ev->data;
ngx_log_debug0(NGX_LOG_DEBUG_CORE, ev->log, 0, "channel handler");
@@ -834,7 +891,8 @@ static void ngx_channel_handler(ngx_event_t *ev)
ngx_processes[ch.slot].channel[0]);
if (close(ngx_processes[ch.slot].channel[0]) == -1) {
- ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno, "close() failed");
+ ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno,
+ "close() channel failed");
}
ngx_processes[ch.slot].channel[0] = -1;
@@ -896,7 +954,6 @@ static void *ngx_worker_thread_cycle(void *data)
ngx_err_t err;
ngx_core_tls_t *tls;
ngx_cycle_t *cycle;
- struct timeval tv;
thr->cv->tid = ngx_thread_self();
@@ -972,3 +1029,51 @@ static void *ngx_worker_thread_cycle(void *data)
}
#endif
+
+
+static void ngx_garbage_collector_cycle(ngx_cycle_t *cycle, void *data)
+{
+ ngx_uint_t i;
+ ngx_gc_t ctx;
+ ngx_path_t **path;
+ ngx_event_t *ev;
+
+ ngx_worker_process_init(cycle);
+
+ ev = &cycle->read_events[ngx_channel];
+
+ ngx_accept_mutex = NULL;
+
+ ngx_setproctitle("garbage collector");
+
+#if 0
+ ngx_add_timer(ev, 60 * 1000);
+#endif
+
+ for ( ;; ) {
+
+ if (ngx_terminate || ngx_quit) {
+ ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting");
+ exit(0);
+ }
+
+ if (ngx_reopen) {
+ ngx_reopen = 0;
+ ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopen logs");
+ ngx_reopen_files(cycle, -1);
+ }
+
+ path = cycle->pathes.elts;
+ for (i = 0; i < cycle->pathes.nelts; i++) {
+ ctx.path = path[i];
+ ctx.log = cycle->log;
+ ctx.handler = path[i]->gc_handler;
+
+ ngx_collect_garbage(&ctx, &path[i]->name, 0);
+ }
+
+ ngx_add_timer(ev, 60 * 60 * 1000);
+
+ ngx_process_events(cycle);
+ }
+}
diff --git a/src/os/unix/ngx_shared.c b/src/os/unix/ngx_shared.c
index 7f3c5e9be..0edc8cbe1 100644
--- a/src/os/unix/ngx_shared.c
+++ b/src/os/unix/ngx_shared.c
@@ -36,7 +36,7 @@ void *ngx_create_shared_memory(size_t size, ngx_log_t *log)
if (fd == -1) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
- "open(/dev/zero) failed");
+ "open(\"/dev/zero\") failed");
return NULL;
}
@@ -49,7 +49,8 @@ void *ngx_create_shared_memory(size_t size, ngx_log_t *log)
}
if (close(fd) == -1) {
- ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "close() failed");
+ ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
+ "close(\"/dev/zero\") failed");
}
return p;
diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h
index 5d94cdc98..8f1841793 100644
--- a/src/os/unix/ngx_solaris_config.h
+++ b/src/os/unix/ngx_solaris_config.h
@@ -49,14 +49,6 @@
#include <ngx_auto_config.h>
-#ifndef HAVE_SELECT
-#define HAVE_SELECT 1
-#endif
-
-
-#ifndef HAVE_POLL
-#define HAVE_POLL 1
-#endif
#if (HAVE_POLL)
#include <poll.h>
#endif
diff --git a/src/os/unix/ngx_time.h b/src/os/unix/ngx_time.h
index 0ead0d837..a6acf59e3 100644
--- a/src/os/unix/ngx_time.h
+++ b/src/os/unix/ngx_time.h
@@ -57,6 +57,7 @@ void ngx_localtime(ngx_tm_t *tm);
#define ngx_gettimeofday(tp) gettimeofday(tp, NULL);
#define ngx_msleep(ms) usleep(ms * 1000)
+#define ngx_sleep(s) sleep(s)
#endif /* _NGX_TIME_H_INCLUDED_ */
diff --git a/src/os/win32/nginx.ico b/src/os/win32/nginx.ico
index 6fb330b51..af53a965c 100644
--- a/src/os/win32/nginx.ico
+++ b/src/os/win32/nginx.ico
Binary files differ
diff --git a/src/os/win32/ngx_errno.h b/src/os/win32/ngx_errno.h
index 863dce879..371b7299e 100644
--- a/src/os/win32/ngx_errno.h
+++ b/src/os/win32/ngx_errno.h
@@ -21,7 +21,10 @@ typedef DWORD ngx_err_t;
#define NGX_ENOENT ERROR_FILE_NOT_FOUND
#define NGX_EACCES ERROR_ACCESS_DENIED
+#if 0
#define NGX_EEXIST ERROR_FILE_EXISTS
+#endif
+#define NGX_EEXIST ERROR_ALREADY_EXISTS
#define NGX_ENOTDIR ERROR_PATH_NOT_FOUND
#define NGX_EPIPE EPIPE
#define NGX_EAGAIN WSAEWOULDBLOCK
diff --git a/src/os/win32/ngx_files.c b/src/os/win32/ngx_files.c
index ffd52c9bd..00d6bbc8e 100644
--- a/src/os/win32/ngx_files.c
+++ b/src/os/win32/ngx_files.c
@@ -171,7 +171,8 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl,
}
-int ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_pool_t *pool)
+ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to,
+ ngx_pool_t *pool)
{
int rc, collision;
u_int num;
@@ -229,7 +230,7 @@ int ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_pool_t *pool)
#if 0
-int ngx_file_info(char *file, ngx_file_info_t *sb)
+ngx_int_t ngx_file_info(char *file, ngx_file_info_t *sb)
{
WIN32_FILE_ATTRIBUTE_DATA fa;
@@ -252,7 +253,7 @@ int ngx_file_info(char *file, ngx_file_info_t *sb)
#endif
-int ngx_file_info(u_char *file, ngx_file_info_t *sb)
+ngx_int_t ngx_file_info(u_char *file, ngx_file_info_t *sb)
{
/* Win95 */
@@ -266,7 +267,7 @@ int ngx_file_info(u_char *file, ngx_file_info_t *sb)
}
-int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
+ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
{
ngx_cpystrn(name->data + name->len, NGX_DIR_MASK, NGX_DIR_MASK_LEN + 1);
@@ -283,7 +284,7 @@ int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
}
-int ngx_read_dir(ngx_dir_t *dir)
+ngx_int_t ngx_read_dir(ngx_dir_t *dir)
{
if (dir->ready) {
dir->ready = 0;
@@ -298,13 +299,25 @@ int ngx_read_dir(ngx_dir_t *dir)
}
-int ngx_file_append_mode(ngx_fd_t fd)
+ngx_int_t ngx_file_append_mode(ngx_fd_t fd)
{
+#if 0
+ if (LockFile(fd, 0, 0, 0xffffffff, 0xffffffff) == 0) {
+ return NGX_ERROR;
+ }
+#endif
+
if (SetFilePointer(fd, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER) {
if (ngx_errno != NO_ERROR) {
return NGX_ERROR;
}
}
+#if 0
+ if (UnlockFile(fd, 0, 0, 0xffffffff, 0xffffffff) == 0) {
+ return NGX_ERROR;
+ }
+#endif
+
return NGX_OK;
}
diff --git a/src/os/win32/ngx_files.h b/src/os/win32/ngx_files.h
index 6d6031537..af0892ae0 100644
--- a/src/os/win32/ngx_files.h
+++ b/src/os/win32/ngx_files.h
@@ -44,7 +44,7 @@
#define NGX_FILE_APPEND 0
-int ngx_file_append_mode(ngx_fd_t fd);
+ngx_int_t ngx_file_append_mode(ngx_fd_t fd);
#define ngx_file_append_mode_n "SetFilePointer()"
@@ -71,10 +71,11 @@ int ngx_file_append_mode(ngx_fd_t fd);
#define ngx_rename_file MoveFile
#define ngx_rename_file_n "MoveFile()"
-int ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_pool_t *pool);
+ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to,
+ ngx_pool_t *pool);
-int ngx_file_info(u_char *filename, ngx_file_info_t *fi);
+ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi);
#define ngx_file_info_n "GetFileAttributesEx()"
@@ -109,11 +110,11 @@ int ngx_file_info(u_char *filename, ngx_file_info_t *fi);
#define NGX_DIR_MASK_LEN 2
-int ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
+ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
#define ngx_open_dir_n "FindFirstFile()"
-int ngx_read_dir(ngx_dir_t *dir);
+ngx_int_t ngx_read_dir(ngx_dir_t *dir);
#define ngx_read_dir_n "FindNextFile()"
diff --git a/src/os/win32/ngx_socket.h b/src/os/win32/ngx_socket.h
index d49ad2c15..88752889a 100644
--- a/src/os/win32/ngx_socket.h
+++ b/src/os/win32/ngx_socket.h
@@ -98,7 +98,7 @@ extern LPFN_GETACCEPTEXSOCKADDRS getacceptexsockaddrs;
extern LPFN_TRANSMITFILE transmitfile;
-ngx_inline static int ngx_tcp_push(ngx_socket_t s) {
+static ngx_inline int ngx_tcp_push(ngx_socket_t s) {
return 0;
}
diff --git a/src/os/win32/tray.ico b/src/os/win32/tray.ico
index 077cbac27..b39e5241c 100644
--- a/src/os/win32/tray.ico
+++ b/src/os/win32/tray.ico
Binary files differ