How to find processes containing a file in C

I want to find which processes contain some file in C code (Linux).

One of the ways that comes to my mind is to look proc/<PID>/fdat all the running processes. However, this will take a very long time and due to sweeping all the files in the files of fdall processes.

Could you give another easier method?

Thanks in advance.

+4
source share
1 answer

/proc, fd/ . , , "lsof", . , .

0

Source: https://habr.com/ru/post/1684650/


All Articles