From owner-freebsd-current Sun Feb 21 8:35:12 1999 Delivered-To: freebsd-current@freebsd.org Received: from room101.wuppy.rcs.ru (room101.wuppy.rcs.ru [194.84.206.44]) by hub.freebsd.org (Postfix) with ESMTP id E0FC410EB8; Sun, 21 Feb 1999 08:32:43 -0800 (PST) (envelope-from romanp@wuppy.rcs.ru) Received: from room101.wuppy.rcs.ru (room101.wuppy.rcs.ru [194.84.206.44]) by room101.wuppy.rcs.ru (8.9.2.NOMIME/8.9.1) with ESMTP id PAA20893; Sun, 21 Feb 1999 15:31:33 +0300 (MSK) (envelope-from romanp@wuppy.rcs.ru) Date: Sun, 21 Feb 1999 15:31:33 +0300 (MSK) From: "Roman V. Palagin" To: Doug Rabson Cc: Bruce Evans , current@FreeBSD.ORG, dfr@FreeBSD.ORG Subject: Re: Problems with nfsstat and dynamic OID In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 21 Feb 1999, Doug Rabson wrote: > > Oh. Thats nasty. I don't want to allocate special oids for 'privileged' > nodes. I think the userland code should use sysctlbyname() instead. > This patch seems to fix it for me: Works for me too. This problem exists not only in -current, i believe. Should all sysctl be replaced by sysctlbyname? I just grep sysctl in `find /usr/src/usr.bin *.c` and got many lines. Just start checking... > > Index: nfsstat.c > =================================================================== > RCS file: /home/ncvs/src/usr.bin/nfsstat/nfsstat.c,v > retrieving revision 1.12 > diff -u -r1.12 nfsstat.c > --- nfsstat.c 1998/10/25 10:59:44 1.12 > +++ nfsstat.c 1999/02/21 11:47:08 > @@ -162,16 +162,9 @@ > err(1, "kvm_read"); > } > } else { > - int name[3]; > size_t buflen = sizeof *stp; > - struct vfsconf vfc; > > - if (getvfsbyname("nfs", &vfc) < 0) > - err(1, "getvfsbyname: NFS not compiled into kernel"); > - name[0] = CTL_VFS; > - name[1] = vfc.vfc_typenum; > - name[2] = NFS_NFSSTATS; > - if (sysctl(name, 3, stp, &buflen, (void *)0, (size_t)0) < 0) { > + if (sysctlbyname("vfs.nfs.nfsstats", stp, &buflen, (void *)0, (size_t)0) < 0) { > err(1, "sysctl"); > } > } > > -- > Doug Rabson Mail: dfr@nlsystems.com > Nonlinear Systems Ltd. Phone: +44 181 442 9037 > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > ------------------------------------------------------------------------- Roman V. Palagin | Friday, monday, what's the difference. System Administrator | (C) Jordan K. Hubbard To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message