aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/cpupowerd
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2009-05-26 01:21:49 +0800
committerume <ume@FreeBSD.org>2009-05-26 01:21:49 +0800
commit42899d0febd78b7d566d6a5b4271264f787c0681 (patch)
treed5ef982457d87a3febb5f65b27625014e738975f /sysutils/cpupowerd
parent4ee3661e2eb0d7dd65c62fad72591b6ac965ff7b (diff)
downloadfreebsd-ports-graphics-42899d0febd78b7d566d6a5b4271264f787c0681.tar.gz
freebsd-ports-graphics-42899d0febd78b7d566d6a5b4271264f787c0681.tar.zst
freebsd-ports-graphics-42899d0febd78b7d566d6a5b4271264f787c0681.zip
Since cpuctl(4) was MFC'ed, sysutils/cpupowerd doesn't need to depend
upon sysutils/devcpu on 7.2-RELEASE and later. PR: ports/134902 Approved by: decke__at__bluelife.at (maintainer)
Diffstat (limited to 'sysutils/cpupowerd')
-rw-r--r--sysutils/cpupowerd/Makefile6
-rw-r--r--sysutils/cpupowerd/files/cpupowerd.in12
-rw-r--r--sysutils/cpupowerd/files/patch-libcpupowerd.c44
3 files changed, 57 insertions, 5 deletions
diff --git a/sysutils/cpupowerd/Makefile b/sysutils/cpupowerd/Makefile
index 6820402ae30..99665b33da8 100644
--- a/sysutils/cpupowerd/Makefile
+++ b/sysutils/cpupowerd/Makefile
@@ -7,6 +7,7 @@
PORTNAME= cpupowerd
PORTVERSION= 0.2.1
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= SF
@@ -23,8 +24,11 @@ OPTIONS= CREATELOAD "Install createload.sh for stability testing" Off
.include <bsd.port.pre.mk>
-.if ${OSVERSION} < 800042
+.if (${OSVERSION} < 800042 && ${OSVERSION} >= 800000) || ${OSVERSION} < 701102
BUILD_DEPENDS+= ${LOCALBASE}/include/cpu.h:${PORTSDIR}/sysutils/devcpu
+SUB_LIST+= CPUCTL="cpu"
+.else
+SUB_LIST+= CPUCTL="cpuctl"
.endif
.if defined(WITH_CREATELOAD)
diff --git a/sysutils/cpupowerd/files/cpupowerd.in b/sysutils/cpupowerd/files/cpupowerd.in
index db71d31fd77..7d3bdac7428 100644
--- a/sysutils/cpupowerd/files/cpupowerd.in
+++ b/sysutils/cpupowerd/files/cpupowerd.in
@@ -20,13 +20,10 @@
name="cpupowerd"
rcvar=`set_rcvar`
command=%%PREFIX%%/sbin/${name}
+start_precmd="${name}_precmd"
load_rc_config $name
-if [ ! -c "/dev/cpu0" -a ! -c "/dev/cpuctl0" ]; then
- kldload cpu
-fi
-
# set default
: ${cpupowerd_enable="NO"}
: ${cpupowerd_config="%%PREFIX%%/etc/cpupowerd.conf"}
@@ -34,4 +31,11 @@ fi
command_args="-d -c ${cpupowerd_config} ${cpupowerd_flags}"
+cpupowerd_precmd()
+{
+ if [ ! -c "/dev/%%CPUCTL%%0" ]; then
+ kldload %%CPUCTL%%
+ fi
+}
+
run_rc_command "$1"
diff --git a/sysutils/cpupowerd/files/patch-libcpupowerd.c b/sysutils/cpupowerd/files/patch-libcpupowerd.c
new file mode 100644
index 00000000000..d86b6eae929
--- /dev/null
+++ b/sysutils/cpupowerd/files/patch-libcpupowerd.c
@@ -0,0 +1,44 @@
+Index: libcpupowerd.c
+diff -u -p libcpupowerd.c.orig libcpupowerd.c
+--- libcpupowerd.c.orig 2009-01-01 22:05:10.000000000 +0900
++++ libcpupowerd.c 2009-05-24 16:16:35.182882907 +0900
+@@ -34,7 +34,8 @@
+ #include <sys/sysctl.h>
+ #ifdef __FreeBSD__
+ #include <sys/param.h>
+-#if __FreeBSD_version < 800042
++#if (__FreeBSD_version < 800042 && __FreeBSD_version >= 800000) || \
++ __FreeBSD_version < 701102
+ #include <cpu.h>
+ #define RDMSR CPU_RDMSR
+ #define WRMSR CPU_WRMSR
+@@ -627,7 +628,8 @@ static int libcpupowerd_get_interfacefil
+ static int libcpupowerd_read_msr_ioctl(char *msrfile, unsigned long index, unsigned long long *msrvalue)
+ {
+ int fd;
+- #if __FreeBSD_version < 800042
++ #if (__FreeBSD_version < 800042 && __FreeBSD_version >= 800000) || \
++ __FreeBSD_version < 701102
+ cpu_msr_args_t args;
+ #else
+ cpuctl_msr_args_t args;
+@@ -663,7 +665,8 @@ static int libcpupowerd_read_msr_ioctl(c
+ static int libcpupowerd_write_msr_ioctl(char *msrfile, unsigned long index, unsigned long long *msrvalue)
+ {
+ int fd;
+- #if __FreeBSD_version < 800042
++ #if (__FreeBSD_version < 800042 && __FreeBSD_version >= 800000) || \
++ __FreeBSD_version < 701102
+ cpu_msr_args_t args;
+ #else
+ cpuctl_msr_args_t args;
+@@ -698,7 +701,8 @@ static int libcpupowerd_write_msr_ioctl(
+ static int libcpupowerd_read_cpuid_ioctl(char *cpuidfile, unsigned long index, unsigned long *eax, unsigned long *ebx, unsigned long *ecx, unsigned long *edx)
+ {
+ int fd;
+- #if __FreeBSD_version < 800042
++ #if (__FreeBSD_version < 800042 && __FreeBSD_version >= 800000) || \
++ __FreeBSD_version < 701102
+ cpu_cpuid_args_t args;
+ #else
+ cpuctl_cpuid_args_t args;