How to get task_struct of a socket owner process? i.e. how to get
task_struct* from sock*

I have tried following (on 2.6.38) but didn't work.

struct sock* sk = xxx;
(i) sk->sk_socket->file->f_cred->uid
(ii) tsk = get_pid_task(sk->sk_socket->file->f_owner->pid,
sk->sk_socket->file->f_owner->pid_type)

The goal is know which process opened the socket. (I know netstat -p
option, and /proc/<pid>/fd methods, but I want to do it in kernel
module only).

Thank you
Lal

_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to