diff options
author | ume <ume@FreeBSD.org> | 2008-02-01 01:32:17 +0800 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2008-02-01 01:32:17 +0800 |
commit | a1f6cac5569c91db3f4c839ece1dd9fcc5cdc498 (patch) | |
tree | df9b17c213f09320ac633c9a22458a3c45d95f2d /sysutils/gkrellm2 | |
parent | d7caf345d7bf5c41fafde6b9585df35d3fde394e (diff) | |
download | freebsd-ports-gnome-a1f6cac5569c91db3f4c839ece1dd9fcc5cdc498.tar.gz freebsd-ports-gnome-a1f6cac5569c91db3f4c839ece1dd9fcc5cdc498.tar.zst freebsd-ports-gnome-a1f6cac5569c91db3f4c839ece1dd9fcc5cdc498.zip |
- Enable battery support on amd64 using ACPI. [1]
- Suppress compile time warnings.
PR: ports/120149 [1]
Submitted by: Sven Berkvens-Matthijsse <sven__at__berkvens.net> [1]
Diffstat (limited to 'sysutils/gkrellm2')
-rw-r--r-- | sysutils/gkrellm2/Makefile | 2 | ||||
-rw-r--r-- | sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c | 128 |
2 files changed, 122 insertions, 8 deletions
diff --git a/sysutils/gkrellm2/Makefile b/sysutils/gkrellm2/Makefile index 7ac5dd6f7410..1255072069cb 100644 --- a/sysutils/gkrellm2/Makefile +++ b/sysutils/gkrellm2/Makefile @@ -7,7 +7,7 @@ PORTNAME= gkrellm PORTVERSION= 2.3.1 -#PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= sysutils ipv6 MASTER_SITES= http://members.dslextreme.com/users/billw/gkrellm/ \ ${MASTER_SITE_LOCAL} diff --git a/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c b/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c index 546f23af699e..01c83a2418c6 100644 --- a/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c +++ b/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c @@ -1,8 +1,113 @@ Index: src/sysdeps/freebsd.c diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c --- src/sysdeps/freebsd.c.orig 2007-07-07 08:53:07.000000000 +0900 -+++ src/sysdeps/freebsd.c 2007-12-24 20:26:19.000000000 +0900 -@@ -1286,6 +1286,7 @@ static VoltDefault voltdefault0[] = ++++ src/sysdeps/freebsd.c 2008-01-31 16:47:46.328923081 +0900 +@@ -97,7 +97,7 @@ void + gkrellm_sys_cpu_read_data(void) + { + long cp_time[CPUSTATES]; +- int len = sizeof(cp_time); ++ size_t len = sizeof(cp_time); + static struct nlist nl[] = { + #define N_CP_TIME 0 + { "_cp_time" }, +@@ -206,7 +206,7 @@ gkrellm_sys_proc_read_data(void) + static u_int n_processes, n_forks = 0, curpid = -1; + u_int n_vforks, n_rforks; + gint r_forks, r_vforks, r_rforks; +- gint len; ++ size_t len; + gint nextpid, nforked; + static struct nlist nl[] = { + #define N_NEXTPID 0 +@@ -570,7 +570,7 @@ gkrellm_sys_inet_read_tcp_data(void) + gint tcp_status; + struct xinpgen *xig, *oxig; + gchar *buf; +- gint len = 0; ++ size_t len = 0; + + if (!initialized) + { +@@ -680,7 +680,7 @@ extern kvm_t *kvmd; + extern char errbuf[]; + + static int +-swapmode(guint64 *retavail, guint64 *retfree) ++swapmode(unsigned long long *retavail, unsigned long long *retfree) + { + guint64 used, avail; + #if __FreeBSD_version >= 400000 +@@ -930,9 +930,9 @@ static struct mibtab mibs[] = { + #endif + + static guint64 swapin, +- swapout, +- swap_total, +- swap_used; ++ swapout; ++static unsigned long long swap_total, ++ swap_used; + + void + gkrellm_sys_mem_read_data(void) +@@ -1078,8 +1078,9 @@ gkrellm_sys_mem_init(void) + /* ===================================================================== */ + /* Battery monitor interface */ + +-#if defined(__i386__) ++#if defined(__i386__) || defined(__amd64__) + #include <osreldate.h> ++#if defined(__i386__) + #include <machine/apm_bios.h> + #define APMDEV "/dev/apm" + +@@ -1087,6 +1088,7 @@ gkrellm_sys_mem_init(void) + #define L_ON_LINE 1 + #define L_CHARGING 3 + #define L_UNKNOWN 0xFF ++#endif + + /* following two definitions are taken from sys/dev/acpica/acpiio.h */ + #define ACPI_BATT_STAT_CHARGING 0x0002 +@@ -1113,16 +1115,18 @@ gkrellm_sys_battery_read_data(void) + size_t size; + int acpi_info[4]; + int i; ++#if defined(__i386__) + int f, r; + struct apm_info info; ++ gint batt_num = 0; ++#endif + gboolean available, on_line, charging; + gint percent, time_left; +- gint batt_num = 0; + + if (!first_time_done) + { + first_time_done = TRUE; +-#ifdef ACPI_SUPPORTS_MULTIPLE_BATTERIES ++#if defined(ACPI_SUPPORTS_MULTIPLE_BATTERIES) || defined(__amd64__) + /* + * XXX: Disable getting battery information via ACPI + * to support multiple batteries via APM sim until +@@ -1162,6 +1166,7 @@ gkrellm_sys_battery_read_data(void) + return; + } + ++#if defined(__i386__) + if ((f = open(APMDEV, O_RDONLY)) == -1) + return; + if ((r = ioctl(f, APMIO_GETINFO, &info)) == -1) { +@@ -1219,6 +1224,7 @@ gkrellm_sys_battery_read_data(void) + #endif + + close(f); ++#endif + } + + gboolean +@@ -1286,6 +1292,7 @@ static VoltDefault voltdefault0[] = #define INTERFACE_IO 0 #define INTERFACE_SMB 1 #define INTERFACE_ACPI 2 @@ -10,7 +115,16 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c /* Addresses to use for /dev/io */ #define WBIO1 0x295 -@@ -1345,6 +1346,8 @@ gkrellm_sys_sensors_get_temperature(gcha +@@ -1319,7 +1326,7 @@ get_data(int iodev, u_char command, int + struct smbcmd cmd; + + bzero(&cmd, sizeof(cmd)); +- cmd.data.byte_ptr = &byte; ++ cmd.data.byte_ptr = (char *)&byte; + cmd.slave = 0x5a; + cmd.cmd = command; + if (ioctl(iodev, SMB_READB, (caddr_t)&cmd) == -1) +@@ -1345,6 +1352,8 @@ gkrellm_sys_sensors_get_temperature(gcha { u_char byte; @@ -19,7 +133,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (interface == MBMON_INTERFACE) { -@@ -1354,15 +1357,24 @@ gkrellm_sys_sensors_get_temperature(gcha +@@ -1354,15 +1363,24 @@ gkrellm_sys_sensors_get_temperature(gcha if (interface == INTERFACE_ACPI) { @@ -47,7 +161,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (get_data(iodev, LM78_TEMP, interface, &byte)) { if (temp) -@@ -1435,7 +1447,7 @@ gkrellm_sys_sensors_init(void) +@@ -1435,7 +1453,7 @@ gkrellm_sys_sensors_init(void) gchar mib_name[256], label[8]; gint interface, id; int oid_acpi_temp[CTL_MAXNAME + 2]; @@ -56,7 +170,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c GList *list; struct freebsd_sensor *sensor; -@@ -1443,10 +1455,12 @@ gkrellm_sys_sensors_init(void) +@@ -1443,10 +1461,12 @@ gkrellm_sys_sensors_init(void) */ gkrellm_sys_sensors_mbmon_check(TRUE); @@ -71,7 +185,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (gk_sysctlnametomib(mib_name, oid_acpi_temp, &oid_acpi_temp_len) < 0) break; -@@ -1458,7 +1472,27 @@ gkrellm_sys_sensors_init(void) +@@ -1458,7 +1478,27 @@ gkrellm_sys_sensors_init(void) gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE, NULL, mib_name, 0, 0, interface, 1.0, 0.0, NULL, label); |