Merge with gkrellm-2.3.3 from upstream

This commit is contained in:
Stefan Gehn 2009-12-26 17:08:15 +00:00
parent a7ea973741
commit a9c193f84c
83 changed files with 9880 additions and 9468 deletions

View File

@ -1,5 +1,32 @@
GKrellM Changelog GKrellM Changelog
----------------- -----------------
2.3.3 - Mon Dec 21, 2009
------------------------
* gkrellm.spec update from Tim Keller.
* Patch from Cyrus Rahman: restore gkrellm_sys_main_init() call to proper
place and fix FreeBSD sensors for amd64 and fix allocate sensor bug.
* Patch from Hajimu Umemoto: add --without-ntlm option
* Patches from Hajimu Umemoto for FreeBSD:
- Support SMP CPU charts coming in FreeBSD 6.4-RELEASE and 7.1-RELEASE
- Use sysctl for swap info on recent FreeBSD; suppress compile warnings
- Include patch from Pietro Cerutti for coretemp(4) sensor support and
fix bug causing only one instance of a sensor type to be added.
- Include patch from Sven Berkvens-Matthijsse to enable battery support
on amd64 using ACPI.
* Patch from Stefan Gehn: Makefile & configure ntlm detect use pkg-config.
* Patch from Erik-Jan: sensors monitor option to show temperature units.
* Patch from Hans de Goede: rename getline to gkrellm_getline to avoid
conflict with new getline function in recent glibc.
* Bugfixes
o Fix a crah by moving "unable to connect" Gtk dialogs outside
of the connect to client thread.
o Divide by zero crash in Linux battery monitor when batteries are dead.
o Patch from Hans de Goede: fix a crash by adding openssl mail check
locking to mail monitor.
* Translation updates
o pt_BR.po update from Vinicius Moreira de Oliveira
2.3.2 - Fri Oct 3, 2008 2.3.2 - Fri Oct 3, 2008
------------------------ ------------------------
* Patch from Stefan Gehn: * Patch from Stefan Gehn:

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 versions 2.3.1 - 2.3.2</h4> <h4>Changes for versions 2.3.1 - 2.3.3</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.2 Changes in 2.2.3 - 2.3.3
------------------------ ------------------------
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.2 VERSION = 2.3.3
INSTALLROOT ?= $(DESTDIR)$(PREFIX) INSTALLROOT ?= $(DESTDIR)$(PREFIX)

2
README
View File

@ -5,7 +5,7 @@ Author: Bill Wilson
Email: billw--at--gkrellm.net Email: billw--at--gkrellm.net
Homepage: http://gkrellm.net Homepage: http://gkrellm.net
Copyright (c) 1999-2008 by Bill Wilson. This program is free software Copyright (c) 1999-2009 by Bill Wilson. This program is free software
which I release under the GNU General Public License. which I release under the GNU General Public License.
Read the COPYRIGHT file for more info. Read the COPYRIGHT file for more info.

View File

@ -1,4 +1,4 @@
.TH gkrellm 1 "Oct 24, 2006" "GNU/Linux" "User's Manual" .TH gkrellm 1 "Dec 21, 2009" "GNU/Linux" "User's Manual"
.SH "NAME" .SH "NAME"
gkrellm \- The GNU Krell Monitors gkrellm \- The GNU Krell Monitors

View File

@ -1,5 +1,5 @@
%define name gkrellm %define name gkrellm
%define version 2.3.2 %define version 2.3.3
%define release 1 %define release 1
%define prefix /usr %define prefix /usr
@ -7,7 +7,7 @@ Summary: Multiple stacked system monitors: 1 process.
Name: %{name} Name: %{name}
Version: %{version} Version: %{version}
Release: %{release} Release: %{release}
Copyright: GPL License: GPL
Group: X11/Utilities Group: X11/Utilities
URL: http://gkrellm.net URL: http://gkrellm.net
Source: http://members.dslextreme.com/users/billw/gkrellm/%{name}-%{version}.tar.bz2 Source: http://members.dslextreme.com/users/billw/gkrellm/%{name}-%{version}.tar.bz2
@ -55,6 +55,7 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/gkrellm.1.gz %{_mandir}/man1/gkrellm.1.gz
%{_mandir}/man1/gkrellmd.1.gz %{_mandir}/man1/gkrellmd.1.gz
%{_includedir}/gkrellm2/gkrellm* %{_includedir}/gkrellm2/gkrellm*
%{_includedir}/gkrellm2/log*
%{_libdir}/pkgconfig/gkrellm.pc %{_libdir}/pkgconfig/gkrellm.pc
%{_datadir}/locale/*/LC_MESSAGES/gkrellm.mo %{_datadir}/locale/*/LC_MESSAGES/gkrellm.mo

View File

@ -1,4 +1,4 @@
.TH gkrellmd 1 "Oct 24, 2006" "GNU/Linux" "User's Manual" .TH gkrellmd 1 "Dec 21, 2009" "GNU/Linux" "User's Manual"
.SH "NAME" .SH "NAME"
gkrellmd \- The GNU Krell Monitors Server gkrellmd \- The GNU Krell Monitors Server

View File

@ -6,7 +6,7 @@
-------------------------------------- --------------------------------------
In the gkrellm po directory, create the .po template (.pot): In the gkrellm po directory, create the .po template (.pot):
xgettext -k_ -kN_ ../src/*.c ../src/sysdeps/*.c -o po/gkrellm.pot xgettext -k_ -kN_ ../src/*.c ../src/sysdeps/*.c -o gkrellm.pot
or or
make enable_nls=1 messages make enable_nls=1 messages

1158
po/bg.po

File diff suppressed because it is too large Load Diff

1158
po/cs.po

File diff suppressed because it is too large Load Diff

1158
po/da.po

File diff suppressed because it is too large Load Diff

1158
po/de.po

File diff suppressed because it is too large Load Diff

1164
po/es.po

File diff suppressed because it is too large Load Diff

1160
po/fr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1158
po/it.po

File diff suppressed because it is too large Load Diff

1160
po/ja.po

File diff suppressed because it is too large Load Diff

1158
po/nl.po

File diff suppressed because it is too large Load Diff

1160
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1158
po/ru.po

File diff suppressed because it is too large Load Diff

1162
po/sl.po

File diff suppressed because it is too large Load Diff

1162
po/sv.po

File diff suppressed because it is too large Load Diff

10
server/configure vendored
View File

@ -3,7 +3,7 @@
# Configure some things for gkrellmd when make is run. # Configure some things for gkrellmd when make is run.
# This configure is run automatically so no need to run it by hand. # This configure is run automatically so no need to run it by hand.
# #
# Copyright (C) 2006 Bill Wilson # Copyright (C) 2006-2009 Bill Wilson
for i for i
do do
@ -36,6 +36,9 @@ int main()
{ {
FILE *f; FILE *f;
#if SENSORS_API_VERSION < 0x400 /* libsensors 3 code */
FILE *f;
f = fopen("/etc/sensors.conf", "r"); f = fopen("/etc/sensors.conf", "r");
if (!f) if (!f)
return 1; return 1;
@ -43,6 +46,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

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#include "configure.h" #include "configure.h"

View File

@ -23,7 +23,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 2 #define GKRELLMD_VERSION_REV 3
#define GKRELLMD_EXTRAVERSION "" #define GKRELLMD_EXTRAVERSION ""
#define GKRELLMD_CHECK_VERSION(major,minor,rev) \ #define GKRELLMD_CHECK_VERSION(major,minor,rev) \

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#ifndef GKRELLMD_H #ifndef GKRELLMD_H
#define GKRELLMD_H #define GKRELLMD_H

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#include "gkrellmd.h" #include "gkrellmd.h"

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#include "gkrellmd.h" #include "gkrellmd.h"

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#include "gkrellmd.h" #include "gkrellmd.h"

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#include "gkrellmd.h" #include "gkrellmd.h"

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#include "gkrellmd.h" #include "gkrellmd.h"

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#include "gkrellmd.h" #include "gkrellmd.h"

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
| |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/ | along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/ */
#include "gkrellmd.h" #include "gkrellmd.h"

View File

@ -29,7 +29,7 @@ BEGIN
VALUE "FileDescription", "GKrellM Daemon" VALUE "FileDescription", "GKrellM Daemon"
VALUE "FileVersion", RC_VER_STRING VALUE "FileVersion", RC_VER_STRING
VALUE "InternalName", "gkrellmd" VALUE "InternalName", "gkrellmd"
VALUE "LegalCopyright", "Copyright (C) 1999-2008 Bill Wilson" VALUE "LegalCopyright", "Copyright (C) 1999-2009 Bill Wilson"
VALUE "OriginalFilename", "gkrellmd.exe" VALUE "OriginalFilename", "gkrellmd.exe"
VALUE "ProductName", "GKrellM" VALUE "ProductName", "GKrellM"
VALUE "ProductVersion", RC_VER_STRING VALUE "ProductVersion", RC_VER_STRING

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Stefan Gehn stefan.gkrellm@srcbox.net | Author: Stefan Gehn stefan.gkrellm@srcbox.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
* Copyright (C) 1999-2008 Bill Wilson * Copyright (C) 1999-2009 Bill Wilson
* *
* @author Bill Wilson <billw@gkrellm.net> * @author Bill Wilson <billw@gkrellm.net>
* *

View File

@ -45,6 +45,12 @@ endif
ifeq ($(without-libsensors),1) ifeq ($(without-libsensors),1)
CONFIGURE_ARGS += --without-libsensors CONFIGURE_ARGS += --without-libsensors
endif endif
ifeq ($(without-ntlm),yes)
CONFIGURE_ARGS += --without-ntlm
endif
ifeq ($(without-ntlm),1)
CONFIGURE_ARGS += --without-ntlm
endif
DUMMY_VAR := $(shell ./configure $(CONFIGURE_ARGS)) DUMMY_VAR := $(shell ./configure $(CONFIGURE_ARGS))
HAVE_GNUTLS = $(shell grep -c HAVE_GNUTLS configure.h) HAVE_GNUTLS = $(shell grep -c HAVE_GNUTLS configure.h)

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -1620,7 +1620,7 @@ KeyTable update_table[] =
static gint static gint
getline(gint fd, gchar *buf, gint len) gkrellm_getline(gint fd, gchar *buf, gint len)
{ {
fd_set read_fds; fd_set read_fds;
struct timeval tv; struct timeval tv;
@ -1714,7 +1714,7 @@ read_server_setup(gint fd)
while (1) while (1)
{ {
rs=getline(fd, buf, sizeof(buf)); rs=gkrellm_getline(fd, buf, sizeof(buf));
if(rs<0) if(rs<0)
return FALSE; return FALSE;
if (!strcmp(buf, "</gkrellmd_setup>")) if (!strcmp(buf, "</gkrellmd_setup>"))
@ -1732,7 +1732,7 @@ read_server_setup(gint fd)
table_size = sizeof(update_table) / sizeof(KeyTable); table_size = sizeof(update_table) / sizeof(KeyTable);
while (1) while (1)
{ {
rs=getline(fd, buf, sizeof(buf)); rs=gkrellm_getline(fd, buf, sizeof(buf));
if(rs<0) if(rs<0)
return FALSE; return FALSE;
if (!strcmp(buf, "</initial_update>")) if (!strcmp(buf, "</initial_update>"))
@ -1870,7 +1870,7 @@ gkrellm_connect_to(gchar *server, gint server_port)
return fd; return fd;
} }
gboolean enum GkrellmConnectResult
gkrellm_client_mode_connect(void) gkrellm_client_mode_connect(void)
{ {
gchar buf[128]; gchar buf[128];
@ -1879,10 +1879,8 @@ gkrellm_client_mode_connect(void)
_GK.server_port = GKRELLMD_SERVER_PORT; _GK.server_port = GKRELLMD_SERVER_PORT;
client_fd = gkrellm_connect_to(_GK.server, _GK.server_port); client_fd = gkrellm_connect_to(_GK.server, _GK.server_port);
if (client_fd < 0) { if (client_fd < 0)
g_warning("%s\n", _("Unable to connect.")); return BAD_CONNECT;
return FALSE;
}
snprintf(buf, sizeof(buf), "gkrellm %d.%d.%d%s\n", snprintf(buf, sizeof(buf), "gkrellm %d.%d.%d%s\n",
GKRELLM_VERSION_MAJOR, GKRELLM_VERSION_MINOR, GKRELLM_VERSION_MAJOR, GKRELLM_VERSION_MINOR,
@ -1891,10 +1889,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.
*/ */
if(!read_server_setup(client_fd)){ if(!read_server_setup(client_fd))
{
close(client_fd); close(client_fd);
return FALSE; return BAD_SETUP;
} }
/* Extra stuff not handled in read_server_setup() /* Extra stuff not handled in read_server_setup()
@ -1911,23 +1909,23 @@ gkrellm_client_mode_connect(void)
server_alive = TRUE; server_alive = TRUE;
return TRUE; return GOOD_CONNECT;
} }
static gboolean client_mode_thread_busy; static gboolean client_mode_thread_busy;
gint enum GkrellmConnectState
gkrellm_client_server_connect_state(void) gkrellm_client_server_connect_state(void)
{ {
if (client_mode_thread_busy) /* reconnect in progress? */ if (client_mode_thread_busy) /* reconnect in progress? */
return 2; return CONNECTING;
if (_GK.client_mode && client_input_id > 0) /* Currently connected? */ if (_GK.client_mode && client_input_id > 0) /* Currently connected? */
return 1; return CONNECTED;
else if (_GK.client_mode) else if (_GK.client_mode)
return 0; return DISCONNECTED;
else else
return -1; return NO_CLIENT;
} }
static gpointer static gpointer

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

11
src/configure vendored
View File

@ -3,7 +3,7 @@
# Configure some things for GKrellM when make is run. # Configure some things for GKrellM when make is run.
# This configure is run automatically so no need to run it by hand. # This configure is run automatically so no need to run it by hand.
# #
# Copyright (C) 2003 Bill Wilson # Copyright (C) 2003-2009 Bill Wilson
for i for i
do do
@ -19,6 +19,10 @@ do
then then
without_libsensors=yes without_libsensors=yes
fi fi
if [ "$i" = "--without-ntlm" ]
then
without_ntlm=yes
fi
done done
PKG_INCLUDE=`pkg-config gtk+-2.0 --cflags` PKG_INCLUDE=`pkg-config gtk+-2.0 --cflags`
@ -121,6 +125,8 @@ fi
rm -f test test.exe test.o test.c rm -f test test.exe test.o test.c
if [ "$without_ntlm" != "yes" ]
then
# echo "Checking for libntlm... " 1>& 2 # echo "Checking for libntlm... " 1>& 2
echo "Checking for libntlm... " 1>& 5 echo "Checking for libntlm... " 1>& 5
@ -151,7 +157,8 @@ else
# echo "Not found, mail check will not have ntlm support..." 1>& 2 # echo "Not found, mail check will not have ntlm support..." 1>& 2
echo "Not found, mail check will not have ntlm support..." 1>& 5 echo "Not found, mail check will not have ntlm support..." 1>& 5
fi fi
fi
# end of ntlm check
rm -f test test.exe test.o test.c rm -f test test.exe test.o test.c

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -1354,7 +1354,7 @@ fstab_user_permission(Mount *m)
{ {
struct stat my_stat; struct stat my_stat;
g_stat(m->device, &my_stat); stat(m->device, &my_stat);
if ( strstr(m->options, "user") if ( strstr(m->options, "user")
|| (strstr(m->options, "owner") && my_stat.st_uid == uid) || (strstr(m->options, "owner") && my_stat.st_uid == uid)
) )

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -49,6 +49,21 @@
#define GKRELLM_FLOAT_FACTOR 1000.0 #define GKRELLM_FLOAT_FACTOR 1000.0
enum GkrellmConnectResult
{
GOOD_CONNECT,
BAD_CONNECT,
BAD_SETUP
};
enum GkrellmConnectState
{
CONNECTING,
CONNECTED,
DISCONNECTED,
NO_CLIENT
};
enum GkrellmState enum GkrellmState
{ {
INITIALIZING, INITIALIZING,
@ -488,10 +503,12 @@ void gkrellm_winop_state_below(gboolean);
/* client */ /* client */
gint gkrellm_connect_to(gchar *, gint); gint gkrellm_connect_to(gchar *, gint);
gboolean gkrellm_client_mode_connect(void); enum GkrellmConnectResult
gkrellm_client_mode_connect(void);
void gkrellm_client_mode_disconnect(void); void gkrellm_client_mode_disconnect(void);
struct tm *gkrellm_client_server_time(void); struct tm *gkrellm_client_server_time(void);
gint gkrellm_client_server_connect_state(void); enum GkrellmConnectState
gkrellm_client_server_connect_state(void);
void gkrellm_client_mode_connect_thread(void); void gkrellm_client_mode_connect_thread(void);
gint gkrellm_client_server_get_net_timer(void); gint gkrellm_client_server_get_net_timer(void);

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -35,7 +35,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 2 #define GKRELLM_VERSION_REV 3
#define GKRELLM_EXTRAVERSION "" #define GKRELLM_EXTRAVERSION ""
#define GKRELLM_CHECK_VERSION(major,minor,rev) \ #define GKRELLM_CHECK_VERSION(major,minor,rev) \

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -768,7 +768,7 @@ create_about_tab(GtkWidget *vbox)
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
buf = g_strdup_printf(_("GKrellM %d.%d.%d%s\nGNU Krell Monitors\n\n" buf = g_strdup_printf(_("GKrellM %d.%d.%d%s\nGNU Krell Monitors\n\n"
"Copyright (c) 1999-2007 by Bill Wilson\n" "Copyright (c) 1999-2009 by Bill Wilson\n"
"billw@gkrellm.net\n" "billw@gkrellm.net\n"
"http://gkrellm.net\n\n" "http://gkrellm.net\n\n"
"Released under the GNU General Public License"), "Released under the GNU General Public License"),

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -255,10 +255,11 @@ void
update_host(void) update_host(void)
{ {
gchar **parts; gchar **parts;
gint connect_state, delta, step, h_scroll; gint delta, step, h_scroll;
gint hz = gkrellm_update_HZ(); gint hz = gkrellm_update_HZ();
static gint reconnect_timeout, y_target, asym; static gint reconnect_timeout, y_target, asym;
static gboolean recheck_sysname; static gboolean recheck_sysname;
enum GkrellmConnectState connect_state;
if (decal_sysname && system_name_mode == 1 && system_dtext.reduced) if (decal_sysname && system_name_mode == 1 && system_dtext.reduced)
{ {
@ -295,7 +296,7 @@ update_host(void)
/* If we loose the server connection, trigger a hardwired alarm. /* If we loose the server connection, trigger a hardwired alarm.
*/ */
connect_state = gkrellm_client_server_connect_state(); connect_state = gkrellm_client_server_connect_state();
if (connect_state == 2) /* thread is trying a reconnect */ if (connect_state == CONNECTING) /* thread is trying a reconnect */
{ {
if (_GK.client_server_reconnect_timeout <= 0) if (_GK.client_server_reconnect_timeout <= 0)
{ {
@ -303,7 +304,7 @@ update_host(void)
draw_sysname(); draw_sysname();
} }
} }
else if (connect_state == 0) /* Lost connection */ else if (connect_state == DISCONNECTED) /* Lost connection */
{ {
gkrellm_check_alert(server_alert, 2.0); /* Alarm */ gkrellm_check_alert(server_alert, 2.0); /* Alarm */
if ( _GK.client_server_reconnect_timeout > 0 if ( _GK.client_server_reconnect_timeout > 0

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -306,6 +306,21 @@ static gint anim_frame,
static gint style_id; static gint style_id;
#ifdef HAVE_SSL
#ifndef HAVE_GNUTLS
static GMutex **ssl_locks;
static void
ssl_locking_cb(int mode, int n, const char *file, int line)
{
if (mode & CRYPTO_LOCK)
g_mutex_lock(ssl_locks[n]);
else
g_mutex_unlock(ssl_locks[n]);
}
#endif
#endif
/* This may be called from gkrellm_sys_main_init() /* This may be called from gkrellm_sys_main_init()
*/ */
void void
@ -750,9 +765,6 @@ ssl_negotiate(ConnInfo *conn, Mailbox *mbox)
{ {
SSL_METHOD *ssl_method; SSL_METHOD *ssl_method;
SSLeay_add_ssl_algorithms();
SSL_load_error_strings();
if (mbox->account->use_ssl == SSL_TRANSPORT) if (mbox->account->use_ssl == SSL_TRANSPORT)
ssl_method = SSLv23_client_method(); ssl_method = SSLv23_client_method();
else else
@ -4246,6 +4258,12 @@ static GkrellmMonitor monitor_mail =
GkrellmMonitor * GkrellmMonitor *
gkrellm_init_mail_monitor(void) gkrellm_init_mail_monitor(void)
{ {
#ifdef HAVE_SSL
#ifndef HAVE_GNUTLS
int i, num_locks = CRYPTO_num_locks();
#endif
#endif
monitor_mail.name = _(monitor_mail.name); monitor_mail.name = _(monitor_mail.name);
enable_mail = TRUE; enable_mail = TRUE;
show_tooltip = TRUE; show_tooltip = TRUE;
@ -4266,6 +4284,15 @@ gkrellm_init_mail_monitor(void)
#ifdef HAVE_GNUTLS #ifdef HAVE_GNUTLS
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
gnutls_global_init(); gnutls_global_init();
#else
#ifdef HAVE_SSL
SSL_load_error_strings();
SSL_library_init();
ssl_locks = g_new(GMutex *, num_locks);
for (i = 0; i < num_locks; i++)
ssl_locks[i] = g_mutex_new();
CRYPTO_set_locking_callback(ssl_locking_cb);
#endif
#endif #endif
mail_fetch = g_new0(Mailbox, 1); mail_fetch = g_new0(Mailbox, 1);

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -645,7 +645,9 @@ top_frame_button_press(GtkWidget *widget, GdkEventButton *ev, gpointer data)
} }
gtk_window_present(GTK_WINDOW(top_window)); gtk_window_present(GTK_WINDOW(top_window));
if (_GK.client_mode && gkrellm_client_server_connect_state() == 0) if ( _GK.client_mode
&& gkrellm_client_server_connect_state() == DISCONNECTED
)
gkrellm_client_mode_connect_thread(); gkrellm_client_mode_connect_thread();
if (!_GK.withdrawn) /* Move window unless in the slit */ if (!_GK.withdrawn) /* Move window unless in the slit */
@ -2049,6 +2051,10 @@ main(gint argc, gchar **argv)
{ {
gint i; gint i;
gchar *s; gchar *s;
enum GkrellmConnectResult connect_result;
GtkWidget *dlg;
gkrellm_sys_main_init();
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
gtk_set_locale(); gtk_set_locale();
@ -2186,16 +2192,45 @@ main(gint argc, gchar **argv)
g_debug("--- GKrellM %d.%d.%d ---\n", GKRELLM_VERSION_MAJOR, g_debug("--- GKrellM %d.%d.%d ---\n", GKRELLM_VERSION_MAJOR,
GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV); GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV);
gkrellm_sys_main_init(); //FIXME: call this later or earlier?
_GK.w_display = gdk_screen_get_width(gdk_screen_get_default()); _GK.w_display = gdk_screen_get_width(gdk_screen_get_default());
_GK.h_display = gdk_screen_get_height(gdk_screen_get_default()); _GK.h_display = gdk_screen_get_height(gdk_screen_get_default());
if (_GK.server && !gkrellm_client_mode_connect()) if (_GK.server)
{
connect_result = gkrellm_client_mode_connect();
while (connect_result == BAD_CONNECT)
{
gint result;
dlg = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO,
"GKrellM cannot connect to server:\n"
"\t%s:%d\n\n"
"Do you want to retry?",
_GK.server, _GK.server_port);
result = gtk_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(dlg);
if (result == GTK_RESPONSE_YES)
connect_result = gkrellm_client_mode_connect();
else
break;
}
if (connect_result == BAD_SETUP)
{
dlg = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
"GKrellM cannot get initial setup from server:\n"
"\t\t%s:%d\n",
_GK.server, _GK.server_port);
gtk_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(dlg);
}
if (connect_result != GOOD_CONNECT)
{ {
gkrellm_exit(0); gkrellm_exit(0);
return 0; return 0;
} }
}
check_gkrellm_directories(); check_gkrellm_directories();
gkrellm_load_user_config(NULL, FALSE); gkrellm_load_user_config(NULL, FALSE);
@ -2272,11 +2307,8 @@ main(gint argc, gchar **argv)
gkrellm_start_timer(_GK.update_HZ); gkrellm_start_timer(_GK.update_HZ);
setup_signal_handler(); setup_signal_handler();
/* Enter main event-loop */
gtk_main(); gtk_main();
/* Save settings, positions and inet-monitor history */
gkrellm_save_all(); gkrellm_save_all();
/* disconnect from gkrellm-server if we're a client */ /* disconnect from gkrellm-server if we're a client */

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -191,7 +191,8 @@ gkrellm_sensors_add_sensor(gint type, gchar *sensor_path, gchar *id_name,
/* ======================================================================== */ /* ======================================================================== */
static gboolean use_threads, static gboolean use_threads,
thread_data_valid, thread_data_valid,
units_fahrenheit; units_fahrenheit,
show_units = TRUE;
static gboolean thread_busy; static gboolean thread_busy;
@ -522,7 +523,12 @@ sensor_read_temperature(Sensor *sensor, gfloat *temp, gchar *units)
if (temp) if (temp)
*temp = t; *temp = t;
if (units) if (units)
{
if (show_units)
*units = units_fahrenheit ? 'F':'C'; *units = units_fahrenheit ? 'F':'C';
else
*units = '\0';
}
if ((_GK.debug_level & DEBUG_SENSORS) && sensor) if ((_GK.debug_level & DEBUG_SENSORS) && sensor)
printf("sensor_temp: %s %s t=%.2f\n", printf("sensor_temp: %s %s t=%.2f\n",
sensor->name_locale, sensor->path, sensor->value); sensor->name_locale, sensor->path, sensor->value);
@ -1362,7 +1368,10 @@ make_temperature_panel(GtkWidget *vbox, gint first_create)
return; return;
style = gkrellm_meter_style(style_id); style = gkrellm_meter_style(style_id);
m = gkrellm_get_style_margins(style); m = gkrellm_get_style_margins(style);
if (show_units)
format = units_fahrenheit ? "188.8F" : "88.8C"; format = units_fahrenheit ? "188.8F" : "88.8C";
else
format = units_fahrenheit ? "188.8" : "88.8";
assign_textstyles(temperature_list, &ts_name, &ts_sensor, format); assign_textstyles(temperature_list, &ts_name, &ts_sensor, format);
gkrellm_get_top_bottom_margins(style, &y, NULL); gkrellm_get_top_bottom_margins(style, &y, NULL);
y += bezel_style->border.top; y += bezel_style->border.top;
@ -1773,6 +1782,8 @@ save_sensors_config(FILE *f_not_used)
fprintf(f, "%s units_fahrenheit %d\n", SENSOR_CONFIG_KEYWORD, fprintf(f, "%s units_fahrenheit %d\n", SENSOR_CONFIG_KEYWORD,
units_fahrenheit); units_fahrenheit);
fprintf(f, "%s show_units %d\n", SENSOR_CONFIG_KEYWORD,
show_units);
fprintf(f, "%s volt_display_mode %d\n", SENSOR_CONFIG_KEYWORD, fprintf(f, "%s volt_display_mode %d\n", SENSOR_CONFIG_KEYWORD,
display_mode); display_mode);
/* _GK.mbmon_port is handled in config.c so that the port can be /* _GK.mbmon_port is handled in config.c so that the port can be
@ -1807,6 +1818,8 @@ load_sensors_config(gchar *arg)
sscanf(item, "%d", &sensor_config_sysdep_private); sscanf(item, "%d", &sensor_config_sysdep_private);
else if (!strcmp(config, "units_fahrenheit")) else if (!strcmp(config, "units_fahrenheit"))
sscanf(item, "%d", &units_fahrenheit); sscanf(item, "%d", &units_fahrenheit);
else if (!strcmp(config, "show_units"))
sscanf(item, "%d", &show_units);
else if (!strcmp(config, "volt_display_mode")) else if (!strcmp(config, "volt_display_mode"))
sscanf(item, "%d", &display_mode); sscanf(item, "%d", &display_mode);
else if (!strcmp(config, "sensor_float_factor")) else if (!strcmp(config, "sensor_float_factor"))
@ -2588,6 +2601,21 @@ cb_temperature_units(GtkWidget *button, gpointer data)
gkrellm_proc_draw_sensors(NULL); gkrellm_proc_draw_sensors(NULL);
} }
static void
cb_show_units(GtkWidget *button, gpointer data)
{
gint show;
show = GTK_TOGGLE_BUTTON(button)->active;
if (show == show_units)
return;
show_units = show;
gkrellm_sensors_rebuild(DO_TEMP, FALSE, FALSE);
gkrellm_cpu_draw_sensors(NULL);
gkrellm_proc_draw_sensors(NULL);
}
static void static void
cb_voltages_display(GtkWidget *entry, gpointer data) cb_voltages_display(GtkWidget *entry, gpointer data)
{ {
@ -2812,6 +2840,10 @@ create_sensors_tab(GtkWidget *tab_vbox)
units_fahrenheit, FALSE, FALSE, 0, units_fahrenheit, FALSE, FALSE, 0,
cb_temperature_units, NULL, cb_temperature_units, NULL,
_("Display fahrenheit")); _("Display fahrenheit"));
gkrellm_gtk_check_button_connected(box, &button,
show_units, FALSE, FALSE, 0,
cb_show_units, NULL,
_("Show units"));
if (!sensor_list) if (!sensor_list)
gtk_widget_set_sensitive(button, FALSE); gtk_widget_set_sensitive(button, FALSE);

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -33,14 +33,20 @@
| as that of the covered work. | as that of the covered work.
*/ */
#include <sys/param.h>
#include <sys/sysctl.h>
#include <osreldate.h>
#if __FreeBSD_version < 500000
#include <kvm.h> #include <kvm.h>
kvm_t *kvmd = NULL; kvm_t *kvmd = NULL;
char errbuf[_POSIX2_LINE_MAX]; char errbuf[_POSIX2_LINE_MAX];
#endif
// extern gboolean force_meminfo_update(void); // extern gboolean force_meminfo_update(void);
#if defined(__i386__) #if defined(__i386__) || defined(__amd64__)
static void scan_for_sensors(); static void scan_for_sensors();
#endif #endif
@ -51,13 +57,15 @@ gkrellm_sys_main_init(void)
/* 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.
*/ */
#if __FreeBSD_version < 500000
kvmd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); kvmd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
#endif
if (setgid(getgid()) != 0) if (setgid(getgid()) != 0)
{ {
fprintf(stderr, "Can't drop setgid privileges."); fprintf(stderr, "Can't drop setgid privileges.");
exit(1); exit(1);
} }
#if defined(__i386__) #if defined(__i386__) || defined(__amd64__)
scan_for_sensors(); scan_for_sensors();
#endif #endif
if (setuid(getuid()) != 0) if (setuid(getuid()) != 0)
@ -72,9 +80,6 @@ gkrellm_sys_main_cleanup(void)
{ {
} }
#include <sys/param.h>
#include <sys/sysctl.h>
static int static int
gk_sysctlnametomib(const char *name, int *mibp, size_t *lenp) gk_sysctlnametomib(const char *name, int *mibp, size_t *lenp)
{ {
@ -90,38 +95,43 @@ gk_sysctlnametomib(const char *name, int *mibp, size_t *lenp)
/* ===================================================================== */ /* ===================================================================== */
/* CPU monitor interface */ /* CPU monitor interface */
#include <osreldate.h>
#if __FreeBSD_version >= 500101 #if __FreeBSD_version >= 500101
#include <sys/resource.h> #include <sys/resource.h>
#else #else
#include <sys/dkstat.h> #include <sys/dkstat.h>
#endif #endif
#include <kvm.h>
extern kvm_t *kvmd;
static int oid_cp_time[CTL_MAXNAME + 2]; static int oid_cp_time[CTL_MAXNAME + 2];
static int oid_cp_times[CTL_MAXNAME + 2];
static size_t oid_cp_time_len = sizeof(oid_cp_time); static size_t oid_cp_time_len = sizeof(oid_cp_time);
static size_t oid_cp_times_len = sizeof(oid_cp_times);
static gint have_cp_time; static gint have_cp_time;
static gint maxid;
static gint ncpus;
static u_long cpumask;
static long *cp_times;
void void
gkrellm_sys_cpu_read_data(void) gkrellm_sys_cpu_read_data(void)
{ {
long cp_time[CPUSTATES]; long cp_time[CPUSTATES], *cp_timep;
int len = sizeof(cp_time); size_t len;
#if __FreeBSD_version < 500000
static struct nlist nl[] = { static struct nlist nl[] = {
#define N_CP_TIME 0 #define N_CP_TIME 0
{ "_cp_time" }, { "_cp_time" },
{ "" } { "" }
}; };
#endif
if (have_cp_time) if (have_cp_time)
{ {
if (sysctl(oid_cp_time, oid_cp_time_len, len = sizeof(cp_time);
cp_time, &len, 0, 0) < 0) if (sysctl(oid_cp_time, oid_cp_time_len, cp_time, &len,
NULL, 0) < 0)
return; return;
} }
#if __FreeBSD_version < 500000
else else
{ {
if (kvmd == NULL) if (kvmd == NULL)
@ -133,8 +143,34 @@ gkrellm_sys_cpu_read_data(void)
sizeof(cp_time)) != sizeof(cp_time)) sizeof(cp_time)) != sizeof(cp_time))
return; return;
} }
#endif
/* Currently, SMP is not supported */ if (ncpus > 1)
{
gint i, j;
gkrellm_cpu_assign_composite_data(cp_time[CP_USER],
cp_time[CP_NICE],
cp_time[CP_SYS],
cp_time[CP_IDLE]);
len = (maxid + 1) * sizeof(long) * CPUSTATES;
if (sysctl(oid_cp_times, oid_cp_times_len, cp_times, &len,
NULL, 0) < 0)
return;
for (i = j = 0; i <= maxid; ++i)
{
if ((cpumask & (1ul << i)) == 0)
continue;
cp_timep = &cp_times[i * CPUSTATES];
gkrellm_cpu_assign_data(j, cp_timep[CP_USER],
cp_timep[CP_NICE],
cp_timep[CP_SYS],
cp_timep[CP_IDLE]);
++j;
}
}
else
gkrellm_cpu_assign_data(0, cp_time[CP_USER], cp_time[CP_NICE], gkrellm_cpu_assign_data(0, cp_time[CP_USER], cp_time[CP_NICE],
cp_time[CP_SYS], cp_time[CP_IDLE]); cp_time[CP_SYS], cp_time[CP_IDLE]);
} }
@ -142,13 +178,57 @@ gkrellm_sys_cpu_read_data(void)
gboolean gboolean
gkrellm_sys_cpu_init(void) gkrellm_sys_cpu_init(void)
{ {
static char *name = "kern.cp_time"; gint have_cp_times = FALSE;
gint maxcpus;
size_t len;
long *p;
gkrellm_cpu_set_number_of_cpus(1); if (gk_sysctlnametomib("kern.cp_time", oid_cp_time,
&oid_cp_time_len) >= 0)
have_cp_time = TRUE;
if (gk_sysctlnametomib(name, oid_cp_time, &oid_cp_time_len) < 0) len = sizeof(maxcpus);
return TRUE; if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0) >= 0)
++have_cp_time; {
gint empty, i, j;
if (gk_sysctlnametomib("kern.cp_times", oid_cp_times,
&oid_cp_times_len) < 0)
goto pcpu_probe_done;
len = maxcpus * sizeof(long) * CPUSTATES;
if ((cp_times = malloc(len)) == NULL)
goto pcpu_probe_done;
if (sysctl(oid_cp_times, oid_cp_times_len, cp_times, &len,
NULL, 0) < 0)
{
free(cp_times);
cp_times = NULL;
goto pcpu_probe_done;
}
maxid = (len / CPUSTATES / sizeof(long)) - 1;
cpumask = 0;
ncpus = 0;
for (i = 0; i <= maxid; ++i)
{
empty = 1;
for (j = 0; empty && j < CPUSTATES; ++j)
if (cp_times[i * CPUSTATES + j] != 0)
empty = 0;
if (!empty)
{
cpumask |= (1ul << i);
++ncpus;
}
}
if ((p = realloc(cp_times, len)) != NULL)
cp_times = p;
have_cp_times = TRUE;
}
pcpu_probe_done:
if (!have_cp_times)
ncpus = 1;
gkrellm_cpu_set_number_of_cpus(ncpus);
return TRUE; return TRUE;
} }
@ -156,8 +236,6 @@ gkrellm_sys_cpu_init(void)
/* ===================================================================== */ /* ===================================================================== */
/* Proc monitor interface */ /* Proc monitor interface */
#include <osreldate.h>
#include <sys/sysctl.h>
#if __FreeBSD_version >= 400000 #if __FreeBSD_version >= 400000
#include <sys/user.h> #include <sys/user.h>
#endif #endif
@ -175,13 +253,10 @@ gkrellm_sys_cpu_init(void)
#undef KERNEL #undef KERNEL
#endif #endif
#include <kvm.h>
#include <limits.h> #include <limits.h>
#include <paths.h> #include <paths.h>
#include <utmp.h> #include <utmp.h>
extern kvm_t *kvmd;
static int oid_v_forks[CTL_MAXNAME + 2]; static int oid_v_forks[CTL_MAXNAME + 2];
static int oid_v_vforks[CTL_MAXNAME + 2]; static int oid_v_vforks[CTL_MAXNAME + 2];
static int oid_v_rforks[CTL_MAXNAME + 2]; static int oid_v_rforks[CTL_MAXNAME + 2];
@ -215,17 +290,19 @@ gkrellm_sys_proc_read_data(void)
static int oid_proc[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL }; static int oid_proc[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
#endif #endif
double avenrun; double avenrun;
static u_int n_processes, n_forks = 0, curpid = -1; static u_int n_processes, n_forks = 0;
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;
gint len; size_t len;
#if __FreeBSD_version < 500000
static u_int curpid = -1;
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;
@ -246,6 +323,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;
} }
#if __FreeBSD_version < 500000
else else
{ {
/* workaround: Can I get total number of processes? */ /* workaround: Can I get total number of processes? */
@ -268,6 +346,7 @@ gkrellm_sys_proc_read_data(void)
} }
} }
} }
#endif
#if __FreeBSD_version >= 400000 #if __FreeBSD_version >= 400000
if (sysctl(oid_proc, 3, NULL, &len, NULL, 0) >= 0) if (sysctl(oid_proc, 3, NULL, &len, NULL, 0) >= 0)
@ -318,10 +397,6 @@ gkrellm_sys_proc_read_users(void)
#if __FreeBSD_version >= 300000 #if __FreeBSD_version >= 300000
#include <devstat.h> #include <devstat.h>
static struct statinfo statinfo_cur; static struct statinfo statinfo_cur;
#else
#include <kvm.h>
extern kvm_t *kvmd;
#endif #endif
gchar * gchar *
@ -479,11 +554,7 @@ gkrellm_sys_disk_init(void)
#include <netinet6/tcp6_var.h> #include <netinet6/tcp6_var.h>
#endif #endif
#include <kvm.h>
#include <nlist.h> #include <nlist.h>
extern kvm_t *kvmd;
extern char errbuf[];
#endif #endif
@ -582,7 +653,7 @@ gkrellm_sys_inet_read_tcp_data(void)
gint tcp_status; gint tcp_status;
struct xinpgen *xig, *oxig; struct xinpgen *xig, *oxig;
gchar *buf; gchar *buf;
gint len = 0; size_t len = 0;
if (!initialized) if (!initialized)
{ {
@ -655,17 +726,14 @@ gkrellm_sys_inet_init(void)
/* ===================================================================== */ /* ===================================================================== */
/* Memory/Swap monitor interface */ /* Memory/Swap monitor interface */
#include <osreldate.h>
#include <kvm.h>
#include <limits.h>
#include <sys/conf.h> #include <sys/conf.h>
#if __FreeBSD_version < 400000 #if __FreeBSD_version < 400000
#include <sys/rlist.h> #include <sys/rlist.h>
#endif #endif
#include <sys/vmmeter.h> #include <sys/vmmeter.h>
#include <sys/sysctl.h>
#include <vm/vm_param.h> #include <vm/vm_param.h>
#if __FreeBSD_version < 410000
static struct nlist nl_mem[] = { static struct nlist nl_mem[] = {
#define N_CNT 0 #define N_CNT 0
{ "_cnt" }, { "_cnt" },
@ -687,17 +755,20 @@ static struct nlist nl_mem[] = {
#endif #endif
{ "" } { "" }
}; };
#endif
extern kvm_t *kvmd;
extern char errbuf[];
static int static int
swapmode(guint64 *retavail, guint64 *retfree) swapmode(unsigned long long *retavail, unsigned long long *retfree)
{ {
guint64 used, avail; guint64 used, avail;
#if __FreeBSD_version >= 400000 #if __FreeBSD_version >= 400000
static int psize = -1; static int psize = -1;
struct kvm_swap kvmswap; struct kvm_swap kvmswap;
#if __FreeBSD_version >= 500000
struct xswdev xsw;
size_t mibsize, size;
int mib[16], n;
#endif
#else #else
char *header; char *header;
int hlen, nswap, nswdev, dmmax; int hlen, nswap, nswdev, dmmax;
@ -734,21 +805,37 @@ swapmode(guint64 *retavail, guint64 *retfree)
} }
warning--; /* decrease counter, see end of function */ warning--; /* decrease counter, see end of function */
#if __FreeBSD_version >= 400000
#if __FreeBSD_version >= 500000
mibsize = sizeof mib / sizeof mib[0];
if (gk_sysctlnametomib("vm.swap_info", mib, &mibsize) == -1)
return(0);
kvmswap.ksw_total = 0;
kvmswap.ksw_used = 0;
for (n = 0; ; ++n)
{
mib[mibsize] = n;
size = sizeof xsw;
if (sysctl(mib, mibsize + 1, &xsw, &size, NULL, 0) == -1)
break;
kvmswap.ksw_total += xsw.xsw_nblks;
kvmswap.ksw_used += xsw.xsw_used;
}
#else
if (kvmd == NULL) if (kvmd == NULL)
return(0); return(0);
#if __FreeBSD_version >= 400000
if (kvm_getswapinfo(kvmd, &kvmswap, 1, 0) < 0) if (kvm_getswapinfo(kvmd, &kvmswap, 1, 0) < 0)
{
fprintf(stderr, "kvm_getswapinfo failed\n");
return(0); return(0);
}
#endif
if (psize < 0) if (psize < 0)
psize = getpagesize(); psize = getpagesize();
*retavail = avail = (quad_t)kvmswap.ksw_total * psize; *retavail = avail = (quad_t)kvmswap.ksw_total * psize;
used = (quad_t)kvmswap.ksw_used * psize; used = (quad_t)kvmswap.ksw_used * psize;
*retfree = avail - used; *retfree = avail - used;
#else #else
if (kvmd == NULL)
return(0);
if (kvm_read(kvmd, nl_mem[VM_NSWAP].n_value, if (kvm_read(kvmd, nl_mem[VM_NSWAP].n_value,
&nswap, sizeof(nswap)) != sizeof(nswap)) &nswap, sizeof(nswap)) != sizeof(nswap))
return(0); return(0);
@ -898,7 +985,7 @@ get_bufspace(guint64 *bufspacep)
} }
if (sysctl(oid_bufspace, oid_bufspace_len, if (sysctl(oid_bufspace, oid_bufspace_len,
&bufspace, &bufspace_len, 0, 0) < 0) &bufspace, &bufspace_len, NULL, 0) < 0)
return 0; return 0;
#endif #endif
*bufspacep = bufspace; *bufspacep = bufspace;
@ -942,8 +1029,8 @@ static struct mibtab mibs[] = {
#endif #endif
static guint64 swapin, static guint64 swapin,
swapout, swapout;
swap_total, static unsigned long long swap_total,
swap_used; swap_used;
void void
@ -954,15 +1041,14 @@ gkrellm_sys_mem_read_data(void)
static gint swappgsin = -1; static gint swappgsin = -1;
static gint swappgsout = -1; static gint swappgsout = -1;
gint dpagein, dpageout; gint dpagein, dpageout;
struct vmmeter sum;
guint64 total, used, x_used, free, shared, buffers, cached; guint64 total, used, x_used, free, shared, buffers, cached;
struct vmtotal vmt; struct vmtotal vmt;
size_t length_vmt = sizeof(vmt); size_t length_vmt = sizeof(vmt);
static int oid_vmt[] = { CTL_VM, VM_TOTAL }; static int oid_vmt[] = { CTL_VM, VM_TOTAL };
#if __FreeBSD_version >= 410000 #if __FreeBSD_version >= 410000
gint i; gint i;
FILE *f; #else
gchar buf[160]; struct vmmeter sum;
#endif #endif
#if 0 #if 0
@ -981,26 +1067,21 @@ gkrellm_sys_mem_read_data(void)
} }
shared = 0; shared = 0;
if (kvmd == NULL)
{
#if __FreeBSD_version >= 410000 #if __FreeBSD_version >= 410000
if (!first_time_done) if (!first_time_done)
{ {
for (i = 0; mibs[i].name; ++i) for (i = 0; mibs[i].name; ++i)
{ {
mibs[i].oid_len = sizeof(mibs[i].oid); mibs[i].oid_len = sizeof(mibs[i].oid);
if (gk_sysctlnametomib(mibs[i].name, if (gk_sysctlnametomib(mibs[i].name, mibs[i].oid,
mibs[i].oid,
&mibs[i].oid_len) < 0) &mibs[i].oid_len) < 0)
return; return;
mibs[i].value_len = sizeof(mibs[i].value); mibs[i].value_len = sizeof(mibs[i].value);
} }
++first_time_done;
} }
for (i = 0; mibs[i].name; ++i) for (i = 0; mibs[i].name; ++i)
if (sysctl(mibs[i].oid, mibs[i].oid_len, if (sysctl(mibs[i].oid, mibs[i].oid_len, &mibs[i].value,
&mibs[i].value, &mibs[i].value_len, NULL, 0) < 0)
&mibs[i].value_len, 0, 0) < 0)
return; return;
total = (mibs[MIB_V_PAGE_COUNT].value - total = (mibs[MIB_V_PAGE_COUNT].value -
mibs[MIB_V_WIRE_COUNT].value) << pshift; mibs[MIB_V_WIRE_COUNT].value) << pshift;
@ -1014,27 +1095,21 @@ gkrellm_sys_mem_read_data(void)
used = x_used - buffers - cached; used = x_used - buffers - cached;
gkrellm_mem_assign_data(total, used, free, shared, buffers, cached); gkrellm_mem_assign_data(total, used, free, shared, buffers, cached);
swapin = mibs[MIB_V_SWAPPGSIN].value; if (swappgsin < 0)
swapout = mibs[MIB_V_SWAPPGSOUT].value;
/* Try linprocfs for swap info */
if ((f = fopen(PROC_MEMINFO_FILE, "r")) == NULL)
return;
/* total: used: free: shared: buffers: cached: */
while ((fgets(buf, sizeof(buf), f)) != NULL)
{ {
if (strncmp(buf, "Swap:", 5) == 0) dpagein = 0;
dpageout = 0;
}
else
{ {
sscanf(buf, "Swap: %llu %llu", dpagein = (mibs[MIB_V_SWAPPGSIN].value - swappgsin) << pshift;
&swap_total, &swap_used); dpageout = (mibs[MIB_V_SWAPPGSOUT].value - swappgsout) << pshift;
break;
} }
} swappgsin = mibs[MIB_V_SWAPPGSIN].value;
fclose(f); swappgsout = mibs[MIB_V_SWAPPGSOUT].value;
#endif #else
if (kvmd == NULL)
return; return;
}
if (nl_mem[0].n_type == 0) if (nl_mem[0].n_type == 0)
if (kvm_nlist(kvmd, nl_mem) < 0 || nl_mem[0].n_type == 0) if (kvm_nlist(kvmd, nl_mem) < 0 || nl_mem[0].n_type == 0)
return; return;
@ -1051,6 +1126,7 @@ gkrellm_sys_mem_read_data(void)
cached = sum.v_cache_count << pshift; cached = sum.v_cache_count << pshift;
used = x_used - buffers - cached; used = x_used - buffers - cached;
gkrellm_mem_assign_data(total, used, free, shared, buffers, cached); gkrellm_mem_assign_data(total, used, free, shared, buffers, cached);
if (swappgsin < 0) if (swappgsin < 0)
{ {
dpagein = 0; dpagein = 0;
@ -1058,11 +1134,12 @@ gkrellm_sys_mem_read_data(void)
} }
else else
{ {
dpagein = (sum.v_swappgsin - swappgsin) << (pshift - 10); dpagein = (sum.v_swappgsin - swappgsin) << pshift;
dpageout = (sum.v_swappgsout - swappgsout) << (pshift - 10); dpageout = (sum.v_swappgsout - swappgsout) << pshift;
} }
swappgsin = sum.v_swappgsin; swappgsin = sum.v_swappgsin;
swappgsout = sum.v_swappgsout; swappgsout = sum.v_swappgsout;
#endif
if (dpagein > 0 || dpageout > 0 || first_time_done == 0) if (dpagein > 0 || dpageout > 0 || first_time_done == 0)
{ {
@ -1090,8 +1167,8 @@ gkrellm_sys_mem_init(void)
/* ===================================================================== */ /* ===================================================================== */
/* Battery monitor interface */ /* Battery monitor interface */
#if defined(__i386__) || defined(__amd64__)
#if defined(__i386__) #if defined(__i386__)
#include <osreldate.h>
#include <machine/apm_bios.h> #include <machine/apm_bios.h>
#define APMDEV "/dev/apm" #define APMDEV "/dev/apm"
@ -1099,6 +1176,7 @@ gkrellm_sys_mem_init(void)
#define L_ON_LINE 1 #define L_ON_LINE 1
#define L_CHARGING 3 #define L_CHARGING 3
#define L_UNKNOWN 0xFF #define L_UNKNOWN 0xFF
#endif
/* following two definitions are taken from sys/dev/acpica/acpiio.h */ /* following two definitions are taken from sys/dev/acpica/acpiio.h */
#define ACPI_BATT_STAT_CHARGING 0x0002 #define ACPI_BATT_STAT_CHARGING 0x0002
@ -1125,16 +1203,18 @@ gkrellm_sys_battery_read_data(void)
size_t size; size_t size;
int acpi_info[4]; int acpi_info[4];
int i; int i;
#if defined(__i386__)
int f, r; int f, r;
struct apm_info info; struct apm_info info;
gint batt_num = 0;
#endif
gboolean available, on_line, charging; gboolean available, on_line, charging;
gint percent, time_left; gint percent, time_left;
gint batt_num = 0;
if (!first_time_done) if (!first_time_done)
{ {
first_time_done = TRUE; first_time_done = TRUE;
#ifdef ACPI_SUPPORTS_MULTIPLE_BATTERIES #if defined(ACPI_SUPPORTS_MULTIPLE_BATTERIES) || defined(__amd64__)
/* /*
* XXX: Disable getting battery information via ACPI * XXX: Disable getting battery information via ACPI
* to support multiple batteries via APM sim until * to support multiple batteries via APM sim until
@ -1174,6 +1254,7 @@ gkrellm_sys_battery_read_data(void)
return; return;
} }
#if defined(__i386__)
if ((f = open(APMDEV, O_RDONLY)) == -1) if ((f = open(APMDEV, O_RDONLY)) == -1)
return; return;
if ((r = ioctl(f, APMIO_GETINFO, &info)) == -1) { if ((r = ioctl(f, APMIO_GETINFO, &info)) == -1) {
@ -1231,6 +1312,7 @@ gkrellm_sys_battery_read_data(void)
#endif #endif
close(f); close(f);
#endif
} }
gboolean gboolean
@ -1258,7 +1340,7 @@ gkrellm_sys_battery_init(void)
/* ===================================================================== */ /* ===================================================================== */
/* Sensor monitor interface */ /* Sensor monitor interface */
#if defined(__i386__) #if defined(__i386__) || defined(__amd64__)
typedef struct typedef struct
{ {
@ -1286,7 +1368,6 @@ static VoltDefault voltdefault0[] =
}; };
#include <dirent.h> #include <dirent.h>
#include <osreldate.h>
#include <machine/cpufunc.h> #include <machine/cpufunc.h>
#if __FreeBSD_version >= 500042 #if __FreeBSD_version >= 500042
#include <dev/smbus/smb.h> #include <dev/smbus/smb.h>
@ -1298,6 +1379,7 @@ static VoltDefault voltdefault0[] =
#define INTERFACE_IO 0 #define INTERFACE_IO 0
#define INTERFACE_SMB 1 #define INTERFACE_SMB 1
#define INTERFACE_ACPI 2 #define INTERFACE_ACPI 2
#define INTERFACE_CORETEMP 3 /* Already in Celsius */
/* Addresses to use for /dev/io */ /* Addresses to use for /dev/io */
#define WBIO1 0x295 #define WBIO1 0x295
@ -1331,7 +1413,7 @@ get_data(int iodev, u_char command, int interface, u_char *ret)
struct smbcmd cmd; struct smbcmd cmd;
bzero(&cmd, sizeof(cmd)); bzero(&cmd, sizeof(cmd));
cmd.data.byte_ptr = &byte; cmd.data.byte_ptr = (char *)&byte;
cmd.slave = 0x5a; cmd.slave = 0x5a;
cmd.cmd = command; cmd.cmd = command;
if (ioctl(iodev, SMB_READB, (caddr_t)&cmd) == -1) if (ioctl(iodev, SMB_READB, (caddr_t)&cmd) == -1)
@ -1357,6 +1439,8 @@ gkrellm_sys_sensors_get_temperature(gchar *path, gint id,
{ {
u_char byte; u_char byte;
int value;
size_t size;
if (interface == MBMON_INTERFACE) if (interface == MBMON_INTERFACE)
{ {
@ -1366,15 +1450,24 @@ gkrellm_sys_sensors_get_temperature(gchar *path, gint id,
if (interface == INTERFACE_ACPI) if (interface == INTERFACE_ACPI)
{ {
int value; size = sizeof(value);
size_t size = sizeof(value);
if (sysctlbyname(path, &value, &size, NULL, 0) < 0) if (sysctlbyname(path, &value, &size, NULL, 0) < 0)
return FALSE; return FALSE;
if (temp) if (temp)
*temp = (gfloat) TZ_KELVTOC(value); *temp = (gfloat) TZ_KELVTOC(value);
return TRUE; return TRUE;
} }
if (interface == INTERFACE_CORETEMP)
{
size = sizeof(value);
if (sysctlbyname(path, &value, &size, NULL, 0) < 0)
return FALSE;
if (temp)
*temp = (gfloat) value;
return TRUE;
}
if (get_data(iodev, LM78_TEMP, interface, &byte)) if (get_data(iodev, LM78_TEMP, interface, &byte))
{ {
if (temp) if (temp)
@ -1447,7 +1540,7 @@ gkrellm_sys_sensors_init(void)
gchar mib_name[256], label[8]; gchar mib_name[256], label[8];
gint interface, id; gint interface, id;
int oid_acpi_temp[CTL_MAXNAME + 2]; int oid_acpi_temp[CTL_MAXNAME + 2];
size_t oid_acpi_temp_len = sizeof(oid_acpi_temp); size_t oid_acpi_temp_len;
GList *list; GList *list;
struct freebsd_sensor *sensor; struct freebsd_sensor *sensor;
@ -1455,10 +1548,12 @@ gkrellm_sys_sensors_init(void)
*/ */
gkrellm_sys_sensors_mbmon_check(TRUE); gkrellm_sys_sensors_mbmon_check(TRUE);
for (id = 0;;) /* ACPI Thermal */
for (id = 0;; id++)
{ {
snprintf(mib_name, sizeof(mib_name), snprintf(mib_name, sizeof(mib_name),
"hw.acpi.thermal.tz%d.temperature", id); "hw.acpi.thermal.tz%d.temperature", id);
oid_acpi_temp_len = sizeof(oid_acpi_temp);
if (gk_sysctlnametomib(mib_name, oid_acpi_temp, if (gk_sysctlnametomib(mib_name, oid_acpi_temp,
&oid_acpi_temp_len) < 0) &oid_acpi_temp_len) < 0)
break; break;
@ -1472,6 +1567,26 @@ gkrellm_sys_sensors_init(void)
interface, 1.0, 0.0, NULL, label); interface, 1.0, 0.0, NULL, label);
} }
/* Coretemp */
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)
break;
interface = INTERFACE_CORETEMP;
if (!gkrellm_sys_sensors_get_temperature(mib_name, 0, 0,
interface, NULL))
continue;
snprintf(label, sizeof(label), "cpu%d", id);
gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE, NULL,
mib_name, 0, 0,
interface, 1.0, 0.0, NULL, label);
}
if (freebsd_sensor_list) if (freebsd_sensor_list)
{ {
for (list = freebsd_sensor_list; list; list = list->next) for (list = freebsd_sensor_list; list; list = list->next)
@ -1504,13 +1619,7 @@ sensors_add_sensor(gint type, gchar *id_name, gint id, gint iodev, gint inter,
sensor->factor = factor; sensor->factor = factor;
sensor->offset = offset; sensor->offset = offset;
sensor->default_label = default_label ? g_strdup(default_label) : NULL; sensor->default_label = default_label ? g_strdup(default_label) : NULL;
if (g_list_append(freebsd_sensor_list, sensor) == NULL) { freebsd_sensor_list = g_list_append(freebsd_sensor_list, sensor);
g_free(sensor->id_name);
if (sensor->default_label)
g_free(sensor->default_label);
g_free(sensor);
return FALSE;
}
return TRUE; return TRUE;
} }

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -1804,10 +1804,15 @@ read_sysfs_entry (gchar *buf, gint buflen, gchar const *sysentry)
if (*nl == '\n') if (*nl == '\n')
*nl = '\0'; *nl = '\0';
fclose (f); fclose (f);
if (_GK.debug_level & DEBUG_BATTERY)
printf ("read_sysfs_entry: %s = %s\n",
sysentry, buf);
return TRUE; return TRUE;
} }
fclose (f); fclose (f);
} }
if (_GK.debug_level & DEBUG_BATTERY)
printf ("read_sysfs_entry: cannot read %s\n", sysentry);
return FALSE; return FALSE;
} }
@ -1873,6 +1878,7 @@ sysfs_power_data (struct syspower *sp)
} }
else else
{ {
if (charge_full > 0)
percent = charge_now * 100 / charge_full; percent = charge_now * 100 / charge_full;
} }

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2007 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -805,15 +805,6 @@ gkrellm_sys_sensors_sf_init(void)
{ {
ret = TRUE; // Mark SpeedFan as available ret = TRUE; // Mark SpeedFan as available
// Wait a bit for a running SpeedFan that has not detected all its sensors yet
i = 10;
while (i-- > 0)
{
if ((pData->NumTemps + pData->NumVolts + pData->NumFans) > 0)
break;
g_usleep(G_USEC_PER_SEC);
}
gkrellm_debug(DEBUG_SYSDEP, "Enumerating %hu temps, %hu voltages and %hu fans\n", gkrellm_debug(DEBUG_SYSDEP, "Enumerating %hu temps, %hu voltages and %hu fans\n",
pData->NumTemps, pData->NumVolts, pData->NumFans); pData->NumTemps, pData->NumVolts, pData->NumFans);

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net
@ -216,7 +216,7 @@ gkrellm_homedir(void)
homedir = (gchar *) g_get_home_dir(); homedir = (gchar *) g_get_home_dir();
if (!homedir) if (!homedir)
homedir = "."; // FIXME: This does not look right to me (stefan) homedir = ".";
return homedir; return homedir;
} }

View File

@ -1,6 +1,6 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| 2007-2008 Stefan Gehn | 2007-2009 Stefan Gehn
| |
| Authors: Bill Wilson billw@gkrellm.net | Authors: Bill Wilson billw@gkrellm.net
| Stefan Gehn stefan@gkrellm.srcbox.net | Stefan Gehn stefan@gkrellm.srcbox.net

View File

@ -1,6 +1,6 @@
/* GKrellM Windows Portion /* GKrellM Windows Portion
| Copyright (C) 2002 Bill Nalen | Copyright (C) 2002 Bill Nalen
| 2007-2008 Stefan Gehn | 2007-2009 Stefan Gehn
| |
| Authors: Bill Nalen bill@nalens.com | Authors: Bill Nalen bill@nalens.com
| Stefan Gehn stefan@gkrellm.srcbox.net | Stefan Gehn stefan@gkrellm.srcbox.net

View File

@ -36,7 +36,7 @@ BEGIN
VALUE "FileDescription", "GKrellM" VALUE "FileDescription", "GKrellM"
VALUE "FileVersion", RC_VER_STRING VALUE "FileVersion", RC_VER_STRING
VALUE "InternalName", "gkrellm" VALUE "InternalName", "gkrellm"
VALUE "LegalCopyright", "Copyright (C) 1999-2008 Bill Wilson" VALUE "LegalCopyright", "Copyright (C) 1999-2009 Bill Wilson"
VALUE "OriginalFilename", "gkrellm.exe" VALUE "OriginalFilename", "gkrellm.exe"
VALUE "ProductName", "GKrellM" VALUE "ProductName", "GKrellM"
VALUE "ProductVersion", RC_VER_STRING VALUE "ProductVersion", RC_VER_STRING

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net

View File

@ -1,6 +1,6 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| 2007-2008 Stefan Gehn | 2007-2009 Stefan Gehn
| |
| Authors: Bill Wilson billw@gkrellm.net | Authors: Bill Wilson billw@gkrellm.net
| Stefan Gehn stefan@gkrellm.srcbox.net | Stefan Gehn stefan@gkrellm.srcbox.net

View File

@ -1,5 +1,5 @@
/* GKrellM /* GKrellM
| Copyright (C) 1999-2008 Bill Wilson | Copyright (C) 1999-2009 Bill Wilson
| |
| Author: Bill Wilson billw@gkrellm.net | Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net | Latest versions might be found at: http://gkrellm.net