amd64/169779: [patch] powerd doesn't honor the -n flag

Axel Gonzalez loox at
Wed Jul 11 02:50:12 UTC 2012

>Number:         169779
>Category:       amd64
>Synopsis:       [patch] powerd doesn't honor the -n flag
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-amd64
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 11 02:50:10 UTC 2012
>Originator:     Axel Gonzalez
>Release:        9.0-RELEASE-p2
FreeBSD moonlight 9.0-RELEASE-p2 FreeBSD 9.0-RELEASE-p2 #0: Tue Jun 12 02:12:57 CDT 2012     toor at moonlight:/usr/obj/usr/src/sys/LXCORE964  amd64
powerd never initializes the variable that keeps the status of the line status. This variable defaults to 0 (with the compiler? with the arch?) and results in powerd using the AC profile.

This is a problem, since at start it says it is in unkown status, but doesn't respect the -n argument. 

Note: since the variable is not initialized, it can lead to other unexpected behaviour.

This should use the "adaptive" profile specified by -n, but uses hiadaptive

# /usr/sbin/powerd -i 50 -r 80 -M 1800 -v -p 1000 -n adaptive
powerd: unable to determine AC line status
CPU frequency is above user-defined maximum; changing frequency to 1795 MHz
load  15%, current freq 1795 MHz ( 0), wanted freq 2094 MHz

Initialize the variable

--- powerd.c.orig       2012-07-10 21:21:07.882970887 -0500
+++ powerd.c    2012-07-10 21:22:29.292974203 -0500
@@ -278,6 +278,7 @@
        acline_mib_len = 4;
+        acline_status = SRC_UNKNOWN;
        if (sysctlnametomib(ACPIAC, acline_mib, &acline_mib_len) == 0) {
                acline_mode = ac_sysctl;


More information about the freebsd-amd64 mailing list