patches/gnome-system-monitor-01-solaris.diff
author hz159841
Thu, 20 Jul 2006 11:23:00 +0000
changeset 7672 7d0c89cf1716
parent 7663 3c1d023035ce
child 7687 46a36a3ada37
permissions -rw-r--r--
2006-07-20 Henry Zhang <[email protected]> * Solaris/SUNWgnome-system-monitor.spec: fix the problem with omf * patches/gnome-system-monitor-01-solaris.diff: fix a monitor bug

diff -Nrup gnome-system-monitor-2.14.1/configure.in gnome-system-monitor-2.14.1.mod/configure.in
--- gnome-system-monitor-2.14.1/configure.in	2006-04-10 01:39:27.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/configure.in	2006-06-23 17:17:39.797532000 +0800
@@ -31,6 +31,12 @@ GNOME_VFS_REQUIRED=2.6.0
 LIBGKSUUI_REQUIRED=1.0.0
 LIBGKSU_REQUIRED=0.15.0
 
+case "$host" in
+*-*-solaris*) GMSGFMT_CHECKOPT= ;;
+*) GMSGFMT_CHECKOPT=-c ;;
+esac
+AC_SUBST( GMSGFMT_CHECKOPT)
+
 PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED)
 
 
diff -Nrup gnome-system-monitor-2.14.1/po/Makefile.in.in gnome-system-monitor-2.14.1.mod/po/Makefile.in.in
--- gnome-system-monitor-2.14.1/po/Makefile.in.in	2006-04-10 19:51:06.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/po/Makefile.in.in	2006-06-23 17:19:28.802301000 +0800
@@ -48,6 +48,7 @@ INSTALL_DATA = @INSTALL_DATA@
 
 CC = @CC@
 GMSGFMT = @GMSGFMT@
+GMSGFMT_CHECKOPT = @GMSGFMT_CHECKOPT@
 MSGFMT = @MSGFMT@
 XGETTEXT = @XGETTEXT@
 INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
@@ -90,7 +91,7 @@ CATOBJEXT = @CATOBJEXT@
 
 .po.gmo:
 	file=`echo $* | sed 's,.*/,,'`.gmo \
-	  && rm -f $$file && $(GMSGFMT) -o $$file $<
+	  && rm -f $$file && $(GMSGFMT) -o $(GMSGFMT_CHECKOPT) $$file $<
 
 .po.cat:
 	sed -f ../intl/po2msg.sed < $< > $*.msg \
diff -Nrup gnome-system-monitor-2.14.1/src/callbacks.c gnome-system-monitor-2.14.1.mod/src/callbacks.c
--- gnome-system-monitor-2.14.1/src/callbacks.c	2005-09-04 10:49:43.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/callbacks.c	2006-07-19 18:47:13.274807000 +0800
@@ -371,7 +371,6 @@ cb_change_current_page (GtkNotebook *nb,
 
 
 	if (num == 0) {
-
 		cb_timeout (procdata);
 
 		if (!procdata->timeout)
@@ -450,7 +449,11 @@ cb_timeout (gpointer data)
 		return FALSE;
 	}
 
-	return TRUE;
+	procdata->timeout = g_timeout_add(new_interval,
+					  cb_timeout,
+					  procdata);
+
+	return FALSE;
 }
 
 
diff -Nrup gnome-system-monitor-2.14.1/src/callbacks.h gnome-system-monitor-2.14.1.mod/src/callbacks.h
--- gnome-system-monitor-2.14.1/src/callbacks.h	2005-07-13 22:35:04.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/callbacks.h	2006-07-19 19:41:55.568027000 +0800
@@ -25,64 +25,64 @@
 #include "procman.h"
 #include <libgnomevfs/gnome-vfs.h>
 
-void		cb_show_memory_maps (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-void		cb_show_open_files (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-void		cb_renice (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-void		cb_end_process (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-void		cb_kill_process (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-void		cb_hide_process (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-void		cb_show_hidden_processes (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-void		cb_edit_preferences (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-
-void		cb_help_contents (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-void		cb_about (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-
-void		cb_app_exit (GtkAction *action, gpointer data) G_GNUC_INTERNAL;
-gboolean	cb_app_delete (GtkWidget *window, GdkEventAny *event, gpointer data) G_GNUC_INTERNAL;
-
-void		cb_end_process_button_pressed (GtkButton *button, gpointer data) G_GNUC_INTERNAL;
-void		cb_logout (GtkButton *button, gpointer data) G_GNUC_INTERNAL;
-
-void		cb_info_button_pressed (GtkButton *button, gpointer user_data) G_GNUC_INTERNAL;
-
-void		cb_cpu_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL;
-void		cb_mem_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL;
-void		cb_swap_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL;
-void		cb_net_in_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL;
-void		cb_net_out_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL;
-void		cb_bg_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL;
-void		cb_frame_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL;
-
-void		cb_row_selected (GtkTreeSelection *selection, gpointer data) G_GNUC_INTERNAL;
-
-gboolean	cb_tree_popup_menu (GtkWidget *widget, gpointer data) G_GNUC_INTERNAL;
-gboolean	cb_tree_button_pressed (GtkWidget *widget, GdkEventButton *event,
-					gpointer data) G_GNUC_INTERNAL;
-
-
-void		cb_change_current_page (GtkNotebook *nb,
-					gint num, gpointer data) G_GNUC_INTERNAL;
-void		cb_switch_page (GtkNotebook *nb, GtkNotebookPage *page,
-				gint num, gpointer data) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void		cb_show_memory_maps (GtkAction *action, gpointer data);
+G_GNUC_INTERNAL void		cb_show_open_files (GtkAction *action, gpointer data) ;
+G_GNUC_INTERNAL void		cb_renice (GtkAction *action, gpointer data) ;
+G_GNUC_INTERNAL void		cb_end_process (GtkAction *action, gpointer data) ;
+G_GNUC_INTERNAL void		cb_kill_process (GtkAction *action, gpointer data) ;
+G_GNUC_INTERNAL void		cb_hide_process (GtkAction *action, gpointer data) ;
+G_GNUC_INTERNAL void		cb_show_hidden_processes (GtkAction *action, gpointer data) ;
+G_GNUC_INTERNAL void		cb_edit_preferences (GtkAction *action, gpointer data) ;
+
+G_GNUC_INTERNAL void		cb_help_contents (GtkAction *action, gpointer data) ;
+G_GNUC_INTERNAL void		cb_about (GtkAction *action, gpointer data) ;
+
+G_GNUC_INTERNAL void		cb_app_exit (GtkAction *action, gpointer data) ;
+G_GNUC_INTERNAL gboolean	cb_app_delete (GtkWidget *window, GdkEventAny *event, gpointer data) ;
+
+G_GNUC_INTERNAL void		cb_end_process_button_pressed (GtkButton *button, gpointer data) ;
+G_GNUC_INTERNAL void		cb_logout (GtkButton *button, gpointer data) ;
+
+G_GNUC_INTERNAL void		cb_info_button_pressed (GtkButton *button, gpointer user_data) ;
+
+G_GNUC_INTERNAL void		cb_cpu_color_changed (GtkColorButton *widget, gpointer user_data) ;
+G_GNUC_INTERNAL void		cb_mem_color_changed (GtkColorButton *widget, gpointer user_data) ;
+G_GNUC_INTERNAL void		cb_swap_color_changed (GtkColorButton *widget, gpointer user_data) ;
+G_GNUC_INTERNAL void		cb_net_in_color_changed (GtkColorButton *widget, gpointer user_data) ;
+G_GNUC_INTERNAL void		cb_net_out_color_changed (GtkColorButton *widget, gpointer user_data) ;
+G_GNUC_INTERNAL void		cb_bg_color_changed (GtkColorButton *widget, gpointer user_data) ;
+G_GNUC_INTERNAL void		cb_frame_color_changed (GtkColorButton *widget, gpointer user_data) ;
+
+G_GNUC_INTERNAL void		cb_row_selected (GtkTreeSelection *selection, gpointer data) ;
+
+G_GNUC_INTERNAL gboolean	cb_tree_popup_menu (GtkWidget *widget, gpointer data) ;
+G_GNUC_INTERNAL gboolean	cb_tree_button_pressed (GtkWidget *widget, GdkEventButton *event,
+					gpointer data) ;
+
+
+G_GNUC_INTERNAL void		cb_change_current_page (GtkNotebook *nb,
+					gint num, gpointer data) ;
+G_GNUC_INTERNAL void		cb_switch_page (GtkNotebook *nb, GtkNotebookPage *page,
+				gint num, gpointer data) ;
 
-gint		cb_update_disks (gpointer data) G_GNUC_INTERNAL;
-gint		cb_timeout (gpointer data) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL gint		cb_update_disks (gpointer data) ;
+G_GNUC_INTERNAL gint		cb_timeout (gpointer data) ;
 
-void		cb_volume_mounted_or_unmounted(GnomeVFSVolumeMonitor *vfsvolumemonitor,
+G_GNUC_INTERNAL void		cb_volume_mounted_or_unmounted(GnomeVFSVolumeMonitor *vfsvolumemonitor,
 					       GnomeVFSVolume *vol,
-					       gpointer procdata) G_GNUC_INTERNAL;
+					       gpointer procdata) ;
 
-void		cb_radio_processes(GtkAction *action,
+G_GNUC_INTERNAL void		cb_radio_processes(GtkAction *action,
 				   GtkRadioAction *current,
-				   gpointer data) G_GNUC_INTERNAL;
+				   gpointer data) ;
 
 
 
-void		cb_kill_sigstop(GtkAction *action,
-				gpointer data) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void		cb_kill_sigstop(GtkAction *action,
+				gpointer data) ;
 
-void		cb_kill_sigcont(GtkAction *action,
-				gpointer data) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void		cb_kill_sigcont(GtkAction *action,
+				gpointer data) ;
 
 
 #endif /* _PROCMAN_CALLBACKS_H_ */
diff -Nrup gnome-system-monitor-2.14.1/src/favorites.h gnome-system-monitor-2.14.1.mod/src/favorites.h
--- gnome-system-monitor-2.14.1/src/favorites.h	2005-03-17 17:23:13.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/favorites.h	2006-07-19 19:43:15.233467000 +0800
@@ -26,15 +26,15 @@
 
 #include "procman.h"
 
-void 		save_blacklist (ProcData *procdata, GConfClient *client) G_GNUC_INTERNAL;
-void		add_to_blacklist (ProcData *procdata, gchar *name) G_GNUC_INTERNAL;
-void		add_selected_to_blacklist (ProcData *procdata) G_GNUC_INTERNAL;
-void		remove_from_blacklist (ProcData *procdata, gchar *name) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void 		save_blacklist (ProcData *procdata, GConfClient *client);
+G_GNUC_INTERNAL void		add_to_blacklist (ProcData *procdata, gchar *name) ;
+G_GNUC_INTERNAL void		add_selected_to_blacklist (ProcData *procdata) ;
+G_GNUC_INTERNAL void		remove_from_blacklist (ProcData *procdata, gchar *name) ;
 
-gboolean	is_process_blacklisted (ProcData *procdata, gchar *name) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL gboolean	is_process_blacklisted (ProcData *procdata, gchar *name) ;
 
-void 		get_blacklist (ProcData *procdata, GConfClient *client) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void 		get_blacklist (ProcData *procdata, GConfClient *client) ;
 
-void		create_blacklist_dialog (ProcData *procdata) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void		create_blacklist_dialog (ProcData *procdata) ;
 
 #endif
diff -Nrup gnome-system-monitor-2.14.1/src/interface.h gnome-system-monitor-2.14.1.mod/src/interface.h
--- gnome-system-monitor-2.14.1/src/interface.h	2005-03-17 22:23:42.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/interface.h	2006-07-19 19:44:10.487576000 +0800
@@ -25,9 +25,9 @@
 #include "procman.h"
 
 
-void		create_main_window (ProcData *data) G_GNUC_INTERNAL;
-void		update_sensitivity (ProcData *data, gboolean sensitivity) G_GNUC_INTERNAL;
-void            do_popup_menu(ProcData *data, GdkEventButton *event) G_GNUC_INTERNAL;
-GtkWidget *	make_title_label (const char *text) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void		create_main_window (ProcData *data) ;
+G_GNUC_INTERNAL void		update_sensitivity (ProcData *data, gboolean sensitivity) ;
+G_GNUC_INTERNAL void            do_popup_menu(ProcData *data, GdkEventButton *event) ;
+G_GNUC_INTERNAL GtkWidget *	make_title_label (const char *text) ;
 
 #endif /* _PROCMAN_INTERFACE_H_ */
diff -Nrup gnome-system-monitor-2.14.1/src/load-graph.c gnome-system-monitor-2.14.1.mod/src/load-graph.c
--- gnome-system-monitor-2.14.1/src/load-graph.c	2006-04-10 00:46:29.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/load-graph.c	2006-07-07 14:16:03.034343000 +0800
@@ -26,6 +26,10 @@
 
 #define NUM_POINTS 100
 #define GRAPH_MIN_HEIGHT 30
+/*static const unsigned needed_netload_flags =
+(1 << GLIBTOP_NETLOAD_IF_FLAGS) +
+(1 << GLIBTOP_NETLOAD_BYTES_TOTAL);
+*/
 
 
 enum {
@@ -71,7 +75,7 @@ struct _LoadGraph {
 			GTimeVal time;
 			float max;
 		} net;
-	};
+	}category;
 };
 
 
@@ -206,8 +210,8 @@ get_load (LoadGraph *g)
 
 #undef NOW
 #undef LAST
-#define NOW  (g->cpu.times[g->cpu.now])
-#define LAST (g->cpu.times[g->cpu.now ^ 1])
+#define NOW  (g->category.cpu.times[g->category.cpu.now])
+#define LAST (g->category.cpu.times[g->category.cpu.now ^ 1])
 
 	if (g->n == 1) {
 		NOW[0][CPU_TOTAL] = cpu.total;
@@ -220,9 +224,9 @@ get_load (LoadGraph *g)
 		}
 	}
 
-	if (G_UNLIKELY(!g->cpu.initialized)) {
+	if (G_UNLIKELY(!g->category.cpu.initialized)) {
 		/* No data yet */
-		g->cpu.initialized = TRUE;
+		g->category.cpu.initialized = TRUE;
 	} else {
 		for (i = 0; i < g->n; i++) {
 			float load;
@@ -242,7 +246,7 @@ get_load (LoadGraph *g)
 		}
 	}
 
-	g->cpu.now ^= 1;
+	g->category.cpu.now ^= 1;
 
 #undef NOW
 #undef LAST
@@ -293,7 +297,7 @@ static void
 net_scale (LoadGraph *g, float new_max)
 {
 	gint i;
-	float old_max = MAX (g->net.max, 1.0f), scale;
+	float old_max = MAX (g->category.net.max, 1.0f), scale;
 
 	if (new_max <= old_max)
 		return;
@@ -307,7 +311,8 @@ net_scale (LoadGraph *g, float new_max)
 		}
 	}
 
-	g->net.max = new_max;
+
+	g->category.net.max = new_max;
 }
 
 static void
@@ -328,12 +333,17 @@ get_net (LoadGraph *g)
 		glibtop_netload netload;
 		glibtop_get_netload (&netload, ifnames[i]);
 
+/*		if ((netload.flags & needed_netload_flags) != needed_netload_flags)
+			continue;
+		if (!(netload.if_flags & (1L << GLIBTOP_IF_FLAGS_UP)))
+            		continue;
+*/
 		if (netload.if_flags & (1 << GLIBTOP_IF_FLAGS_LOOPBACK))
 			continue;
-
+		
 		/* Don't skip interfaces that are down (GLIBTOP_IF_FLAGS_UP)
 		   to avoid spikes when they are brought up */
-
+					   
 		in  += netload.bytes_in;
 		out += netload.bytes_out;
 	}
@@ -342,13 +352,13 @@ get_net (LoadGraph *g)
 
 	g_get_current_time (&time);
 
-	if (in >= g->net.last_in && out >= g->net.last_out &&
-	    g->net.time.tv_sec != 0) {
+	if (in >= g->category.net.last_in && out >= g->category.net.last_out &&
+            g->category.net.time.tv_sec != 0) {
 		float dtime;
-		dtime = time.tv_sec - g->net.time.tv_sec +
-			(float) (time.tv_usec - g->net.time.tv_usec) / G_USEC_PER_SEC;
-		din   = (in - g->net.last_in) / dtime;
-		dout  = (out - g->net.last_out) / dtime;
+		dtime = time.tv_sec - g->category.net.time.tv_sec +
+			(float) (time.tv_usec - g->category.net.time.tv_usec) / G_USEC_PER_SEC;
+		din   = (in - g->category.net.last_in) / dtime;
+		dout  = (out - g->category.net.last_out) / dtime;
 	} else {
 		/* Don't calc anything if new data is less than old (interface
 		   removed, counters reset, ...) or if it is the first time */
@@ -356,15 +366,16 @@ get_net (LoadGraph *g)
 		dout = 0.0f;
 	}
 
-	g->net.last_in  = in;
-	g->net.last_out = out;
-	g->net.time     = time;
+	g->category.net.last_in  = in;
+	g->category.net.last_out = out;
+	g->category.net.time     = time;
 
-	g->data[0][0] = din  / MAX(g->net.max, 1.0f);
-	g->data[0][1] = dout / MAX(g->net.max, 1.0f);
 
+	g->data[0][0] = din  / MAX(g->category.net.max, 1.0f);
+	g->data[0][1] = dout / MAX(g->category.net.max, 1.0f);
+	
 	net_scale (g, MAX (din, dout));
-
+	
 	text1 = SI_gnome_vfs_format_file_size_for_display (din);
 	text2 = g_strdup_printf (_("%s/s"), text1);
 	gtk_label_set_text (GTK_LABEL (g->labels.net_in), text2);
diff -Nrup gnome-system-monitor-2.14.1/src/load-graph.h gnome-system-monitor-2.14.1.mod/src/load-graph.h
--- gnome-system-monitor-2.14.1/src/load-graph.h	2006-01-02 17:28:58.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/load-graph.h	2006-07-19 19:45:43.271548000 +0800
@@ -34,35 +34,35 @@ struct _LoadGraphLabels
 
 
 /* Create new load graph. */
-LoadGraph *
-load_graph_new (gint type, ProcData *procdata) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL LoadGraph *
+load_graph_new (gint type, ProcData *procdata);
 
 /* Force a drawing update */
-void
-load_graph_draw (LoadGraph *g) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void
+load_graph_draw (LoadGraph *g) ;
 
 /* Start load graph. */
-void
-load_graph_start (LoadGraph *g) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void
+load_graph_start (LoadGraph *g) ;
 
 /* Stop load graph. */
-void
-load_graph_stop (LoadGraph *g) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void
+load_graph_stop (LoadGraph *g) ;
 
 /* Change load graph speed and restart it if it has been previously started */
-void
+G_GNUC_INTERNAL void
 load_graph_change_speed (LoadGraph *g,
-			 guint new_speed) G_GNUC_INTERNAL;
+			 guint new_speed) ;
 
-GdkColor*
-load_graph_get_colors (LoadGraph *g) G_GNUC_INTERNAL G_GNUC_CONST;
+G_GNUC_INTERNAL GdkColor*
+load_graph_get_colors (LoadGraph *g)  G_GNUC_CONST;
 
-LoadGraphLabels*
-load_graph_get_labels (LoadGraph *g) G_GNUC_INTERNAL G_GNUC_CONST;
+G_GNUC_INTERNAL LoadGraphLabels*
+load_graph_get_labels (LoadGraph *g)  G_GNUC_CONST;
 
 
-GtkWidget*
-load_graph_get_widget (LoadGraph *g) G_GNUC_INTERNAL G_GNUC_CONST;
+G_GNUC_INTERNAL GtkWidget*
+load_graph_get_widget (LoadGraph *g)  G_GNUC_CONST;
 
 
 #endif /* _PROCMAN_LOAD_GRAPH_H_ */
diff -Nrup gnome-system-monitor-2.14.1/src/memmaps.h gnome-system-monitor-2.14.1.mod/src/memmaps.h
--- gnome-system-monitor-2.14.1/src/memmaps.h	2005-03-17 17:23:13.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/memmaps.h	2006-07-19 19:46:11.814984000 +0800
@@ -4,6 +4,6 @@
 #include <glib/gtypes.h>
 #include "procman.h"
 
-void 		create_memmaps_dialog (ProcData *procdata) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void 		create_memmaps_dialog (ProcData *procdata) ;
 
 #endif /* _PROCMAN_MEMMAPS_H_ */
diff -Nrup gnome-system-monitor-2.14.1/src/openfiles.h gnome-system-monitor-2.14.1.mod/src/openfiles.h
--- gnome-system-monitor-2.14.1/src/openfiles.h	2005-03-17 17:23:13.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/openfiles.h	2006-07-19 19:46:23.623237000 +0800
@@ -5,7 +5,7 @@
 
 #include "procman.h"
 
-void 		create_openfiles_dialog (ProcData *procdata) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void 		create_openfiles_dialog (ProcData *procdata) ;
 
 
 #endif
diff -Nrup gnome-system-monitor-2.14.1/src/prettytable.h gnome-system-monitor-2.14.1.mod/src/prettytable.h
--- gnome-system-monitor-2.14.1/src/prettytable.h	2005-02-16 23:40:01.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/prettytable.h	2006-07-19 19:46:54.611707000 +0800
@@ -6,10 +6,10 @@
 #include "procman.h"
 
 
-void		pretty_table_new (ProcData *procdata) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void		pretty_table_new (ProcData *procdata) ;
 
-GdkPixbuf*	pretty_table_get_icon (PrettyTable *pretty_table,
-				       const gchar *command, guint pid) G_GNUC_INTERNAL;
-void 		pretty_table_free (PrettyTable *pretty_table) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL GdkPixbuf*	pretty_table_get_icon (PrettyTable *pretty_table,
+				       const gchar *command, guint pid) ;
+G_GNUC_INTERNAL void 		pretty_table_free (PrettyTable *pretty_table) ;
 
 #endif /* _PROCMAN_PRETTYTABLE_H_ */
diff -Nrup gnome-system-monitor-2.14.1/src/procactions.c gnome-system-monitor-2.14.1.mod/src/procactions.c
--- gnome-system-monitor-2.14.1/src/procactions.c	2005-12-01 23:46:20.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/procactions.c	2006-07-20 16:43:42.394779000 +0800
@@ -25,6 +25,8 @@
 #include <signal.h>
 #include <sys/time.h>
 #include <sys/resource.h>
+#include <procfs.h>
+#include <fcntl.h>
 #include "procactions.h"
 #include "procman.h"
 #include "proctable.h"
@@ -111,12 +113,35 @@ kill_single_process (GtkTreeModel *model
 	int error;
 	int saved_errno;
 	GtkWidget *dialog;
-
+	int fd;
+	char buffer[BUFSIZ];
+	struct pstatus *pstatus;
+	
 	gtk_tree_model_get (model, iter, COL_POINTER, &info, -1);
 
 	if (!info)
 		return;
-
+	/*
+         * If the process is a system process, we can't control it even as root
+         */
+	sprintf(buffer, "/proc/%d/status", (int)info->pid);
+	if((fd = s_open(buffer, O_RDONLY)) < 0)
+		return;
+		
+	if(s_pread(fd, pstatus, sizeof(struct pstatus), 0)
+	   != sizeof(struct pstatus))
+	{
+		s_close(fd);
+		return;
+	}
+		
+	s_close(fd);
+	
+     	if (pstatus->pr_flags & PR_ISSYS) {
+		return;
+     	}
+	
+	/* if it is not a system process, we can kill it now */
 	error = kill (info->pid, args->signal);
 
 	/* success */
diff -Nrup gnome-system-monitor-2.14.1/src/procactions.h gnome-system-monitor-2.14.1.mod/src/procactions.h
--- gnome-system-monitor-2.14.1/src/procactions.h	2005-12-01 21:06:34.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/procactions.h	2006-07-19 19:47:15.262213000 +0800
@@ -21,8 +21,8 @@
 
 #include "procman.h"
  
-void		renice (ProcData *procdata, int nice) G_GNUC_INTERNAL;
-void		kill_process (ProcData *procdata, int sig) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL  void		renice (ProcData *procdata, int nice) ;
+G_GNUC_INTERNAL void		kill_process (ProcData *procdata, int sig) ;
 
 #endif
 
diff -Nrup gnome-system-monitor-2.14.1/src/procdialogs.c gnome-system-monitor-2.14.1.mod/src/procdialogs.c
--- gnome-system-monitor-2.14.1/src/procdialogs.c	2006-04-10 01:19:39.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/procdialogs.c	2006-07-08 02:26:05.271840000 +0800
@@ -333,7 +333,7 @@ smooth_refresh_toggled(GtkToggleButton *
 
 	gboolean toggled;
 
-	toggled = gtk_toggle_button_get_active(button);
+	toggled = TRUE; /*gtk_toggle_button_get_active(button);*/
 
 	gconf_client_set_bool(client, SMOOTH_REFRESH_KEY, toggled, NULL);
 }
diff -Nrup gnome-system-monitor-2.14.1/src/procdialogs.h gnome-system-monitor-2.14.1.mod/src/procdialogs.h
--- gnome-system-monitor-2.14.1/src/procdialogs.h	2005-12-01 23:46:20.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/procdialogs.h	2006-07-19 19:47:52.878996000 +0800
@@ -42,14 +42,14 @@ typedef enum
 } ProcmanActionType;
 
 
-void			procdialog_create_hide_dialog (ProcData *data) G_GNUC_INTERNAL;
-void			procdialog_create_kill_dialog (ProcData *data, int signal) G_GNUC_INTERNAL;
-void 			procdialog_create_renice_dialog (ProcData *data) G_GNUC_INTERNAL;
-gboolean		procdialog_create_root_password_dialog (ProcmanActionType type,
+G_GNUC_INTERNAL void			procdialog_create_hide_dialog (ProcData *data) ;
+G_GNUC_INTERNAL void			procdialog_create_kill_dialog (ProcData *data, int signal) ;
+G_GNUC_INTERNAL void 			procdialog_create_renice_dialog (ProcData *data) ;
+G_GNUC_INTERNAL gboolean		procdialog_create_root_password_dialog (ProcmanActionType type,
 								ProcData *procdata,
-								gint pid, gint extra_value) G_GNUC_INTERNAL;
-void 			procdialog_create_memmaps_dialog (ProcData *data) G_GNUC_INTERNAL;
-void			procdialog_create_preferences_dialog (ProcData *data) G_GNUC_INTERNAL;
+								gint pid, gint extra_value) ;
+G_GNUC_INTERNAL void 			procdialog_create_memmaps_dialog (ProcData *data) ;
+G_GNUC_INTERNAL void			procdialog_create_preferences_dialog (ProcData *data) ;
 
 #endif
 
diff -Nrup gnome-system-monitor-2.14.1/src/procman.h gnome-system-monitor-2.14.1.mod/src/procman.h
--- gnome-system-monitor-2.14.1/src/procman.h	2006-03-25 16:35:49.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/procman.h	2006-07-19 19:48:19.238672000 +0800
@@ -179,9 +179,9 @@ struct _ProcData
 	SmoothRefresh  *smooth_refresh;
 };
 
-void		procman_save_config (ProcData *data) G_GNUC_INTERNAL;
-void		procman_save_tree_state (GConfClient *client, GtkWidget *tree, const gchar *prefix) G_GNUC_INTERNAL;
-gboolean	procman_get_tree_state (GConfClient *client, GtkWidget *tree, const gchar *prefix) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void		procman_save_config (ProcData *data) ;
+G_GNUC_INTERNAL void		procman_save_tree_state (GConfClient *client, GtkWidget *tree, const gchar *prefix) ;
+G_GNUC_INTERNAL gboolean	procman_get_tree_state (GConfClient *client, GtkWidget *tree, const gchar *prefix) ;
 
 
 
diff -Nrup gnome-system-monitor-2.14.1/src/proctable.c gnome-system-monitor-2.14.1.mod/src/proctable.c
--- gnome-system-monitor-2.14.1/src/proctable.c	2006-02-27 17:44:35.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/proctable.c	2006-07-19 18:47:48.938626000 +0800
@@ -53,7 +53,6 @@
 #include "selinux.h"
 #include "e_date.h"
 
-
 static guint64 total_time = 1;
 static guint64 total_time_last = 1;
 
@@ -533,16 +532,19 @@ get_process_memory_info(ProcInfo *info)
 	wnck_pid_read_resource_usage (gdk_screen_get_display (gdk_screen_get_default ()),
 				      info->pid,
 				      &xresources);
+	info->memxserver = xresources.total_bytes_estimate;
+	
+	get_process_memory_writable(info);
 
 	glibtop_get_proc_mem(&procmem, info->pid);
-
 	info->vmsize	= procmem.vsize;
 	info->memres	= procmem.resident;
-	info->memshared	= procmem.share;
-
-	info->memxserver = xresources.total_bytes_estimate;
+        info->memshared = procmem.share;
+	
+#ifdef __sun
+	info->pcpu	= procmem.load;
+#endif
 
-	get_process_memory_writable(info);
 }
 
 
@@ -795,15 +797,16 @@ update_info (ProcData *procdata, ProcInf
 		glibtop_get_proc_uid (&procuid, info->pid);
 		glibtop_get_proc_time (&proctime, info->pid);
 
-		get_process_memory_info(info);
 		get_process_user(procdata, info, procstate.uid);
-
-		info->pcpu = (proctime.rtime - info->cpu_time_last) * 100 / total_time;
-		info->pcpu = MIN(info->pcpu, 100);
-
-		info->cpu_time_last = proctime.rtime;
+                info->pcpu = (proctime.rtime - info->cpu_time_last) * 100 / total_time;
+                info->pcpu = MIN(info->pcpu, 100);
+		
+		/* there is a bug here, because info can't store cpu_time_last, it's only a temporary variable in refresh_list() */
+                info->cpu_time_last = proctime.rtime;
 		info->nice = procuid.nice;
-
+		 
+		/* if at Solaris, in get_process_memory_info() info->pcpu will get again from glibtop_get_proc_mem() */
+		get_process_memory_info(info);
 
 		model = gtk_tree_view_get_model (GTK_TREE_VIEW (procdata->tree));
 
@@ -963,8 +966,9 @@ proctable_update_list (ProcData * const 
 	/* FIXME: total cpu time elapsed should be calculated on an individual basis here
 	** should probably have a total_time_last gint in the ProcInfo structure */
 	glibtop_get_cpu (&cpu);
-	total_time = MAX(cpu.total - total_time_last, 1);
-	total_time_last = cpu.total;
+	/* total is normally is 1/100 second, if transfer to second, have to divide by frequency */
+	total_time = MAX(cpu.total / cpu.frequency - total_time_last, 1);
+	total_time_last = cpu.total / cpu.frequency;
 
 	refresh_list (procdata, pid_list, proclist.number);
 
diff -Nrup gnome-system-monitor-2.14.1/src/proctable.h gnome-system-monitor-2.14.1.mod/src/proctable.h
--- gnome-system-monitor-2.14.1/src/proctable.h	2005-12-27 23:28:53.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/proctable.h	2006-07-19 19:49:18.901282000 +0800
@@ -47,19 +47,19 @@ enum
 };
 
 
-GtkWidget*	proctable_new (ProcData *data) G_GNUC_INTERNAL;
-void		proctable_update_table (ProcData *data) G_GNUC_INTERNAL;
-void		proctable_update_list (ProcData *data) G_GNUC_INTERNAL;
-void		insert_info_to_tree (ProcInfo *info, ProcData *procdata) G_GNUC_INTERNAL;
-void		remove_info_from_tree (ProcInfo *info, ProcData *procdata) G_GNUC_INTERNAL;
-ProcInfo *	proctable_find_process (guint pid, ProcData *procdata) G_GNUC_INTERNAL;
-void		proctable_update_all (ProcData *data) G_GNUC_INTERNAL;
-void		proctable_clear_tree (ProcData *data) G_GNUC_INTERNAL;
-void		proctable_free_table (ProcData *data) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL GtkWidget*	proctable_new (ProcData *data) ;
+G_GNUC_INTERNAL void		proctable_update_table (ProcData *data) ;
+G_GNUC_INTERNAL void		proctable_update_list (ProcData *data) ;
+G_GNUC_INTERNAL void		insert_info_to_tree (ProcInfo *info, ProcData *procdata) ;
+G_GNUC_INTERNAL void		remove_info_from_tree (ProcInfo *info, ProcData *procdata) ;
+G_GNUC_INTERNAL ProcInfo *	proctable_find_process (guint pid, ProcData *procdata) ;
+G_GNUC_INTERNAL void		proctable_update_all (ProcData *data) ;
+G_GNUC_INTERNAL void		proctable_clear_tree (ProcData *data) ;
+G_GNUC_INTERNAL void		proctable_free_table (ProcData *data) ;
 
-GSList*		proctable_get_columns_order(GtkTreeView *treeview) G_GNUC_INTERNAL;
-void		proctable_set_columns_order(GtkTreeView *treeview, GSList *order) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL GSList*		proctable_get_columns_order(GtkTreeView *treeview) ;
+G_GNUC_INTERNAL void		proctable_set_columns_order(GtkTreeView *treeview, GSList *order) ;
 
-char*		make_loadavg_string(void) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL char*		make_loadavg_string(void) ;
 
 #endif /* _PROCMAN_PROCTABLE_H_ */
diff -Nrup gnome-system-monitor-2.14.1/src/selinux.h gnome-system-monitor-2.14.1.mod/src/selinux.h
--- gnome-system-monitor-2.14.1/src/selinux.h	2005-05-25 20:15:45.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/selinux.h	2006-07-19 19:49:34.954362000 +0800
@@ -8,11 +8,11 @@
 
 #if HAVE_SELINUX
 
-void
-get_process_selinux_context (ProcInfo *info) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void
+get_process_selinux_context (ProcInfo *info) ;
 
-gboolean
-can_show_security_context_column (void) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL gboolean
+can_show_security_context_column (void) ;
 
 #else /* ! HAVE_SELINUX */
 
diff -Nrup gnome-system-monitor-2.14.1/src/smooth_refresh.c gnome-system-monitor-2.14.1.mod/src/smooth_refresh.c
--- gnome-system-monitor-2.14.1/src/smooth_refresh.c	2005-12-28 00:14:59.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/smooth_refresh.c	2006-07-19 18:47:58.412015000 +0800
@@ -181,8 +181,10 @@ smooth_refresh_get(SmoothRefresh *sm, gu
 	gboolean changed;
 	float pcpu;
 
-	if (!sm->active)
+	if (!sm->active){
+		*new_interval = sm->interval;
 		return FALSE;
+	}
 
 	pcpu = get_own_cpu_usage(sm);
 /*
@@ -241,6 +243,8 @@ smooth_refresh_get(SmoothRefresh *sm, gu
 		       *sm->config_interval,
 		       ctime(&now));
 	}
+	else
+		*new_interval = sm->interval;	
 
 	g_assert(sm->interval == *new_interval);
 	g_assert(sm->interval >= *sm->config_interval);
diff -Nrup gnome-system-monitor-2.14.1/src/smooth_refresh.h gnome-system-monitor-2.14.1.mod/src/smooth_refresh.h
--- gnome-system-monitor-2.14.1/src/smooth_refresh.h	2005-12-28 00:14:59.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/smooth_refresh.h	2006-07-19 19:50:05.712418000 +0800
@@ -18,8 +18,8 @@ typedef struct _SmoothRefresh SmoothRefr
   @return : initialized SmoothRefresh
  */
 
-SmoothRefresh*
-smooth_refresh_new(const guint * config_interval) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL SmoothRefresh*
+smooth_refresh_new(const guint * config_interval) ;
 
 
 
@@ -30,8 +30,8 @@ smooth_refresh_new(const guint * config_
 
  */
 
-void
-smooth_refresh_reset(SmoothRefresh *sm) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void
+smooth_refresh_reset(SmoothRefresh *sm) ;
 
 
 
@@ -42,8 +42,8 @@ smooth_refresh_reset(SmoothRefresh *sm) 
 
  */
 
-void
-smooth_refresh_destroy(SmoothRefresh *sm) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void
+smooth_refresh_destroy(SmoothRefresh *sm) ;
 
 
 
@@ -59,8 +59,8 @@ smooth_refresh_destroy(SmoothRefresh *sm
   is stored in @new_interval. Else FALSE;
  */
 
-gboolean
-smooth_refresh_get(SmoothRefresh *sm, guint *new_interval) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL gboolean
+smooth_refresh_get(SmoothRefresh *sm, guint *new_interval) ;
 
 
 #endif /* _PROCMAN_SMOOTH_REFRESH */
diff -Nrup gnome-system-monitor-2.14.1/src/util.h gnome-system-monitor-2.14.1.mod/src/util.h
--- gnome-system-monitor-2.14.1/src/util.h	2005-08-05 02:45:17.000000000 +0800
+++ gnome-system-monitor-2.14.1.mod/src/util.h	2006-07-19 19:50:38.877926000 +0800
@@ -5,7 +5,7 @@
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <stddef.h>
 
-void _procman_array_gettext_init(const char * strings[], size_t n) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void _procman_array_gettext_init(const char * strings[], size_t n) ;
 
 #define PROCMAN_GETTEXT_ARRAY_INIT(A) G_STMT_START { \
 static gboolean is_init = FALSE; \
@@ -19,14 +19,14 @@ if(!is_init) { \
 #define PROCMAN_RCMP(X, Y) PROCMAN_CMP((Y), (X))
 
 
-GtkWidget*
+G_GNUC_INTERNAL GtkWidget*
 procman_make_label_for_mmaps_or_ofiles(const char *format,
 					     const char *process_name,
-					     unsigned pid) G_GNUC_INTERNAL;
+					     unsigned pid) ;
 
 
-gchar*
-SI_gnome_vfs_format_file_size_for_display (GnomeVFSFileSize size) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL gchar*
+SI_gnome_vfs_format_file_size_for_display (GnomeVFSFileSize size) ;
 
 
 #endif /* H_GNOME_SYSTEM_MONITOR_UTIL_1123178725 */