Hello, A few months ago I discovered a problem with libevent and arm architecture. I have TI DM355 board with montavista distribution, kernel Linux testarm 2.6.10_mvl401 #8 Wed Mar 18 15:04:34 MSK 2009 armv5tejl unknown
My embedded libevent-based http server unexpectedly crashed. Then I set variable EVENT_NOEPOLL=1 and everything went well. The problem appears in the all libevent versions including the latest 1.4.9. Today I tried to discover the problem with gdb and made this patch (attached): Index: epoll.c =================================================================== --- epoll.c (revision 5589) +++ epoll.c (revision 5590) @@ -141,7 +141,7 @@ epollop->epfd = epfd; /* Initalize fields */ - epollop->events = malloc(nfiles * sizeof(struct epoll_event)); + epollop->events = calloc(nfiles, sizeof(struct epoll_event)); if (epollop->events == NULL) { free(epollop); return (NULL); @@ -226,6 +226,7 @@ struct event *evread = NULL, *evwrite = NULL; evep = (struct evepoll *)events[i].data.ptr; + if (!evep) continue; if (what & (EPOLLHUP|EPOLLERR)) { evread = evep->evread; It works OK now, but I'm not sure I made a correct patch. And I don't understand why it doesn't segfaulted on x86_64 or x86 architecture.
libevent.patch
Description: Binary data
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users