Re: Getting a list of open files, the smart way?



On 5/15/08, Shaun McCance <shaunm gnome org> wrote:
> On Thu, 2008-05-15 at 06:19 -0500, Diego Escalante Urrelo wrote:
>  > On 5/15/08, Gustavo J. A. M. Carneiro <gjc inescporto pt> wrote:
>  > > On Wed, 2008-05-14 at 19:10 -0500, Diego Escalante Urrelo wrote:
>  > >
>  > > > Hi,
>  > >  >
>  > >  > I have made a quite simple patch for bug 528559[0], it makes the quite
>  > >  > useless "drive is being used" dialog into a list of applications using
>  > >  > such drive[1].
>  > >  >
>  > >  > I'm using a little hack with lsof, but it's not really reliable, like
>  > >  > when process names are too long. I checked libgtop quickly but the
>  > >  > lack of documentation didn't help.
>  > >  >
>  > >  > So, I'm writing to get some clues about this, any advice? My main
>  > >  > problem is to do something like "tell me which files in device $d are
>  > >  > in use, and tell me the executable for the process using such file"
>  > >
>  > >
>  > > If you have time, you could go two steps further than "the executable
>  > >  for the process using such file":
>  > >
>  > >   1- Try to find a .desktop file associated with the exe and display the
>  > >  application name and icon instead;
>  > >
>  >
>  > That's what it does right now :). I forgot to mention the coolest part
>  > of the patch, *smacks head against desk*.
>  > The executable name is important to use it as the .desktop file name,
>  > luckily all the end user process have executables that match their
>  > .desktop files (banshee = banshee.desktop).
>
>
> That's not necessarily true.  On Fedora, they change
>  the .desktop file names for lots of Gnome applications
>  to gnome-${app}.desktop.  I don't know why.
>

True!.

>  Don't we have a library that manages this stuff?  Is it
>  not possible to query this library on the Exec line?
>

No we don't or at least I didn't find one. And it seems that grepping
for Exec lines is not a good idea either. There's a bit of magic in
the patch, :P.


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