libevent-1.1b-mingw-custom.diff 9.0 KB

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