From danny@cs.huji.ac.il  Wed Apr 23 13:17:48 2008
Return-Path: <danny@cs.huji.ac.il>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 08B981065672
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 23 Apr 2008 13:17:48 +0000 (UTC)
	(envelope-from danny@cs.huji.ac.il)
Received: from cs1.cs.huji.ac.il (cs1.cs.huji.ac.il [132.65.16.10])
	by mx1.freebsd.org (Postfix) with ESMTP id A2A778FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 23 Apr 2008 13:17:47 +0000 (UTC)
	(envelope-from danny@cs.huji.ac.il)
Received: from pundit.cs.huji.ac.il ([132.65.80.200])
	by cs1.cs.huji.ac.il with esmtp
	id 1JoeBi-000JIi-SC
	for FreeBSD-gnats-submit@freebsd.org; Wed, 23 Apr 2008 15:35:02 +0300
Received: from danny by pundit.cs.huji.ac.il with local (Exim 4.69 (FreeBSD))
	(envelope-from <danny@cs.huji.ac.il>)
	id 1JoeBi-0000Vu-QD
	for FreeBSD-gnats-submit@freebsd.org; Wed, 23 Apr 2008 15:35:02 +0300
Message-Id: <E1JoeBi-0000Vu-QD@pundit.cs.huji.ac.il>
Date: Wed, 23 Apr 2008 15:35:02 +0300
From: Danny Braniss <danny@cs.huji.ac.il>
Reply-To: Danny Braniss <danny@cs.huji.ac.il>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: rpc.rstatd broken
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         123014
>Category:       bin
>Synopsis:       [patch] rpc.rstatd broken
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    peter
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 23 13:20:00 UTC 2008
>Closed-Date:    Tue Jun 10 18:49:16 UTC 2008
>Last-Modified:  Tue Jun 10 18:50:04 UTC 2008
>Originator:     Danny Braniss
>Release:        FreeBSD 7.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD pundit 7.0-STABLE FreeBSD 7.0-STABLE #78: Wed Apr 23 13:41:25 IDT 2008 danny@sunfire:/r+d/obj/sunfire/r+d/7.0/src/sys/HUJI amd64


	
>Description:
	cp_time is no longer a global variable, so kvm_nlist fails.
	rpc.rstatd[1678]: rstatd: Can't get namelist. 1
	inetd[1187]: /usr/libexec/rpc.rstatd[1678]: exited, status 1

>How-To-Repeat:
	enable rpc.rstatd/1-3 in inetd.conf, and try rup localhost
>Fix:
	use sysctl instead:

diff -bru /r+d/releng_7/src/libexec/rpc.rstatd/rstat_proc.c rpc.rstatd/rstat_proc.c
--- /r+d/releng_7/src/libexec/rpc.rstatd/rstat_proc.c   2003-06-02 05:34:36.000000000 +0300
+++ rpc.rstatd/rstat_proc.c     2008-04-23 15:25:24.534878000 +0300
@@ -77,9 +77,7 @@
 #include <rpcsvc/rstat.h>
 
 struct nlist nl[] = {
-#define        X_CPTIME        0
-       { "_cp_time" },
-#define        X_CNT           1
+#define        X_CNT           0
        { "_cnt" },
        { "" },
 };
@@ -213,9 +211,9 @@
        }
        hz = clockrate.hz;
 
-       if (kvm_read(kd, (long)nl[X_CPTIME].n_value, (char *)bsd_cp_time, sizeof(bsd_cp_time))
-           != sizeof(bsd_cp_time)) {
-               syslog(LOG_ERR, "rstat: can't read cp_time from kmem");
+       len = sizeof(bsd_cp_time);
+       if (sysctlbyname("kern.cp_time", bsd_cp_time, &len, 0, 0) < 0) {
+            syslog(LOG_ERR, "sysctl kern.cp_time: %m");
                exit(1);
        }
        for(i = 0; i < RSTAT_CPUSTATES ; i++)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->peter 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Wed Apr 23 17:02:55 UTC 2008 
Responsible-Changed-Why:  
Peter, this looks like it is fallout from your per-cpu stats rework 
in kern/kern_clock.c 1.204 (and subsequent MFC).  Is there any chance 
you could take a look? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123014 

From: John Baldwin <jhb@freebsd.org>
To: bug-followup@freebsd.org, danny@cs.huji.ac.il
Cc:  
Subject: Re: bin/123014: rpc.rstatd broken
Date: Wed, 4 Jun 2008 11:46:12 -0400

 Please try http://www.FreeBSD.org/~jhb/patches/rstatd.patch
 
 It removes all use of kvm access from rpc.rstatd which includes this fix as 
 well.
 
 -- 
 John Baldwin
State-Changed-From-To: open->closed 
State-Changed-By: jhb 
State-Changed-When: Tue Jun 10 18:48:44 UTC 2008 
State-Changed-Why:  
Duplicate of 122875.  Also, fix is in HEAD now, 122875 will be closed once 
it is MFC'd. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123014 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/123014: commit references a PR
Date: Tue, 10 Jun 2008 18:48:09 +0000 (UTC)

 jhb         2008-06-10 18:47:43 UTC
 
   FreeBSD src repository
 
   Modified files:
     libexec/rpc.rstatd   Makefile rstat_proc.c 
   Log:
   SVN rev 179710 on 2008-06-10 18:47:43Z by jhb
   
   Use sysctl to fetch stats from the kernel instead of reading variables
   directly via libkvm.
   
   PR:             kern/122875, bin/123014
   Tested by:      Danny Braniss  danny cs.huji.ac.il
   MFC after:      1 week
   
   Revision  Changes    Path
   1.9       +2 -2      src/libexec/rpc.rstatd/Makefile
   1.26      +17 -46    src/libexec/rpc.rstatd/rstat_proc.c
 _______________________________________________
 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"
 
>Unformatted:
