1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
Only in libevent-1.1b: CHANGES
Only in libevent-1.1b: Makefile
diff -uwr libevent-1.1b-old/Makefile.am libevent-1.1b/Makefile.am
--- libevent-1.1b-old/Makefile.am Wed Aug 9 22:16:35 2006
+++ libevent-1.1b/Makefile.am Sat Sep 2 03:49:26 2006
@@ -1,6 +1,5 @@
AUTOMAKE_OPTIONS = foreign no-dependencies
-SUBDIRS = . sample test
EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \
kqueue.c epoll_sub.c epoll.c select.c rtsig.c poll.c signal.c \
@@ -20,8 +19,29 @@
lib_LTLIBRARIES = libevent.la
-libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c
-libevent_la_LIBADD = @LTLIBOBJS@
+
+if BUILD_WIN32
+
+SUBDIRS = . sample
+SYS_LIBS = -lws2_32
+SYS_SRC = WIN32-Code/misc.c WIN32-Code/win32.c
+
+else
+
+SUBDIRS = . sample test
+SYS_LIBS =
+SYS_SRC =
+
+endif
+
+if USE_CUSTOM_CODE
+CUST_SRC = custom/custom.c
+else
+CUST_SRC =
+endif
+
+libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c $(CUST_SRC) $(SYS_SRC)
+libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS)
libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:2:0
include_HEADERS = event.h
Only in libevent-1.1b: Makefile.in
diff -uwr libevent-1.1b-old/WIN32-Code/misc.c libevent-1.1b/WIN32-Code/misc.c
--- libevent-1.1b-old/WIN32-Code/misc.c Wed Aug 9 21:01:14 2006
+++ libevent-1.1b/WIN32-Code/misc.c Fri Sep 1 22:21:31 2006
@@ -4,6 +4,12 @@
#include <sys/timeb.h>
#include <time.h>
+#ifdef __GNUC__
+/*our prototypes for timeval and timezone are in here, just in case the above
+ headers don't have them*/
+#include "misc.h"
+#endif
+
/****************************************************************************
*
* Function: gettimeofday(struct timeval *, struct timezone *)
diff -uwr libevent-1.1b-old/WIN32-Code/misc.h libevent-1.1b/WIN32-Code/misc.h
--- libevent-1.1b-old/WIN32-Code/misc.h Wed Aug 9 21:01:14 2006
+++ libevent-1.1b/WIN32-Code/misc.h Fri Sep 1 18:47:09 2006
@@ -1,6 +1,9 @@
#ifndef MISC_H
#define MISC_H
+struct timezone;
+struct timeval;
+
int gettimeofday(struct timeval *,struct timezone *);
#endif
diff -uwr libevent-1.1b-old/WIN32-Code/win32.c libevent-1.1b/WIN32-Code/win32.c
--- libevent-1.1b-old/WIN32-Code/win32.c Wed Aug 9 21:25:48 2006
+++ libevent-1.1b/WIN32-Code/win32.c Sat Sep 2 00:45:55 2006
@@ -60,7 +60,8 @@
/* MSDN says this is required to handle SIGFPE */
volatile double SIGFPE_REQ = 0.0f;
-int signal_handler(int sig);
+static int signal_handler(int sig);
+
void signal_process(void);
int signal_recalc(void);
@@ -77,20 +78,21 @@
};
void *win32_init (void);
-int win32_insert (void *, struct event *);
-int win32_del (void *, struct event *);
+int win32_insert (struct win32op *, struct event *);
+int win32_del (struct win32op *, struct event *);
int win32_recalc (struct event_base *base, void *, int);
-int win32_dispatch (struct event_base *base, void *, struct timeval *);
+int win32_dispatch (struct event_base *base, struct win32op *, struct timeval *);
struct eventop win32ops = {
"win32",
win32_init,
- win32_insert,
- win32_del,
+ (int (*) (void*, struct event*)) win32_insert,
+ (int (*) (void*, struct event*)) win32_del,
win32_recalc,
- win32_dispatch
+ (int (*) (struct event_base*, void*, struct timeval*)) win32_dispatch
};
+
#define FD_SET_ALLOC_SIZE(n) ((sizeof(struct win_fd_set) + ((n)-1)*sizeof(SOCKET)))
static int
@@ -213,7 +215,13 @@
if (ev->ev_events & (EV_READ|EV_WRITE))
event_errx(1, "%s: EV_SIGNAL incompatible use",
__func__);
+
+#ifndef __GNUC__
if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1)
+#else
+ if((int)signal(EVENT_SIGNAL(ev), (void*) signal_handler) == -1)
+#endif
+
return (-1);
return (0);
@@ -382,8 +390,13 @@
/* Reinstall our signal handler. */
TAILQ_FOREACH(ev, &signalqueue, ev_signal_next) {
+#ifndef __GNUC__
if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1)
+#else
+ if((int)signal(EVENT_SIGNAL(ev), (void*) signal_handler) == -1)
+#endif
return (-1);
+
}
return (0);
}
Only in libevent-1.1b-old/: aclocal.m4
Only in libevent-1.1b: autom4te.cache
diff -uwr libevent-1.1b-old/buffer.c libevent-1.1b/buffer.c
--- libevent-1.1b-old/buffer.c Wed Aug 9 22:01:40 2006
+++ libevent-1.1b/buffer.c Fri Sep 1 18:52:56 2006
@@ -197,7 +197,7 @@
u_char *data = EVBUFFER_DATA(buffer);
size_t len = EVBUFFER_LENGTH(buffer);
char *line;
- u_int i;
+ unsigned int i;
for (i = 0; i < len; i++) {
if (data[i] == '\r' || data[i] == '\n')
Only in libevent-1.1b: config.guess
Only in libevent-1.1b: config.h
diff -uwr libevent-1.1b-old/config.h.in libevent-1.1b/config.h.in
--- libevent-1.1b-old/config.h.in Wed Aug 9 21:27:37 2006
+++ libevent-1.1b/config.h.in Sat Sep 2 02:23:17 2006
@@ -223,6 +223,9 @@
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
+/* Define to 1 if you want to use a custom eventops variable */
+#undef USE_CUSTOM_EVENTOPS
+
/* Version number of package */
#undef VERSION
@@ -232,11 +235,9 @@
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+ if it is not supported. */
#undef inline
-#endif
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
Only in libevent-1.1b: config.h.in~
Only in libevent-1.1b: config.log
Only in libevent-1.1b: config.status
Only in libevent-1.1b: configure
diff -uwr libevent-1.1b-old/configure.in libevent-1.1b/configure.in
--- libevent-1.1b-old/configure.in Wed Aug 9 22:05:17 2006
+++ libevent-1.1b/configure.in Sat Sep 2 03:40:15 2006
@@ -21,6 +21,18 @@
CFLAGS="$CFLAGS -Wall"
fi
+AC_ARG_ENABLE(custom-eventops,
+ [ --enable-custom-eventops Use custom eventops variable],
+ AC_DEFINE([USE_CUSTOM_EVENTOPS],[1],
+ [Define to 1 to use a custom eventops variable])
+ ,)
+AC_ARG_ENABLE(custom-code,
+ [ --enable-custom-code Use custom code from custom/],
+ customcodev=true,
+ customcodev=false)
+
+AM_CONDITIONAL(USE_CUSTOM_CODE, test x$customcodev = xtrue)
+
AC_PROG_LIBTOOL
dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get
@@ -110,6 +122,22 @@
AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
)
fi
+
+dnl - check if the macro WIN32 is defined on this compiler.
+dnl - (this is how we check for a windows version of GCC)
+AC_MSG_CHECKING(for WIN32)
+AC_TRY_COMPILE(,
+ [
+ #ifndef WIN32
+ #error
+ #endif
+ ],
+ bwin32=true; AC_MSG_RESULT(yes),
+ bwin32=false; AC_MSG_RESULT(no),
+)
+
+AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
+
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
diff -uwr libevent-1.1b-old/evbuffer.c libevent-1.1b/evbuffer.c
--- libevent-1.1b-old/evbuffer.c Wed Aug 9 21:01:14 2006
+++ libevent-1.1b/evbuffer.c Fri Sep 1 19:18:13 2006
@@ -154,12 +154,20 @@
if (EVBUFFER_LENGTH(bufev->output)) {
res = evbuffer_write(bufev->output, fd);
if (res == -1) {
+#ifndef WIN32
+/*todo. evbuffer uses WriteFile when WIN32 is set. WIN32 system calls do not
+ *set errno. thus this error checking is not portable*/
if (errno == EAGAIN ||
errno == EINTR ||
errno == EINPROGRESS)
goto reschedule;
/* error case */
what |= EVBUFFER_ERROR;
+
+#else
+ goto reschedule;
+#endif
+
} else if (res == 0) {
/* eof case */
what |= EVBUFFER_EOF;
@@ -181,6 +189,7 @@
return;
reschedule:
+
if (EVBUFFER_LENGTH(bufev->output) != 0)
bufferevent_add(&bufev->ev_write, bufev->timeout_write);
return;
diff -uwr libevent-1.1b-old/event.c libevent-1.1b/event.c
--- libevent-1.1b-old/event.c Wed Aug 9 21:25:48 2006
+++ libevent-1.1b/event.c Sat Sep 2 04:22:05 2006
@@ -30,8 +30,14 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
+
+#ifdef __GNUC__
+#include "WIN32-Code/misc.h"
+#else
#include "misc.h"
#endif
+
+#endif
#include <sys/types.h>
#include <sys/tree.h>
#ifdef HAVE_SYS_TIME_H
@@ -53,6 +59,7 @@
#include "event-internal.h"
#include "log.h"
+
#ifdef HAVE_SELECT
extern const struct eventop selectops;
#endif
@@ -75,6 +82,8 @@
extern const struct eventop win32ops;
#endif
+#ifndef USE_CUSTOM_EVENTOPS
+
/* In order of preference */
const struct eventop *eventops[] = {
#ifdef HAVE_WORKING_KQUEUE
@@ -101,6 +110,11 @@
NULL
};
+#else
+#include "custom-eventops.h"
+#endif //USE_CUSTOM_EVENTOPS
+
+
/* Global state */
struct event_list signalqueue;
Only in libevent-1.1b: libtool
diff -uwr libevent-1.1b-old/log.c libevent-1.1b/log.c
--- libevent-1.1b-old/log.c Wed Aug 9 21:01:14 2006
+++ libevent-1.1b/log.c Fri Sep 1 19:09:45 2006
@@ -45,8 +45,14 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
+
+#ifdef __GNUC__
+#include "WIN32-Code/misc.h"
+#else
#include "misc.h"
#endif
+
+#endif
#include <sys/types.h>
#include <sys/tree.h>
#ifdef HAVE_SYS_TIME_H
Only in libevent-1.1b/sample: Makefile
Only in libevent-1.1b/sample: Makefile.in
Only in libevent-1.1b: stamp-h1
Only in libevent-1.1b/test: Makefile
Only in libevent-1.1b/test: Makefile.in
|