Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Nov 2008 15:48:23 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r185053 - head/usr.sbin/powerd
Message-ID:  <200811181548.mAIFmNuL081972@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Nov 18 15:48:23 2008
New Revision: 185053
URL: http://svn.freebsd.org/changeset/base/185053

Log:
  Restore original frequency on exit.
  
  PR:		bin/113813

Modified:
  head/usr.sbin/powerd/powerd.c

Modified: head/usr.sbin/powerd/powerd.c
==============================================================================
--- head/usr.sbin/powerd/powerd.c	Tue Nov 18 14:05:11 2008	(r185052)
+++ head/usr.sbin/powerd/powerd.c	Tue Nov 18 15:48:23 2008	(r185053)
@@ -422,7 +422,7 @@ main(int argc, char * argv[])
 	int nfds;
 	struct pidfh *pfh = NULL;
 	const char *pidfile = NULL;
-	int freq, curfreq, *freqs, i, j, *mwatts, numfreqs, load;
+	int freq, curfreq, initfreq, *freqs, i, j, *mwatts, numfreqs, load;
 	int ch, mode, mode_ac, mode_battery, mode_none;
 	uint64_t mjoules_used;
 	size_t len;
@@ -536,7 +536,7 @@ main(int argc, char * argv[])
 	signal(SIGINT, handle_sigs);
 	signal(SIGTERM, handle_sigs);
 
-	freq = get_freq();
+	freq = initfreq = get_freq();
 	if (freq < 1)
 		freq = 1;
 	/* Main loop. */
@@ -682,6 +682,8 @@ main(int argc, char * argv[])
 				    freqs[j]);
 		}
 	}
+	if (set_freq(initfreq))
+		warn("error setting CPU frequency %d", initfreq);
 	free(freqs);
 	free(mwatts);
 	devd_close();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811181548.mAIFmNuL081972>