On Fri, Jan 20, 2006 at 05:06:36PM -0600, Christopher Friesen ([EMAIL
PROTECTED]) wrote:
>
> I've been asked if there is any way to map a "struct socket *" in
> kernelspace, to the userspace fd that corresponds to it.
>
> I came up with looping through current->files->fd[i] and matching it
> against socket->file--if they match then "i" is the fd.
>
> Is there a better way?
struct file *file = fget(fd)/fget_light(fd);
struct inode *inode = igrab(file->f_dentry->d_inode);
struct socket *socket = SOCKET_I(inode);
> Chris
--
Evgeniy Polyakov
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html