Opening Up GNOME

12:52 am General

One of the DTrace examples that I gave during my talk at the GNOME mini conf was something that Bryan showed us in the recent Solaris Desktop summit. A simple script showing what files were being opened –

#!/usr/sbin/dtrace -s

syscall::open*:entry {
    /* Store the first argument of the open()
     * call in a thread local variable
     */
    self->filename = arg0;
}

syscall::open*:return
/self->filename != NULL/ {
    /* Get the filename string and put it into
     * a clause local variable
     */
    this->filename = copyinstr(self->filename);
    self->filename = NULL;
    /* Aggregate on the number of times this filename is opened */
    @[this->filename == NULL ? "" : this->filename] = count();
}

Pretty simple, huh? Now we need to run the script – let’s see what zenity does by simply opening up the about dialog, and then closing it –

 /usr/sbin/dtrace -Z -s fileopen.d -c 'zenity --about' 

Let’s not forget what this dialog looks like – a simple window with a couple of buttons, and a couple of icons –

and DTrace gives us the following output –

  /.pangorc                                                         1
  /etc/fonts/fonts.conf                                             1
  /etc/gtk-2.0/gdk-pixbuf.loaders                                   1
  /etc/pango/pango.modules                                          1
  /etc/pango/pangorc                                                1
  /export/home/gman/.Xauthority                                     1
  /export/home/gman/.Xdefaults-rampage                              1
  /export/home/gman/.fonts.cache-1                                  1
....
  /proc/14473/psinfo                                                2
  /usr/lib/iconv/alias                                              2
  /usr/openwin/lib/locale/locale.dir                                2
  /usr/share/zenity/zenity.png                                      2
  /usr/openwin/lib/locale/locale.alias                              3
  /proc/14473/auxv                                                 19
  /proc/14473/map                                                  19

Pretty neat in many respects. Alarming in others considering the simplicity of the screenshot above.

Comments are closed.