xfce4-taskmanager not working on FreeBSD?
Xavier Otazu
xotazu at cvc.uab.es
Thu Feb 1 13:56:17 CET 2007
Hi:
This goodie has an important memory leak (in less than 5 minutes RAM
size grows higher than 100 Mb). Some time ago I submitted a patch for it
in this mail-list, but I think that the original developer never applied
it to the original source code.
Here I attach again the patch I made for an old Linux version of the xfce4-taskmanager. Probably original
developer can adapt it to the new version and Oliver can addapt it to
the FreeBSD port.
cheers
Xavier
--- xfce4-taskmanager-0.2.1/src/functions.c 2005-02-01 23:32:27.000000000 +0100
+++ xfce4-taskmanager-0.2.1_xop/src/functions.c 2005-04-03 23:51:54.000000000 +0200
@@ -62,6 +62,8 @@
g_strlcat(task_file_name,"/status", 256);
gchar buffer[256];
+ gchar label[256];
+ gchar **tmp, **tmp_uid;
gint line_count = 0;
struct task task;
struct passwd *passwdp;
@@ -70,7 +72,7 @@
{
while(fgets(buffer, 256, task_file) != NULL)
{
- if(line_count == 0)
+/* if(line_count == 0)
strcpy(task.name,g_strstrip(g_strsplit(buffer, ":", 2)[1]));
else if(line_count == 3)
strcpy(task.pid,g_strstrip(g_strsplit(buffer, ":", 2)[1]));
@@ -81,7 +83,23 @@
passwdp = getpwuid(atoi(g_strsplit(g_strstrip(g_strsplit(buffer, ":", 2)[1]), "\t", 2)[0]));
strcpy(task.uid, passwdp->pw_name);
}
-
+*/
+ tmp=g_strsplit(buffer, ":", 2);
+ strcpy(label,tmp[0]);
+ if(!strcmp(label,"Name"))
+ strcpy(task.name,g_strstrip(tmp[1]));
+ else if(!strcmp(label,"Pid"))
+ strcpy(task.pid,g_strstrip(tmp[1]));
+ else if(!strcmp(label,"PPid"))
+ strcpy(task.ppid,g_strstrip(tmp[1]));
+ else if(!strcmp(label,"Uid"))
+ {
+ tmp_uid=g_strsplit(g_strstrip(tmp[1]), "\t", 2);
+ passwdp = getpwuid(atoi(tmp_uid[0]));
+ strcpy(task.uid, passwdp->pw_name);
+ g_strfreev(tmp_uid);
+ }
+ g_strfreev(tmp);
line_count++;
}
On Thu, 01 Feb 2007 12:00:02 +0100
xfce4-dev-request at xfce.org wrote:
> 2007/1/31, Oliver Lehmann <oliver at freebsd.org>:
> ed is my first attempt in parsing the freebsd proc status file...
> > CPU is not displayed properly, and I'm not sure how to fill the
> > other fields in the display which are not delivered by FreeBSDs
> > status file
> >
> > Are there plans to migrate xfce4-taskmanager away from procfs?
>
> If we can make it work on more OS-es why not, but there is not active
> maintainer for the taskmanager atm. Anyway if your patch doesn't break
> the linux build and it works on *bsd (including multi procs if
> possible) I will commit the patch.
>
> Nick
More information about the Xfce4-dev
mailing list