Mercurial > hg > nginx-quic
annotate src/os/win32/ngx_win32_init.c @ 8853:ce6d9cf0f567 quic
Merged with the default branch.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 14 Feb 2022 10:14:07 +0300 |
parents | d1079d6b2f19 |
children |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
373
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
373
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
373
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
373
diff
changeset
|
6 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
8 #include <ngx_config.h> |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
9 #include <ngx_core.h> |
541 | 10 #include <nginx.h> |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
11 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
12 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
13 ngx_uint_t ngx_win32_version; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
14 ngx_uint_t ngx_ncpu; |
461 | 15 ngx_uint_t ngx_max_wsabufs; |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
16 ngx_int_t ngx_max_sockets; |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
17 ngx_uint_t ngx_inherited_nonblocking = 1; |
473 | 18 ngx_uint_t ngx_tcp_nodelay_and_tcp_nopush; |
19 | |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
20 char ngx_unique[NGX_INT32_LEN + 1]; |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
21 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
22 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
23 ngx_os_io_t ngx_os_io = { |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
24 ngx_wsarecv, |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
25 ngx_wsarecv_chain, |
1689 | 26 ngx_udp_wsarecv, |
2725 | 27 ngx_wsasend, |
6692 | 28 NULL, |
29 NULL, | |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
30 ngx_wsasend_chain, |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
31 0 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
32 }; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
33 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
35 typedef struct { |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
36 WORD wServicePackMinor; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
37 WORD wSuiteMask; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
38 BYTE wProductType; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
39 } ngx_osviex_stub_t; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
40 |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
41 |
461 | 42 static u_int osviex; |
43 static OSVERSIONINFOEX osvi; | |
44 | |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
45 /* Should these pointers be per protocol ? */ |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
46 LPFN_ACCEPTEX ngx_acceptex; |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
47 LPFN_GETACCEPTEXSOCKADDRS ngx_getacceptexsockaddrs; |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
48 LPFN_TRANSMITFILE ngx_transmitfile; |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
49 LPFN_TRANSMITPACKETS ngx_transmitpackets; |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
50 LPFN_CONNECTEX ngx_connectex; |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
51 LPFN_DISCONNECTEX ngx_disconnectex; |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
52 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
53 static GUID ax_guid = WSAID_ACCEPTEX; |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
54 static GUID as_guid = WSAID_GETACCEPTEXSOCKADDRS; |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
55 static GUID tf_guid = WSAID_TRANSMITFILE; |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
56 static GUID tp_guid = WSAID_TRANSMITPACKETS; |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
57 static GUID cx_guid = WSAID_CONNECTEX; |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
58 static GUID dx_guid = WSAID_DISCONNECTEX; |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
59 |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
60 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
61 #if (NGX_LOAD_WSAPOLL) |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
62 ngx_wsapoll_pt WSAPoll; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
63 ngx_uint_t ngx_have_wsapoll; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
64 #endif |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
65 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
66 |
2725 | 67 ngx_int_t |
68 ngx_os_init(ngx_log_t *log) | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
69 { |
6651
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
70 DWORD bytes; |
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
71 SOCKET s; |
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
72 WSADATA wsd; |
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
73 ngx_err_t err; |
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
74 ngx_time_t *tp; |
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
75 ngx_uint_t n; |
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
76 SYSTEM_INFO si; |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
77 |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
78 /* get Windows version */ |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
79 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
80 ngx_memzero(&osvi, sizeof(OSVERSIONINFOEX)); |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
81 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
82 |
5577
bfe536716dbf
Win32: MSVC 2013 compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5499
diff
changeset
|
83 #ifdef _MSC_VER |
bfe536716dbf
Win32: MSVC 2013 compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5499
diff
changeset
|
84 #pragma warning(disable:4996) |
bfe536716dbf
Win32: MSVC 2013 compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5499
diff
changeset
|
85 #endif |
bfe536716dbf
Win32: MSVC 2013 compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5499
diff
changeset
|
86 |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
87 osviex = GetVersionEx((OSVERSIONINFO *) &osvi); |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
88 |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
89 if (osviex == 0) { |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
90 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
91 if (GetVersionEx((OSVERSIONINFO *) &osvi) == 0) { |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
92 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
93 "GetVersionEx() failed"); |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
94 return NGX_ERROR; |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
95 } |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
96 } |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
97 |
5577
bfe536716dbf
Win32: MSVC 2013 compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5499
diff
changeset
|
98 #ifdef _MSC_VER |
bfe536716dbf
Win32: MSVC 2013 compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5499
diff
changeset
|
99 #pragma warning(default:4996) |
bfe536716dbf
Win32: MSVC 2013 compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5499
diff
changeset
|
100 #endif |
bfe536716dbf
Win32: MSVC 2013 compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5499
diff
changeset
|
101 |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
102 /* |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
103 * Windows 3.1 Win32s 0xxxxx |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
104 * |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
105 * Windows 95 140000 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
106 * Windows 98 141000 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
107 * Windows ME 149000 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
108 * Windows NT 3.51 235100 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
109 * Windows NT 4.0 240000 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
110 * Windows NT 4.0 SP5 240050 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
111 * Windows 2000 250000 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
112 * Windows XP 250100 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
113 * Windows 2003 250200 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
114 * Windows Vista/2008 260000 |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
115 * |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
116 * Windows CE x.x 3xxxxx |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
117 */ |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
118 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
119 ngx_win32_version = osvi.dwPlatformId * 100000 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
120 + osvi.dwMajorVersion * 10000 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
121 + osvi.dwMinorVersion * 100; |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
122 |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
123 if (osviex) { |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
124 ngx_win32_version += osvi.wServicePackMajor * 10 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
102
diff
changeset
|
125 + osvi.wServicePackMinor; |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
126 } |
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
127 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
282
diff
changeset
|
128 GetSystemInfo(&si); |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
282
diff
changeset
|
129 ngx_pagesize = si.dwPageSize; |
6133
af7eba90645d
Win32: shared memory base addresses and remapping.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5701
diff
changeset
|
130 ngx_allocation_granularity = si.dwAllocationGranularity; |
373
018569a8f09c
nginx-0.0.7-2004-06-30-19:30:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
346
diff
changeset
|
131 ngx_ncpu = si.dwNumberOfProcessors; |
589 | 132 ngx_cacheline_size = NGX_CPU_CACHE_LINE; |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
282
diff
changeset
|
133 |
860
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
589
diff
changeset
|
134 for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ } |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
589
diff
changeset
|
135 |
3458
bdcae1a576e3
compare long file names in case-insensitive mode,
Igor Sysoev <igor@sysoev.ru>
parents:
2743
diff
changeset
|
136 /* delete default "C" locale for _wcsicmp() */ |
bdcae1a576e3
compare long file names in case-insensitive mode,
Igor Sysoev <igor@sysoev.ru>
parents:
2743
diff
changeset
|
137 setlocale(LC_ALL, ""); |
bdcae1a576e3
compare long file names in case-insensitive mode,
Igor Sysoev <igor@sysoev.ru>
parents:
2743
diff
changeset
|
138 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
139 |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
140 /* init Winsock */ |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
141 |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
142 if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) { |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
143 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, |
102
7e86d028d8f0
nginx-0.0.1-2003-06-06-18:59:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
144 "WSAStartup() failed"); |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
145 return NGX_ERROR; |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
146 } |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
147 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
148 if (ngx_win32_version < NGX_WIN_NT) { |
461 | 149 ngx_max_wsabufs = 16; |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
150 return NGX_OK; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
151 } |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
152 |
461 | 153 /* STUB: ngx_uint_t max */ |
154 ngx_max_wsabufs = 1024 * 1024; | |
155 | |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
156 /* |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
157 * get AcceptEx(), GetAcceptExSockAddrs(), TransmitFile(), |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
158 * TransmitPackets(), ConnectEx(), and DisconnectEx() addresses |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
159 */ |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
160 |
461 | 161 s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP); |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4555
diff
changeset
|
162 if (s == (ngx_socket_t) -1) { |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
163 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, |
6504 | 164 ngx_socket_n " failed"); |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
165 return NGX_ERROR; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
166 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
167 |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
168 if (WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &ax_guid, sizeof(GUID), |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
169 &ngx_acceptex, sizeof(LPFN_ACCEPTEX), &bytes, NULL, NULL) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
170 == -1) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
171 { |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
172 ngx_log_error(NGX_LOG_NOTICE, log, ngx_socket_errno, |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
173 "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, " |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
174 "WSAID_ACCEPTEX) failed"); |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
175 } |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
176 |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
177 if (WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &as_guid, sizeof(GUID), |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
178 &ngx_getacceptexsockaddrs, sizeof(LPFN_GETACCEPTEXSOCKADDRS), |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
179 &bytes, NULL, NULL) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
180 == -1) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
181 { |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
182 ngx_log_error(NGX_LOG_NOTICE, log, ngx_socket_errno, |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
183 "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, " |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
184 "WSAID_GETACCEPTEXSOCKADDRS) failed"); |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
185 } |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
186 |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
187 if (WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &tf_guid, sizeof(GUID), |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
188 &ngx_transmitfile, sizeof(LPFN_TRANSMITFILE), &bytes, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
189 NULL, NULL) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
190 == -1) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
191 { |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
192 ngx_log_error(NGX_LOG_NOTICE, log, ngx_socket_errno, |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
193 "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, " |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
194 "WSAID_TRANSMITFILE) failed"); |
1633
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
195 } |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
196 |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
197 if (WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &tp_guid, sizeof(GUID), |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
198 &ngx_transmitpackets, sizeof(LPFN_TRANSMITPACKETS), &bytes, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
199 NULL, NULL) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
200 == -1) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
201 { |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
202 ngx_log_error(NGX_LOG_NOTICE, log, ngx_socket_errno, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
203 "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, " |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
204 "WSAID_TRANSMITPACKETS) failed"); |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
205 } |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
206 |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
207 if (WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &cx_guid, sizeof(GUID), |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
208 &ngx_connectex, sizeof(LPFN_CONNECTEX), &bytes, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
209 NULL, NULL) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
210 == -1) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
211 { |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
212 ngx_log_error(NGX_LOG_NOTICE, log, ngx_socket_errno, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
213 "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, " |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
214 "WSAID_CONNECTEX) failed"); |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
215 } |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
216 |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
217 if (WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &dx_guid, sizeof(GUID), |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
218 &ngx_disconnectex, sizeof(LPFN_DISCONNECTEX), &bytes, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
219 NULL, NULL) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
220 == -1) |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
221 { |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
222 ngx_log_error(NGX_LOG_NOTICE, log, ngx_socket_errno, |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
223 "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, " |
74b2a52bc3c9
TransmitPackets(), ConnectEx(), and DisconnectEx()
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
224 "WSAID_DISCONNECTEX) failed"); |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
225 } |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
226 |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
227 if (ngx_close_socket(s) == -1) { |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
228 ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno, |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
229 ngx_close_socket_n " failed"); |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
230 } |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
231 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
232 #if (NGX_LOAD_WSAPOLL) |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
233 { |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
234 HMODULE hmod; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
235 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
236 hmod = GetModuleHandle("ws2_32.dll"); |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
237 if (hmod == NULL) { |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
238 ngx_log_error(NGX_LOG_NOTICE, log, ngx_errno, |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
239 "GetModuleHandle(\"ws2_32.dll\") failed"); |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
240 goto nopoll; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
241 } |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
242 |
7586
4f6e315eef15
Win32: silenced -Wcast-function-type GCC warning (ticket #1865).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7444
diff
changeset
|
243 WSAPoll = (ngx_wsapoll_pt) (void *) GetProcAddress(hmod, "WSAPoll"); |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
244 if (WSAPoll == NULL) { |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
245 ngx_log_error(NGX_LOG_NOTICE, log, ngx_errno, |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
246 "GetProcAddress(\"WSAPoll\") failed"); |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
247 goto nopoll; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
248 } |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
249 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
250 ngx_have_wsapoll = 1; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
251 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
252 } |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
253 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
254 nopoll: |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
255 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
256 #endif |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6692
diff
changeset
|
257 |
2725 | 258 if (GetEnvironmentVariable("ngx_unique", ngx_unique, NGX_INT32_LEN + 1) |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
259 != 0) |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
260 { |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
261 ngx_process = NGX_PROCESS_WORKER; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
262 |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
263 } else { |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
264 err = ngx_errno; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
265 |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
266 if (err != ERROR_ENVVAR_NOT_FOUND) { |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
267 ngx_log_error(NGX_LOG_EMERG, log, err, |
2725 | 268 "GetEnvironmentVariable(\"ngx_unique\") failed"); |
2720
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
269 return NGX_ERROR; |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
270 } |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
271 |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
272 ngx_sprintf((u_char *) ngx_unique, "%P%Z", ngx_pid); |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
273 } |
b3b8c66bd520
support attaching to an existent Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
1689
diff
changeset
|
274 |
6651
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
275 tp = ngx_timeofday(); |
7d4e33092e2a
Always seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov <ru@nginx.com>
parents:
6504
diff
changeset
|
276 srand((ngx_pid << 16) ^ (unsigned) tp->sec ^ tp->msec); |
4555
555ca31dea18
Win32: added missing call to srand().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
277 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
278 return NGX_OK; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
279 } |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
280 |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
281 |
2725 | 282 void |
283 ngx_os_status(ngx_log_t *log) | |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
284 { |
461 | 285 ngx_osviex_stub_t *osviex_stub; |
286 | |
5701
1209b8a7b077
Configure: the --build= option.
Ruslan Ermilov <ru@nginx.com>
parents:
5577
diff
changeset
|
287 ngx_log_error(NGX_LOG_NOTICE, log, 0, NGINX_VER_BUILD); |
541 | 288 |
461 | 289 if (osviex) { |
290 | |
291 /* | |
292 * the MSVC 6.0 SP2 defines wSuiteMask and wProductType | |
293 * as WORD wReserved[2] | |
294 */ | |
295 osviex_stub = (ngx_osviex_stub_t *) &osvi.wServicePackMinor; | |
296 | |
297 ngx_log_error(NGX_LOG_INFO, log, 0, | |
8522
d1079d6b2f19
Fixed format strings for ngx_win32_version.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7586
diff
changeset
|
298 "OS: %ui build:%ud, \"%s\", suite:%Xd, type:%ud", |
461 | 299 ngx_win32_version, osvi.dwBuildNumber, osvi.szCSDVersion, |
300 osviex_stub->wSuiteMask, osviex_stub->wProductType); | |
301 | |
302 } else { | |
303 if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { | |
304 | |
305 /* Win9x build */ | |
306 | |
307 ngx_log_error(NGX_LOG_INFO, log, 0, | |
8522
d1079d6b2f19
Fixed format strings for ngx_win32_version.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7586
diff
changeset
|
308 "OS: %ui build:%ud.%ud.%ud, \"%s\"", |
461 | 309 ngx_win32_version, |
310 osvi.dwBuildNumber >> 24, | |
311 (osvi.dwBuildNumber >> 16) & 0xff, | |
312 osvi.dwBuildNumber & 0xffff, | |
313 osvi.szCSDVersion); | |
314 | |
315 } else { | |
316 | |
317 /* | |
318 * VER_PLATFORM_WIN32_NT | |
319 * | |
320 * we do not currently support VER_PLATFORM_WIN32_CE | |
321 * and we do not support VER_PLATFORM_WIN32s at all | |
322 */ | |
323 | |
8522
d1079d6b2f19
Fixed format strings for ngx_win32_version.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7586
diff
changeset
|
324 ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %ui build:%ud, \"%s\"", |
461 | 325 ngx_win32_version, osvi.dwBuildNumber, |
326 osvi.szCSDVersion); | |
327 } | |
328 } | |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
329 } |