Bug 134902 - sysutils/cpupowerd doesn't need to depend upon devcpu on 7.2-RELEASE
Summary: sysutils/cpupowerd doesn't need to depend upon devcpu on 7.2-RELEASE
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Hajimu UMEMOTO
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-24 10:50 UTC by ume
Modified: 2009-05-25 18:30 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ume 2009-05-24 10:50:07 UTC
Since cpuctl(4) was MFC'ed, sysutils/cpupowerd doesn't need to depend
upon sysutils/devcpu on 7.2-RELEASE and later.

Fix: Please apply the attched patch to sysutils/cpupowerd.


--Multipart_Sun_May_24_18:45:48_2009-1
Content-Type: text/x-patch; type=patch; charset=US-ASCII
Content-Disposition: attachment; filename="cpupowerd-use_cpuctl.diff"
Content-Transfer-Encoding: 7bit



--Multipart_Sun_May_24_18:45:48_2009-1----KecPbrPFtM7V8yrCiRfJFYZHzSRQpYFk9FKxoFMnOM7qiOxM
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

Index: cpupowerd/Makefile
diff -u cpupowerd/Makefile.orig cpupowerd/Makefile
--- cpupowerd/Makefile.orig	2009-01-10 03:52:52.000000000 +0900
+++ cpupowerd/Makefile	2009-05-24 16:30:34.817720205 +0900
@@ -23,8 +23,11 @@
 
 .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)
Index: cpupowerd/files/cpupowerd.in
diff -u cpupowerd/files/cpupowerd.in.orig cpupowerd/files/cpupowerd.in
--- cpupowerd/files/cpupowerd.in.orig	2008-11-23 22:43:09.000000000 +0900
+++ cpupowerd/files/cpupowerd.in	2009-05-24 16:40:30.567642929 +0900
@@ -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 @@
 
 command_args="-d -c ${cpupowerd_config} ${cpupowerd_flags}"
 
+cpupowerd_precmd()
+{
+	if [ ! -c "/dev/%%CPUCTL%%0" ]; then
+		kldload %%CPUCTL%%
+	fi
+}
+
 run_rc_command "$1"
Index: cpupowerd/files/patch-libcpupowerd.c
diff -u -p /dev/null cpupowerd/files/patch-libcpupowerd.c
--- /dev/null	2009-05-24 16:44:18.000000000 +0900
+++ cpupowerd/files/patch-libcpupowerd.c	2009-05-24 16:17:09.828029912 +0900
@@ -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;
How-To-Repeat: Try `kldload cpuctl' on 7.2-RELEASE and later.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2009-05-24 12:36:40 UTC
Maintainer of sysutils/cpupowerd,

Please note that PR ports/134902 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/134902

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2009-05-24 12:36:42 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Bernhard Froehlich 2009-05-24 16:47:44 UTC
On Sun, May 24, 2009 1:36 pm, Edwin Groothuis wrote:
> Maintainer of sysutils/cpupowerd,
>
> Please note that PR ports/134902 has just been submitted.
>
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
>
> The full text of the PR can be found at:
>     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/134902
>
> --
> Edwin Groothuis via the GNATS Auto Assign Tool
> edwin@FreeBSD.org
>

Patch looks fine so I'm okay with the update.

-- 
Bernhard Fröhlich
http://www.bluelife.at/
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2009-05-25 00:11:00 UTC
State Changed
From-To: feedback->open

Maintainer approved.
Comment 5 dfilter service freebsd_committer freebsd_triage 2009-05-25 18:21:59 UTC
ume         2009-05-25 17:21:49 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/cpupowerd   Makefile 
    sysutils/cpupowerd/files cpupowerd.in 
  Added files:
    sysutils/cpupowerd/files patch-libcpupowerd.c 
  Log:
  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)
  
  Revision  Changes    Path
  1.3       +5 -1      ports/sysutils/cpupowerd/Makefile
  1.2       +8 -4      ports/sysutils/cpupowerd/files/cpupowerd.in
  1.3       +44 -0     ports/sysutils/cpupowerd/files/patch-libcpupowerd.c (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 6 Hajimu UMEMOTO freebsd_committer freebsd_triage 2009-05-25 18:22:44 UTC
State Changed
From-To: open->closed
Comment 7 Hajimu UMEMOTO freebsd_committer freebsd_triage 2009-05-25 18:22:44 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ume

Committed.