[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting fd from pointer to sock
Hi,
I wanted a mapping from the scok struct to the fd... I know the mapping from
the task_struct to the sock... I just want the reverse.
On Wed, 14 Aug 2002 10:33:00 -0700
Marco Cova <giardini@libero.it> wrote:
MC> Hi.
MC>
MC> This is how the different data structures are related to each other:
MC>
MC> struct task_struct --> struct files_struct * --> struct file ** -->
MC> (current) (files) (fd)
MC>
MC> --> struct dentry --> struct inode --> struct socket --> struct
MC> sock
MC> (f_dentry) (d_inode) (u.socket_i) (sk)
MC>
MC>
MC> Mmmh, not too clear? It means: you can get a pointer to a struct
MC> files_struct through the 'files' field in the struct task_struct. From
MC> that and its field 'fd', you can a pointer to a struct file, and so on.
MC>
MC>
MC>
MC> HTH,
MC> Marco
MC>
---
- Amit
Want to know more about me? Follow this link-> http://amitshah.nav.to/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/