From owner-svn-src-all@FreeBSD.ORG Fri Jan 25 06:27:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 964F2261; Fri, 25 Jan 2013 06:27:04 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 87F2DFF0; Fri, 25 Jan 2013 06:27:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0P6R4vl053216; Fri, 25 Jan 2013 06:27:04 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0P6R4Hx053215; Fri, 25 Jan 2013 06:27:04 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201301250627.r0P6R4Hx053215@svn.freebsd.org> From: Neel Natu Date: Fri, 25 Jan 2013 06:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245899 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 06:27:04 -0000 Author: neel Date: Fri Jan 25 06:27:03 2013 New Revision: 245899 URL: http://svnweb.freebsd.org/changeset/base/245899 Log: Use the correct type (uint64_t) to retrieve sysctl machdep.tsc_freq. Simplify the function a bit by falling through after initialization and return via the normal code path. Reviewed by: grehan Obtained from: NetApp Modified: head/usr.sbin/bhyve/pmtmr.c Modified: head/usr.sbin/bhyve/pmtmr.c ============================================================================== --- head/usr.sbin/bhyve/pmtmr.c Fri Jan 25 06:18:49 2013 (r245898) +++ head/usr.sbin/bhyve/pmtmr.c Fri Jan 25 06:27:03 2013 (r245899) @@ -66,17 +66,14 @@ pmtmr_val(void) if (!inited) { size_t len; - uint32_t tmpf; inited = 1; pthread_mutex_init(&pmtmr_mtx, NULL); - len = sizeof(tmpf); - sysctlbyname("machdep.tsc_freq", &tmpf, &len, + len = sizeof(pmtmr_tscf); + sysctlbyname("machdep.tsc_freq", &pmtmr_tscf, &len, NULL, 0); - pmtmr_tscf = tmpf; pmtmr_tsc_old = rdtsc(); pmtmr_old = pmtmr_tsc_old / pmtmr_tscf * PMTMR_FREQ; - return (pmtmr_old); } pthread_mutex_lock(&pmtmr_mtx);