kov changed libgksu/trunk/ChangeLog, libgksu/trunk/configure.ac, libgksu/trunk/libgksu/libgksu.c

Gustavo Noronha kov at costa.debian.org
Sun Jun 25 22:48:26 UTC 2006


Mensagem de log: 
	- accepted patch by Beno?\195?\174t Dejean <benoit at placenet.org>
	  to get the process name in a platform independent way


-----


Modified: libgksu/trunk/ChangeLog
===================================================================
--- libgksu/trunk/ChangeLog	2006-06-25 22:40:14 UTC (rev 626)
+++ libgksu/trunk/ChangeLog	2006-06-25 22:48:25 UTC (rev 627)
@@ -1,3 +1,9 @@
+2006-06-25  Gustavo Noronha Silva  <kov at debian.org>
+
+	* configure.ac, libgksu/libgksu.c:
+	- accepted patch by Benoît Dejean <benoit at placenet.org>
+	  to get the process name in a platform independent way
+
 2006-05-01  Gustavo Noronha Silva  <kov at debian.org>
 
 	* configure.ac:

Modified: libgksu/trunk/configure.ac
===================================================================
--- libgksu/trunk/configure.ac	2006-06-25 22:40:14 UTC (rev 626)
+++ libgksu/trunk/configure.ac	2006-06-25 22:48:25 UTC (rev 627)
@@ -21,7 +21,7 @@
 
 AM_MAINTAINER_MODE
 
-AC_DEFINE(PACKAGE, AC_PACKAGE_NAME, [package name])
+AC_DEFINE(PACKAGE, DOMAIN, [package name])
 AC_DEFINE(VERSION, AC_PACKAGE_VERSION, [package version])
 
 # Checks for programs.
@@ -40,7 +40,7 @@
 AC_PATH_PROG(GCONFTOOL, gconftool-2)
 AM_GCONF_SOURCE_2
 
-PKG_CHECK_MODULES(LIBGKSU, [gtk+-2.0 >= 2.4.0, gconf-2.0, libstartup-notification-1.0, gnome-keyring-1])
+PKG_CHECK_MODULES(LIBGKSU, [gtk+-2.0 >= 2.4.0, gconf-2.0, libstartup-notification-1.0, gnome-keyring-1, libgtop-2.0])
 
 # Checks for library functions.
 ALL_LINGUAS="ca cs da de es eu fr hu pl pt_BR ro ru sk nb nl"

Modified: libgksu/trunk/libgksu/libgksu.c
===================================================================
--- libgksu/trunk/libgksu/libgksu.c	2006-06-25 22:40:14 UTC (rev 626)
+++ libgksu/trunk/libgksu/libgksu.c	2006-06-25 22:48:25 UTC (rev 627)
@@ -31,6 +31,9 @@
 #include <sys/select.h>
 #include <errno.h>
 
+#include <glibtop.h>
+#include <glibtop/procstate.h>
+
 #define SN_API_NOT_YET_FROZEN
 #include <libsn/sn.h>
 
@@ -1012,25 +1015,16 @@
 static gchar *
 get_process_name (pid_t pid)
 {
-#ifdef linux
-  FILE *f;
-  char *cmdline = malloc (sizeof(gchar*)*256);
-  char *cmdfile = g_strdup_printf("/proc/%i/status",pid);
+  static gboolean init;
+  glibtop_proc_state buf;
 
-  cmdline[255] = '\0';
+  if (!init) {
+    glibtop_init();
+    init = TRUE;
+  }
 
-  f = fopen(cmdfile, "r");
-  g_free (cmdfile);
-  if(f != NULL)
-    {
-      fgets(cmdline, 255, f);
-      cmdline[255] = '\0';
-      fclose(f);
-    }
-  return cmdline;
-#else
-  return NULL;
-#endif
+  glibtop_get_proc_state (&buf, pid);
+  return strdup(buf.cmd);
 }
 
 /**




More information about the gksu-commits mailing list