diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2003-06-06 14:59:20 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2003-06-06 14:59:20 +0000 |
| commit | e4a2526e5ccd4f3f5f160656c1a7b6f865ac44c8 (patch) | |
| tree | bfa99dbe2be9b41364c325bf1d990958c93247f8 /src/os | |
| parent | 9cf783074fd7793ebb6859e7f62b054d79074efe (diff) | |
| download | nginx-e4a2526e5ccd4f3f5f160656c1a7b6f865ac44c8.tar.gz nginx-e4a2526e5ccd4f3f5f160656c1a7b6f865ac44c8.tar.bz2 | |
nginx-0.0.1-2003-06-06-18:59:20 import
Diffstat (limited to '')
| -rw-r--r-- | src/os/unix/ngx_freebsd_config.h | 5 | ||||
| -rw-r--r-- | src/os/unix/ngx_linux_config.h | 14 | ||||
| -rw-r--r-- | src/os/unix/ngx_solaris_config.h | 6 | ||||
| -rw-r--r-- | src/os/unix/ngx_types.h | 16 | ||||
| -rw-r--r-- | src/os/win32/ngx_init.c | 57 | ||||
| -rw-r--r-- | src/os/win32/ngx_types.h | 2 |
6 files changed, 68 insertions, 32 deletions
diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h index 7c229a417..0a7eedd10 100644 --- a/src/os/unix/ngx_freebsd_config.h +++ b/src/os/unix/ngx_freebsd_config.h @@ -22,6 +22,11 @@ #include <osreldate.h> +#define QD_FMT "%qd" +#define QX_FMT "%qx" +#define OFF_FMT "%qd" + + #ifndef HAVE_SELECT #define HAVE_SELECT 1 #endif diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h index b90792c96..96e1d8856 100644 --- a/src/os/unix/ngx_linux_config.h +++ b/src/os/unix/ngx_linux_config.h @@ -2,25 +2,20 @@ #define _NGX_LINUX_CONFIG_H_INCLUDED_ +#define _GNU_SOURCE /* pread, pwrite, gethostname, bzero */ + #define _FILE_OFFSET_BITS 64 #define _LARGEFILE_SOURCE -#define _XOPEN_SOURCE 500 /* pread, pwrite */ #include <unistd.h> -#undef _XOPEN_SOURCE 500 - #include <stddef.h> /* offsetof */ #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <signal.h> #include <time.h> - -#define __USE_BSD /* bzero */ #include <string.h> -#undef __USE_BSD - #include <sys/types.h> #include <sys/time.h> #include <sys/select.h> @@ -39,6 +34,11 @@ typedef unsigned short u_short; typedef unsigned char u_char; +#define QD_FMT "%qd" +#define QX_FMT "%qx" +#define OFF_FMT "%qd" + + #ifndef HAVE_SELECT #define HAVE_SELECT 1 #endif diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h index 31e17e1c1..e7946449d 100644 --- a/src/os/unix/ngx_solaris_config.h +++ b/src/os/unix/ngx_solaris_config.h @@ -5,8 +5,8 @@ #define SOLARIS 1 #define _REENTRANT -#define _FILE_OFFSET_BITS 64 /* must be before sys/types.h */ +#define _FILE_OFFSET_BITS 64 /* must be before sys/types.h */ #include <unistd.h> #include <stddef.h> /* offsetof */ @@ -27,6 +27,10 @@ typedef uint32_t u_int32_t; +#define QD_FMT "%lld" +#define QX_FMT "%llx" +#define OFF_FMT "%lld" + #ifndef HAVE_SELECT #define HAVE_SELECT 1 diff --git a/src/os/unix/ngx_types.h b/src/os/unix/ngx_types.h index bf61ae2d9..8d6065027 100644 --- a/src/os/unix/ngx_types.h +++ b/src/os/unix/ngx_types.h @@ -12,20 +12,4 @@ typedef int ngx_fd_t; typedef struct stat ngx_file_info_t; - -#ifdef SOLARIS - -#define QD_FMT "%lld" -#define QX_FMT "%llx" -#define OFF_FMT "%lld" - -#else - -#define QD_FMT "%qd" -#define QX_FMT "%qx" -#define OFF_FMT "%qd" - -#endif - - #endif /* _NGX_TYPES_H_INCLUDED_ */ diff --git a/src/os/win32/ngx_init.c b/src/os/win32/ngx_init.c index 529233046..c57ce6c9d 100644 --- a/src/os/win32/ngx_init.c +++ b/src/os/win32/ngx_init.c @@ -26,20 +26,65 @@ static GUID tf_guid = WSAID_TRANSMITFILE; int ngx_os_init(ngx_log_t *log) { - DWORD bytes; - SOCKET s; - WSADATA wsd; + u_int sp; + DWORD bytes; + SOCKET s; + WSADATA wsd; + OSVERSIONINFOEX osvi; + + /* get Windows version */ + + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + osviex = GetVersionEx((OSVERSIONINFO *) &osvi); + + if (osviex == 0) { + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + if (GetVersionEx((OSVERSIONINFO *) &osvi) == 0) + ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, + "GetVersionEx() failed"); + return NGX_ERROR; + } + } + + /* + * Windows 95 1400 + * Windows 98 1410 + * Windows ME 1490 + * Windows NT 3.51 2351 + * Windows NT 4.0 2400 + * Windows 2000 2500 + * Windows XP 2501 + * Windows 2003 2502 + */ + + ngx_win32_version = osvi.dwPlatformId * 1000 + + osvi.dwMajorVersion * 100 + + osvi.dwMinorVersion; + + if (osviex) { + sp = osvi.wServicePackMajor * 100 + osvi.wServicePackMinor; + + ngx_log_error(NGX_LOG_INFO, log, 0, + "OS: %u build:%u, %s, SP:%u, suite:%x, type:%u", + ngx_win32_version, osvi.dwBuildNumber, osvi.szCSDVersion, + sp, osvi.wSuiteMask, osvi.wProductType); + + } else { + ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %u build:%u, %s", + ngx_win32_version, osvi.dwBuildNumber, osvi.szCSDVersion); + } + /* init Winsock */ if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) { ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, - "WSAStartup failed"); + "WSAStartup() failed"); return NGX_ERROR; } - ngx_log_error(NGX_LOG_INFO, log, 0, "max sockets: %d", wsd.iMaxSockets); - /* get AcceptEx(), GetAcceptExSockAddrs() and TransmitFile() addresses */ s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0); diff --git a/src/os/win32/ngx_types.h b/src/os/win32/ngx_types.h index cf8db97b3..1c4ff0c02 100644 --- a/src/os/win32/ngx_types.h +++ b/src/os/win32/ngx_types.h @@ -16,8 +16,6 @@ typedef unsigned __int64 off_t; typedef BY_HANDLE_FILE_INFORMATION ngx_file_info_t; - - #define QD_FMT "%I64d" #define QX_FMT "%I64x" #define OFF_FMT "%I64d" |
