[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Obtaining information on running processes

Hi Thiago!

You wrote:

> How can I retrieve information on the running processes thru a program
> written in c? Is there any function that does something like lsof ?? I
> need specifically info on processes communicating thru the local
> network, like lsof -i. I know I can get most of the info from
> /proc/net/tcp (inode, ports, etc...), but how can I get the PID of the
> processes listed in this file, and also, the NAME of the process
> (field NAME when running lsof -i)

Well, it's Open Source, so just get the source of lsof and look how it
is done there.  IIRC, it searches /proc/NNNN/fd/*.

PS:  The debian-devel list is for discussions related to the devlopment
of Debian.  User question like this are best asked on

Kind regards,
| Bas Zoetekouw              | GPG key: 0644fab7                     |
|----------------------------| Fingerprint: c1f5 f24c d514 3fec 8bf6 |
| bas@o2w.nl, bas@debian.org |              a2b1 2bae e41f 0644 fab7 |

Reply to: