1 To build libevent, type
2
3 $ ./configure && make
4
5 Install as root via
6
7 # make install
8
9 You can run the regression tests by
10
11 $ make verify
12
13 Before, reporting any problems, please run the regression tests.
14
15 To enable the low-level tracing build the library as:
16
17 CFLAGS=-DUSE_DEBUG ./configure [...]
18
19 Acknowledgements:
20 -----------------
21
22 The following people have helped with suggestions, ideas, code or
23 fixing bugs:
24
25 Alejo
26 Weston Andros Adamson
27 William Ahern
28 Stas Bekman
29 Andrew Danforth
30 Mike Davis
31 Shie Erlich
32 Alexander von Gernler
33 Artur Grabowski
34 Aaron Hopkins
35 Claudio Jeker
36 Scott Lamb
37 Adam Langley
38 Philip Lewis
39 David Libenzi
40 Nick Mathewson
41 Andrey Matveev
42 Richard Nyberg
43 Jon Oberheide
44 Phil Oleson
45 Dave Pacheco
46 Tassilo von Parseval
47 Pierre Phaneuf
48 Jon Poland
49 Bert JW Regeer
50 Dug Song
51 Taral
52
53 If I have forgotten your name, please contact me.
54 1 Use the script 'make_solaris.sh' to re-build libevent.
2
3 To compile on Solaris, files event.c, configure.in and
4 Index: test/regress.c were modified as shown below.
5
6 Index: evport.c
7 ===================================================================
8 --- evport.c (revision 67)
9 +++ evport.c (revision 222)
10 @@ -240,8 +240,10 @@
11 grow(struct evport_data *epdp, int factor)
12 {
13 struct fd_info *tmp;
14 + struct fd_info *old = epdp->ed_fds;
15 int oldsize = epdp->ed_nevents;
16 int newsize = factor * oldsize;
17 + int ii;
18 assert(factor > 1);
19
20 check_evportop(epdp);
21 @@ -252,6 +254,15 @@
22 epdp->ed_fds = tmp;
23 memset((char*) (epdp->ed_fds + oldsize), 0,
24 (newsize - oldsize)*sizeof(struct fd_info));
25 +
26 + /* The ev_pending array contains pointers into the released array. */
27 + for (ii = 0; ii < EVENTS_PER_GETN; ++ii) {
28 + if (epdp->ed_pending[ii] != 0) {
29 + int offset = epdp->ed_pending[ii] - old;
30 + epdp->ed_pending[ii] = epdp->ed_fds + offset;
31 + }
32 + }
33 +
34 epdp->ed_nevents = newsize;
35
36 check_evportop(epdp);
37 @@ -309,9 +320,16 @@
38
39 /*
40 * We have to convert a struct timeval to a struct timespec
41 - * (only difference is nanoseconds vs. microseconds)
42 + * (only difference is nanoseconds vs. microseconds). If no time-based
43 + * events are active, we should wait for I/O (and tv == NULL).
44 */
45 - struct timespec ts = {tv->tv_sec, tv->tv_usec * 1000};
46 + struct timespec ts;
47 + struct timespec *ts_p = NULL;
48 + if (tv != NULL) {
49 + ts.tv_sec = tv->tv_sec;
50 + ts.tv_nsec = tv->tv_usec * 1000;
51 + ts_p = &ts;
52 + }
53
54 /*
55 * Before doing anything else, we need to reassociate the events we hit
56 @@ -330,7 +348,7 @@
57 }
58
59 if ((res = port_getn(epdp->ed_port, pevtlist, EVENTS_PER_GETN,
60 - (unsigned int *) &nevents, &ts)) == -1) {
61 + (unsigned int *) &nevents, ts_p)) == -1) {
62 if (errno == EINTR) {
63 evsignal_process(base);
64 return (0);
65 @@ -473,6 +491,8 @@
66 {
67 struct evport_data *evpd = arg;
68 struct fd_info *fdi;
69 + int doreassoc = 1;
70 + int ii;
71
72 check_evportop(evpd);
73
74 @@ -487,14 +507,21 @@
75 return (-1);
76 }
77
78 + for (int ii = 0; ii < EVENTS_PER_GETN; ++ii) {
79 + struct fd_info *fdi = evpd->ed_pending[ii];
80 + if (fdi && (fdi->fdi_revt == ev || fdi->fdi_wevt == ev)) {
81 + doreassoc = 0;
82 + }
83 + }
84
85 +
86 fdi = &evpd->ed_fds[ev->ev_fd];
87 if (ev->ev_events & EV_READ)
88 fdi->fdi_revt = NULL;
89 if (ev->ev_events & EV_WRITE)
90 fdi->fdi_wevt = NULL;
91
92 - return reassociate(evpd, fdi, ev->ev_fd);
93 + return (doreassoc) ? reassociate(evpd, fdi, ev->ev_fd) : 0;
94 }
95
96
97 Index: test/regress.c
98 ===================================================================
99 --- test/regress.c (revision 67)
100 +++ test/regress.c (revision 222)
101 @@ -821,7 +821,7 @@
102 cleanup_test();
103 }
104
105 -int decode_int(u_int32_t *pnumber, struct evbuffer *evbuf);
106 +int decode_int(uint32_t *pnumber, struct evbuffer *evbuf);
107
108 void
109 read_once_cb(int fd, short event, void *arg)
110 @@ -872,10 +872,10 @@
111 evtag_int_test(void)
112 {
113 struct evbuffer *tmp = evbuffer_new();
114 - u_int32_t integers[TEST_MAX_INT] = {
115 + uint32_t integers[TEST_MAX_INT] = {
116 0xaf0, 0x1000, 0x1, 0xdeadbeef, 0x00, 0xbef000
117 };
118 - u_int32_t integer;
119 + uint32_t integer;
120 int i;
121
122 for (i = 0; i < TEST_MAX_INT; i++) {
123 Index: configure.in
124 ===================================================================
125 --- configure.in (revision 67)
126 +++ configure.in (revision 222)
127 @@ -37,6 +37,7 @@
128 AC_CHECK_LIB(socket, socket)
129 AC_CHECK_LIB(resolv, inet_aton)
130 AC_CHECK_LIB(rt, clock_gettime)
131 +AC_CHECK_LIB(nsl, inet_ntoa)
132
133 dnl Checks for header files.
134 AC_HEADER_STDC
135 @@ -366,12 +367,12 @@
136
137 AC_MSG_CHECKING([whether our compiler supports __func__])
138 AC_TRY_COMPILE([],
139 - [void foo() { const char *cp = __func__; }],
140 + [ const char *cp = __func__; ],
141 AC_MSG_RESULT([yes]),
142 AC_MSG_RESULT([no])
143 AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
144 AC_TRY_COMPILE([],
145 - [void foo() { const char *cp = __FUNCTION__; }],
146 + [ const char *cp = __FUNCTION__; ],
147 AC_MSG_RESULT([yes])
148 AC_DEFINE(__func__, __FUNCTION__,
149 [Define to appropriate substitue if compiler doesnt have __func__]),
150 Index: event.c
151 ===================================================================
152 --- event.c (revision 67)
153 +++ event.c (revision 222)
154 @@ -753,7 +753,8 @@
155 if (gettime(&now) == -1)
156 return (-1);
157
158 - if (timercmp(&ev->ev_timeout, &now, <=)) {
159 + /* Solaris timercmp macro does not properly handle <= */
160 + if (!timercmp(&ev->ev_timeout, &now, >)) {
161 timerclear(tv);
162 return (0);
163 }
164