- merge in changes from gkrellm 2.3.2 snapshot (fetched 2008-09-27)

This commit is contained in:
Stefan Gehn 2008-09-28 18:06:24 +00:00
parent 37c7f836ef
commit 6fc301ca06
20 changed files with 626 additions and 103 deletions

View File

@ -1,5 +1,28 @@
GKrellM Changelog GKrellM Changelog
----------------- -----------------
2.3.2 - Not released
------------------------
* Add OpenSSL license exception (TODO).
Make OpenSSL the default to avoid gnutls symbol conflict crash.
* Patch from Takao Fujiwara: Pass clock/calendar strings to strftime in
current locale. Bump default width up to 100.
* Patch from Leo Schwab: add linux sysfs battery interface. Use
preferencially over deprecated /proc/acpi interface.
* Patch from Lycestra:
- Mac OS X support:
"darwin9" build mode for Leopard, which lacks libkvm
add inet monitor interface
add buffers and cache data to memory monitor
- don't client connect to server in the case read_server_setup() fails
* Bugfixes
o Allow spaces in file system monitor directories.
o Andrey Rahmatullin and Ravi Pinjal both sent a patch to fix:
some memleaks in clock monitor.
o Ken Milmore patch: fix configure script to work for lm_sensors >= 3.1
o NULL serve_name segfault
* Translation updates
o pl.po from Michal Smoczyk
2.3.1 - Sun Dec 2, 2007 2.3.1 - Sun Dec 2, 2007
------------------------ ------------------------
* Clock/Calendar monitor rewritten to use user configurable display * Clock/Calendar monitor rewritten to use user configurable display

View File

@ -5,7 +5,7 @@
<h3>Changelog for GKrellM Plugins</h3> <h3>Changelog for GKrellM Plugins</h3>
<hr size="4"> <hr size="4">
<h4>Changes for version 2.3.1</h4> <h4>Changes for versions 2.3.1 - 2.3.2</h4>
none none
<h4>Changes for version 2.3.0</h4> <h4>Changes for version 2.3.0</h4>

View File

@ -10,7 +10,7 @@
<pre> <pre>
Changes in 2.2.3 - 2.3.1 Changes in 2.2.3 - 2.3.2
------------------------ ------------------------
None None

View File

@ -87,7 +87,7 @@ BINMODE = 755
#GTOP_LIBS_D = -L$(GTOP_PREFIX)/lib -lgtop -lgtop_common -lgtop_sysdeps #GTOP_LIBS_D = -L$(GTOP_PREFIX)/lib -lgtop -lgtop_common -lgtop_sysdeps
#export GTOP_INCLUDE GTOP_LIBS GTOP_LIBS_D #export GTOP_INCLUDE GTOP_LIBS GTOP_LIBS_D
VERSION = 2.3.0 VERSION = 2.3.2
INSTALLROOT ?= $(DESTDIR)$(PREFIX) INSTALLROOT ?= $(DESTDIR)$(PREFIX)
@ -161,7 +161,7 @@ install_gkrellm.pc:
$(INSTALL) -d $(PKGCONFIGDIR) $(INSTALL) -d $(PKGCONFIGDIR)
$(INSTALL) -m $(INCLUDEMODE) -c gkrellm.pc $(PKGCONFIGDIR) $(INSTALL) -m $(INCLUDEMODE) -c gkrellm.pc $(PKGCONFIGDIR)
install_darwin install_macosx: install_gkrellm.pc install_darwin install_darwin9 install_macosx: install_gkrellm.pc
(cd po && ${MAKE} install) (cd po && ${MAKE} install)
(cd src && ${MAKE} install STRIP="") (cd src && ${MAKE} install STRIP="")
(cd server && ${MAKE} install STRIP="") (cd server && ${MAKE} install STRIP="")
@ -227,6 +227,17 @@ darwin: gkrellm.pc
LINK_FLAGS="-prebind -Wl,-bind_at_load -framework CoreFoundation" \ LINK_FLAGS="-prebind -Wl,-bind_at_load -framework CoreFoundation" \
gkrellmd ) gkrellmd )
darwin9: gkrellm.pc
(cd po && ${MAKE} all)
(cd src && ${MAKE} GTK_CONFIG=gtk-config STRIP= HAVE_GETADDRINFO=1 \
EXTRAOBJS= SYS_LIBS="-framework IOKit" \
LINK_FLAGS="-prebind -Wl,-bind_at_load -framework CoreFoundation -lX11" \
gkrellm )
(cd server && ${MAKE} GTK_CONFIG=gtk-config STRIP= HAVE_GETADDRINFO=1 \
EXTRAOBJS= SYS_LIBS="-framework IOKit" \
LINK_FLAGS="-prebind -Wl,-bind_at_load -framework CoreFoundation" \
gkrellmd )
macosx: gkrellm.pc macosx: gkrellm.pc
(cd po && ${MAKE} all) (cd po && ${MAKE} all)
(cd src && ${MAKE} macosx) (cd src && ${MAKE} macosx)

View File

@ -1,5 +1,5 @@
%define name gkrellm %define name gkrellm
%define version 2.3.1 %define version 2.3.2
%define release 1 %define release 1
%define prefix /usr %define prefix /usr

View File

@ -136,6 +136,11 @@ darwin:
EXTRAOBJS= SYS_LIBS="-lkvm -lmd5" \ EXTRAOBJS= SYS_LIBS="-lkvm -lmd5" \
LINK_FLAGS="-flat_namespace -undefined warning" gkrellmd LINK_FLAGS="-flat_namespace -undefined warning" gkrellmd
darwin9:
$(MAKE) GTK_CONFIG=gtk-config STRIP= \
EXTRAOBJS= SYS_LIBS="-lmd5" \
LINK_FLAGS="-flat_namespace -undefined warning" gkrellmd
macosx: macosx:
$(MAKE) STRIP= HAVE_GETADDRINFO=1 \ $(MAKE) STRIP= HAVE_GETADDRINFO=1 \
EXTRAOBJS= SYS_LIBS="-lkvm" \ EXTRAOBJS= SYS_LIBS="-lkvm" \
@ -192,7 +197,7 @@ uninstall:
rm -f $(SINSTALLDIR)/$(PACKAGE_D) rm -f $(SINSTALLDIR)/$(PACKAGE_D)
rm -f $(SMANDIR)/$(PACKAGE_D).1 rm -f $(SMANDIR)/$(PACKAGE_D).1
install_darwin install_macosx: install_darwin install_darwin9 install_macosx:
$(MAKE) install STRIP= $(MAKE) install STRIP=
install_freebsd: install_freebsd:

View File

@ -95,7 +95,7 @@
*/ */
#define GKRELLMD_VERSION_MAJOR 2 #define GKRELLMD_VERSION_MAJOR 2
#define GKRELLMD_VERSION_MINOR 3 #define GKRELLMD_VERSION_MINOR 3
#define GKRELLMD_VERSION_REV 1 #define GKRELLMD_VERSION_REV 2
#define GKRELLMD_EXTRAVERSION "" #define GKRELLMD_EXTRAVERSION ""
#define GKRELLMD_CHECK_VERSION(major,minor,rev) \ #define GKRELLMD_CHECK_VERSION(major,minor,rev) \

View File

@ -965,7 +965,7 @@ gkrellm_net_routed_event(gchar *name, gboolean routed)
void void
gkrellm_net_add_timer_type_ppp(gchar *name) gkrellm_net_add_timer_type_ppp(gchar *name)
{ {
if (!_GK.net_timer) if (!_GK.net_timer || !name)
return; return;
if (name && !strncmp(_GK.net_timer, name, strlen(name) - 1)) if (name && !strncmp(_GK.net_timer, name, strlen(name) - 1))
net_timer_type = TIMER_TYPE_PPP; net_timer_type = TIMER_TYPE_PPP;
@ -974,7 +974,7 @@ gkrellm_net_add_timer_type_ppp(gchar *name)
void void
gkrellm_net_add_timer_type_ippp(gchar *name) gkrellm_net_add_timer_type_ippp(gchar *name)
{ {
if (!_GK.net_timer) if (!_GK.net_timer || !name)
return; return;
if (name && !strncmp(_GK.net_timer, name, strlen(name) - 1)) if (name && !strncmp(_GK.net_timer, name, strlen(name) - 1))
net_timer_type = TIMER_TYPE_IPPP; net_timer_type = TIMER_TYPE_IPPP;
@ -2328,6 +2328,8 @@ gkrellmd_client_read(gint fd, gint nbytes)
{ {
mon = (GkrellmdMonitor *) list->data; mon = (GkrellmdMonitor *) list->data;
mp = mon->privat; mp = mon->privat;
if (!mp->serve_name)
continue;
n = strlen(mp->serve_name); n = strlen(mp->serve_name);
e = s + n; e = s + n;
if (*e == '>' && !strncmp(mp->serve_name, s, n)) if (*e == '>' && !strncmp(mp->serve_name, s, n))

View File

@ -152,9 +152,20 @@ else
gkrellm gkrellm
endif endif
darwin9:
ifeq ($(HAVE_SSL),1)
$(MAKE) GTK_CONFIG=gtk-config STRIP= \
EXTRAOBJS= SYS_LIBS="" \
gkrellm
else
$(MAKE) GTK_CONFIG=gtk-config STRIP= \
EXTRAOBJS= SYS_LIBS="-lmd5" \
gkrellm
endif
macosx: macosx:
$(MAKE) STRIP= HAVE_GETADDRINFO=1 \ $(MAKE) STRIP= HAVE_GETADDRINFO=1 \
EXTRAOBJS="winops-gtk-mac.o sysdeps-unix.o" \ EXTRAOBJS="winops-gtk-mac.o" \
LINK_FLAGS="-Wl,-bind_at_load -framework CoreFoundation" \ LINK_FLAGS="-Wl,-bind_at_load -framework CoreFoundation" \
SYS_LIBS="-lkvm -framework IOKit" \ SYS_LIBS="-lkvm -framework IOKit" \
SMC_LIBS="" \ SMC_LIBS="" \
@ -207,7 +218,7 @@ uninstall:
$(RM) $(MANDIR)/$(PACKAGE).1 $(RM) $(MANDIR)/$(PACKAGE).1
$(RM) $(LIBDIR)/libgkrellm.a $(RM) $(LIBDIR)/libgkrellm.a
install_darwin install_macosx: install_darwin install_darwin9 install_macosx:
$(MAKE) install STRIP= $(MAKE) install STRIP=
install_freebsd: install_freebsd:

View File

@ -1481,6 +1481,8 @@ client_plugin_func(gchar *line)
for (list = client_plugin_serve_data_list; list; list = list->next) for (list = client_plugin_serve_data_list; list; list = list->next)
{ {
plug = (ClientPlugin *) list->data; plug = (ClientPlugin *) list->data;
if (!plug->key_name)
continue;
n = strlen(plug->key_name); n = strlen(plug->key_name);
s = line + n; s = line + n;
if (*s == '>' && !strncmp(plug->key_name, line, n)) if (*s == '>' && !strncmp(plug->key_name, line, n))
@ -1539,7 +1541,7 @@ client_send_to_server(gchar *buf)
{ {
gint n; gint n;
if (!server_alive || client_fd < 0) if (!server_alive || client_fd < 0 || !buf)
return FALSE; return FALSE;
#if defined(MSG_NOSIGNAL) #if defined(MSG_NOSIGNAL)
n = send(client_fd, buf, strlen(buf), MSG_NOSIGNAL); n = send(client_fd, buf, strlen(buf), MSG_NOSIGNAL);
@ -1681,7 +1683,7 @@ process_server_line(KeyTable *table, gint table_size, gchar *line)
/* Read setup info from gkrellmd server. Stuff needed before the /* Read setup info from gkrellmd server. Stuff needed before the
| client_init calls must be read here. | client_init calls must be read here.
*/ */
static void static gboolean
read_server_setup(gint fd) read_server_setup(gint fd)
{ {
gchar buf[256]; gchar buf[256];
@ -1696,9 +1698,13 @@ read_server_setup(gint fd)
gkrellm_free_glist_and_data(&client_plugin_setup_line_list); gkrellm_free_glist_and_data(&client_plugin_setup_line_list);
gint rs;
while (1) while (1)
{ {
getline(fd, buf, sizeof(buf)); rs=getline(fd, buf, sizeof(buf));
if(rs<0)
return FALSE;
if (!strcmp(buf, "</gkrellmd_setup>")) if (!strcmp(buf, "</gkrellmd_setup>"))
break; break;
process_server_line(&setup_table[0], table_size, buf); process_server_line(&setup_table[0], table_size, buf);
@ -1714,12 +1720,15 @@ read_server_setup(gint fd)
table_size = sizeof(update_table) / sizeof(KeyTable); table_size = sizeof(update_table) / sizeof(KeyTable);
while (1) while (1)
{ {
getline(fd, buf, sizeof(buf)); rs=getline(fd, buf, sizeof(buf));
if(rs<0)
return FALSE;
if (!strcmp(buf, "</initial_update>")) if (!strcmp(buf, "</initial_update>"))
break; break;
process_server_line(&update_table[0], table_size, buf); process_server_line(&update_table[0], table_size, buf);
} }
setup_done = TRUE; setup_done = TRUE;
return TRUE;
} }
void void
@ -1870,7 +1879,10 @@ gkrellm_client_mode_connect(void)
/* Initial setup lines from server are read in blocking mode. /* Initial setup lines from server are read in blocking mode.
*/ */
read_server_setup(client_fd); if(!read_server_setup(client_fd)){
close(client_fd);
return FALSE;
}
/* Extra stuff not handled in read_server_setup() /* Extra stuff not handled in read_server_setup()
*/ */

View File

@ -144,6 +144,7 @@ get_color_name(GdkColor *color, gchar **color_string)
(color->green >> 8) & 0xff, (color->green >> 8) & 0xff,
(color->blue >> 8) & 0xff ); (color->blue >> 8) & 0xff );
gkrellm_dup_string(color_string, cstring); gkrellm_dup_string(color_string, cstring);
g_free(cstring);
} }
static void static void
@ -192,6 +193,7 @@ static gchar *
strftime_format(gchar *format, gchar *alt_color) strftime_format(gchar *format, gchar *alt_color)
{ {
struct tm *t; struct tm *t;
gchar *locale_format = NULL;
gchar buf1[512], buf2[512]; gchar buf1[512], buf2[512];
if (_GK.client_mode) if (_GK.client_mode)
@ -199,12 +201,14 @@ strftime_format(gchar *format, gchar *alt_color)
else else
t = &gkrellm_current_tm; t = &gkrellm_current_tm;
strftime(buf1, sizeof(buf1), format, t); locale_format = g_locale_from_utf8 (format, -1, NULL, NULL, NULL);
strftime(buf1, sizeof(buf1), locale_format, t);
g_free (locale_format);
format_alt_color(buf1, buf2, sizeof(buf2), alt_color); format_alt_color(buf1, buf2, sizeof(buf2), alt_color);
// printf("%s\n", buf2); // printf("%s\n", buf2);
return g_strdup(buf2); return g_locale_to_utf8 (buf2, -1, NULL, NULL, NULL);
} }
static gint static gint

View File

@ -2291,7 +2291,7 @@ gkrellm_load_user_config(GkrellmMonitor *mon_only, gboolean monitor_values)
_GK.enable_hostname = TRUE; _GK.enable_hostname = TRUE;
_GK.hostname_short = FALSE; _GK.hostname_short = FALSE;
_GK.enable_system_name = FALSE; _GK.enable_system_name = FALSE;
_GK.chart_width = 60; _GK.chart_width = 100;
_GK.update_HZ = 10; _GK.update_HZ = 10;
_GK.theme_scale = 100; _GK.theme_scale = 100;
_GK.float_factor = 1.0; _GK.float_factor = 1.0;

85
src/configure vendored
View File

@ -34,6 +34,46 @@ exec 5>./configure.log
rm -f test test.exe test.o test.c rm -f test test.exe test.o test.c
if [ "$without_ssl" != "yes" ]
then
# echo "Checking for ssl... " 1>& 2
echo "Checking for ssl... " 1>& 5
cat << EOF > test.c
#include <openssl/ssl.h>
int main()
{
SSL_METHOD *ssl_method = NULL;
SSLeay_add_ssl_algorithms();
SSL_load_error_strings();
if ((ssl_method = SSLv23_client_method()) == NULL)
return 1;
return 0;
}
EOF
$CC ${CFLAGS} ${PKG_INCLUDE} -c test.c -o test.o 2>& 5
$CC test.o -o test ${LINK_FLAGS} ${PKG_LIBS} -lssl -lcrypto 2>& 5
if [ -x ./test ] && ./test
then
# echo 'Defining HAVE_SSL' 1>& 2
echo 'Defining HAVE_SSL' 1>& 5
echo '#define HAVE_SSL 1' >> configure.h
without_gnutls=yes
else
# echo "Not found, mail check will not have ssl support..." 1>& 2
echo "Not found, mail check will not have ssl support..." 1>& 5
fi
fi
# end of ssl check
rm -f test test.exe test.o test.c
if [ "$without_gnutls" != "yes" ] if [ "$without_gnutls" != "yes" ]
then then
# echo "Checking for gnutls... " 1>& 2 # echo "Checking for gnutls... " 1>& 2
@ -71,7 +111,6 @@ then
echo 'Defining HAVE_GNUTLS' 1>& 5 echo 'Defining HAVE_GNUTLS' 1>& 5
echo '#define HAVE_GNUTLS 1' >> configure.h echo '#define HAVE_GNUTLS 1' >> configure.h
echo '#define HAVE_SSL 1' >> configure.h echo '#define HAVE_SSL 1' >> configure.h
without_ssl=yes
else else
# echo "Not found, mail check will not have gnutls support..." 1>& 2 # echo "Not found, mail check will not have gnutls support..." 1>& 2
echo "Not found, mail check will not have gnutls support..." 1>& 5 echo "Not found, mail check will not have gnutls support..." 1>& 5
@ -79,44 +118,6 @@ fi
fi fi
# end of gnutls check # end of gnutls check
rm -f test test.exe test.o test.c
if [ "$without_ssl" != "yes" ]
then
# echo "Checking for ssl... " 1>& 2
echo "Checking for ssl... " 1>& 5
cat << EOF > test.c
#include <openssl/ssl.h>
int main()
{
SSL_METHOD *ssl_method = NULL;
SSLeay_add_ssl_algorithms();
SSL_load_error_strings();
if ((ssl_method = SSLv23_client_method()) == NULL)
return 1;
return 0;
}
EOF
$CC ${CFLAGS} ${PKG_INCLUDE} -c test.c -o test.o 2>& 5
$CC test.o -o test ${LINK_FLAGS} ${PKG_LIBS} -lssl -lcrypto 2>& 5
if [ -x ./test ] && ./test
then
# echo 'Defining HAVE_SSL' 1>& 2
echo 'Defining HAVE_SSL' 1>& 5
echo '#define HAVE_SSL 1' >> configure.h
else
# echo "Not found, mail check will not have ssl support..." 1>& 2
echo "Not found, mail check will not have ssl support..." 1>& 5
fi
fi
# end of ssl check
rm -f test test.exe test.o test.c rm -f test test.exe test.o test.c
@ -130,6 +131,7 @@ cat << EOF > test.c
int main() int main()
{ {
#if SENSORS_API_VERSION < 0x400 /* libsensors 3 code */
FILE *f; FILE *f;
f = fopen("/etc/sensors.conf", "r"); f = fopen("/etc/sensors.conf", "r");
@ -139,6 +141,11 @@ int main()
return 1; return 1;
fclose(f); fclose(f);
return 0; return 0;
#else /* libsensors 4 code */
if (sensors_init(NULL) != 0)
return 1;
return 0;
#endif
} }
EOF EOF

View File

@ -1354,13 +1354,11 @@ create_disk_tab(GtkWidget *tab_vbox)
gtk_box_pack_start(GTK_BOX(tab_vbox), tabs, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tab_vbox), tabs, TRUE, TRUE, 0);
/* -- Options tab */ /* -- Options tab */
vbox = gkrellm_gtk_notebook_page(tabs, _("Options")); vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Options"));
scrolled = gtk_scrolled_window_new(NULL, NULL); scrolled = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
GTK_SHADOW_IN);
gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0);
model = create_model(); model = create_model();
@ -1428,6 +1426,8 @@ create_disk_tab(GtkWidget *tab_vbox)
4, 0, TRUE); 4, 0, TRUE);
launch_vbox = gkrellm_gtk_scrolled_vbox(vbox, NULL, launch_vbox = gkrellm_gtk_scrolled_vbox(vbox, NULL,
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show(launch_vbox);
gtk_widget_realize(launch_vbox);
for (i = 0, list = disk_mon_list; list; list = list->next, ++i) for (i = 0, list = disk_mon_list; list; list = list->next, ++i)
{ {
disk = (DiskMon *) list->data; disk = (DiskMon *) list->data;

View File

@ -599,7 +599,7 @@ mount_command(FSmon *fs)
if (fs->is_mounted) if (fs->is_mounted)
{ {
if (fs->fstab_mounting) if (fs->fstab_mounting)
snprintf(cmd, sizeof(cmd), "umount %s", fs->mount.directory); snprintf(cmd, sizeof(cmd), "umount '%s'", fs->mount.directory);
else else
snprintf(cmd, sizeof(cmd), "%s", fs->launch_umount.command); snprintf(cmd, sizeof(cmd), "%s", fs->launch_umount.command);
fs->label_is_data = FALSE; fs->label_is_data = FALSE;
@ -613,7 +613,7 @@ mount_command(FSmon *fs)
if (fs->ejectable) if (fs->ejectable)
close_tray(fs); close_tray(fs);
if (fs->fstab_mounting) if (fs->fstab_mounting)
snprintf(cmd, sizeof(cmd), "mount %s", fs->mount.directory); snprintf(cmd, sizeof(cmd), "mount '%s'", fs->mount.directory);
else else
snprintf(cmd, sizeof(cmd), "%s", fs->launch_mount.command); snprintf(cmd, sizeof(cmd), "%s", fs->launch_mount.command);
fs->blocks = fs->bfree = fs->bavail = fs->bsize = 0; fs->blocks = fs->bfree = fs->bavail = fs->bsize = 0;
@ -1299,14 +1299,15 @@ fs_config_save(FILE *f)
{ {
GList *list; GList *list;
FSmon *fs; FSmon *fs;
gchar quoted_label[64]; gchar quoted_label[64], quoted_dir[512];
for (list = fs_mon_list; list; list = list->next) for (list = fs_mon_list; list; list = list->next)
{ {
fs = (FSmon *) list->data; fs = (FSmon *) list->data;
snprintf(quoted_label, sizeof(quoted_label), "\"%s\"", fs->label); snprintf(quoted_label, sizeof(quoted_label), "\"%s\"", fs->label);
snprintf(quoted_dir, sizeof(quoted_dir), "\"%s\"",fs->mount.directory);
fprintf(f, "%s %s %s %d %d %d %d %d\n", FS_CONFIG_KEYWORD, fprintf(f, "%s %s %s %d %d %d %d %d\n", FS_CONFIG_KEYWORD,
quoted_label, fs->mount.directory, quoted_label, quoted_dir,
fs->fstab_mounting, fs->secondary, fs->fstab_mounting, fs->secondary,
fs->show_if_mounted, fs->label_is_data, fs->ejectable); fs->show_if_mounted, fs->label_is_data, fs->ejectable);
if (*(fs->launch_mount.command)) if (*(fs->launch_mount.command))
@ -1387,8 +1388,8 @@ fs_config_load(gchar *arg)
{ {
static FSmon *fs_prev; static FSmon *fs_prev;
FSmon *fs; FSmon *fs;
gchar *label; gchar *cut_label, *cut_dir;
gchar config[32], item[CFG_BUFSIZE], dir[CFG_BUFSIZE]; gchar config[32], item[CFG_BUFSIZE];
gchar name[64], item1[CFG_BUFSIZE]; gchar name[64], item1[CFG_BUFSIZE];
gint n; gint n;
@ -1435,13 +1436,14 @@ fs_config_load(gchar *arg)
} }
else else
{ {
if ((label = gkrellm_cut_quoted_string(arg, &arg)) != NULL) if ( (cut_label = gkrellm_cut_quoted_string(arg, &arg)) != NULL
&& (cut_dir = gkrellm_cut_quoted_string(arg, &arg)) != NULL
)
{ {
fs = g_new0(FSmon, 1); fs = g_new0(FSmon, 1);
gkrellm_locale_dup_string(&fs->label, label, &fs->label_shadow); gkrellm_locale_dup_string(&fs->label, cut_label,&fs->label_shadow);
dir[0] = '\0';
sscanf(arg, "%s %d %d %d %d %d", dir, &fs->fstab_mounting, sscanf(arg, "%d %d %d %d %d", &fs->fstab_mounting,
&fs->secondary, &fs->show_if_mounted, &fs->secondary, &fs->show_if_mounted,
&fs->label_is_data, &fs->ejectable); &fs->label_is_data, &fs->ejectable);
if (fs->fstab_mounting > 1) /* pre 2.0.0 config fix */ if (fs->fstab_mounting > 1) /* pre 2.0.0 config fix */
@ -1452,7 +1454,7 @@ fs_config_load(gchar *arg)
fs->fstab_mounting = fs->show_if_mounted = FALSE; fs->fstab_mounting = fs->show_if_mounted = FALSE;
if (fs->secondary) if (fs->secondary)
have_secondary_panels = TRUE; have_secondary_panels = TRUE;
fs->mount.directory = g_strdup(dir); fs->mount.directory = g_strdup(cut_dir);
fs->restore_label = fs->label_is_data; fs->restore_label = fs->label_is_data;
fix_fstab_mountable_changed(fs); fix_fstab_mountable_changed(fs);

View File

@ -95,7 +95,7 @@
*/ */
#define GKRELLM_VERSION_MAJOR 2 #define GKRELLM_VERSION_MAJOR 2
#define GKRELLM_VERSION_MINOR 3 #define GKRELLM_VERSION_MINOR 3
#define GKRELLM_VERSION_REV 1 #define GKRELLM_VERSION_REV 2
#define GKRELLM_EXTRAVERSION "" #define GKRELLM_EXTRAVERSION ""
#define GKRELLM_CHECK_VERSION(major,minor,rev) \ #define GKRELLM_CHECK_VERSION(major,minor,rev) \

View File

@ -2027,6 +2027,8 @@ create_inet_tab(GtkWidget *tab_vbox)
4, 0, TRUE); 4, 0, TRUE);
launch_vbox = gkrellm_gtk_scrolled_vbox(vbox1, NULL, launch_vbox = gkrellm_gtk_scrolled_vbox(vbox1, NULL,
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show(launch_vbox);
gtk_widget_realize(launch_vbox);
for (i = 0, list = inet_mon_list; list; list = list->next, ++i) for (i = 0, list = inet_mon_list; list; list = list->next, ++i)
{ {
in = (InetMon *) list->data; in = (InetMon *) list->data;

View File

@ -2036,8 +2036,6 @@ main(gint argc, gchar **argv)
gint i; gint i;
gchar *s; gchar *s;
//gkrellm_sys_main_init();
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
gtk_set_locale(); gtk_set_locale();
#endif #endif

View File

@ -21,19 +21,23 @@
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
*/ */
#ifdef HAVE_KVM_H
#include <kvm.h> #include <kvm.h>
#endif
#include <mach/mach_init.h> #include <mach/mach_init.h>
#include <mach/mach_host.h> #include <mach/mach_host.h>
#include <mach/vm_map.h> #include <mach/vm_map.h>
#ifdef HAVE_KVM_H
kvm_t *kvmd = NULL; kvm_t *kvmd = NULL;
char errbuf[_POSIX2_LINE_MAX]; char errbuf[_POSIX2_LINE_MAX];
#endif
void void
gkrellm_sys_main_init(void) gkrellm_sys_main_init(void)
{ {
#ifdef HAVE_KVM_H
/* We just ignore error, here. Even if GKrellM doesn't have /* We just ignore error, here. Even if GKrellM doesn't have
| kmem privilege, it runs with available information. | kmem privilege, it runs with available information.
*/ */
@ -43,6 +47,7 @@ gkrellm_sys_main_init(void)
fprintf(stderr, "Can't drop setgid privileges."); fprintf(stderr, "Can't drop setgid privileges.");
exit(1); exit(1);
} }
#endif
} }
void void
@ -53,7 +58,7 @@ gkrellm_sys_main_cleanup(void)
/* ===================================================================== */ /* ===================================================================== */
/* CPU monitor interface */ /* CPU monitor interface */
static gint n_cpus; static guint n_cpus;
void void
gkrellm_sys_cpu_read_data(void) gkrellm_sys_cpu_read_data(void)
@ -107,7 +112,9 @@ gkrellm_sys_cpu_init(void)
#include <sys/user.h> #include <sys/user.h>
#define PID_MAX 30000 #define PID_MAX 30000
#ifdef HAVE_KVM_H
#include <kvm.h> #include <kvm.h>
#endif
#include <limits.h> #include <limits.h>
#include <paths.h> #include <paths.h>
#include <utmp.h> #include <utmp.h>
@ -154,13 +161,14 @@ gkrellm_sys_proc_read_data(void)
u_int n_vforks, n_rforks; u_int n_vforks, n_rforks;
gint r_forks, r_vforks, r_rforks; gint r_forks, r_vforks, r_rforks;
size_t len; size_t len;
#ifdef HAVE_KVM_H
gint nextpid, nforked; gint nextpid, nforked;
static struct nlist nl[] = { static struct nlist nl[] = {
#define N_NEXTPID 0 #define N_NEXTPID 0
{ "_nextpid" }, { "_nextpid" },
{ "" } { "" }
}; };
#endif
if (getloadavg(&avenrun, 1) <= 0) if (getloadavg(&avenrun, 1) <= 0)
avenrun = 0; avenrun = 0;
@ -181,6 +189,7 @@ gkrellm_sys_proc_read_data(void)
if (r_forks >= 0 && r_vforks >= 0 && r_rforks >= 0) if (r_forks >= 0 && r_vforks >= 0 && r_rforks >= 0)
n_forks = n_forks + n_vforks + n_rforks; n_forks = n_forks + n_vforks + n_rforks;
} }
#ifdef HAVE_KVM_H
else else
{ {
/* workaround: Can I get total number of processes? */ /* workaround: Can I get total number of processes? */
@ -203,7 +212,8 @@ gkrellm_sys_proc_read_data(void)
} }
} }
} }
#endif
if (sysctl(oid_proc, 3, NULL, &len, NULL, 0) >= 0) if (sysctl(oid_proc, 3, NULL, &len, NULL, 0) >= 0)
n_processes = len / sizeof(struct kinfo_proc); n_processes = len / sizeof(struct kinfo_proc);
@ -395,19 +405,117 @@ gkrellm_sys_disk_init(void)
} }
/* ===================================================================== */ #include "../inet.h"
/* Inet monitor interface - not implemented */
void #include <net/route.h>
gkrellm_sys_inet_read_tcp_data(void) #include <netinet/in.h>
{ #include <netinet/in_systm.h>
} #include <netinet/ip.h>
#ifdef INET6
#include <netinet/ip6.h>
#endif /* INET6 */
#include <netinet/in_pcb.h>
#include <netinet/ip_icmp.h>
#include <netinet/icmp_var.h>
#include <netinet/igmp_var.h>
#include <netinet/ip_var.h>
#include <netinet/tcp.h>
#include <netinet/tcpip.h>
#include <netinet/tcp_seq.h>
#define TCPSTATES
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_var.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <sys/types.h>
gboolean #define warn(x...) fprintf(stderr,x)
gkrellm_sys_inet_init(void)
{ void
return FALSE; gkrellm_sys_inet_read_tcp_data(void)
{
ActiveTCP tcp;
const char *mibvar="net.inet.tcp.pcblist";
char *buf;
struct tcpcb *tp = NULL;
struct inpcb *inp;
struct xinpgen *xig, *oxig;
struct xsocket *so;
size_t len=0;
if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
if (errno != ENOENT)
warn("sysctl: %s", mibvar);
return;
}
if ((buf = malloc(len)) == 0) {
warn("malloc %lu bytes", (u_long)len);
return;
}
if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {
warn("sysctl: %s", mibvar);
free(buf);
return;
} }
/*
* Bail-out to avoid logic error in the loop below when
* there is in fact no more control block to process
*/
if (len <= sizeof(struct xinpgen)) {
free(buf);
return;
}
oxig = xig = (struct xinpgen *)buf;
for (xig = (struct xinpgen *)((char *)xig + xig->xig_len);
xig->xig_len > sizeof(struct xinpgen);
xig = (struct xinpgen *)((char *)xig + xig->xig_len)) {
tp = &((struct xtcpcb *)xig)->xt_tp;
inp = &((struct xtcpcb *)xig)->xt_inp;
so = &((struct xtcpcb *)xig)->xt_socket;
if (so->xso_protocol != IPPROTO_TCP)
continue;
/* Ignore PCBs which were freed during copyout. */
if (inp->inp_gencnt > oxig->xig_gen)
continue;
if ((inp->inp_vflag & INP_IPV4) == 0
#ifdef INET6
&& (inp->inp_vflag & INP_IPV6) == 0
#endif /* INET6 */
)
continue;
/*
* Local address is not an indication of listening socket or
* server sockey but just rather the socket has been bound.
* That why many UDP sockets were not displayed in the original code.
*/
if (tp->t_state <= TCPS_LISTEN){
continue;
}
if (inp->inp_vflag & INP_IPV4) {
tcp.local_port=ntohs(inp->inp_lport);
tcp.remote_addr.s_addr=(uint32_t)inp->inp_faddr.s_addr;
tcp.remote_port=ntohs(inp->inp_fport);
tcp.family=AF_INET;
gkrellm_inet_log_tcp_port_data(&tcp);
}
#ifdef INET6
else if (inp->inp_vflag & INP_IPV6) {
tcp.local_port=ntohs(inp->inp_lport);
memcpy(&(tcp.remote_addr6),&(inp->in6p_faddr),sizeof(struct in6_addr));
tcp.remote_port=ntohs(inp->inp_fport);
tcp.family=AF_INET6;
gkrellm_inet_log_tcp_port_data(&tcp);
} /* else nothing printed now */
#endif /* INET6 */
}
free(buf);
}
gboolean
gkrellm_sys_inet_init(void)
{
return TRUE;
}
/* ===================================================================== */ /* ===================================================================== */
@ -453,12 +561,12 @@ gkrellm_sys_mem_read_data(void)
pshift++; pshift++;
} }
used = (natural_t)(vm_info.active_count + vm_info.inactive_count + vm_info.wire_count) << pshift; used = (guint64)(vm_info.active_count) << pshift;
free = (natural_t)vm_info.free_count << pshift; free = (guint64)vm_info.free_count << pshift;
total = (natural_t)(vm_info.active_count + vm_info.inactive_count + vm_info.free_count + vm_info.wire_count) << pshift; total = (guint64)(vm_info.active_count + vm_info.inactive_count + vm_info.free_count + vm_info.wire_count) << pshift;
/* Don't know how to get cached or buffers. */ /* Don't know how to get cached or buffers. */
buffers = 0; buffers = (guint64) (vm_info.wire_count) << pshift;
cached = 0; cached = (guint64) (vm_info.inactive_count) << pshift;
/* shared 0 for now, shared is a PITA */ /* shared 0 for now, shared is a PITA */
shared = 0; shared = 0;
gkrellm_mem_assign_data(total, used, free, shared, buffers, cached); gkrellm_mem_assign_data(total, used, free, shared, buffers, cached);

View File

@ -1363,13 +1363,18 @@ void
gkrellm_sys_fs_get_mounts_list(void) gkrellm_sys_fs_get_mounts_list(void)
{ {
FILE *f; FILE *f;
gchar *s, buf[512], dev[256], dir[256], type[64]; gchar *s, buf[1024], dev[512], dir[512], type[128];
if ((f = fopen(PROC_MOUNTS_FILE, "r")) == NULL) if ((f = fopen(PROC_MOUNTS_FILE, "r")) == NULL)
return; return;
while (fgets(buf, sizeof(buf), f)) while (fgets(buf, sizeof(buf), f))
{ {
sscanf(buf, "%255s %255s %63s", dev, dir, type); dev[0] = dir[0] = type[0] = '\0';
sscanf(buf, "%512s %512s %127s", dev, dir, type);
fix_fstab_name(dev);
fix_fstab_name(dir);
fix_fstab_name(type);
if ( !strcmp(type, "devpts") if ( !strcmp(type, "devpts")
|| !strcmp(type, "proc") || !strcmp(type, "proc")
|| !strcmp(type, "usbdevfs") || !strcmp(type, "usbdevfs")
@ -1429,8 +1434,8 @@ gkrellm_sys_fs_init(void)
n = system("eject -d > /dev/null 2>&1"); n = system("eject -d > /dev/null 2>&1");
if (WEXITSTATUS(n) == 0) if (WEXITSTATUS(n) == 0)
{ {
eject_command = "eject %s"; eject_command = "eject '%s'";
close_command = "eject -t %s"; close_command = "eject -t '%s'";
} }
#endif #endif
gkrellm_fs_setup_eject(eject_command, close_command, gkrellm_fs_setup_eject(eject_command, close_command,
@ -1441,12 +1446,13 @@ gkrellm_sys_fs_init(void)
/* ===================================================================== */ /* ===================================================================== */
/* Battery monitor interface */ /* Battery monitor interface */
/* ---------------------------- */ /* ---------------------- */
/* ACPI battery interface */ /* ACPI battery interface */
#define ACPI_BATTERY_DIR "/proc/acpi/battery/" #define ACPI_BATTERY_DIR "/proc/acpi/battery/"
#define ACPI_AC_ADAPTOR_DIR "/proc/acpi/ac_adapter/" #define ACPI_AC_ADAPTOR_DIR "/proc/acpi/ac_adapter/"
typedef struct typedef struct
{ {
gint id; gint id;
@ -1557,6 +1563,7 @@ acpi_setup(void)
} }
} }
static gboolean static gboolean
fgets_lower_case(gchar *buf, gint len, FILE *f) fgets_lower_case(gchar *buf, gint len, FILE *f)
{ {
@ -1727,6 +1734,328 @@ acpi_battery_data(BatteryFile *bf)
return TRUE; return TRUE;
} }
/* ---------------------------- */
/* sysfs power interface */
#define SYSFS_POWER_SUPPLIES "/sys/class/power_supply/"
#define SYSFS_TYPE_BATTERY "battery"
#define SYSFS_TYPE_AC_ADAPTER "mains"
typedef struct syspower
{
gint type;
gint id;
gint charge_units;
gchar const *sysdir;
gchar const *sys_charge_full;
gchar const *sys_charge_now;
gboolean present;
gboolean ac_present;
gboolean charging;
}
syspower;
#define PWRTYPE_BATTERY 0
#define PWRTYPE_UPS 1
#define PWRTYPE_MAINS 2
#define PWRTYPE_USB 3
#define CHGUNITS_INVALID 0
#define CHGUNITS_PERCENT 1 /* 'capacity' */
#define CHGUNITS_uWH 2 /* 'energy' */
#define CHGUNITS_uAH 3 /* 'charge' */
/*
* Ordering in this list is significant: Mains power sources appear before
* battery sources.
*/
static GList *g_sysfs_power_list;
static gint g_on_line;
static gint g_pwr_id;
static gboolean
read_sysfs_entry (gchar *buf, gint buflen, gchar const *sysentry)
{
FILE *f;
if ((f = fopen (sysentry, "r")))
{
if (fgets (buf, buflen, f))
{
gchar *nl;
/* Squash trailing newline if present. */
nl = buf + strlen (buf) - 1;
if (*nl == '\n')
*nl = '\0';
fclose (f);
return TRUE;
}
fclose (f);
}
return FALSE;
}
static gboolean
sysfs_power_data (struct syspower *sp)
{
uint64_t charge_full, charge_now;
gint time_left;
gint present;
gint percent;
gchar sysentry[128];
gchar buf[128];
gchar *syszap;
gboolean charging;
gboolean stat_full;
time_left = -1;
charge_full = charge_now = 0;
present = 0;
percent = 0;
charging = FALSE;
strcpy (sysentry, sp->sysdir);
syszap = sysentry + strlen (sysentry);
/* What type of entry is this? */
if (sp->type == PWRTYPE_MAINS)
{
/* Get the 'on-line' status. */
*syszap = '\0';
strcat (sysentry, "/online");
if (read_sysfs_entry (buf, sizeof (buf), sysentry))
g_on_line = strtol (buf, NULL, 0);
return TRUE;
}
/*
* The rest of this code doesn't know how to handle anything other than
* a battery.
*/
if (sp->type != PWRTYPE_BATTERY)
return FALSE;
/* Is the battery still there? */
*syszap = '\0';
strcat (sysentry, "/present");
if (read_sysfs_entry (buf, sizeof (buf), sysentry))
present = strtol (buf, NULL, 0);
if (present)
{
if (read_sysfs_entry (buf, sizeof (buf), sp->sys_charge_full))
{
charge_full = strtoll (buf, NULL, 0);
}
if (read_sysfs_entry (buf, sizeof (buf), sp->sys_charge_now))
{
charge_now = strtoll (buf, NULL, 0);
}
if (sp->charge_units == CHGUNITS_PERCENT)
{
percent = charge_now;
}
else
{
percent = charge_now * 100 / charge_full;
}
/* Get charging status. */
*syszap = '\0';
strcat (sysentry, "/status");
if (read_sysfs_entry (buf, sizeof (buf), sysentry))
{
charging = !strcasecmp (buf, "charging");
stat_full = !strcasecmp (buf, "full");
}
}
gkrellm_battery_assign_data (sp->id, present, g_on_line, charging,
percent, time_left);
return TRUE;
}
static gboolean
setup_sysfs_ac_power (gchar const *sysdir)
{
syspower *sp;
if (_GK.debug_level & DEBUG_BATTERY)
printf ("setup_sysfs_ac_power: %s\n", sysdir);
sp = g_new0 (syspower, 1);
sp->type = PWRTYPE_MAINS;
sp->id = g_pwr_id++;
sp->charge_units = CHGUNITS_INVALID;
sp->sysdir = g_strdup (sysdir);
sp->sys_charge_full =
sp->sys_charge_now = NULL;
/* Add mains power sources to head of list. */
g_sysfs_power_list = g_list_prepend (g_sysfs_power_list, sp);
return TRUE;
}
static gboolean
setup_sysfs_battery (gchar const *sysdir)
{
syspower *sp;
gchar *sys_charge_full = NULL,
*sys_charge_now = NULL;
gint units;
gboolean retval = FALSE;
/*
* There are three flavors of reporting: 'energy', 'charge', and
* 'capacity'. Check for them in that order. (Apologies for the
* ugliness; you try coding an unrolled 'if ((A || B) && C)' and make it
* pretty.)
*/
if (_GK.debug_level & DEBUG_BATTERY)
printf ("setup_sysfs_battery: %s\n", sysdir);
units = CHGUNITS_uWH;
sys_charge_full = g_strconcat (sysdir, "/energy_full", NULL);
if (access (sys_charge_full, F_OK | R_OK))
{
g_free (sys_charge_full);
sys_charge_full = g_strconcat (sysdir, "/energy_full_design", NULL);
if (access (sys_charge_full, F_OK | R_OK))
{
goto try_charge; /* Look down */
}
}
sys_charge_now = g_strconcat (sysdir, "/energy_now", NULL);
if (!access (sys_charge_now, F_OK | R_OK))
goto done; /* Look down */
try_charge:
if (sys_charge_full) g_free (sys_charge_full), sys_charge_full = NULL;
if (sys_charge_now) g_free (sys_charge_now), sys_charge_now = NULL;
units = CHGUNITS_uAH;
sys_charge_full = g_strconcat (sysdir, "/charge_full", NULL);
if (access (sys_charge_full, F_OK | R_OK))
{
g_free (sys_charge_full);
sys_charge_full = g_strconcat (sysdir, "/charge_full_design", NULL);
if (access (sys_charge_full, F_OK | R_OK))
{
goto try_capacity; /* Look down */
}
}
sys_charge_now = g_strconcat (sysdir, "/charge_now", NULL);
if (!access (sys_charge_now, F_OK | R_OK))
goto done; /* Look down */
try_capacity:
if (sys_charge_full) g_free (sys_charge_full), sys_charge_full = NULL;
if (sys_charge_now) g_free (sys_charge_now), sys_charge_now = NULL;
/* This one's a little simpler... */
units = CHGUNITS_PERCENT;
/*
* FIXME: I have no idea if 'capacity_full' actually shows up, since
* 'capacity' always defines "full" as always 100%
*/
sys_charge_full = g_strconcat (sysdir, "/capacity_full", NULL);
if (access (sys_charge_full, F_OK | R_OK))
goto ackphft; /* Look down */
sys_charge_now = g_strconcat (sysdir, "/capacity_now", NULL);
if (access (sys_charge_now, F_OK | R_OK))
goto ackphft; /* Look down */
done:
sp = g_new0 (syspower, 1);
sp->type = PWRTYPE_BATTERY;
sp->id = g_pwr_id++;
sp->charge_units = units;
sp->sysdir = g_strdup (sysdir);
sp->sys_charge_full = sys_charge_full;
sp->sys_charge_now = sys_charge_now;
/* Battery power sources are appended to the end of the list. */
g_sysfs_power_list = g_list_append (g_sysfs_power_list, sp);
if (_GK.debug_level & DEBUG_BATTERY)
printf ("setup_sysfs_battery: %s, %s\n",
sys_charge_full, sys_charge_now);
retval = TRUE;
if (0)
{
ackphft:
if (sys_charge_full) g_free (sys_charge_full);
if (sys_charge_now) g_free (sys_charge_now);
}
return retval;
}
static gboolean
setup_sysfs_power_entry (gchar const *sysentry)
{
gchar *sysdir;
gboolean retval = FALSE;
sysdir = g_strconcat (SYSFS_POWER_SUPPLIES, sysentry, NULL);
if (!access (sysdir, F_OK | R_OK))
{
/*
* Read the type of this power source, and setup the appropriate
* entry for it.
*/
gchar *type;
gchar buf[64];
type = g_strconcat (sysdir, "/type", NULL);
if (_GK.debug_level & DEBUG_BATTERY)
printf ("setup_sysfs_power_entry: checking %s\n", type);
if (read_sysfs_entry (buf, sizeof (buf), type))
{
if (!strcasecmp (buf, SYSFS_TYPE_AC_ADAPTER))
retval = setup_sysfs_ac_power (sysdir);
else if (!strcasecmp (buf, SYSFS_TYPE_BATTERY))
retval = setup_sysfs_battery (sysdir);
else if (_GK.debug_level & DEBUG_BATTERY)
printf ("setup_sysfs_power_entry: unknown power type: %s\n",
buf);
}
g_free (type);
}
g_free (sysdir);
return retval;
}
static gboolean
sysfs_power_setup (void)
{
DIR *d;
struct dirent *de;
gboolean retval = FALSE;
if (_GK.debug_level & DEBUG_BATTERY)
printf ("sysfs_power_setup() entry\n");
if ((d = opendir (SYSFS_POWER_SUPPLIES)) == NULL)
return retval;
while ((de = readdir (d)) != NULL)
{
if ( !strcmp (de->d_name, ".")
|| !strcmp (de->d_name, ".."))
{
continue;
}
retval |= setup_sysfs_power_entry (de->d_name);
}
closedir (d);
return retval;
}
/* ---------------------------- */ /* ---------------------------- */
/* APM battery interface */ /* APM battery interface */
@ -1871,9 +2200,16 @@ gkrellm_sys_battery_read_data(void)
{ {
GList *list; GList *list;
if (acpi_battery_list) if (g_sysfs_power_list)
for (list = acpi_battery_list; list; list = list->next) {
for (list = g_sysfs_power_list; list; list = list->next)
sysfs_power_data ((syspower *) (list->data));
}
else if (acpi_battery_list)
{
for (list = acpi_battery_list; list; list = list->next)
acpi_battery_data((BatteryFile *)(list->data)); acpi_battery_data((BatteryFile *)(list->data));
}
else else
apm_battery_data(); apm_battery_data();
} }
@ -1881,7 +2217,9 @@ gkrellm_sys_battery_read_data(void)
gboolean gboolean
gkrellm_sys_battery_init() gkrellm_sys_battery_init()
{ {
acpi_setup(); /* Prefer sysfs power data to /proc/acpi (which is deprecated). */
if (!sysfs_power_setup ())
acpi_setup();
return TRUE; return TRUE;
} }