process with socket
Hi,
I am working on UNIX Network Programming (sockets programming in C). My
problem is I do not know how to identify whether a process in Linux kernel has a socket. Because so many different processes in Linux kernel are running, a process forks many child processes and forms a process tree. I want to identify a process that has socket and saves state data about it. Then saves the same data about his parent process and walks up the process tree by repeating this procedure until a process with PID 0 is reached. But I do not know how to identify if a process has a socket.
Quoted 9 lines
Hi,
I am working on UNIX Network Programming (sockets programming in C). My problem is I do not know how to identify whether a process in Linux kernel has a socket. Because so many different processes in Linux kernel are running, a process forks many child processes and forms a process tree. I want to identify a process that has socket and saves state data about it. Then saves the same data about his parent process and walks up the process tree by repeating this procedure until a process with PID 0 is reached. But I do not know how to identify if a process has a socket.
This might give you a start:
$ find /proc -type s
or
$ ls -Rl /proc/[0-9]* | grep ^s
Jan Engelhardt
Signature · 2 lines
Gesellschaft für Wissenschaftliche Datenverarbeitung Am Fassberg, 37077 Göttingen, www.gwdg.de