diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-03-09 22:47:07 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-03-09 22:47:07 +0300 |
commit | fc5a10aedcdd8cf261ecc164941562bc52fe415d (patch) | |
tree | dc6ad97805a315afca82e852717f84debb30eb54 /src/os/win32 | |
parent | 833823cbb89482710779c59206b77c197c3747d2 (diff) |
nginx-0.0.2-2004-03-09-22:47:07 import
Diffstat (limited to 'src/os/win32')
-rw-r--r-- | src/os/win32/ngx_process_cycle.c | 18 | ||||
-rw-r--r-- | src/os/win32/ngx_socket.h | 56 | ||||
-rw-r--r-- | src/os/win32/ngx_win32_config.h | 15 | ||||
-rw-r--r-- | src/os/win32/ngx_win32_init.c | 35 | ||||
-rw-r--r-- | src/os/win32/ngx_wsarecv.c | 2 |
5 files changed, 102 insertions, 24 deletions
diff --git a/src/os/win32/ngx_process_cycle.c b/src/os/win32/ngx_process_cycle.c index 8ffef52dc..7b26d6b35 100644 --- a/src/os/win32/ngx_process_cycle.c +++ b/src/os/win32/ngx_process_cycle.c @@ -25,4 +25,22 @@ sig_atomic_t ngx_change_binary; void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) { + ngx_int_t i; + + ngx_init_temp_number(); + + for (i = 0; ngx_modules[i]; i++) { + if (ngx_modules[i]->init_process) { + if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) { + /* fatal */ + exit(2); + } + } + } + + for ( ;; ) { + ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); + + ngx_process_events(cycle->log); + } } diff --git a/src/os/win32/ngx_socket.h b/src/os/win32/ngx_socket.h index 86231030f..ec519c31c 100644 --- a/src/os/win32/ngx_socket.h +++ b/src/os/win32/ngx_socket.h @@ -35,6 +35,62 @@ int ngx_blocking(ngx_socket_t s); #define ngx_close_socket_n "closesocket()" +#ifndef WSAID_ACCEPTEX + +typedef BOOL (PASCAL FAR * LPFN_ACCEPTEX)( + IN SOCKET sListenSocket, + IN SOCKET sAcceptSocket, + IN PVOID lpOutputBuffer, + IN DWORD dwReceiveDataLength, + IN DWORD dwLocalAddressLength, + IN DWORD dwRemoteAddressLength, + OUT LPDWORD lpdwBytesReceived, + IN LPOVERLAPPED lpOverlapped + ); + +#define WSAID_ACCEPTEX \ + {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} + +#endif + + +#ifndef WSAID_GETACCEPTEXSOCKADDRS + +typedef VOID (PASCAL FAR * LPFN_GETACCEPTEXSOCKADDRS)( + IN PVOID lpOutputBuffer, + IN DWORD dwReceiveDataLength, + IN DWORD dwLocalAddressLength, + IN DWORD dwRemoteAddressLength, + OUT struct sockaddr **LocalSockaddr, + OUT LPINT LocalSockaddrLength, + OUT struct sockaddr **RemoteSockaddr, + OUT LPINT RemoteSockaddrLength + ); + +#define WSAID_GETACCEPTEXSOCKADDRS \ + {0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} + +#endif + + +#ifndef LPFN_TRANSMITFILE + +typedef BOOL (PASCAL FAR * LPFN_TRANSMITFILE)( + IN SOCKET hSocket, + IN HANDLE hFile, + IN DWORD nNumberOfBytesToWrite, + IN DWORD nNumberOfBytesPerSend, + IN LPOVERLAPPED lpOverlapped, + IN LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, + IN DWORD dwReserved + ); + +#define WSAID_TRANSMITFILE \ + {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} + +#endif + + extern LPFN_ACCEPTEX acceptex; extern LPFN_GETACCEPTEXSOCKADDRS getacceptexsockaddrs; extern LPFN_TRANSMITFILE transmitfile; diff --git a/src/os/win32/ngx_win32_config.h b/src/os/win32/ngx_win32_config.h index b1d7d5781..38cca91e5 100644 --- a/src/os/win32/ngx_win32_config.h +++ b/src/os/win32/ngx_win32_config.h @@ -7,13 +7,9 @@ #define STRICT #define WIN32_LEAN_AND_MEAN -#ifdef __WATCOMC__ -#pragma disable_message(107) -#endif - /* * we need to include windows.h explicity before winsock2.h because - * warning 4201 is enabled in windows.h + * the warning 4201 is enabled in windows.h */ #include <windows.h> @@ -35,19 +31,16 @@ #pragma warning(disable:4100) /* STUB */ +#if 0 #pragma warning(disable:4127) #endif +#endif #ifdef __WATCOMC__ -#pragma enable_message(107) -#if 0 -/* Symbol 'ngx_rbtree_min' has been defined, but not referenced */ +/* disable "Symbol 'ngx_rbtree_min' has been defined, but not referenced" */ #pragma disable_message(202) #endif -/* No prototype found for 'stricmp' */ -#pragma disable_message(301) -#endif #include <ngx_auto_config.h> diff --git a/src/os/win32/ngx_win32_init.c b/src/os/win32/ngx_win32_init.c index aaeca21b8..c4ffc1121 100644 --- a/src/os/win32/ngx_win32_init.c +++ b/src/os/win32/ngx_win32_init.c @@ -17,6 +17,13 @@ ngx_os_io_t ngx_os_io = { }; +typedef struct { + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; +} ngx_osviex_stub_t; + + /* Should these pointers be per protocol ? */ LPFN_ACCEPTEX acceptex; LPFN_GETACCEPTEXSOCKADDRS getacceptexsockaddrs; @@ -29,11 +36,12 @@ static GUID tf_guid = WSAID_TRANSMITFILE; int ngx_os_init(ngx_log_t *log) { - u_int osviex; - DWORD bytes; - SOCKET s; - WSADATA wsd; - OSVERSIONINFOEX osvi; + u_int osviex; + DWORD bytes; + SOCKET s; + WSADATA wsd; + OSVERSIONINFOEX osvi; + ngx_osviex_stub_t *osviex_stub; /* get Windows version */ @@ -75,17 +83,16 @@ int ngx_os_init(ngx_log_t *log) ngx_win32_version += osvi.wServicePackMajor * 10 + osvi.wServicePackMinor; - ngx_log_error(NGX_LOG_INFO, log, 0, - "OS: %u build:%u, \"%s\", suite:%x, type:%u", - ngx_win32_version, osvi.dwBuildNumber, osvi.szCSDVersion, - osvi.wReserved[0], osvi.wReserved[1]); + /* + * the MSVC 6.0 SP2 defines wSuiteMask and wProductType + * as WORD wReserved[2] + */ + osviex_stub = (ngx_osviex_stub_t *) &osvi.wServicePackMinor; -#if 0 ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %u build:%u, \"%s\", suite:%x, type:%u", ngx_win32_version, osvi.dwBuildNumber, osvi.szCSDVersion, - osvi.wSuiteMask, osvi.wProductType); -#endif + osviex_stub->wSuiteMask, osviex_stub->wProductType); } else { if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { @@ -123,6 +130,10 @@ int ngx_os_init(ngx_log_t *log) return NGX_ERROR; } + if (ngx_win32_version < NGX_WIN_NT) { + return NGX_OK; + } + /* get AcceptEx(), GetAcceptExSockAddrs() and TransmitFile() addresses */ s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0); diff --git a/src/os/win32/ngx_wsarecv.c b/src/os/win32/ngx_wsarecv.c index 2de1110c0..040adc4da 100644 --- a/src/os/win32/ngx_wsarecv.c +++ b/src/os/win32/ngx_wsarecv.c @@ -64,7 +64,7 @@ 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, c->log, 0, "second wsa post"); return NGX_AGAIN; } |