Branch: master

630abb9f 2019-04-16 09:02:18 OBATA Akio
Fix to build on NetBSD missing statfs from BSD44 feature

Signed-off-by: OBATA Akio <obache@...>
M ark/arkutils.cpp

ark/arkutils.cpp

diff --git a/ark/arkutils.cpp b/ark/arkutils.cpp
index 24411e8..72545f5 100644
--- a/ark/arkutils.cpp
+++ b/ark/arkutils.cpp
@@ -48,11 +48,11 @@
 #endif
 
 // for statfs:
-#ifdef BSD4_4
+#if defined(BSD4_4) && !defined(__NetBSD__)
 #include <sys/mount.h>
 #elif defined(__linux__)
 #include <sys/vfs.h>
-#elif defined(__sun)
+#elif defined(__sun) || defined(__NetBSD__)
 #include <sys/statvfs.h>
 #define STATFS statvfs
 #elif defined(_AIX)
032b927b 2019-04-16 09:02:34 OBATA Akio
Recent NetBSD explicitly need uvm/uvm_extern.h

Signed-off-by: OBATA Akio <obache@...>
M superkaramba/src/memsensor.cpp

superkaramba/src/memsensor.cpp

diff --git a/superkaramba/src/memsensor.cpp b/superkaramba/src/memsensor.cpp
index 4cc2e7d..98eceea 100644
--- a/superkaramba/src/memsensor.cpp
+++ b/superkaramba/src/memsensor.cpp
@@ -30,6 +30,7 @@
 #include <sys/sysctl.h>
 #include <sys/sched.h>
 #include <sys/swap.h>
+#include <uvm/uvm_extern.h>
 #endif
 
 #include <kprocio.h>
da2fceb0 2019-04-16 09:02:34 OBATA Akio
Fix if-def condition same as *.cpp

Signed-off-by: OBATA Akio <obache@...>
M superkaramba/src/sensorsensor.h

superkaramba/src/sensorsensor.h

diff --git a/superkaramba/src/sensorsensor.h b/superkaramba/src/sensorsensor.h
index fccf5bf..c2692ef 100644
--- a/superkaramba/src/sensorsensor.h
+++ b/superkaramba/src/sensorsensor.h
@@ -34,7 +34,7 @@
     TQString extraParams;
 
     TQMap<TQString,TQString> sensorMap;
-#ifdef __FreeBSD__
+#if defined __FreeBSD__ || defined(Q_OS_NETBSD)
     TQMap<TQString,TQString> sensorMapBSD;
 #endif
     TQString sensorResult;
f8424834 2019-04-16 09:02:35 OBATA Akio
Fix NetBSD APM support

NetBSD APM is supported other than i386 too, emulate API,
so change to detect with MI support header.
Additionally, catch up support codes to others.

Signed-off-by: OBATA Akio <obache@...>
M CMakeLists.txt
M ConfigureChecks.cmake
M config.h.cmake
M klaptopdaemon/portable.cpp

CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a51b14c..27d5897 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,7 @@
 
 include( FindPkgConfig )
 include( CheckIncludeFile )
+include( CheckIncludeFiles )
 include( CheckLibraryExists )
 include( CheckSymbolExists )
 include( CheckFunctionExists )

ConfigureChecks.cmake

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 44ca497..1b48407 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -80,6 +80,10 @@
     tde_message_fatal( "stdint.h header is required, but was not found on your system" )
   endif( NOT HAVE_STDINT_H )
 
+# NetBSD apm support
+  check_include_files( "unistd.h;machine/apm_bios.h" HAVE_MACHINE_APM_BIOS_H )
+  check_include_files( "unistd.h;dev/apm/apmio.h" HAVE_DEV_APM_APMIO_H )
+
 # xtest
   pkg_search_module( XTEST xtst )
    if( XTEST_FOUND )

config.h.cmake

diff --git a/config.h.cmake b/config.h.cmake
index 50adee4..52adf87 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -60,6 +60,12 @@
 #if !defined( HAVE_STDINT_H )
 #cmakedefine HAVE_STDINT_H
 #endif // HAVE_STDINT_H
+#if !defined( HAVE_MACHINE_APM_BIOS_H )
+#cmakedefine HAVE_MACHINE_APM_BIOS_H
+#endif // HAVE_MACHIE_APM_BIOS_H
+#if !defined( HAVE_DEV_APM_APMIO_H )
+#cmakedefine HAVE_DEV_APM_APMIO_H
+#endif // HAVE_DEV_APM_APMIO_H
 
 #cmakedefine HAVE_XSCREENSAVER
 #cmakedefine HAVE_DPMS

klaptopdaemon/portable.cpp

diff --git a/klaptopdaemon/portable.cpp b/klaptopdaemon/portable.cpp
index 35d69b6..1be8706 100644
--- a/klaptopdaemon/portable.cpp
+++ b/klaptopdaemon/portable.cpp
@@ -39,7 +39,7 @@
 //
 //	Linux 		(#if __linux__)
 //	FreeBSD		(#elif __FreeBSD__)
-//	NetBSD		(#elif __NetBSD_APM__)
+//	NetBSD		(#elif __NetBSD__)
 //	generic nothing	(#else)
 //
 //
@@ -2429,7 +2429,7 @@
 }
 
 
-#elif  defined(__NetBSD_APM__)
+#elif  defined(__NetBSD__) && defined(HAVE_DEV_APM_APMIO_H)
 
 #include <errno.h>
 #include <fcntl.h>
@@ -2437,11 +2437,16 @@
 #include <stdlib.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
-#include <machine/apmvar.h>
-#include <iostream.h>
+#include <dev/apm/apmbios.h>
+#include <dev/apm/apmio.h>
+#include <iostream>
+#include <tqpushbutton.h>
+#include <tqobject.h>
+#include <kactivelabel.h>
+#include <kprocess.h>
 
 //
-// klaptopdeamon interface to NetBSD 1.5 apm.
+// Klaptopdeamon interface to NetBSD 1.5 apm.
 // Scott Presnell, srp@..., srp@...
 // Fri Jun 29 17:21:25 PDT 2001
 // Tested on Dell I4K running NetBSD 1.5R
@@ -2463,6 +2468,7 @@
        }
 
        struct apm_power_info info;
+       memset(&info, 0, sizeof(info));
        ret=ioctl(fd, APM_IOC_GETPOWER, &info);
        ::close(fd);
 
@@ -2490,6 +2496,7 @@
          return 0;
 
        struct apm_power_info info;
+       memset(&info, 0, sizeof(info));
        ret=ioctl(fd, APM_IOC_GETPOWER, &info);
        ::close(fd);
 
@@ -2661,6 +2668,15 @@
 
 
 //
+//     adds extra widgets to the battery panel
+//
+void
+laptop_portable::extra_config(TQWidget *parent, TDEConfig *config, TQVBoxLayout *layout)
+{
+}
+
+
+//
 //     return current battery state
 //
 struct power_result laptop_portable::poll_battery_state()
@@ -2674,6 +2690,7 @@
                goto bad;
 
                struct apm_power_info info;
+               memset(&info, 0, sizeof(info));
                ret=ioctl(fd, APM_IOC_GETPOWER, &info);
                ::close(fd);
        
@@ -2736,7 +2753,16 @@
 }
 
 bool
-laptop_portable::get_system_throttling(bool, int &current, TQStringList &s)   // do something to help get system throttling data from places like ACPI
+laptop_portable::get_system_performance(bool, int &current, TQStringList &s, bool *&)   // do something to help get system profiles from places like ACPI
+{
+	// INSERT HERE
+        current = 0;
+        s.clear();
+        return(0);	// if no profiles are available
+}
+
+bool
+laptop_portable::get_system_throttling(bool, int &current, TQStringList &s, bool *&)   // do something to help get system throttling data from places like ACPI
 {
 	// INSERT HERE
 	current = 0;
@@ -2794,6 +2820,18 @@
 	values.append(s);
 }
 
+bool
+laptop_portable::has_software_suspend(int /*type*/)
+{
+        return false; // (::has_software_suspend(type));
+}
+
+void
+laptop_portable::software_suspend_set_mask(bool hibernate)
+{
+        // software_suspend_is_preferred =hibernate;
+}
+
 #else
 
 /*
d3499954 2019-05-04 15:22:41 OBATA Akio
Change and simplify `statvfs` conditions in FileSystemStats

`getfsstat` v.s. `getvfsstat` condition is different than
`statfs` v.s. `statvfs`, so split each condition and simplify.

For `get(v)fsstat` side, changed to check and use `getmntinfo`, because
it is better than `get(v)fsstat` with fixed buffer size, and easier
than improve it with dynamic buffer allocation.

Signed-off-by: OBATA Akio <obache@...>
M ConfigureChecks.cmake
M config.h.cmake
M ksim/monitors/filesystem/filesystemstats.cpp

ConfigureChecks.cmake

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 1b48407..148884c 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -155,6 +155,20 @@
 
   check_include_file( "sys/loadavg.h"  HAVE_SYS_LOADAVG_H )
   check_function_exists( getloadavg    HAVE_GETLOADAVG )
+  check_function_exists( statfs        HAVE_STATFS )
+  check_function_exists( statvfs       HAVE_STATVFS )
+  check_function_exists( getmntinfo    HAVE_GETMNTINFO )
+  if( HAVE_GETMNTINFO )
+    check_cxx_source_compiles("
+      #include <sys/types.h>
+      #include <sys/statvfs.h>
+      int main(){
+        struct statvfs *mntbufp;
+        int flags;
+        return getmntinfo(&mntbufp, flags);
+      }"
+      GETMNTINFO_USES_STATVFS )
+  endif( HAVE_GETMNTINFO )
 
   check_c_source_compiles(
     "#include <linux/kernel.h>

config.h.cmake

diff --git a/config.h.cmake b/config.h.cmake
index 52adf87..6676c8b 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -91,6 +91,12 @@
 #cmakedefine HAVE_GETLOADAVG
 #endif // HAVE_GETLOADAVG
 
+#cmakedefine HAVE_STATFS
+#if !defined( HAVE_STATVFS )
+#cmakedefine HAVE_STATVFS
+#endif
+#cmakedefine HAVE_GETMNTINFO
+#cmakedefine GETMNTINFO_USES_STATVFS
 
 // superkaramba
 

ksim/monitors/filesystem/filesystemstats.cpp

diff --git a/ksim/monitors/filesystem/filesystemstats.cpp b/ksim/monitors/filesystem/filesystemstats.cpp
index 1aa156d..f60ce58 100644
** Diff limit reached (max: 250 lines) **
a5230373 2019-05-04 15:22:41 OBATA Akio
Use `getvfsnumber()` to retrieve filesystem name on OSF/1 (Tru64)

Signed-off-by: OBATA Akio <obache@...>
M ksim/monitors/filesystem/filesystemstats.cpp
** Diff limit reached (max: 250 lines) **

Branch: r14.0.x

e4a9b5ac 2019-05-04 15:25:50 OBATA Akio
Recent NetBSD explicitly need uvm/uvm_extern.h

Signed-off-by: OBATA Akio <obache@...>
(cherry picked from commit 032b927bf5d3afa5b13be40f1bfcb716980f0a58)
M superkaramba/src/memsensor.cpp
** Diff limit reached (max: 250 lines) **
145adcea 2019-05-04 15:25:50 OBATA Akio
Fix if-def condition same as *.cpp

Signed-off-by: OBATA Akio <obache@...>
(cherry picked from commit da2fceb03bbdb031fbe6e3e285f5a4d0b013c0b4)
M superkaramba/src/sensorsensor.h
** Diff limit reached (max: 250 lines) **
e2e56f4e 2019-05-04 15:25:51 OBATA Akio
Fix NetBSD APM support

NetBSD APM is supported other than i386 too, emulate API,
so change to detect with MI support header.
Additionally, catch up support codes to others.

Signed-off-by: OBATA Akio <obache@...>
(cherry picked from commit f8424834b6a36b4d3e43e3af199e55c18fb913b8)
M CMakeLists.txt
M ConfigureChecks.cmake
M config.h.cmake
M klaptopdaemon/portable.cpp
** Diff limit reached (max: 250 lines) **
39a89fa0 2019-05-04 15:25:51 OBATA Akio
Change and simplify `statvfs` conditions in FileSystemStats

`getfsstat` v.s. `getvfsstat` condition is different than
`statfs` v.s. `statvfs`, so split each condition and simplify.

For `get(v)fsstat` side, changed to check and use `getmntinfo`, because
it is better than `get(v)fsstat` with fixed buffer size, and easier
than improve it with dynamic buffer allocation.

Signed-off-by: OBATA Akio <obache@...>
(cherry picked from commit d349995488a13687171a67efd981e986b3b703e5)
M ConfigureChecks.cmake
M config.h.cmake
M ksim/monitors/filesystem/filesystemstats.cpp
** Diff limit reached (max: 250 lines) **
f0ab3066 2019-05-04 15:25:51 OBATA Akio
Use `getvfsnumber()` to retrieve filesystem name on OSF/1 (Tru64)

Signed-off-by: OBATA Akio <obache@...>
(cherry picked from commit a52303734b6b7ade6c3eca81871aad2d488d37f8)
M ksim/monitors/filesystem/filesystemstats.cpp
** Diff limit reached (max: 250 lines) **