Re: How to get list of all files open in the system

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

 



On Sat, Nov 14, 2015 at 08:13:26PM +0200, Sergei Starovoi wrote:
> Hi, all.
>  
> I'm writing a kernel module. One of its tasks requires getting full paths of
> all open files in the system.

That's a very odd request, why would a kernel module ever care about
such a thing?  And in what namespace do these files need to be in?

> My first solution essentially looks like:
>  for_each_process_thread(process, thread)
>   iterate_fd(files, 0, my_callback, NULL);
> my_callback calls d_path for passed file->f_path to get its full path.
>  
> But this solution has obvious problems:
>    A. It will skip files which were opened directly from kernel code (using
> filp_open for example);

You shouldn't care about those, but then again, you aren't saying why
you care about open files, so I can't judge that.

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux