Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 2
    lsof does this. Download the source for lsof and read it. Commented May 8, 2021 at 18:06
  • 1
    lsof does this and probably does it by reading /proc :) Commented May 8, 2021 at 18:06
  • Yeah, lsof -- and fuser -- scan /proc. But that yields more information than I need -- I don't care, which processes have the file open. I just want to know, whether any such exist. Perhaps, this information can be obtained more cheaply, than /proc rescan? Commented May 8, 2021 at 18:23
  • The advantage of scanning /proc is that it is backed by direct kernel calls, not a physical file system. That gives /proc a huge performance advantage over opening and reading a directory, even just to find the names. Commented May 8, 2021 at 18:34
  • The advantage of scanning /proc is that it is the only way to get the information without modifying the kernel. Commented May 8, 2021 at 23:25