Messages in this thread | | | Date | Sat, 28 Mar 2009 01:42:22 +0300 | From | Michael Tokarev <> | Subject | Re: epoll_ctl and const correctness |
| |
nicolas sitbon wrote: > I was looking at libevent of niels provos, and even him, is apparently > doing a mistake : > > static int > epoll_add(void *arg, struct event *ev) > { > struct epollop *epollop = arg; > struct epoll_event epev = {0, {0}}; > > /* ... some code here ... */ > if (epoll_ctl(epollop->epfd, op, ev->ev_fd, &epev) == -1) > return (-1); > > /* Update events responsible */ > if (ev->ev_events & EV_READ) > evep->evread = ev; > if (ev->ev_events & EV_WRITE) > evep->evwrite = ev; > > return (0); > } > > the structure pointed to by &epev is allocated on the stack, so how > the kernel could keep track of it?
I've no idea what are you talking about and what exactly is your problem. Both the examples (one at cplayer.org and another above) gives correct usage of epoll. If you don't understand it, well, I'd suggest reading some documentation first, maybe in kernel, maybe in glibc, maybe numerous available on the net. And all the numerous examples too, which you quote as, for some reason, wrong.
/mjt
| |