filesystems - How to get all open file handles in kernel space code? -


i want write code in kernel space find open file handles in system , process id holdes handles.

in user space can using utility "lsof". similarly, want same in kernel space.

what's great linux kernel it's open source. if want understand how implement similar lsof why not inspecting its' source code (i suggest the following implementation, android 4.2.2 source tree, @ simplified , easier understand) or straceing understand how magic happens?

if you'll so, @ point you'll encounter following lines

openat(at_fdcwd, "/proc/<pid>/fd", o_rdonly|o_nonblock|o_directory|o_cloexec) 

which hint each pid running, procfs able print information open file descriptors process holds. therefore, this start research , journey through code.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -