From fcd0b544e461d51fdee1e7d0b3a062537e8317cd Mon Sep 17 00:00:00 2001 From: Stefan Gehn Date: Sat, 29 May 2010 12:49:28 +0000 Subject: [PATCH] - Merge with gkrellm-2.3.4 from upstream --- Changelog | 17 +++++++++++++ Changelog-plugins.html | 2 +- Changelog-themes.html | 2 +- Makefile | 2 +- README | 35 ++++++++++++++++++------- gkrellm.1 | 58 ++++++++++++++++++++++++++++++++++-------- gkrellm.spec | 2 +- server/gkrellmd.h | 2 +- src/gkrellm-private.h | 2 ++ src/gkrellm-sysdeps.h | 10 ++++++++ src/gkrellm.h | 2 +- src/mail.c | 2 ++ src/main.c | 8 ++++++ src/sensors.c | 12 +++++++-- src/sysdeps/freebsd.c | 46 ++++++++++++++++----------------- src/sysdeps/linux.c | 5 ++++ src/winops-x11.c | 4 +-- 17 files changed, 158 insertions(+), 53 deletions(-) diff --git a/Changelog b/Changelog index 3a38a9f..284ef95 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,22 @@ GKrellM Changelog ----------------- +2.3.4 - Mon Jan 4, 2010 +------------------------ + * Add gkrellm_sys_setup_connect() function so sysdep code can register + from gkrellm_sys_main_init() a setup function to call after main() + argument parsing. + * Patch from Hajimu Umemoto: add FreeBSD support for the amdtemp + temperature sensor. + * Add some mbmon usage help to gkrellm.1 and README. + * Bugfixes + o Patch from Sandro Tosi: fix a FTBFS when using gold as linker + (by simply adding -lX11). + o Add SSL library init calls to mail check for gnutls case. + o Patch from Hans de Goede: Fix some crashes - check for NULL GC when + drawing root pixmap on transparent chart or panel. + o Patch from Goswin von Brederlow: Ignore device mapper devices in + Linux disk stats. + 2.3.3 - Mon Dec 21, 2009 ------------------------ * gkrellm.spec update from Tim Keller. diff --git a/Changelog-plugins.html b/Changelog-plugins.html index d78fc6c..a7a3916 100644 --- a/Changelog-plugins.html +++ b/Changelog-plugins.html @@ -5,7 +5,7 @@

Changelog for GKrellM Plugins


-

Changes for versions 2.3.1 - 2.3.3

+

Changes for versions 2.3.1 - 2.3.4

none

Changes for version 2.3.0

diff --git a/Changelog-themes.html b/Changelog-themes.html index 0680217..b538d6a 100644 --- a/Changelog-themes.html +++ b/Changelog-themes.html @@ -10,7 +10,7 @@
 
-Changes in 2.2.3 - 2.3.3
+Changes in 2.2.3 - 2.3.4
 ------------------------
 None
 
diff --git a/Makefile b/Makefile
index 4cf6ecb..ae76350 100644
--- a/Makefile
+++ b/Makefile
@@ -87,7 +87,7 @@ BINMODE = 755
 #GTOP_LIBS_D = -L$(GTOP_PREFIX)/lib -lgtop -lgtop_common -lgtop_sysdeps
 #export GTOP_INCLUDE GTOP_LIBS GTOP_LIBS_D
 
-VERSION = 2.3.3
+VERSION = 2.3.4
 
 INSTALLROOT ?= $(DESTDIR)$(PREFIX)
 
diff --git a/README b/README
index 8a971ac..1275c35 100644
--- a/README
+++ b/README
@@ -437,22 +437,38 @@ Linux:
 Sensor monitoring requires that either lm_sensors modules are
 installed in your running kernel, that you run a kernel >= 2.6 with sysfs
 sensors configured, or, for i386 architectures, that you have the mbmon
-daemon running when gkrellm is started.  If the mbmon daemon is used, it
-must be started before gkrellm like so:
+daemon running when gkrellm is started (as long as mbmon supports reporting
+sensor values for your motherboard).
+
+For lm_sensors to be used, gkrellm must be compiled with libsensors support.
+It will be if the libsensors development package is installed when gkrellm
+is compiled.
+
+If the mbmon daemon is used, it must be started before gkrellm like so:
 
     mbmon -r -P port-number
 
 where the given "port-number" must be configured to match in the gkrellm
-Sensors->Options config.  Sensor temperatures can also be read from
-/proc/acpi/thermal_zone, /proc/acpi/thermal, /proc/acpi/ibm. the
-PowerMac Windfarm /sysfs interface, and PowerMac PMU /sysfs based
-sensors.
+Sensors->Options config.  If you have mbmon installed from a distribution
+package, you can probably easily set up for mbmon to be started at boot.
+With Debian, for example, you would edit the file /etc/default/mbmon
+to set:
+
+	START_MBMON=1
+
+and you would need to set in the gkrellm Sensors->Option config the
+mbmon port to be "411" to match the default in the /etc/default/mbmon
+file.
+
+Sensor temperatures can also be read from /proc/acpi/thermal_zone,
+/proc/acpi/thermal, /proc/acpi/ibm. the PowerMac Windfarm /sysfs
+interface, and PowerMac PMU /sysfs based sensors.
 
 When using lm_sensors, libsensors will be used if available, but if
 libsensors is not linked into the program, the sensor data will be
 read directly from the /sysfs or /proc file systems.  If running a newer
 Linux kernel sensor module not yet supported by libsensors and libsensors
-is linked, there will also be an automaitc  fallback to using /sysfs as
+is linked, there will also be an automatic  fallback to using /sysfs as
 long as libsensors doesn't detect any sensors.  But if it does detect some
 sensors which does not include the new sensors you need, you can force
 getting /sysfs sensor data either by running:
@@ -466,8 +482,9 @@ or by rebuilding with:
 
 Disk temperatures may also be monitored if you have the hddtemp daemon
 running when gkrellm is started.  Gkrellm uses the default hddtemp port
-of 7634.  Both hddtemp and mbmon are best started in a boot rc script to
-guarantee they will be running when gkrellm is started.
+of 7634.  Like mbmon, hddtemp is best started in a boot script to guarantee
+it will be running when gkrellm is started.
+
 
 Nvidia graphics card GPU temperatures may also be monitored if
 the nvidia-settings command is installed and your Nvidia card supports
diff --git a/gkrellm.1 b/gkrellm.1
index 367cf04..fee79f0 100644
--- a/gkrellm.1
+++ b/gkrellm.1
@@ -646,7 +646,8 @@ Before internal POP3 and IMAP checking was added, an external mail
 fetch/check program could be set up to be executed periodically to
 download or check remote POP3 or IMAP mail.  This method is still
 available and must be used if you want
-gkrellm to be able to
+.B gkrellm
+to be able to
 download remote mail to local mailboxes because the builtin checking
 functions cannot download.
 
@@ -679,8 +680,22 @@ which is duplicated for each battery.
 Sensor monitoring on Linux requires that either lm_sensors modules are
 installed in your running kernel, that you run a kernel >= 2.6 with sysfs
 sensors configured, or, for i386 architectures, that you have the mbmon
-daemon running when gkrellm is started.  If the mbmon daemon is used, it
-must be started before gkrellm like so:
+daemon running when
+.B gkrellm
+is started (as long as mbmon supports reporting
+sensor values for your motherboard).
+.PP
+For lm_sensors to be used,
+.B gkrellm
+must be compiled with libsensors support.
+It will be if the libsensors development package is installed when
+.B gkrellm
+is compiled.
+.PP
+If the mbmon daemon is used, it
+must be started before
+.B gkrellm
+like so:
 .PP
 .RS
 .nf
@@ -688,8 +703,27 @@ mbmon -r -P port-number
 .fi
 .RE
 .PP
-where the given "port-number" must be configured to match in the gkrellm
-Sensors->Options config.  Sensor temperatures can also be read from
+where the given "port-number" must be configured to match in the
+.B gkrellm
+Sensors->Options config.
+If you have mbmon installed from a distribution
+package, you can probably easily set up for mbmon to be started at boot.
+With Debian, for example, you would edit the file /etc/default/mbmon
+to set:
+.PP
+.RS
+.nf
+START_MBMON=1
+.fi
+.RE
+.PP
+and you would need to set in the
+.B gkrellm
+Sensors->Option config the
+mbmon port to be "411" to match the default in the /etc/default/mbmon
+file.
+.PP
+Sensor temperatures can also be read from
 /proc/acpi/thermal_zone, /proc/acpi/thermal, /proc/acpi/ibm, the
 PowerMac Windfarm /sysfs interface, and PowerMac PMU /sysfs based
 sensors.
@@ -698,7 +732,7 @@ When using lm_sensors, libsensors will be used if available, but if
 libsensors is not linked into the program, the sensor data will be
 read directly from the /sysfs or /proc file systems.  If running a newer
 Linux kernel sensor module not yet supported by libsensors and libsensors
-is linked, there will also be an automaitc  fallback to using /sysfs as
+is linked, there will also be an automatic  fallback to using /sysfs as
 long as libsensors doesn't detect any sensors.  But if it does detect some
 sensors which does not include the new sensors you need, you can force
 getting /sysfs sensor data either by running:
@@ -718,10 +752,12 @@ make without-libsensors=yes
 .RE
 .PP
 Disk temperatures may also be monitored if you have the hddtemp daemon
-running when gkrellm is started.
+running when
 .B gkrellm
-uses the default hddtemp port of 7634.  Both hddtemp and mbmon are best
-started in a boot rc script to guarantee they will be running when
+is started.
+.B gkrellm
+uses the default hddtemp port of 7634.  Like mbmon, hddtemp is best
+started in a boot script to guarantee it will be running when
 .B gkrellm
 is started.
 .PP
@@ -731,7 +767,9 @@ the temperature reporting.  If nvidia-settings is not installed or does not
 report temperatures for your card, an option for using the nvclock
 program will appear in the Sensors config.  Nvclock use is not
 automatically enabled as is nvidia-settings because nvclock can
-add seconds of gkrellm startup time
+add seconds of
+.B gkrellm
+startup time
 when used on a NVIDIA GPU chipset it does not support.  GKrellM must be
 restarted to recognize changes for the nvclock option.
 .PP
diff --git a/gkrellm.spec b/gkrellm.spec
index 8fee6c9..07d976b 100644
--- a/gkrellm.spec
+++ b/gkrellm.spec
@@ -1,5 +1,5 @@
 %define name gkrellm
-%define version 2.3.3
+%define version 2.3.4
 %define release 1
 %define prefix /usr
 
diff --git a/server/gkrellmd.h b/server/gkrellmd.h
index 6cae730..f963921 100644
--- a/server/gkrellmd.h
+++ b/server/gkrellmd.h
@@ -108,7 +108,7 @@
 */
 #define GKRELLMD_VERSION_MAJOR   2
 #define GKRELLMD_VERSION_MINOR   3
-#define GKRELLMD_VERSION_REV     3
+#define GKRELLMD_VERSION_REV     4
 #define GKRELLMD_EXTRAVERSION    ""
 
 #define GKRELLMD_CHECK_VERSION(major,minor,rev)    \
diff --git a/src/gkrellm-private.h b/src/gkrellm-private.h
index f501916..1118a67 100644
--- a/src/gkrellm-private.h
+++ b/src/gkrellm-private.h
@@ -326,6 +326,8 @@ struct	GkrellmConfig
 	gint		m2;
 	gint		use_top_bottom_margins;
 
+	void		(*sys_setup_func)(gint, gchar **);
+
 	GList		*chart_name_list,		/* Move these lists to monitor_list */
 				*meter_name_list,
 				*custom_name_list,
diff --git a/src/gkrellm-sysdeps.h b/src/gkrellm-sysdeps.h
index 3f35ac6..0e2c304 100644
--- a/src/gkrellm-sysdeps.h
+++ b/src/gkrellm-sysdeps.h
@@ -59,6 +59,16 @@
 void	gkrellm_sys_main_init(void);
 void	gkrellm_sys_main_cleanup(void);
 
+	/* If the sysdep code needs to call a function for additional
+	|  setup after the main() arguments are parsed and GTK is
+	|  initialized, register the function by calling this from
+	|  gkrellm_sys_main_init().
+	*/
+void	gkrellm_sys_setup_connect(void (*setup_func)());
+
+	/* The setup function will be passed the main() argc and argv and
+	|  should be declared like:  void XXX_setup(gint ac, gchar **av);
+	*/
 
 /* ===================================================================== */
 /* Misc monitor interface functions */
diff --git a/src/gkrellm.h b/src/gkrellm.h
index fa3f314..f4c4ecd 100644
--- a/src/gkrellm.h
+++ b/src/gkrellm.h
@@ -108,7 +108,7 @@
 */
 #define	GKRELLM_VERSION_MAJOR	2
 #define	GKRELLM_VERSION_MINOR	3
-#define	GKRELLM_VERSION_REV		3
+#define	GKRELLM_VERSION_REV		4
 #define	GKRELLM_EXTRAVERSION	""
 
 #define GKRELLM_CHECK_VERSION(major,minor,rev)    \
diff --git a/src/mail.c b/src/mail.c
index 0c0cddd..a0ac273 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -4284,6 +4284,8 @@ gkrellm_init_mail_monitor(void)
 #ifdef HAVE_GNUTLS
 	gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
 	gnutls_global_init();
+	SSL_load_error_strings();
+	SSL_library_init();
 #else
 #ifdef HAVE_SSL
 	SSL_load_error_strings();
diff --git a/src/main.c b/src/main.c
index a0b628c..27bc1a2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2045,6 +2045,11 @@ setup_signal_handler(void)
 	signal(SIGTERM, _signal_quit);
 	}
 
+void
+gkrellm_sys_setup_connect(void (*setup_func)())
+	{
+	_GK.sys_setup_func = setup_func;
+	}
 
 gint
 main(gint argc, gchar **argv)
@@ -2192,6 +2197,9 @@ main(gint argc, gchar **argv)
 		g_debug("--- GKrellM %d.%d.%d ---\n", GKRELLM_VERSION_MAJOR,
 			GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV);
 
+	if (_GK.sys_setup_func)
+		(*_GK.sys_setup_func)(argc, argv);
+
 	_GK.w_display = gdk_screen_get_width(gdk_screen_get_default());
 	_GK.h_display = gdk_screen_get_height(gdk_screen_get_default());
 
diff --git a/src/sensors.c b/src/sensors.c
index e7de9d2..a80d671 100644
--- a/src/sensors.c
+++ b/src/sensors.c
@@ -2891,16 +2891,24 @@ create_sensors_tab(GtkWidget *tab_vbox)
 		gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
 		gtk_label_set_markup(GTK_LABEL(label),
 			_("Daemon command must be: mbmon -r -P port\n"
-			  "where 'port' must match the port number entered here:"));
+			 "where 'port' must match the port number entered here:"));
 		gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
+		hbox = gtk_hbox_new(FALSE, 2);
+		gtk_box_pack_start(GTK_BOX(box), hbox, TRUE, TRUE, 0);
 		entry = gtk_entry_new();
+		gtk_entry_set_max_length(GTK_ENTRY(entry), 6);
 		mbmon_port_entry = entry;
 		if (_GK.mbmon_port > 0)
 			{
 			snprintf(buf, sizeof(buf), "%d", _GK.mbmon_port);
 			gtk_entry_set_text(GTK_ENTRY(entry), buf);
 			}
-		gtk_box_pack_start(GTK_BOX(box), entry, FALSE, FALSE, 4);
+		gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 4);
+		label = gtk_label_new(
+			_("See the README or do a \"man gkrellm\" for more information.\n"));
+		gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+		gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 4);
+
 		g_signal_connect(G_OBJECT(mbmon_port_entry), "activate",
 	                G_CALLBACK(mbmon_port_entry_activate_cb), NULL);
 		}
diff --git a/src/sysdeps/freebsd.c b/src/sysdeps/freebsd.c
index fcadfa1..fec5771 100644
--- a/src/sysdeps/freebsd.c
+++ b/src/sysdeps/freebsd.c
@@ -1041,7 +1041,7 @@ gkrellm_sys_mem_read_data(void)
 	static gint	swappgsin = -1;
 	static gint	swappgsout = -1;
 	gint		dpagein, dpageout;
-	guint64		total, used, x_used, free, shared, buffers, cached;
+	guint64		total, used, x_used, free, shared, buffers = 0, cached;
 	struct vmtotal	vmt;
 	size_t		length_vmt = sizeof(vmt);
 	static int	oid_vmt[] = { CTL_VM, VM_TOTAL };
@@ -1380,6 +1380,7 @@ static VoltDefault	voltdefault0[] =
 #define INTERFACE_SMB		1
 #define INTERFACE_ACPI		2
 #define INTERFACE_CORETEMP	3		/* Already in Celsius */
+#define INTERFACE_AMDTEMP	4
 
 /* Addresses to use for /dev/io */
 #define WBIO1			0x295
@@ -1448,23 +1449,15 @@ gkrellm_sys_sensors_get_temperature(gchar *path, gint id,
 		return gkrellm_sys_sensors_mbmon_get_value(path, temp);
 		}
 
-	if (interface == INTERFACE_ACPI)
+	if (interface == INTERFACE_ACPI || interface == INTERFACE_CORETEMP ||
+	    interface == INTERFACE_AMDTEMP)
 		{
 		size = sizeof(value);
 		if (sysctlbyname(path, &value, &size, NULL, 0) < 0)
 			return FALSE;
 		if (temp)
-			*temp = (gfloat) TZ_KELVTOC(value);
-		return TRUE;
-		}
-
-	if (interface == INTERFACE_CORETEMP)
-		{
-		size = sizeof(value);
-		if (sysctlbyname(path, &value, &size, NULL, 0) < 0)
-			return FALSE;
-		if (temp)
-			*temp = (gfloat) value;
+			*temp = (interface == INTERFACE_CORETEMP) ?
+				(gfloat) value : (gfloat) TZ_KELVTOC(value);
 		return TRUE;
 		}
 
@@ -1537,10 +1530,10 @@ static GList	*freebsd_sensor_list;
 gboolean
 gkrellm_sys_sensors_init(void)
 	{
-	gchar		mib_name[256], label[8];
+	gchar		mib_name[256], label[8], buf[BUFSIZ], *fmt;
 	gint		interface, id;
-	int		oid_acpi_temp[CTL_MAXNAME + 2];
-	size_t		oid_acpi_temp_len;
+	int		oid[CTL_MAXNAME + 2];
+	size_t		oid_len, len;
 	GList		*list;
 	struct freebsd_sensor *sensor;
 
@@ -1553,9 +1546,8 @@ gkrellm_sys_sensors_init(void)
 		{
 		snprintf(mib_name, sizeof(mib_name),
 			 "hw.acpi.thermal.tz%d.temperature", id);
-		oid_acpi_temp_len = sizeof(oid_acpi_temp);
-		if (gk_sysctlnametomib(mib_name, oid_acpi_temp,
-				       &oid_acpi_temp_len) < 0)
+		oid_len = sizeof(oid);
+		if (gk_sysctlnametomib(mib_name, oid, &oid_len) < 0)
 			break;
 		interface = INTERFACE_ACPI;
 		if (!gkrellm_sys_sensors_get_temperature(mib_name, 0, 0,
@@ -1567,16 +1559,22 @@ gkrellm_sys_sensors_init(void)
 					   interface, 1.0, 0.0, NULL, label);
 		}
 
-	/* Coretemp */
+	/* Coretemp and Amdtemp */
 	for (id = 0;; id++)
 		{
 		snprintf(mib_name, sizeof(mib_name),
 			 "dev.cpu.%d.temperature", id);
-		oid_acpi_temp_len = sizeof(oid_acpi_temp);
-		if (gk_sysctlnametomib(mib_name, oid_acpi_temp,
-				       &oid_acpi_temp_len) < 0)
+		oid_len = sizeof(oid) - sizeof(int) * 2;
+		if (gk_sysctlnametomib(mib_name, oid + 2, &oid_len) < 0)
 			break;
-		interface = INTERFACE_CORETEMP;
+		oid[0] = 0;
+		oid[1] = 4;
+		len = sizeof(buf);
+		if (sysctl(oid, oid_len + 2, buf, &len, 0, 0) < 0)
+			break;
+		fmt = (gchar *)(buf + sizeof(u_int));
+		interface = (fmt[1] == 'K') ?
+			INTERFACE_AMDTEMP : INTERFACE_CORETEMP;
 		if (!gkrellm_sys_sensors_get_temperature(mib_name, 0, 0,
 							 interface, NULL))
 			continue;
diff --git a/src/sysdeps/linux.c b/src/sysdeps/linux.c
index e6e8d50..d3d1006 100644
--- a/src/sysdeps/linux.c
+++ b/src/sysdeps/linux.c
@@ -314,6 +314,9 @@ gkrellm_sys_cpu_init(void)
 #if ! defined (MD_MAJOR)
 #define MD_MAJOR	9
 #endif
+#if !defined(DM_MAJOR)
+#define DM_MAJOR 254
+#endif
 
 #if !defined(IDE4_MAJOR)
 #define IDE4_MAJOR	56
@@ -409,6 +412,7 @@ static struct _disk_name_map
 	{"cc5d", COMPAQ_CISS_MAJOR + 5,		16,	'0' },	/* 109:  c5d0-c5d15 */
 	{"cc6d", COMPAQ_CISS_MAJOR + 6,		16,	'0' },	/* 110:  c6d0-c6d15 */
 	{"cc7d", COMPAQ_CISS_MAJOR + 7,		16,	'0' },	/* 111:  c7d0-c7d15 */
+	{"dm-",  DM_MAJOR,              	256, '0' },	/* 254:  dm-0 - dm-255 */
 
 	{"fd",	FLOPPY_MAJOR,				0,	'0' }	/* 2:  fd0-fd3  */
 	};
@@ -587,6 +591,7 @@ linux_read_proc_diskstats(void)
 			|| (rd == 0 && wr == 0 && !inactivity_override)
 			|| major == LVM_BLK_MAJOR || major == NBD_MAJOR
 			|| major == RAMDISK_MAJOR || major == LOOP_MAJOR
+		    || major == DM_MAJOR
 			|| !disk_get_device_name(major, minor, disk, part)
 		   )
 			continue;
diff --git a/src/winops-x11.c b/src/winops-x11.c
index e78a8ab..e5e7f1d 100644
--- a/src/winops-x11.c
+++ b/src/winops-x11.c
@@ -538,7 +538,7 @@ gkrellm_winop_draw_rootpixmap_onto_transparent_chart(GkrellmChart *cp)
 	GkrellmMargin	*m;
 	gint			x, y;
 
-	if (   root_xpixmap == None || !cp->transparency
+	if (   root_xpixmap == None || trans_gc == NULL || !cp->transparency
 		|| !cp->drawing_area || !cp->drawing_area->window
 	   )
 		return FALSE;
@@ -605,7 +605,7 @@ gkrellm_winop_draw_rootpixmap_onto_transparent_panel(GkrellmPanel *p)
 	Window	child;
 	gint	x, y;
 
-	if (   root_xpixmap == None || !p->transparency
+	if (   root_xpixmap == None || trans_gc == NULL || !p->transparency
 		|| !p->drawing_area || !p->drawing_area->window
 	   )
 		return FALSE;