Merge with gkrellm-2.3.5-pre2.tar.bz2

This commit is contained in:
Stefan Gehn 2010-10-06 21:38:56 +00:00
parent 6bd26e8401
commit bf3d25c568
16 changed files with 185 additions and 97 deletions

View File

@ -2,7 +2,11 @@ GKrellM Changelog
-----------------
2.3.5 - Not released
------------------------
* Patch from Stefan Gehn:
* Linux sensors: check for /sys/class/thermal/thermal_zone[0-*].
* Patch from Simon de Hartog: Add Linux net monitor checking for
IPv6 routes.
* Patches from Stefan Gehn:
- Use dynamic buffering to handle large disk names from a Mac gkrellmd.
- Clean up debug printing by using gkrellm_debug(), g_message(),
g_debug(), g_warning().
- Replace sprintf() calls with snprintf().

4
README
View File

@ -443,7 +443,9 @@ 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.
is compiled. Using libsensors is the preferred interface on Linux since it is
the only interface that will be up to date on supporting correct voltage
scaling factors and offsets for recent sensor chips.
If the mbmon daemon is used, it must be started before gkrellm like so:

View File

@ -690,7 +690,9 @@ For lm_sensors to be used,
must be compiled with libsensors support.
It will be if the libsensors development package is installed when
.B gkrellm
is compiled.
is compiled. Using libsensors is the preferred interface on Linux since it is
the only interface that will be up to date on supporting correct voltage
scaling factors and offsets for recent sensor chips.
.PP
If the mbmon daemon is used, it
must be started before

View File

@ -502,7 +502,7 @@ allow_host(GkrellmdClient *client, struct sockaddr *sa, socklen_t salen)
snprintf(buf, sizeof(buf), _("Connection not allowed from %s\n"),
hostname ? hostname : addr);
g_warning("%s", buf),
g_warning("%s", buf);
gkrellmd_send_to_client(client, "<error>\n");
gkrellmd_send_to_client(client, buf);
return FALSE;

View File

@ -349,7 +349,7 @@ static gboolean units_are_blocks;
static DiskData *
add_disk(gchar *name, gint order, gint device_number, gint unit_number)
add_disk(const gchar *name, gint order, gint device_number, gint unit_number)
{
DiskData *disk;
GList *list;

View File

@ -158,7 +158,7 @@ gboolean gkrellm_sys_disk_init(void);
void gkrellm_sys_disk_read_data(void);
gchar *gkrellm_sys_disk_name_from_device(gint device_number,
gint unit_number, gint *order);
gint gkrellm_sys_disk_order_from_name(gchar *name);
gint gkrellm_sys_disk_order_from_name(const gchar *name);
void gkrellm_disk_client_divert(void (*read_func)(),
gchar *(*name_from_device_func)(), gint (*order_from_name_func)());

View File

@ -406,7 +406,7 @@ gkrellm_sys_disk_name_from_device(gint device_number, gint unit_number,
}
gint
gkrellm_sys_disk_order_from_name(gchar *name)
gkrellm_sys_disk_order_from_name(const gchar *name)
{
/* implement this if you want disk charts to show up in a particular
| order in gkrellm.

View File

@ -408,7 +408,7 @@ gkrellm_sys_disk_name_from_device(gint device_number, gint unit_number,
#if __FreeBSD_version < 300000
gint
gkrellm_sys_disk_order_from_name(gchar *name)
gkrellm_sys_disk_order_from_name(const gchar *name)
{
return 0; /* Not implemented */
}
@ -464,7 +464,7 @@ gkrellm_sys_disk_init(void)
#endif
gint
gkrellm_sys_disk_order_from_name(gchar *name)
gkrellm_sys_disk_order_from_name(const gchar *name)
{
return -1; /* Append as added */
}

View File

@ -116,7 +116,7 @@ gkrellm_sys_disk_name_from_device(gint major, gint minor,gint *order)
}
gint
gkrellm_sys_disk_order_from_name(gchar *name)
gkrellm_sys_disk_order_from_name(const gchar *name)
{
return -1;
}

View File

@ -458,7 +458,7 @@ gkrellm_sys_disk_name_from_device(gint device_number, gint unit_number,
}
gint
gkrellm_sys_disk_order_from_name(gchar *name)
gkrellm_sys_disk_order_from_name(const gchar *name)
{
struct _disk_name_map *dm, *dm_next;
gint i, len, table_size;
@ -886,6 +886,7 @@ gkrellm_sys_inet_init(void)
#define PROC_NET_DEV_FILE "/proc/net/dev"
#define PROC_NET_ROUTE_FILE "/proc/net/route"
#define PROC_NET_IPV6ROUTE_FILE "/proc/net/ipv6_route"
typedef struct
{
@ -906,11 +907,13 @@ static gint rx_bytes_index,
void
gkrellm_sys_net_check_routes(void)
{
static FILE *f;
static FILE *f=NULL;
static FILE *f6=NULL;
GList *list;
NetUp *net;
gchar *s;
gchar buf[512];
gint i;
for (list = net_routed_list; list; list = list->next)
@ -945,6 +948,43 @@ gkrellm_sys_net_check_routes(void)
}
rewind(f);
}
if (f6 || (f6 = fopen(PROC_NET_IPV6ROUTE_FILE, "r")) != NULL)
{
while (fgets(buf, sizeof(buf), f6))
{
if ( strtok(buf, " \t\n") == NULL) continue; /* Extract first field */
/* Extract the nineth field on the line, i.e., the name of the device */
for (i = 1; i <= 9 && (s = strtok(NULL, " \t\n")) != NULL; i++);
/* If i is not 10, strtok failed prematurely */
if (i != 10) continue;
if ( !strncmp(s, "dummy", 5)
|| (*s == '*' && *(s+1) == '\0')
)
continue;
for (list = net_routed_list; list; list = list->next)
{
net = (NetUp *) list->data;
if (!strcmp(net->name, s))
{
net->cur_up = TRUE;
break;
}
}
if (!list)
{
net = g_new0(NetUp, 1);
net_routed_list = g_list_append(net_routed_list, net);
net->name = g_strdup(s);
net->cur_up = TRUE;
}
}
rewind(f6);
}
for (list = net_routed_list; list; list = list->next)
{
net = (NetUp *) list->data;
@ -2287,6 +2327,7 @@ gkrellm_sys_uptime_init(void)
#define THERMAL_ZONE_DIR "/proc/acpi/thermal_zone"
#define THERMAL_DIR "/proc/acpi/thermal"
#define SYS_THERMAL_DIR "/sys/class/thermal"
#define SENSORS_DIR "/proc/sys/dev/sensors"
#define SYSFS_I2C_DIR "/sys/bus/i2c/devices"
#define SYSFS_HWMON_DIR "/sys/class/hwmon"
@ -2303,6 +2344,7 @@ gkrellm_sys_uptime_init(void)
#define IBM_ACPI_INTERFACE 6
#define UNINORTH_INTERFACE 7
#define WINDFARM_INTERFACE 8
#define SYS_THERMAL_INTERFACE 9
#define IBM_ACPI_FAN_FILE "/proc/acpi/ibm/fan"
#define IBM_ACPI_THERMAL "/proc/acpi/ibm/thermal"
@ -2976,6 +3018,26 @@ gkrellm_sys_sensors_get_temperature(gchar *sensor_path, gint id,
gfloat T, t[5],ibm_acpi_temp[8];
gboolean result = FALSE;
if ( interface == SYS_THERMAL_INTERFACE)
{
f = fopen(sensor_path, "r");
if (f)
{
while (fgets(buf, sizeof(buf), f) != NULL)
{
if (need_locale_fix)
locale_fix(buf);
if ((n = sscanf(buf, "%f", &T)) > 0)
{
*temp = T / 1000.0; /* Units from file are millidegree */
result = TRUE;
}
}
fclose(f);
}
return result;
}
if ( interface == THERMAL_INTERFACE
|| interface == THERMAL_ZONE_INTERFACE
)
@ -3697,6 +3759,24 @@ gkrellm_sys_sensors_init(void)
g_dir_close(dir);
}
if ((dir = g_dir_open(SYS_THERMAL_DIR, 0, NULL)) != NULL)
{
while ((name = (gchar *) g_dir_read_name(dir)) != NULL)
{
path = g_build_filename(SYS_THERMAL_DIR, name, "temp", NULL);
if (g_file_test(path, G_FILE_TEST_IS_REGULAR))
{
snprintf(id_name, sizeof(id_name), "%s", name);
gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE,
path, id_name,
id, 0, SYS_THERMAL_INTERFACE,
1.0, 0.0, NULL, "temp");
}
g_free(path);
}
g_dir_close(dir);
}
/* Do intial daemon reads to get sensors loaded into sensors.c
*/
gkrellm_sys_sensors_hddtemp_check();

View File

@ -728,7 +728,7 @@ gkrellm_sys_disk_name_from_device(gint device_number, gint unit_number,
}
gint
gkrellm_sys_disk_order_from_name(gchar *name)
gkrellm_sys_disk_order_from_name(const gchar *name)
{
return -1; /* append disk charts as added */
}

View File

@ -383,7 +383,7 @@ gkrellm_sys_disk_name_from_device(gint device_number, gint unit_number,
}
gint
gkrellm_sys_disk_order_from_name(gchar *name)
gkrellm_sys_disk_order_from_name(const gchar *name)
{
return -1; /* append disk charts as added */
}

View File

@ -276,7 +276,7 @@ gkrellm_sys_disk_name_from_device(gint device_number, gint unit_number,
}
gint
gkrellm_sys_disk_order_from_name(gchar *name)
gkrellm_sys_disk_order_from_name(const gchar *name)
{
return -1; /* Append as added */
}

View File

@ -1340,7 +1340,7 @@ gchar *gkrellm_sys_disk_name_from_device(gint device_number, gint unit_number,
return name;
}
gint gkrellm_sys_disk_order_from_name(gchar *name)
gint gkrellm_sys_disk_order_from_name(const gchar *name)
{
return 0; // Disk by name not implemented in Windows
}