Re: [patch v2] epoll use a single inode ...

Davide Libenzi
2007-03-06T00:20:28Z

On Mon, 5 Mar 2007, Davide Libenzi wrote:

> On Mon, 5 Mar 2007, Linus Torvalds wrote:
>
> > On Mon, 5 Mar 2007, Davide Libenzi wrote:
> > > @@ -763,15 +767,17 @@
> > > * using the inode number.
> > > */
> > > error = -ENOMEM;
> > > - sprintf(name, "[%lu]", inode->i_ino);
> > > this.name = name;
> > > - this.len = strlen(name);
> > > - this.hash = inode->i_ino;
> > > + this.len = sprintf(name, "[%p]", ep);
> > > + this.hash = 0;
> >
> > Please don't expose kernel pointers to user space.
> >
> > It's much better to do something like
> >
> > static unsigned int epoll_inode;
> >
> > this.len = sprintf(name, "[%u]", ++epoll_inode);
> >
> > if you just need some pseudo-unique name to distinguish two epoll things
> > from each other (vs from a dup'ed fd).
>
> Heh, this is what Al was saying ;)
> I'm fine with that, but how about counter cycles (going back to zero)?
> Should we care to handle them correctly?

Maybe a [TID.FD] format?

- Davide