Update Solaris patch from Peter Tribble
Check for the lib kstat in the autoconf script. Build with the correct file for Solaris in the automake script. Fixed the xfce_err messages and switched to g_snprintf for the command strings. Updated the TODO file.
This commit is contained in:
13
TODO
13
TODO
@@ -1,8 +1,17 @@
|
|||||||
+ drop old gtk_tooltips
|
+ drop old gtk_tooltips
|
||||||
+ display mem < 0MB (we can't show in KB unless we rewrite the sort function
|
|
||||||
which I think is not worth the effort)
|
|
||||||
+ support multi core (show cpu usage per process)
|
+ support multi core (show cpu usage per process)
|
||||||
+ move get_cpu_usage() out from functions.c, it is an os-dependant function
|
+ move get_cpu_usage() out from functions.c, it is an os-dependant function
|
||||||
|
+ change priority numbers against an enum with text labels Low Medium Normal
|
||||||
|
High Very-high
|
||||||
|
+ figure a proper way to get the cpu usage of a process, currently the
|
||||||
|
time/old_time is messy and BSD doesn't even do it this way which makes this
|
||||||
|
os dependant
|
||||||
|
|
||||||
|
+ settings dialog
|
||||||
|
+ 1-move the current Preferences submenu
|
||||||
|
+ 2-switch the button action to show the dialog
|
||||||
|
+ 3-drop the submenu
|
||||||
|
+ CPU precision with 2 decimals
|
||||||
|
|
||||||
+ *BSD support with the 'kvm' files
|
+ *BSD support with the 'kvm' files
|
||||||
+ ability to switch to a tree-store
|
+ ability to switch to a tree-store
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ AC_INIT([Xfce4 Taskmanager], [taskmanager_version], [http://bugzilla.xfce.org/],
|
|||||||
[http://goodies.xfce.org/projects/applications/xfce4-taskmanager])
|
[http://goodies.xfce.org/projects/applications/xfce4-taskmanager])
|
||||||
AC_PREREQ([2.50])
|
AC_PREREQ([2.50])
|
||||||
AC_CANONICAL_TARGET()
|
AC_CANONICAL_TARGET()
|
||||||
AC_REVISION([$Id: configure.in.in 5430 2008-09-21 19:49:06Z mmassonnet $])
|
AC_REVISION([taskmanager_version_build])
|
||||||
|
|
||||||
dnl ***************************
|
dnl ***************************
|
||||||
dnl *** Initialize automake ***
|
dnl *** Initialize automake ***
|
||||||
dnl ***************************
|
dnl ***************************
|
||||||
AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
|
AM_INIT_AUTOMAKE([1.8 dist-bzip2])
|
||||||
AM_CONFIG_HEADER([config.h])
|
AM_CONFIG_HEADER([config.h])
|
||||||
AM_MAINTAINER_MODE()
|
AM_MAINTAINER_MODE()
|
||||||
|
|
||||||
@@ -82,6 +82,7 @@ case "$target_os" in
|
|||||||
;;
|
;;
|
||||||
solaris*)
|
solaris*)
|
||||||
ac_taskmanager_os_family="solaris"
|
ac_taskmanager_os_family="solaris"
|
||||||
|
AC_CHECK_LIB([kstat], [kstat_open])
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ac_taskmanager_os_family="linux"
|
ac_taskmanager_os_family="linux"
|
||||||
@@ -109,7 +110,7 @@ dnl ***************************
|
|||||||
echo
|
echo
|
||||||
echo "Build Configuration:"
|
echo "Build Configuration:"
|
||||||
echo
|
echo
|
||||||
echo "* Target OS: $target_os"
|
echo "* Target OS: $ac_taskmanager_os_family"
|
||||||
echo "* Debug Support: $enable_debug"
|
echo "* Debug Support: $enable_debug"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
# $Id$
|
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
-I$(top_srcdir)/include \
|
-I$(top_srcdir)/include \
|
||||||
-DG_LOG_DOMAIN=\"xfce4-taskmanager\" \
|
-DG_LOG_DOMAIN=\"xfce4-taskmanager\" \
|
||||||
@@ -25,7 +23,7 @@ if OS_BSD_FAMILY
|
|||||||
xfce4_taskmanager_SOURCES += taskmanager-bsd.c
|
xfce4_taskmanager_SOURCES += taskmanager-bsd.c
|
||||||
endif
|
endif
|
||||||
if OS_SOLARIS
|
if OS_SOLARIS
|
||||||
xfce4_taskmanager_SOURCES += taskmanager-linux.c
|
xfce4_taskmanager_SOURCES += taskmanager-solaris.c
|
||||||
endif
|
endif
|
||||||
if OS_LINUX
|
if OS_LINUX
|
||||||
xfce4_taskmanager_SOURCES += taskmanager-linux.c
|
xfce4_taskmanager_SOURCES += taskmanager-linux.c
|
||||||
|
|||||||
@@ -58,13 +58,20 @@ gboolean refresh_task_list(void)
|
|||||||
|
|
||||||
tmp->old_time_percentage = tmp->time_percentage;
|
tmp->old_time_percentage = tmp->time_percentage;
|
||||||
tmp->time_percentage = (gdouble)(tmp->time - tmp->old_time) * (1.0/num_cpus);
|
tmp->time_percentage = (gdouble)(tmp->time - tmp->old_time) * (1.0/num_cpus);
|
||||||
|
#endif
|
||||||
|
#ifdef __sun
|
||||||
|
tmp->old_time = tmp->time;
|
||||||
|
tmp->time = new_tmp->time;
|
||||||
|
|
||||||
|
tmp->old_time_percentage = tmp->time_percentage;
|
||||||
|
tmp->time_percentage = (gdouble)(tmp->time - tmp->old_time) / (100.0*num_cpus);
|
||||||
#endif
|
#endif
|
||||||
if(
|
if(
|
||||||
tmp->ppid != new_tmp->ppid ||
|
tmp->ppid != new_tmp->ppid ||
|
||||||
strcmp(tmp->state,new_tmp->state) ||
|
strcmp(tmp->state,new_tmp->state) ||
|
||||||
tmp->vsize != new_tmp->vsize ||
|
tmp->vsize != new_tmp->vsize ||
|
||||||
tmp->rss != new_tmp->rss ||
|
tmp->rss != new_tmp->rss ||
|
||||||
#ifdef __linux
|
#ifdef __linux || __sun
|
||||||
tmp->time_percentage != tmp->old_time_percentage ||
|
tmp->time_percentage != tmp->old_time_percentage ||
|
||||||
#endif
|
#endif
|
||||||
tmp->prio != new_tmp->prio
|
tmp->prio != new_tmp->prio
|
||||||
|
|||||||
@@ -238,6 +238,37 @@ GtkWidget *create_prio_submenu(void)
|
|||||||
GtkWidget *prio_submenu = gtk_menu_new ();
|
GtkWidget *prio_submenu = gtk_menu_new ();
|
||||||
GtkWidget *menu_item;
|
GtkWidget *menu_item;
|
||||||
|
|
||||||
|
#ifdef __sun
|
||||||
|
menu_item = gtk_menu_item_new_with_label ("0");
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (GTK_BIN (menu_item)->child), 1.0, 0.5);
|
||||||
|
gtk_widget_show (menu_item);
|
||||||
|
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||||
|
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "0");
|
||||||
|
|
||||||
|
menu_item = gtk_menu_item_new_with_label ("-5");
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (GTK_BIN (menu_item)->child), 1.0, 0.5);
|
||||||
|
gtk_widget_show (menu_item);
|
||||||
|
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||||
|
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "-5");
|
||||||
|
|
||||||
|
menu_item = gtk_menu_item_new_with_label ("-10");
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (GTK_BIN (menu_item)->child), 1.0, 0.5);
|
||||||
|
gtk_widget_show (menu_item);
|
||||||
|
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||||
|
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "-10");
|
||||||
|
|
||||||
|
menu_item = gtk_menu_item_new_with_label ("-15");
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (GTK_BIN (menu_item)->child), 1.0, 0.5);
|
||||||
|
gtk_widget_show (menu_item);
|
||||||
|
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||||
|
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "-15");
|
||||||
|
|
||||||
|
menu_item = gtk_menu_item_new_with_label ("-20");
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (GTK_BIN (menu_item)->child), 1.0, 0.5);
|
||||||
|
gtk_widget_show (menu_item);
|
||||||
|
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||||
|
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "-20");
|
||||||
|
#else
|
||||||
menu_item = gtk_menu_item_new_with_label ("-10");
|
menu_item = gtk_menu_item_new_with_label ("-10");
|
||||||
gtk_misc_set_alignment (GTK_MISC (GTK_BIN (menu_item)->child), 1.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (GTK_BIN (menu_item)->child), 1.0, 0.5);
|
||||||
gtk_widget_show (menu_item);
|
gtk_widget_show (menu_item);
|
||||||
@@ -267,6 +298,7 @@ GtkWidget *create_prio_submenu(void)
|
|||||||
gtk_widget_show (menu_item);
|
gtk_widget_show (menu_item);
|
||||||
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
gtk_container_add (GTK_CONTAINER (prio_submenu), menu_item);
|
||||||
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "10");
|
g_signal_connect ((gpointer) menu_item, "activate", G_CALLBACK (handle_prio_menu), "10");
|
||||||
|
#endif
|
||||||
|
|
||||||
return prio_submenu;
|
return prio_submenu;
|
||||||
}
|
}
|
||||||
@@ -451,7 +483,7 @@ void fill_list_item(gint i, GtkTreeIter *iter)
|
|||||||
(gdouble)(task->rss)/1024/1024);
|
(gdouble)(task->rss)/1024/1024);
|
||||||
name = g_strdup_printf("%s", task->name);
|
name = g_strdup_printf("%s", task->name);
|
||||||
uname = g_strdup_printf("%s", task->uname);
|
uname = g_strdup_printf("%s", task->uname);
|
||||||
time = g_strdup_printf("%0d%%", (guint)task->time_percentage);
|
time = g_strdup_printf("%.0f%%", task->time_percentage);
|
||||||
prio = g_strdup_printf("%i", task->prio); /* my change */
|
prio = g_strdup_printf("%i", task->prio); /* my change */
|
||||||
|
|
||||||
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_NAME, name, -1);
|
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_NAME, name, -1);
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void send_signal_to_task(gint task_id, gint signal)
|
|||||||
ret = kill(task_id, signal);
|
ret = kill(task_id, signal);
|
||||||
|
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
xfce_err(_("Couldn't send signal to the task with ID %d"), signal, task_id);
|
xfce_err(_("Couldn't send signal %d to the task with ID %d"), signal, task_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ void set_priority_to_task(gint task_id, gint prio)
|
|||||||
if(task_id > 0)
|
if(task_id > 0)
|
||||||
{
|
{
|
||||||
gchar command[128] = "";
|
gchar command[128] = "";
|
||||||
g_sprintf(command, "renice %d %d > /dev/null", prio, task_id);
|
g_snprintf(command, 128, "renice %d %d > /dev/null", prio, task_id);
|
||||||
|
|
||||||
if(system(command) != 0)
|
if(system(command) != 0)
|
||||||
xfce_err(_("Couldn't set priority %d to the task with ID %d"), prio, task_id);
|
xfce_err(_("Couldn't set priority %d to the task with ID %d"), prio, task_id);
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ void send_signal_to_task(gint task_id, gint signal)
|
|||||||
ret = kill(task_id, signal);
|
ret = kill(task_id, signal);
|
||||||
|
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
xfce_err(_("Couldn't send signal to the task with ID %d"), signal, task_id);
|
xfce_err(_("Couldn't send signal %d to the task with ID %d"), signal, task_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ void set_priority_to_task(gint task_id, gint prio)
|
|||||||
if(task_id > 0)
|
if(task_id > 0)
|
||||||
{
|
{
|
||||||
gchar command[128] = "";
|
gchar command[128] = "";
|
||||||
g_sprintf(command, "renice %d %d > /dev/null", prio, task_id);
|
g_snprintf(command, 128, "renice %d %d > /dev/null", prio, task_id);
|
||||||
|
|
||||||
if(system(command) != 0)
|
if(system(command) != 0)
|
||||||
xfce_err(_("Couldn't set priority %d to the task with ID %d"), prio, task_id);
|
xfce_err(_("Couldn't set priority %d to the task with ID %d"), prio, task_id);
|
||||||
|
|||||||
@@ -18,6 +18,19 @@
|
|||||||
|
|
||||||
#include "taskmanager.h"
|
#include "taskmanager.h"
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <kstat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <procfs.h>
|
||||||
|
#include <sys/procfs.h>
|
||||||
|
|
||||||
|
kstat_ctl_t *kc;
|
||||||
|
|
||||||
static void init_stats()
|
static void init_stats()
|
||||||
{
|
{
|
||||||
kc = kstat_open();
|
kc = kstat_open();
|
||||||
@@ -45,8 +58,9 @@ struct task get_task_details(gint pid)
|
|||||||
sprintf(pstate, "%c", thisproc.pr_lwp.pr_sname);
|
sprintf(pstate, "%c", thisproc.pr_lwp.pr_sname);
|
||||||
g_strlcpy(task.state, pstate, 16);
|
g_strlcpy(task.state, pstate, 16);
|
||||||
task.ppid = (gint) thisproc.pr_ppid;
|
task.ppid = (gint) thisproc.pr_ppid;
|
||||||
task.size = (gint) thisproc.pr_size;
|
task.prio = (gint) thisproc.pr_lwp.pr_pri;
|
||||||
task.rss = (gint) thisproc.pr_rssize;
|
task.vsize = (gint) thisproc.pr_size*1024;
|
||||||
|
task.rss = (gint) thisproc.pr_rssize*1024;
|
||||||
task.uid = (gint) thisproc.pr_uid;
|
task.uid = (gint) thisproc.pr_uid;
|
||||||
passwdp = getpwuid(thisproc.pr_uid);
|
passwdp = getpwuid(thisproc.pr_uid);
|
||||||
if(passwdp != NULL && passwdp->pw_name != NULL)
|
if(passwdp != NULL && passwdp->pw_name != NULL)
|
||||||
@@ -55,8 +69,8 @@ struct task get_task_details(gint pid)
|
|||||||
* To get the appropriate precision we need to multiply up by 10000
|
* To get the appropriate precision we need to multiply up by 10000
|
||||||
* so that when we convert to a percentage we can represent 0.01%.
|
* so that when we convert to a percentage we can represent 0.01%.
|
||||||
*/
|
*/
|
||||||
task.time = 10000*thisproc.pr_time.tv_sec + thisproc.pr_time.tv_nsec/100000;
|
|
||||||
task.old_time = task.time;
|
task.old_time = task.time;
|
||||||
|
task.time = 10000*thisproc.pr_time.tv_sec + thisproc.pr_time.tv_nsec/100000;
|
||||||
task.time_percentage = 0;
|
task.time_percentage = 0;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -188,7 +202,7 @@ void send_signal_to_task(gint task_id, gint signal)
|
|||||||
ret = kill(task_id, signal);
|
ret = kill(task_id, signal);
|
||||||
|
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
xfce_err(_("Couldn't send signal to the task with ID %d"), signal, task_id);
|
xfce_err(_("Couldn't send signal %d to the task with ID %d"), signal, task_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,8 +212,11 @@ void set_priority_to_task(gint task_id, gint prio)
|
|||||||
if(task_id > 0)
|
if(task_id > 0)
|
||||||
{
|
{
|
||||||
gchar command[128] = "";
|
gchar command[128] = "";
|
||||||
g_sprintf(command, "renice %d %d > /dev/null", prio, task_id);
|
g_snprintf(command, 128, "/usr/bin/priocntl -s -p %d -i pid %d > /dev/null", prio, task_id);
|
||||||
|
/*
|
||||||
|
* priocntl always returns 0, so this test is useless until
|
||||||
|
* priocntl gets fixed
|
||||||
|
*/
|
||||||
if(system(command) != 0)
|
if(system(command) != 0)
|
||||||
xfce_err(_("Couldn't set priority %d to the task with ID %d"), prio, task_id);
|
xfce_err(_("Couldn't set priority %d to the task with ID %d"), prio, task_id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user