... | ... |
@@ -207,7 +207,7 @@ int poll_fd(int fd, int timeout_sec, int check_signals) |
207 | 207 |
if (fds_add(&fds, fd, 1, timeout_sec) == -1) |
208 | 208 |
return -1; |
209 | 209 |
do { |
210 |
- ret = fds_poll_recv(&fds, timeout_sec, check_signals); |
|
210 |
+ ret = fds_poll_recv(&fds, timeout_sec, check_signals, NULL); |
|
211 | 211 |
} while (ret == -1 && errno == EINTR); |
212 | 212 |
fds_free(&fds); |
213 | 213 |
return ret; |
... | ... |
@@ -431,7 +431,7 @@ void fds_remove(struct fd_data *data, int fd) |
431 | 431 |
* Must be called with buf_mutex lock held. |
432 | 432 |
*/ |
433 | 433 |
/* TODO: handle ReadTimeout */ |
434 |
-int fds_poll_recv(struct fd_data *data, int timeout, int check_signals) |
|
434 |
+int fds_poll_recv(struct fd_data *data, int timeout, int check_signals, void *dummy) |
|
435 | 435 |
{ |
436 | 436 |
unsigned fdsok = data->nfds; |
437 | 437 |
size_t i; |
... | ... |
@@ -496,7 +496,11 @@ int fds_poll_recv(struct fd_data *data, int timeout, int check_signals) |
496 | 496 |
int n = data->nfds; |
497 | 497 |
|
498 | 498 |
fds_unlock(data); |
499 |
+#ifdef _WIN32 |
|
500 |
+ retval = poll_with_event(data->poll_data, n, timeout, dummy); |
|
501 |
+#else |
|
499 | 502 |
retval = poll(data->poll_data, n, timeout); |
503 |
+#endif |
|
500 | 504 |
fds_lock(data); |
501 | 505 |
|
502 | 506 |
if (retval > 0) { |
... | ... |
@@ -79,7 +79,7 @@ int writen(int fd, void *buff, unsigned int count); |
79 | 79 |
int fds_add(struct fd_data *data, int fd, int listen_only, int timeout); |
80 | 80 |
void fds_remove(struct fd_data *data, int fd); |
81 | 81 |
void fds_cleanup(struct fd_data *data); |
82 |
-int fds_poll_recv(struct fd_data *data, int timeout, int check_signals); |
|
82 |
+int fds_poll_recv(struct fd_data *data, int timeout, int check_signals, void *dummy); |
|
83 | 83 |
void fds_free(struct fd_data *data); |
84 | 84 |
|
85 | 85 |
#endif |
... | ... |
@@ -69,6 +69,9 @@ pthread_mutex_t reload_mutex = PTHREAD_MUTEX_INITIALIZER; |
69 | 69 |
int sighup = 0; |
70 | 70 |
static struct cl_stat dbstat; |
71 | 71 |
|
72 |
+static void *event_wake_recv = NULL; |
|
73 |
+static void *event_wake_accept = NULL; |
|
74 |
+ |
|
72 | 75 |
static void scanner_thread(void *arg) |
73 | 76 |
{ |
74 | 77 |
client_conn_t *conn = (client_conn_t *) arg; |
... | ... |
@@ -326,7 +329,7 @@ static void *acceptloop_th(void *arg) |
326 | 326 |
pthread_mutex_lock(fds->buf_mutex); |
327 | 327 |
for (;;) { |
328 | 328 |
/* Block waiting for data to become available for reading */ |
329 |
- int new_sd = fds_poll_recv(fds, -1, 0); |
|
329 |
+ int new_sd = fds_poll_recv(fds, -1, 0, event_wake_accept); |
|
330 | 330 |
|
331 | 331 |
/* TODO: what about sockets that get rm-ed? */ |
332 | 332 |
if (!fds->nfds) { |
... | ... |
@@ -418,7 +421,7 @@ static void *acceptloop_th(void *arg) |
418 | 418 |
|
419 | 419 |
/* notify recvloop */ |
420 | 420 |
#ifdef _WIN32 |
421 |
- SetEvent(data->event_wake_recv); |
|
421 |
+ SetEvent(event_wake_recv); |
|
422 | 422 |
#else |
423 | 423 |
if (write(data->syncpipe_wake_recv[1], "", 1) == -1) { |
424 | 424 |
logg("!write syncpipe failed\n"); |
... | ... |
@@ -462,7 +465,7 @@ static void *acceptloop_th(void *arg) |
462 | 462 |
progexit = 1; |
463 | 463 |
pthread_mutex_unlock(&exit_mutex); |
464 | 464 |
#ifdef _WIN32 |
465 |
- SetEvent(data->event_wake_recv); |
|
465 |
+ SetEvent(event_wake_recv); |
|
466 | 466 |
#else |
467 | 467 |
if (write(data->syncpipe_wake_recv[1], "", 1) < 0) { |
468 | 468 |
logg("$Syncpipe write failed\n"); |
... | ... |
@@ -1065,8 +1068,8 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi |
1065 | 1065 |
return 1; |
1066 | 1066 |
} |
1067 | 1067 |
#ifdef _WIN32 |
1068 |
- acceptdata.event_wake_accept = CreateEvent(NULL, TRUE, FALSE, NULL); |
|
1069 |
- acceptdata.event_wake_recv = CreateEvent(NULL, TRUE, FALSE, NULL); |
|
1068 |
+ event_wake_accept = CreateEvent(NULL, TRUE, FALSE, NULL); |
|
1069 |
+ event_wake_recv = CreateEvent(NULL, TRUE, FALSE, NULL); |
|
1070 | 1070 |
#else |
1071 | 1071 |
if (pipe(acceptdata.syncpipe_wake_recv) == -1 || |
1072 | 1072 |
(pipe(acceptdata.syncpipe_wake_accept) == -1)) { |
... | ... |
@@ -1102,9 +1105,12 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi |
1102 | 1102 |
/* signal that we can accept more connections */ |
1103 | 1103 |
if (fds->nfds <= (unsigned)max_queue) |
1104 | 1104 |
pthread_cond_signal(&acceptdata.cond_nfds); |
1105 |
- new_sd = fds_poll_recv(fds, selfchk ? (int)selfchk : -1, 1); |
|
1105 |
+ new_sd = fds_poll_recv(fds, selfchk ? (int)selfchk : -1, 1, event_wake_recv); |
|
1106 |
+ |
|
1106 | 1107 |
|
1108 |
+#ifndef _WIN32 |
|
1107 | 1109 |
if (!fds->nfds) { |
1110 |
+ continue; |
|
1108 | 1111 |
/* at least the dummy/sync pipe should have remained */ |
1109 | 1112 |
logg("!All recv() descriptors gone: fatal\n"); |
1110 | 1113 |
pthread_mutex_lock(&exit_mutex); |
... | ... |
@@ -1113,6 +1119,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi |
1113 | 1113 |
pthread_mutex_unlock(fds->buf_mutex); |
1114 | 1114 |
break; |
1115 | 1115 |
} |
1116 |
+#endif |
|
1116 | 1117 |
|
1117 | 1118 |
if (new_sd == -1 && errno != EINTR) { |
1118 | 1119 |
logg("!Failed to poll sockets, fatal\n"); |
... | ... |
@@ -1122,7 +1129,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi |
1122 | 1122 |
} |
1123 | 1123 |
|
1124 | 1124 |
|
1125 |
- i = (rr_last + 1) % fds->nfds; |
|
1125 |
+ if(fds->nfds) i = (rr_last + 1) % fds->nfds; |
|
1126 | 1126 |
for (j = 0; j < fds->nfds && new_sd >= 0; j++, i = (i+1) % fds->nfds) { |
1127 | 1127 |
size_t pos = 0; |
1128 | 1128 |
int error = 0; |
... | ... |
@@ -1311,7 +1318,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi |
1311 | 1311 |
progexit = 1; |
1312 | 1312 |
pthread_mutex_unlock(&exit_mutex); |
1313 | 1313 |
#ifdef _WIN32 |
1314 |
- SetEvent(acceptdata.event_wake_accept); |
|
1314 |
+ SetEvent(event_wake_accept); |
|
1315 | 1315 |
#else |
1316 | 1316 |
if (write(acceptdata.syncpipe_wake_accept[1], "", 1) < 0) { |
1317 | 1317 |
logg("^Write to syncpipe failed\n"); |
... | ... |
@@ -1337,8 +1344,8 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi |
1337 | 1337 |
pthread_join(accept_th, NULL); |
1338 | 1338 |
fds_free(fds); |
1339 | 1339 |
#ifdef _WIN32 |
1340 |
- CloseHandle(acceptdata.event_wake_accept); |
|
1341 |
- CloseHandle(acceptdata.event_wake_recv); |
|
1340 |
+ CloseHandle(event_wake_accept); |
|
1341 |
+ CloseHandle(event_wake_recv); |
|
1342 | 1342 |
#else |
1343 | 1343 |
close(acceptdata.syncpipe_wake_accept[1]); |
1344 | 1344 |
close(acceptdata.syncpipe_wake_recv[1]); |
... | ... |
@@ -1,251 +1,251 @@ |
1 |
-<?xml version="1.0" encoding="Windows-1252"?> |
|
2 |
-<VisualStudioProject |
|
3 |
- ProjectType="Visual C++" |
|
4 |
- Version="9,00" |
|
5 |
- Name="clamd" |
|
6 |
- ProjectGUID="{B3CA73CF-E71E-42F3-95DE-43797A86C798}" |
|
7 |
- RootNamespace="clamd" |
|
8 |
- Keyword="Win32Proj" |
|
9 |
- TargetFrameworkVersion="196613" |
|
10 |
- > |
|
11 |
- <Platforms> |
|
12 |
- <Platform |
|
13 |
- Name="Win32" |
|
14 |
- /> |
|
15 |
- </Platforms> |
|
16 |
- <ToolFiles> |
|
17 |
- </ToolFiles> |
|
18 |
- <Configurations> |
|
19 |
- <Configuration |
|
20 |
- Name="Debug|Win32" |
|
21 |
- OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
|
22 |
- IntermediateDirectory="$(SolutionDir)build\$(ProjectName)\$(ConfigurationName)" |
|
23 |
- ConfigurationType="1" |
|
24 |
- CharacterSet="2" |
|
25 |
- > |
|
26 |
- <Tool |
|
27 |
- Name="VCPreBuildEventTool" |
|
28 |
- /> |
|
29 |
- <Tool |
|
30 |
- Name="VCCustomBuildTool" |
|
31 |
- /> |
|
32 |
- <Tool |
|
33 |
- Name="VCXMLDataGeneratorTool" |
|
34 |
- /> |
|
35 |
- <Tool |
|
36 |
- Name="VCWebServiceProxyGeneratorTool" |
|
37 |
- /> |
|
38 |
- <Tool |
|
39 |
- Name="VCMIDLTool" |
|
40 |
- /> |
|
41 |
- <Tool |
|
42 |
- Name="VCCLCompilerTool" |
|
43 |
- Optimization="0" |
|
44 |
- AdditionalIncludeDirectories=""$(SolutionDir)";"$(SolutionDir)..\libclamav";"$(SolutionDir)compat";"$(SolutionDir)3rdparty\zlib";"$(SolutionDir)3rdparty\pthreads";"$(SolutionDir)3rdparty\bzip2";"$(SolutionDir).."" |
|
45 |
- PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1" |
|
46 |
- MinimalRebuild="true" |
|
47 |
- BasicRuntimeChecks="3" |
|
48 |
- RuntimeLibrary="3" |
|
49 |
- UsePrecompiledHeader="0" |
|
50 |
- WarningLevel="3" |
|
51 |
- DebugInformationFormat="3" |
|
52 |
- CompileAs="1" |
|
53 |
- DisableSpecificWarnings="4996;4244;4090;4018" |
|
54 |
- /> |
|
55 |
- <Tool |
|
56 |
- Name="VCManagedResourceCompilerTool" |
|
57 |
- /> |
|
58 |
- <Tool |
|
59 |
- Name="VCResourceCompilerTool" |
|
60 |
- /> |
|
61 |
- <Tool |
|
62 |
- Name="VCPreLinkEventTool" |
|
63 |
- /> |
|
64 |
- <Tool |
|
65 |
- Name="VCLinkerTool" |
|
66 |
- LinkIncremental="1" |
|
67 |
- GenerateDebugInformation="true" |
|
68 |
- SubSystem="1" |
|
69 |
- TargetMachine="1" |
|
70 |
- /> |
|
71 |
- <Tool |
|
72 |
- Name="VCALinkTool" |
|
73 |
- /> |
|
74 |
- <Tool |
|
75 |
- Name="VCManifestTool" |
|
76 |
- /> |
|
77 |
- <Tool |
|
78 |
- Name="VCXDCMakeTool" |
|
79 |
- /> |
|
80 |
- <Tool |
|
81 |
- Name="VCBscMakeTool" |
|
82 |
- /> |
|
83 |
- <Tool |
|
84 |
- Name="VCFxCopTool" |
|
85 |
- /> |
|
86 |
- <Tool |
|
87 |
- Name="VCAppVerifierTool" |
|
88 |
- /> |
|
89 |
- <Tool |
|
90 |
- Name="VCPostBuildEventTool" |
|
91 |
- /> |
|
92 |
- </Configuration> |
|
93 |
- <Configuration |
|
94 |
- Name="Release|Win32" |
|
95 |
- OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
|
96 |
- IntermediateDirectory="$(SolutionDir)build\$(ProjectName)\$(ConfigurationName)" |
|
97 |
- ConfigurationType="1" |
|
98 |
- CharacterSet="2" |
|
99 |
- WholeProgramOptimization="1" |
|
100 |
- > |
|
101 |
- <Tool |
|
102 |
- Name="VCPreBuildEventTool" |
|
103 |
- /> |
|
104 |
- <Tool |
|
105 |
- Name="VCCustomBuildTool" |
|
106 |
- /> |
|
107 |
- <Tool |
|
108 |
- Name="VCXMLDataGeneratorTool" |
|
109 |
- /> |
|
110 |
- <Tool |
|
111 |
- Name="VCWebServiceProxyGeneratorTool" |
|
112 |
- /> |
|
113 |
- <Tool |
|
114 |
- Name="VCMIDLTool" |
|
115 |
- /> |
|
116 |
- <Tool |
|
117 |
- Name="VCCLCompilerTool" |
|
118 |
- Optimization="2" |
|
119 |
- EnableIntrinsicFunctions="true" |
|
120 |
- AdditionalIncludeDirectories=""$(SolutionDir)";"$(SolutionDir)..\libclamav";"$(SolutionDir)compat";"$(SolutionDir)3rdparty\zlib";"$(SolutionDir)3rdparty\pthreads";"$(SolutionDir)3rdparty\bzip2";"$(SolutionDir).."" |
|
121 |
- PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1" |
|
122 |
- RuntimeLibrary="2" |
|
123 |
- EnableFunctionLevelLinking="true" |
|
124 |
- UsePrecompiledHeader="0" |
|
125 |
- WarningLevel="3" |
|
126 |
- DebugInformationFormat="3" |
|
127 |
- CompileAs="1" |
|
128 |
- DisableSpecificWarnings="4996;4244;4090;4018" |
|
129 |
- /> |
|
130 |
- <Tool |
|
131 |
- Name="VCManagedResourceCompilerTool" |
|
132 |
- /> |
|
133 |
- <Tool |
|
134 |
- Name="VCResourceCompilerTool" |
|
135 |
- /> |
|
136 |
- <Tool |
|
137 |
- Name="VCPreLinkEventTool" |
|
138 |
- /> |
|
139 |
- <Tool |
|
140 |
- Name="VCLinkerTool" |
|
141 |
- LinkIncremental="1" |
|
142 |
- GenerateDebugInformation="true" |
|
143 |
- SubSystem="1" |
|
144 |
- OptimizeReferences="2" |
|
145 |
- EnableCOMDATFolding="2" |
|
146 |
- TargetMachine="1" |
|
147 |
- /> |
|
148 |
- <Tool |
|
149 |
- Name="VCALinkTool" |
|
150 |
- /> |
|
151 |
- <Tool |
|
152 |
- Name="VCManifestTool" |
|
153 |
- /> |
|
154 |
- <Tool |
|
155 |
- Name="VCXDCMakeTool" |
|
156 |
- /> |
|
157 |
- <Tool |
|
158 |
- Name="VCBscMakeTool" |
|
159 |
- /> |
|
160 |
- <Tool |
|
161 |
- Name="VCFxCopTool" |
|
162 |
- /> |
|
163 |
- <Tool |
|
164 |
- Name="VCAppVerifierTool" |
|
165 |
- /> |
|
166 |
- <Tool |
|
167 |
- Name="VCPostBuildEventTool" |
|
168 |
- /> |
|
169 |
- </Configuration> |
|
170 |
- </Configurations> |
|
171 |
- <References> |
|
172 |
- </References> |
|
173 |
- <Files> |
|
174 |
- <Filter |
|
175 |
- Name="Source Files" |
|
176 |
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" |
|
177 |
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" |
|
178 |
- > |
|
179 |
- <File |
|
180 |
- RelativePath="..\clamd\clamd.c" |
|
181 |
- > |
|
182 |
- </File> |
|
183 |
- <File |
|
184 |
- RelativePath="..\clamd\localserver.c" |
|
185 |
- > |
|
186 |
- </File> |
|
187 |
- <File |
|
188 |
- RelativePath="..\clamd\others.c" |
|
189 |
- > |
|
190 |
- </File> |
|
191 |
- <File |
|
192 |
- RelativePath="..\clamd\scanner.c" |
|
193 |
- > |
|
194 |
- </File> |
|
195 |
- <File |
|
196 |
- RelativePath="..\clamd\server-th.c" |
|
197 |
- > |
|
198 |
- </File> |
|
199 |
- <File |
|
200 |
- RelativePath="..\clamd\session.c" |
|
201 |
- > |
|
202 |
- </File> |
|
203 |
- <File |
|
204 |
- RelativePath="..\clamd\tcpserver.c" |
|
205 |
- > |
|
206 |
- </File> |
|
207 |
- <File |
|
208 |
- RelativePath="..\clamd\thrmgr.c" |
|
209 |
- > |
|
210 |
- </File> |
|
211 |
- <Filter |
|
212 |
- Name="shared" |
|
213 |
- > |
|
214 |
- <File |
|
215 |
- RelativePath="..\shared\misc.c" |
|
216 |
- > |
|
217 |
- </File> |
|
218 |
- <File |
|
219 |
- RelativePath="..\shared\output.c" |
|
220 |
- > |
|
221 |
- </File> |
|
222 |
- </Filter> |
|
223 |
- <Filter |
|
224 |
- Name="compat" |
|
225 |
- > |
|
226 |
- <File |
|
227 |
- RelativePath=".\compat\libgen.c" |
|
228 |
- > |
|
229 |
- </File> |
|
230 |
- <File |
|
231 |
- RelativePath=".\compat\setargv.c" |
|
232 |
- > |
|
233 |
- </File> |
|
234 |
- </Filter> |
|
235 |
- </Filter> |
|
236 |
- <Filter |
|
237 |
- Name="Header Files" |
|
238 |
- Filter="h;hpp;hxx;hm;inl;inc;xsd" |
|
239 |
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" |
|
240 |
- > |
|
241 |
- </Filter> |
|
242 |
- <Filter |
|
243 |
- Name="Resource Files" |
|
244 |
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" |
|
245 |
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" |
|
246 |
- > |
|
247 |
- </Filter> |
|
248 |
- </Files> |
|
249 |
- <Globals> |
|
250 |
- </Globals> |
|
251 |
-</VisualStudioProject> |
|
1 |
+<?xml version="1.0" encoding="Windows-1252"?> |
|
2 |
+<VisualStudioProject |
|
3 |
+ Keyword="Win32Proj" |
|
4 |
+ Name="clamd" |
|
5 |
+ ProjectGUID="{B3CA73CF-E71E-42F3-95DE-43797A86C798}" |
|
6 |
+ ProjectType="Visual C++" |
|
7 |
+ RootNamespace="clamd" |
|
8 |
+ TargetFrameworkVersion="196613" |
|
9 |
+ Version="9,00" |
|
10 |
+ > |
|
11 |
+ <Platforms> |
|
12 |
+ <Platform |
|
13 |
+ Name="Win32" |
|
14 |
+ /> |
|
15 |
+ </Platforms> |
|
16 |
+ <ToolFiles> |
|
17 |
+ </ToolFiles> |
|
18 |
+ <Configurations> |
|
19 |
+ <Configuration |
|
20 |
+ CharacterSet="2" |
|
21 |
+ ConfigurationType="1" |
|
22 |
+ IntermediateDirectory="$(SolutionDir)build\$(ProjectName)\$(ConfigurationName)" |
|
23 |
+ Name="Debug|Win32" |
|
24 |
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
|
25 |
+ > |
|
26 |
+ <Tool |
|
27 |
+ Name="VCPreBuildEventTool" |
|
28 |
+ /> |
|
29 |
+ <Tool |
|
30 |
+ Name="VCCustomBuildTool" |
|
31 |
+ /> |
|
32 |
+ <Tool |
|
33 |
+ Name="VCXMLDataGeneratorTool" |
|
34 |
+ /> |
|
35 |
+ <Tool |
|
36 |
+ Name="VCWebServiceProxyGeneratorTool" |
|
37 |
+ /> |
|
38 |
+ <Tool |
|
39 |
+ Name="VCMIDLTool" |
|
40 |
+ /> |
|
41 |
+ <Tool |
|
42 |
+ AdditionalIncludeDirectories=""$(SolutionDir)";"$(SolutionDir)..\libclamav";"$(SolutionDir)compat";"$(SolutionDir)3rdparty\zlib";"$(SolutionDir)3rdparty\pthreads";"$(SolutionDir)3rdparty\bzip2";"$(SolutionDir).."" |
|
43 |
+ BasicRuntimeChecks="3" |
|
44 |
+ CompileAs="1" |
|
45 |
+ DebugInformationFormat="3" |
|
46 |
+ DisableSpecificWarnings="4996;4244;4090;4018" |
|
47 |
+ MinimalRebuild="true" |
|
48 |
+ Name="VCCLCompilerTool" |
|
49 |
+ Optimization="0" |
|
50 |
+ PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1" |
|
51 |
+ RuntimeLibrary="3" |
|
52 |
+ UsePrecompiledHeader="0" |
|
53 |
+ WarningLevel="3" |
|
54 |
+ /> |
|
55 |
+ <Tool |
|
56 |
+ Name="VCManagedResourceCompilerTool" |
|
57 |
+ /> |
|
58 |
+ <Tool |
|
59 |
+ Name="VCResourceCompilerTool" |
|
60 |
+ /> |
|
61 |
+ <Tool |
|
62 |
+ Name="VCPreLinkEventTool" |
|
63 |
+ /> |
|
64 |
+ <Tool |
|
65 |
+ GenerateDebugInformation="true" |
|
66 |
+ LinkIncremental="1" |
|
67 |
+ Name="VCLinkerTool" |
|
68 |
+ SubSystem="1" |
|
69 |
+ TargetMachine="1" |
|
70 |
+ /> |
|
71 |
+ <Tool |
|
72 |
+ Name="VCALinkTool" |
|
73 |
+ /> |
|
74 |
+ <Tool |
|
75 |
+ Name="VCManifestTool" |
|
76 |
+ /> |
|
77 |
+ <Tool |
|
78 |
+ Name="VCXDCMakeTool" |
|
79 |
+ /> |
|
80 |
+ <Tool |
|
81 |
+ Name="VCBscMakeTool" |
|
82 |
+ /> |
|
83 |
+ <Tool |
|
84 |
+ Name="VCFxCopTool" |
|
85 |
+ /> |
|
86 |
+ <Tool |
|
87 |
+ Name="VCAppVerifierTool" |
|
88 |
+ /> |
|
89 |
+ <Tool |
|
90 |
+ Name="VCPostBuildEventTool" |
|
91 |
+ /> |
|
92 |
+ </Configuration> |
|
93 |
+ <Configuration |
|
94 |
+ CharacterSet="2" |
|
95 |
+ ConfigurationType="1" |
|
96 |
+ IntermediateDirectory="$(SolutionDir)build\$(ProjectName)\$(ConfigurationName)" |
|
97 |
+ Name="Release|Win32" |
|
98 |
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
|
99 |
+ WholeProgramOptimization="1" |
|
100 |
+ > |
|
101 |
+ <Tool |
|
102 |
+ Name="VCPreBuildEventTool" |
|
103 |
+ /> |
|
104 |
+ <Tool |
|
105 |
+ Name="VCCustomBuildTool" |
|
106 |
+ /> |
|
107 |
+ <Tool |
|
108 |
+ Name="VCXMLDataGeneratorTool" |
|
109 |
+ /> |
|
110 |
+ <Tool |
|
111 |
+ Name="VCWebServiceProxyGeneratorTool" |
|
112 |
+ /> |
|
113 |
+ <Tool |
|
114 |
+ Name="VCMIDLTool" |
|
115 |
+ /> |
|
116 |
+ <Tool |
|
117 |
+ AdditionalIncludeDirectories=""$(SolutionDir)";"$(SolutionDir)..\libclamav";"$(SolutionDir)compat";"$(SolutionDir)3rdparty\zlib";"$(SolutionDir)3rdparty\pthreads";"$(SolutionDir)3rdparty\bzip2";"$(SolutionDir).."" |
|
118 |
+ CompileAs="1" |
|
119 |
+ DebugInformationFormat="3" |
|
120 |
+ DisableSpecificWarnings="4996;4244;4090;4018" |
|
121 |
+ EnableFunctionLevelLinking="true" |
|
122 |
+ EnableIntrinsicFunctions="true" |
|
123 |
+ Name="VCCLCompilerTool" |
|
124 |
+ Optimization="2" |
|
125 |
+ PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1" |
|
126 |
+ RuntimeLibrary="2" |
|
127 |
+ UsePrecompiledHeader="0" |
|
128 |
+ WarningLevel="3" |
|
129 |
+ /> |
|
130 |
+ <Tool |
|
131 |
+ Name="VCManagedResourceCompilerTool" |
|
132 |
+ /> |
|
133 |
+ <Tool |
|
134 |
+ Name="VCResourceCompilerTool" |
|
135 |
+ /> |
|
136 |
+ <Tool |
|
137 |
+ Name="VCPreLinkEventTool" |
|
138 |
+ /> |
|
139 |
+ <Tool |
|
140 |
+ EnableCOMDATFolding="2" |
|
141 |
+ GenerateDebugInformation="true" |
|
142 |
+ LinkIncremental="1" |
|
143 |
+ Name="VCLinkerTool" |
|
144 |
+ OptimizeReferences="2" |
|
145 |
+ SubSystem="1" |
|
146 |
+ TargetMachine="1" |
|
147 |
+ /> |
|
148 |
+ <Tool |
|
149 |
+ Name="VCALinkTool" |
|
150 |
+ /> |
|
151 |
+ <Tool |
|
152 |
+ Name="VCManifestTool" |
|
153 |
+ /> |
|
154 |
+ <Tool |
|
155 |
+ Name="VCXDCMakeTool" |
|
156 |
+ /> |
|
157 |
+ <Tool |
|
158 |
+ Name="VCBscMakeTool" |
|
159 |
+ /> |
|
160 |
+ <Tool |
|
161 |
+ Name="VCFxCopTool" |
|
162 |
+ /> |
|
163 |
+ <Tool |
|
164 |
+ Name="VCAppVerifierTool" |
|
165 |
+ /> |
|
166 |
+ <Tool |
|
167 |
+ Name="VCPostBuildEventTool" |
|
168 |
+ /> |
|
169 |
+ </Configuration> |
|
170 |
+ </Configurations> |
|
171 |
+ <References> |
|
172 |
+ </References> |
|
173 |
+ <Files> |
|
174 |
+ <Filter |
|
175 |
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" |
|
176 |
+ Name="Source Files" |
|
177 |
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" |
|
178 |
+ > |
|
179 |
+ <File |
|
180 |
+ RelativePath="..\clamd\clamd.c" |
|
181 |
+ > |
|
182 |
+ </File> |
|
183 |
+ <File |
|
184 |
+ RelativePath="..\clamd\localserver.c" |
|
185 |
+ > |
|
186 |
+ </File> |
|
187 |
+ <File |
|
188 |
+ RelativePath="..\clamd\others.c" |
|
189 |
+ > |
|
190 |
+ </File> |
|
191 |
+ <File |
|
192 |
+ RelativePath="..\clamd\scanner.c" |
|
193 |
+ > |
|
194 |
+ </File> |
|
195 |
+ <File |
|
196 |
+ RelativePath="..\clamd\server-th.c" |
|
197 |
+ > |
|
198 |
+ </File> |
|
199 |
+ <File |
|
200 |
+ RelativePath="..\clamd\session.c" |
|
201 |
+ > |
|
202 |
+ </File> |
|
203 |
+ <File |
|
204 |
+ RelativePath="..\clamd\tcpserver.c" |
|
205 |
+ > |
|
206 |
+ </File> |
|
207 |
+ <File |
|
208 |
+ RelativePath="..\clamd\thrmgr.c" |
|
209 |
+ > |
|
210 |
+ </File> |
|
211 |
+ <Filter |
|
212 |
+ Name="shared" |
|
213 |
+ > |
|
214 |
+ <File |
|
215 |
+ RelativePath="..\shared\misc.c" |
|
216 |
+ > |
|
217 |
+ </File> |
|
218 |
+ <File |
|
219 |
+ RelativePath="..\shared\output.c" |
|
220 |
+ > |
|
221 |
+ </File> |
|
222 |
+ </Filter> |
|
223 |
+ <Filter |
|
224 |
+ Name="compat" |
|
225 |
+ > |
|
226 |
+ <File |
|
227 |
+ RelativePath=".\compat\libgen.c" |
|
228 |
+ > |
|
229 |
+ </File> |
|
230 |
+ <File |
|
231 |
+ RelativePath=".\compat\setargv.c" |
|
232 |
+ > |
|
233 |
+ </File> |
|
234 |
+ </Filter> |
|
235 |
+ </Filter> |
|
236 |
+ <Filter |
|
237 |
+ Filter="h;hpp;hxx;hm;inl;inc;xsd" |
|
238 |
+ Name="Header Files" |
|
239 |
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" |
|
240 |
+ > |
|
241 |
+ </Filter> |
|
242 |
+ <Filter |
|
243 |
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" |
|
244 |
+ Name="Resource Files" |
|
245 |
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" |
|
246 |
+ > |
|
247 |
+ </Filter> |
|
248 |
+ </Files> |
|
249 |
+ <Globals> |
|
250 |
+ </Globals> |
|
251 |
+</VisualStudioProject> |
... | ... |
@@ -327,11 +327,12 @@ int w32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, s |
327 | 327 |
} |
328 | 328 |
|
329 | 329 |
int w32_accept(int sockfd, const struct sockaddr *addr, socklen_t *addrlen) { |
330 |
- if(accept((SOCKET)sockfd, addr, addrlen)) { |
|
330 |
+ int sock; |
|
331 |
+ if((sock = (int)accept((SOCKET)sockfd, addr, addrlen)<0)) { |
|
331 | 332 |
wsock2errno(); |
332 | 333 |
return -1; |
333 | 334 |
} |
334 |
- return 0; |
|
335 |
+ return sock; |
|
335 | 336 |
} |
336 | 337 |
|
337 | 338 |
int w32_listen(int sockfd, int backlog) { |
... | ... |
@@ -358,7 +359,7 @@ struct w32polldata { |
358 | 358 |
struct pollfd *polldata; |
359 | 359 |
}; |
360 | 360 |
|
361 |
-VOID CALLBACK poll_cb(PVOID param, BOOLEAN timedout) { |
|
361 |
+static VOID CALLBACK poll_cb(PVOID param, BOOLEAN timedout) { |
|
362 | 362 |
WSANETWORKEVENTS evt; |
363 | 363 |
struct w32polldata *item = (struct w32polldata *)param; |
364 | 364 |
if(!timedout) { |
... | ... |
@@ -368,6 +369,23 @@ VOID CALLBACK poll_cb(PVOID param, BOOLEAN timedout) { |
368 | 368 |
if(evt.iErrorCode[i] & (FD_ACCEPT|FD_READ)) item->polldata->revents |= POLLIN; |
369 | 369 |
if(evt.iErrorCode[i] & FD_CLOSE) item->polldata->revents |= POLLHUP; |
370 | 370 |
} |
371 |
+<<<<<<< HEAD:win32/compat/net.c |
|
372 |
+ if(SetEvent(item->setme)==0) { |
|
373 |
+ int a = GetLastError(); |
|
374 |
+ a++; |
|
375 |
+ } |
|
376 |
+ } |
|
377 |
+} |
|
378 |
+ |
|
379 |
+int poll_with_event(struct pollfd *fds, int nfds, int timeout, HANDLE event) { |
|
380 |
+ HANDLE *setme; |
|
381 |
+ struct w32polldata *items; |
|
382 |
+ unsigned int i, ret = 0; |
|
383 |
+ |
|
384 |
+ setme = malloc(2 * sizeof(HANDLE)); |
|
385 |
+ setme[0] = CreateEvent(NULL, TRUE, FALSE, NULL); |
|
386 |
+ setme[1] = event; |
|
387 |
+======= |
|
371 | 388 |
} |
372 | 389 |
} |
373 | 390 |
|
... | ... |
@@ -376,6 +394,7 @@ int w32_poll(struct pollfd *fds, int nfds, int timeout) { |
376 | 376 |
struct w32polldata *items; |
377 | 377 |
unsigned int i, ret = 0; |
378 | 378 |
|
379 |
+>>>>>>> d29df4cf2d499717dde976c27fa293470cfcf114:win32/compat/net.c |
|
379 | 380 |
timeout = timeout>=0 ? timeout*1000 : INFINITE; |
380 | 381 |
if(!nfds) { |
381 | 382 |
Sleep(timeout); |
... | ... |
@@ -385,7 +404,11 @@ int w32_poll(struct pollfd *fds, int nfds, int timeout) { |
385 | 385 |
for(i=0; i<nfds; i++) { |
386 | 386 |
items[i].event = CreateEvent(NULL, TRUE, FALSE, NULL); |
387 | 387 |
items[i].polldata = &fds[i]; |
388 |
+<<<<<<< HEAD:win32/compat/net.c |
|
389 |
+ items[i].setme = setme[0]; |
|
390 |
+======= |
|
388 | 391 |
items[i].setme = setme; |
392 |
+>>>>>>> d29df4cf2d499717dde976c27fa293470cfcf114:win32/compat/net.c |
|
389 | 393 |
if(WSAEventSelect(fds[i].fd, items[i].event, FD_ACCEPT|FD_READ|FD_CLOSE)) { |
390 | 394 |
/* handle error here */ |
391 | 395 |
} |
... | ... |
@@ -393,7 +416,11 @@ int w32_poll(struct pollfd *fds, int nfds, int timeout) { |
393 | 393 |
/* handle errors here */ |
394 | 394 |
} |
395 | 395 |
} |
396 |
+<<<<<<< HEAD:win32/compat/net.c |
|
397 |
+ WaitForMultipleObjects(2 - (event == NULL) , setme, FALSE, timeout); |
|
398 |
+======= |
|
396 | 399 |
WaitForSingleObject(setme, timeout); /* FIXME - add the pipe here */ |
400 |
+>>>>>>> d29df4cf2d499717dde976c27fa293470cfcf114:win32/compat/net.c |
|
397 | 401 |
for(i=0; i<nfds; i++) { |
398 | 402 |
UnregisterWait(items[i].waiter); |
399 | 403 |
WSAEventSelect(fds[i].fd, items[i].event, 0); |
... | ... |
@@ -401,5 +428,10 @@ int w32_poll(struct pollfd *fds, int nfds, int timeout) { |
401 | 401 |
ret += (items[i].polldata->revents != 0); |
402 | 402 |
} |
403 | 403 |
free(items); |
404 |
+<<<<<<< HEAD:win32/compat/net.c |
|
405 |
+ CloseHandle(setme[0]); |
|
406 |
+ free(setme); |
|
407 |
+======= |
|
408 |
+>>>>>>> d29df4cf2d499717dde976c27fa293470cfcf114:win32/compat/net.c |
|
404 | 409 |
return ret; |
405 | 410 |
} |
... | ... |
@@ -39,7 +39,7 @@ void w32_freeaddrinfo(struct addrinfo *res); |
39 | 39 |
const char *w32_inet_ntop(int af, const void *src, char *dst, socklen_t size); |
40 | 40 |
struct hostent *w32_gethostbyname(const char *name); |
41 | 41 |
int w32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); |
42 |
-int w32_poll(struct pollfd *fds, int nfds, int timeout); |
|
42 |
+int poll_with_event(struct pollfd *fds, int nfds, int timeout, HANDLE event); |
|
43 | 43 |
int w32_accept(int sockfd, const struct sockaddr *addr, socklen_t *addrlen); |
44 | 44 |
int w32_listen(int sockfd, int backlog); |
45 | 45 |
int w32_shutdown(int sockfd, int how); |