bin/123014: rpc.rstatd broken

Danny Braniss danny at cs.huji.ac.il
Wed Apr 23 13:20:01 UTC 2008


>Number:         123014
>Category:       bin
>Synopsis:       rpc.rstatd broken
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 23 13:20:00 UTC 2008
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list