Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-03-04 10:04:55 +0300
committerIgor Sysoev <igor@sysoev.ru>2004-03-04 10:04:55 +0300
commita536298c7bd1f525db97facab814a2906214ee7f (patch)
tree201ef9d639e1ff100684bf0a6781f59602418e35 /src/os/win32
parent5edf387f199efe5b67b2b81a00bc8404bea8365b (diff)
nginx-0.0.2-2004-03-04-10:04:55 import
Diffstat (limited to 'src/os/win32')
-rw-r--r--src/os/win32/ngx_errno.h5
-rw-r--r--src/os/win32/ngx_files.h2
-rw-r--r--src/os/win32/ngx_os.h9
-rw-r--r--src/os/win32/ngx_process.c9
-rw-r--r--src/os/win32/ngx_process.h24
-rw-r--r--src/os/win32/ngx_process_cycle.c28
-rw-r--r--src/os/win32/ngx_process_cycle.h40
-rw-r--r--src/os/win32/ngx_thread.h26
-rw-r--r--src/os/win32/ngx_user.h14
-rw-r--r--src/os/win32/ngx_win32_config.h13
-rw-r--r--src/os/win32/ngx_wsarecv.c27
-rw-r--r--src/os/win32/ngx_wsarecv_chain.c9
-rw-r--r--src/os/win32/ngx_wsasend_chain.c18
13 files changed, 190 insertions, 34 deletions
diff --git a/src/os/win32/ngx_errno.h b/src/os/win32/ngx_errno.h
index 179cbbce5..a7acf53a2 100644
--- a/src/os/win32/ngx_errno.h
+++ b/src/os/win32/ngx_errno.h
@@ -17,10 +17,13 @@ typedef DWORD ngx_err_t;
#define NGX_EACCES ERROR_ACCESS_DENIED
#define NGX_EEXIST ERROR_FILE_EXISTS
#define NGX_ENOTDIR ERROR_PATH_NOT_FOUND
+#define NGX_EPIPE EPIPE
#define NGX_EAGAIN WSAEWOULDBLOCK
#define NGX_EINPROGRESS WSAEINPROGRESS
#define NGX_EADDRINUSE WSAEADDRINUSE
-#define NGX_ECONNRESET ECONNRESET
+#define NGX_ECONNABORTED WSAECONNABORTED
+#define NGX_ECONNRESET WSAECONNRESET
+#define NGX_ENOTCONN WSAENOTCONN
#define NGX_ETIMEDOUT WSAETIMEDOUT
#define NGX_ENOMOREFILES ERROR_NO_MORE_FILES
diff --git a/src/os/win32/ngx_files.h b/src/os/win32/ngx_files.h
index 1268d47c0..1b13f4c7d 100644
--- a/src/os/win32/ngx_files.h
+++ b/src/os/win32/ngx_files.h
@@ -21,8 +21,6 @@
#define NGX_FILE_ERROR 0
-#define STDERR_FILENO (HANDLE) 2
-
#define ngx_open_file(name, access, create) \
CreateFile(name, access, \
diff --git a/src/os/win32/ngx_os.h b/src/os/win32/ngx_os.h
index 212d57fb1..39af212b3 100644
--- a/src/os/win32/ngx_os.h
+++ b/src/os/win32/ngx_os.h
@@ -46,8 +46,13 @@ extern int ngx_inherited_nonblocking;
extern int ngx_win32_version;
-extern int reconfigure;
-extern int reopen;
+extern ngx_int_t ngx_process;
+
+extern ngx_int_t ngx_quit;
+extern ngx_int_t ngx_terminate;
+
+extern ngx_int_t ngx_reconfigure;
+extern ngx_int_t ngx_reopen;
diff --git a/src/os/win32/ngx_process.c b/src/os/win32/ngx_process.c
new file mode 100644
index 000000000..e3a278647
--- /dev/null
+++ b/src/os/win32/ngx_process.c
@@ -0,0 +1,9 @@
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+ngx_pid_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx)
+{
+ return /* STUB */ 0;
+}
diff --git a/src/os/win32/ngx_process.h b/src/os/win32/ngx_process.h
index a4d4bbcc7..35d9bb904 100644
--- a/src/os/win32/ngx_process.h
+++ b/src/os/win32/ngx_process.h
@@ -2,7 +2,29 @@
#define _NGX_PROCESS_H_INCLUDED_
-#define ngx_getpid GetCurrentProcessId
+typedef DWORD ngx_pid_t;
+
+#define ngx_getpid GetCurrentProcessId
+#define ngx_log_pid ngx_pid
+
+
+typedef struct {
+ char *path;
+ char *name;
+ char *const *argv;
+ char *const *envp;
+} ngx_exec_ctx_t;
+
+
+#define NGX_PROCESS_SINGLE 0
+#define NGX_PROCESS_MASTER 1
+#define NGX_PROCESS_WORKER 2
+
+
+ngx_pid_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx);
+
+
+extern ngx_pid_t ngx_pid;
#endif /* _NGX_PROCESS_H_INCLUDED_ */
diff --git a/src/os/win32/ngx_process_cycle.c b/src/os/win32/ngx_process_cycle.c
new file mode 100644
index 000000000..8ffef52dc
--- /dev/null
+++ b/src/os/win32/ngx_process_cycle.c
@@ -0,0 +1,28 @@
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_event.h>
+
+
+#if 0
+
+ngx_int_t ngx_process;
+ngx_pid_t ngx_pid;
+ngx_pid_t ngx_new_binary;
+ngx_int_t ngx_inherited;
+
+sig_atomic_t ngx_reap;
+sig_atomic_t ngx_timer;
+sig_atomic_t ngx_terminate;
+sig_atomic_t ngx_quit;
+sig_atomic_t ngx_noaccept;
+sig_atomic_t ngx_reconfigure;
+sig_atomic_t ngx_reopen;
+sig_atomic_t ngx_change_binary;
+
+#endif
+
+
+void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
+{
+}
diff --git a/src/os/win32/ngx_process_cycle.h b/src/os/win32/ngx_process_cycle.h
new file mode 100644
index 000000000..c863b6213
--- /dev/null
+++ b/src/os/win32/ngx_process_cycle.h
@@ -0,0 +1,40 @@
+#ifndef _NGX_PROCESS_CYCLE_H_INCLUDED_
+#define _NGX_PROCESS_CYCLE_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+typedef struct {
+ ngx_file_t pid;
+ char *name;
+ int argc;
+ char *const *argv;
+} ngx_master_ctx_t;
+
+
+#define NGX_PROCESS_SINGLE 0
+#define NGX_PROCESS_MASTER 1
+#define NGX_PROCESS_WORKER 2
+
+
+void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx);
+
+
+extern ngx_int_t ngx_process;
+extern ngx_pid_t ngx_pid;
+extern ngx_pid_t ngx_new_binary;
+extern ngx_int_t ngx_inherited;
+
+extern sig_atomic_t ngx_reap;
+extern sig_atomic_t ngx_timer;
+extern sig_atomic_t ngx_quit;
+extern sig_atomic_t ngx_terminate;
+extern sig_atomic_t ngx_noaccept;
+extern sig_atomic_t ngx_reconfigure;
+extern sig_atomic_t ngx_reopen;
+extern sig_atomic_t ngx_change_binary;
+
+
+#endif /* _NGX_PROCESS_CYCLE_H_INCLUDED_ */
diff --git a/src/os/win32/ngx_thread.h b/src/os/win32/ngx_thread.h
new file mode 100644
index 000000000..cb282fbc0
--- /dev/null
+++ b/src/os/win32/ngx_thread.h
@@ -0,0 +1,26 @@
+#ifndef _NGX_THREAD_H_INCLUDED_
+#define _NGX_THREAD_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+#if (NGX_THREADS)
+
+#define ngx_thread_volatile volatile
+
+#else /* !NGX_THREADS */
+
+#define ngx_thread_volatile
+
+#define ngx_log_tid 0
+#define TID_T_FMT "%d"
+
+#define ngx_mutex_lock(m) NGX_OK
+#define ngx_mutex_unlock(m)
+
+#endif
+
+
+#endif /* _NGX_THREAD_H_INCLUDED_ */
diff --git a/src/os/win32/ngx_user.h b/src/os/win32/ngx_user.h
new file mode 100644
index 000000000..480a25885
--- /dev/null
+++ b/src/os/win32/ngx_user.h
@@ -0,0 +1,14 @@
+#ifndef _NGX_USER_H_INCLUDED_
+#define _NGX_USER_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+/* STUB */
+#define ngx_uid_t ngx_int_t
+#define ngx_gid_t ngx_int_t
+
+
+#endif /* _NGX_USER_H_INCLUDED_ */
diff --git a/src/os/win32/ngx_win32_config.h b/src/os/win32/ngx_win32_config.h
index 7b1fd130b..00f6426e3 100644
--- a/src/os/win32/ngx_win32_config.h
+++ b/src/os/win32/ngx_win32_config.h
@@ -4,8 +4,6 @@
#define WIN32 1
-#define NGX_WIN_NT 200000
-
#define STRICT
#define WIN32_LEAN_AND_MEAN
@@ -36,16 +34,19 @@
#pragma warning(disable:4127)
#endif
+#include <ngx_auto_config.h>
+
#define ngx_inline __inline
-#if 0
-/* owc have not __int32 */
+#if 1
typedef unsigned __int32 uint32_t;
#else
+/* OWC has not __int32 */
typedef unsigned int uint32_t;
#endif
+
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef u_int uintptr_t;
@@ -54,6 +55,7 @@ typedef int ssize_t;
typedef long time_t;
typedef __int64 off_t;
typedef uint32_t in_addr_t;
+typedef int sig_atomic_t;
#define OFF_T_FMT "%I64d"
@@ -61,7 +63,10 @@ typedef uint32_t in_addr_t;
#define SIZE_T_X_FMT "%x"
#define PID_T_FMT "%d"
#define TIME_T_FMT "%lu"
+#define PTR_FMT "%08X"
+
+#define NGX_WIN_NT 200000
#ifndef HAVE_INHERITED_NONBLOCK
diff --git a/src/os/win32/ngx_wsarecv.c b/src/os/win32/ngx_wsarecv.c
index 2a43498ad..96fa0ff4c 100644
--- a/src/os/win32/ngx_wsarecv.c
+++ b/src/os/win32/ngx_wsarecv.c
@@ -20,7 +20,8 @@ ssize_t ngx_wsarecv(ngx_connection_t *c, char *buf, size_t size)
rc = WSARecv(c->fd, wsabuf, 1, &bytes, &flags, NULL, NULL);
- ngx_log_debug(c->log, "WSARecv: %d:%d" _ rc _ bytes);
+ ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
+ "WSARecv: fd:%d rc:%d %d of %d", c->fd, rc, bytes, size);
rev = c->read;
@@ -29,12 +30,14 @@ ssize_t ngx_wsarecv(ngx_connection_t *c, char *buf, size_t size)
err = ngx_socket_errno;
if (err == WSAEWOULDBLOCK) {
- ngx_log_error(NGX_LOG_INFO, c->log, err, "WSARecv() EAGAIN");
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err,
+ "WSARecv() not ready");
return NGX_AGAIN;
}
rev->error = 1;
- ngx_log_error(NGX_LOG_CRIT, c->log, err, "WSARecv() failed");
+ ngx_connection_error(c, err, "WSARecv() failed");
+
return NGX_ERROR;
}
@@ -63,19 +66,19 @@ ssize_t ngx_overlapped_wsarecv(ngx_connection_t *c, char *buf, size_t size)
rev = c->read;
if (!rev->ready) {
- ngx_log_error(NGX_LOG_ALERT, rev->log, 0, "SECOND WSA POST");
+ ngx_log_error(NGX_LOG_ALERT, rev->log, 0, "second wsa post");
return NGX_AGAIN;
}
- ngx_log_debug(c->log, "rev->complete: %d" _ rev->complete);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
+ "rev->complete: %d", rev->complete);
if (rev->complete) {
rev->complete = 0;
if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
if (rev->ovlp.error) {
- ngx_log_error(NGX_LOG_ERR, c->log, rev->ovlp.error,
- "WSARecv() failed");
+ ngx_connection_error(c, rev->ovlp.error, "WSARecv() failed");
return NGX_ERROR;
}
@@ -84,9 +87,8 @@ ssize_t ngx_overlapped_wsarecv(ngx_connection_t *c, char *buf, size_t size)
if (WSAGetOverlappedResult(c->fd, (LPWSAOVERLAPPED) &rev->ovlp,
&bytes, 0, NULL) == 0) {
- ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
- "WSARecv() or WSAGetOverlappedResult() failed");
-
+ ngx_connection_error(c, ngx_socket_errno,
+ "WSARecv() or WSAGetOverlappedResult() failed");
return NGX_ERROR;
}
@@ -104,7 +106,8 @@ ssize_t ngx_overlapped_wsarecv(ngx_connection_t *c, char *buf, size_t size)
rev->complete = 0;
- ngx_log_debug(c->log, "WSARecv: %d:%d" _ rc _ bytes);
+ ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
+ "WSARecv: fd:%d rc:%d %d of %d", c->fd, rc, bytes, size);
if (rc == -1) {
err = ngx_socket_errno;
@@ -114,7 +117,7 @@ ssize_t ngx_overlapped_wsarecv(ngx_connection_t *c, char *buf, size_t size)
}
rev->error = 1;
- ngx_log_error(NGX_LOG_CRIT, c->log, err, "WSARecv() failed");
+ ngx_connection_error(c, err, "WSARecv() failed");
return NGX_ERROR;
}
diff --git a/src/os/win32/ngx_wsarecv_chain.c b/src/os/win32/ngx_wsarecv_chain.c
index edc4421dd..afdfa05c0 100644
--- a/src/os/win32/ngx_wsarecv_chain.c
+++ b/src/os/win32/ngx_wsarecv_chain.c
@@ -40,7 +40,9 @@ ssize_t ngx_wsarecv_chain(ngx_connection_t *c, ngx_chain_t *chain)
chain = chain->next;
}
-ngx_log_debug(c->log, "WSARecv: %d:%d" _ io.nelts _ wsabuf->len);
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
+ "WSARecv: %d:%d", io.nelts, wsabuf->len);
+
rc = WSARecv(c->fd, io.elts, io.nelts, &bytes, &flags, NULL, NULL);
@@ -51,12 +53,13 @@ ngx_log_debug(c->log, "WSARecv: %d:%d" _ io.nelts _ wsabuf->len);
err = ngx_socket_errno;
if (err == WSAEWOULDBLOCK) {
- ngx_log_error(NGX_LOG_INFO, c->log, err, "WSARecv() EAGAIN");
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err,
+ "WSARecv() not ready");
return NGX_AGAIN;
}
rev->error = 1;
- ngx_log_error(NGX_LOG_CRIT, c->log, err, "WSARecv() failed");
+ ngx_connection_error(c, err, "WSARecv() failed");
return NGX_ERROR;
}
diff --git a/src/os/win32/ngx_wsasend_chain.c b/src/os/win32/ngx_wsasend_chain.c
index 438f3dbd0..a52296a09 100644
--- a/src/os/win32/ngx_wsasend_chain.c
+++ b/src/os/win32/ngx_wsasend_chain.c
@@ -53,18 +53,19 @@ ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
err = ngx_errno;
if (err == WSAEWOULDBLOCK) {
- ngx_log_error(NGX_LOG_INFO, c->log, err, "WSASend() EAGAIN");
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err,
+ "WSASend() not ready");
wev->ready = 0;
return in;
} else {
wev->error = 1;
- ngx_log_error(NGX_LOG_CRIT, c->log, err, "WSASend() failed");
+ ngx_connection_error(c, err, "WSASend() failed");
return NGX_CHAIN_ERROR;
}
}
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "WSASend(): %d", sent);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "WSASend: %d", sent);
c->sent += sent;
@@ -162,7 +163,7 @@ ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
} else {
wev->error = 1;
- ngx_log_error(NGX_LOG_CRIT, c->log, err, "WSASend() failed");
+ ngx_connection_error(c, err, "WSASend() failed");
return NGX_CHAIN_ERROR;
}
@@ -187,8 +188,7 @@ ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
if (wev->ovlp.error) {
- ngx_log_error(NGX_LOG_ERR, c->log, wev->ovlp.error,
- "WSASend() failed");
+ ngx_connection_error(c, wev->ovlp.error, "WSASend() failed");
return NGX_CHAIN_ERROR;
}
@@ -197,15 +197,15 @@ ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
} else {
if (WSAGetOverlappedResult(c->fd, (LPWSAOVERLAPPED) &wev->ovlp,
&sent, 0, NULL) == 0) {
- ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
- "WSASend() or WSAGetOverlappedResult() failed");
+ ngx_connection_error(c, ngx_socket_errno,
+ "WSASend() or WSAGetOverlappedResult() failed");
return NGX_CHAIN_ERROR;
}
}
}
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "WSASend(): %d", sent);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "WSASend: %d", sent);
c->sent += sent;