[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0903271535350.31272@makko.or.mcafeemobile.com>
Date: Fri, 27 Mar 2009 15:40:42 -0700 (PDT)
From: Davide Libenzi <davidel@...ilserver.org>
To: nicolas sitbon <nicolas.sitbon@...il.com>
cc: Michael Tokarev <mjt@....msk.ru>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists