From owner-cvs-all Mon Feb 19 17:59:38 2001 Delivered-To: cvs-all@freebsd.org Received: from meow.osd.bsdi.com (meow.osd.bsdi.com [204.216.28.88]) by hub.freebsd.org (Postfix) with ESMTP id 36F6337B491; Mon, 19 Feb 2001 17:59:28 -0800 (PST) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by meow.osd.bsdi.com (8.11.2/8.11.2) with ESMTP id f1K1t7l93126; Mon, 19 Feb 2001 17:55:08 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <3A90DF0A.236698A9@westmarsh.com> Date: Mon, 19 Feb 2001 17:56:24 -0800 (PST) From: John Baldwin To: "Pierre Y. Dampure" Subject: Re: cvs commit: src/sys/sys user.h Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Poul-Henning Kamp Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 19-Feb-01 Pierre Y. Dampure wrote: > Poul-Henning Kamp wrote: > >> phk 2001/02/12 09:19:01 PST >> >> Modified files: >> sys/sys user.h >> Log: >> Since we're in "everybody is hosed anyway" add an layout identifier >> to struct kinfo_proc. >> >> All userland/kernel shared structs should contain *both* a size and >> a layout field. >> >> I will add the code to use the field later. >> > > Hmm... I think you added this field without updating KINFO_PROC_SIZE -- > we now get warnings at boot time about the size of kinfo_proc differing > from KINFO_PROC_SIZE. That needs to die. I think a scheme like the following will work: The kernel exports a mininum version, maximum version, and kinfo_proc size in the form of symbols that can be read from a crash dump or via sysctl(8) on a live kernel. libkvm will know how to read the version specified in the version of sys/user.h that it gets. The spare fields go away. If you add something to the end of the kinfo_proc, you bump the max version (aka current version) and leave min version alone. If you change something which changes the size or order of existing fields, then you bump both max version and min version. Then, when libkvm reads kinfo_proc's, it checks that its version is >= min version and <= max version. If so, then it can use the kinfo_proc size in from the crash dump or live kernel and just discard the extra bits it doesn't know about if needed. The current kinfo_proc is now actually worse than before, because if something changes in teh middle, then all the programs such as ps(1), top(1) etc. just misparse the information instead of telling you that proc chagned as they did in the past. Of course, a better way of doing this would involve changing how sysctl's work to allow for namespaces, and then allow the sysctl 'proc.XXX.YYY' to lookup field 'YYY' in the proc with pid 'XXX' and return its value, but that is much more work. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message