A few places where we could save syscalls



25012 1140018536.736085 lstat64("/home/federico/.gtkrc-2.0", {st_mode=S_IFREG|0664, st_size=385, ...}) = 0
25012 1140018536.736216 open("/home/federico/.gtkrc-2.0", O_RDONLY|O_LARGEFILE) = 4

That is gtk_rc_context_parse_one_file():

  if (!g_lstat (rc_file->canonical_name, &statbuf))
    {
      gint fd;
      
      rc_file->mtime = statbuf.st_mtime;

      fd = g_open (rc_file->canonical_name, O_RDONLY, 0);
      if (fd < 0)
	goto out;

Can we do this instead:

  fd = g_open (...);
  if (!fd)
     goto out;
  else
    {
      if (fstat (fd, &statbuf) == 0)
        rc_file->mtime = statbuf.st_mtime;

      ...
    }


25012 1140018536.741220 access("/usr/local/lib/gtk-2.0/2.4.0/i686-suse-linux/engines/libindustrial.so", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.741328 access("/usr/local/lib/gtk-2.0/2.4.0/i686-suse-linux/engines/libindustrial.la", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.741416 access("/usr/local/lib/gtk-2.0/2.4.0/engines/libindustrial.so", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.741501 access("/usr/local/lib/gtk-2.0/2.4.0/engines/libindustrial.la", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.741582 access("/usr/local/lib/gtk-2.0/i686-suse-linux/engines/libindustrial.so", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.741669 access("/usr/local/lib/gtk-2.0/i686-suse-linux/engines/libindustrial.la", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.741752 access("/usr/local/lib/gtk-2.0/engines/libindustrial.so", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.741834 access("/usr/local/lib/gtk-2.0/engines/libindustrial.la", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.741913 access("/opt/gnome/lib/gtk-2.0/2.4.0/i686-suse-linux/engines/libindustrial.so", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.742007 access("/opt/gnome/lib/gtk-2.0/2.4.0/i686-suse-linux/engines/libindustrial.la", F_OK) = -1 ENOENT (No such file or directory)
25012 1140018536.742095 access("/opt/gnome/lib/gtk-2.0/2.4.0/engines/libindustrial.so", F_OK) = 0
25012 1140018536.742295 stat64("/opt/gnome/lib/gtk-2.0/2.4.0/engines/libindustrial.so", {st_mode=S_IFREG|0755, st_size=46552, ...}) = 0
25012 1140018536.742475 open("/opt/gnome/lib/gtk-2.0/2.4.0/engines/libindustrial.so", O_RDONLY) = 5

Note how we search for .so and .la files.  Then, for each item in
$GTK_PATH, we look in 2.4.0/$host/$type/, then 2.4.0/$type/, then plain
$type/.  Then once we find the file, we stat it to be really sure, and
finally open it.

Looking at the various paths happens in _gtk_get_module_path().

The extra stat() is g_module_open()'s 

  if (g_file_test (file_name, G_FILE_TEST_IS_REGULAR))
    name = g_strdup (file_name);

and it later tests for .so and .la by itself.  We had already done this
in _gtk_find_module()!

  Federico




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