From owner-freebsd-current Sun Feb 20 5:52:45 2000 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 1276037BCD5; Sun, 20 Feb 2000 05:52:34 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id AAA17728; Mon, 21 Feb 2000 00:54:39 +1100 Date: Mon, 21 Feb 2000 00:50:45 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Ruslan Ermilov Cc: Garrett Wollman , Peter Wemm , committers@FreeBSD.org, current@FreeBSD.org, dcs@FreeBSD.org Subject: Re: pstat(8) depends on loader(8)??? In-Reply-To: <20000218142846.A14682@relay.ucb.crimea.ua> 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 Fri, 18 Feb 2000, Ruslan Ermilov wrote: > Hi! > > Why then it works on 3.4-STABLE (booting without loader(8) and > having kvm(3) programs like pstat(8) and top(1) working). > What makes a difference here? RCS file: /home/ncvs/src/lib/libkvm/kvm_file.c,v Working file: kvm_file.c head: 1.10 ... ---------------------------- revision 1.9 date: 1999/12/27 07:14:57; author: peter; state: Exp; lines: +5 -0 Use kldsym(2) to lookup symbol values. This avoids the kvm_mkdb juggling and is module aware. Yes, this means that kvm_nlist(3) will find symbols in loaded modules. The emulation of the nlist struct is pretty crude but seems to work well enough for all the users in the tree that I found. ---------------------------- > On Mon, Feb 07, 2000 at 10:14:29PM +0800, Peter Wemm wrote: > > More to the point, a non-stripped kernel has *two* symbol tables. One that > > has the global symbols and is used for dynamic linking, and the other that > > has the debugging info in it including static symbols. loader(8) goes to a > > great deal of trouble to get the second table - it's very hard to get it > > when reading from a zlib decompression stream that can't be seek'ed. The ELF > > format defines a convenient 'load segment' table which defines (usually) > > two chunks of the file to be loaded into memory and at what addresses. The > > verbose symbol table is not part of this, but the global table is and we get > > it for free. > > > > Anyway, the correct fix is to make numvnodes global or to change it to a > > sysctl. Nothing that is referred to by the common libkvm applications > > should be static - this warning has been given before. running a strip on / > > kernel has the same effect as using boot2 - only global symbols are > > accessible. The former would be a very incorrect fix. C linkage shouldn't be weakened to work around deficiencies in binary utilities. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message