lkml.org 
[lkml]   [2009]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: epoll_ctl and const correctness
On Fri, 27 Mar 2009, 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?

Oh, I see, Niels is doing mistakes, whereas you've all figured out.



- Davide




\
 
 \ /
  Last update: 2009-03-27 23:45    [W:0.092 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site