2 Fixes for NetBSD, OpenBSD, FreeBSD:

- Add cpu times calculations
- Disable backlight handling, it is linux-only.
This commit is contained in:
youri 2019-01-21 13:12:32 +00:00
parent 0b06bd6669
commit 887532c6cc
4 changed files with 61 additions and 2 deletions

View file

@ -1,8 +1,9 @@
# $NetBSD: Makefile,v 1.13 2019/01/16 18:09:52 youri Exp $
# $NetBSD: Makefile,v 1.14 2019/01/21 13:12:32 youri Exp $
.include "../../meta-pkgs/mate/Makefile.common"
DISTNAME= mate-power-manager-${VERSION:R}.1
PKGREVISION= 1
CATEGORIES= sysutils
COMMENT= Power manager for MATE

View file

@ -1,6 +1,8 @@
$NetBSD: distinfo,v 1.4 2019/01/16 18:09:52 youri Exp $
$NetBSD: distinfo,v 1.5 2019/01/21 13:12:32 youri Exp $
SHA1 (mate-power-manager-1.21.1.tar.xz) = e6094ab906de5dbde508359705e92f859537f0f5
RMD160 (mate-power-manager-1.21.1.tar.xz) = 91aa1d44262affcc039c90074f7b41c1eb405ebf
SHA512 (mate-power-manager-1.21.1.tar.xz) = e7a63e5693f70f233b44983261837b5224c956720340ad70f500fef44e7f9fdb15c1a183bc23a2f28d0f423c2163c23178d346c2ac5d0ac46fdbcc2b334721ae
Size (mate-power-manager-1.21.1.tar.xz) = 3214980 bytes
SHA1 (patch-src_gpm-backlight-helper.c) = 01c6549805efa557ec6a219c99bf2b6fb77d6fb8
SHA1 (patch-src_gpm-load.c) = 86b3189f77cf64f05631ddc72fd56acafadc1714

View file

@ -0,0 +1,16 @@
$NetBSD: patch-src_gpm-backlight-helper.c,v 1.1 2019/01/21 13:12:32 youri Exp $
Disable backlight helper for non linux.
--- src/gpm-backlight-helper.c.orig 2018-01-29 14:50:11.000000000 +0000
+++ src/gpm-backlight-helper.c
@@ -146,6 +146,9 @@ out:
gint
main (gint argc, gchar *argv[])
{
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ return GCM_BACKLIGHT_HELPER_EXIT_CODE_FAILED;
+#endif
GOptionContext *context;
gint uid;
gint euid;

View file

@ -0,0 +1,40 @@
$NetBSD: patch-src_gpm-load.c,v 1.1 2019/01/21 13:12:32 youri Exp $
Add cpu times calculations for *BSD.
--- src/gpm-load.c.orig 2018-01-29 14:50:11.000000000 +0000
+++ src/gpm-load.c
@@ -151,6 +151,33 @@ out:
return FALSE;
}
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+
+/**
+ * gpm_load_get_cpu_values:
+ * @cpu_idle: The idle time reported by the CPU
+ * @cpu_total: The total time reported by the CPU
+ * Return value: Success of reading of the kern.cp_time sysctl.
+ **/
+static gboolean
+gpm_load_get_cpu_values (long unsigned *cpu_idle, long unsigned *cpu_total)
+{
+ long cpts[CPUSTATES];
+ size_t length;
+
+ length = sizeof (cpts);
+ if (sysctlbyname ("kern.cp_time", cpts, &length, NULL, 0)) {
+ return FALSE;
+ }
+
+ *cpu_idle = (unsigned long) cpts[CP_IDLE];
+ *cpu_total = (unsigned long) (cpts[CP_USER] + cpts[CP_NICE] + \
+ cpts[CP_SYS] + cpts[CP_IDLE] + cpts[CP_INTR]);
+
+ return TRUE;
+}
+
+
#else
/**