From owner-freebsd-arch Thu Dec 7 11:56:19 2000 From owner-freebsd-arch@FreeBSD.ORG Thu Dec 7 11:56:17 2000 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 7CF1E37B400 for ; Thu, 7 Dec 2000 11:56:17 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eB7JuGg15731; Thu, 7 Dec 2000 11:56:16 -0800 (PST) Date: Thu, 7 Dec 2000 11:56:16 -0800 From: Alfred Perlstein To: Kirk McKusick Cc: arch@FreeBSD.ORG Subject: Re: Getting Kernel Process Information Message-ID: <20001207115616.V16205@fw.wintelcom.net> References: <200012071938.LAA03622@beastie.mckusick.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200012071938.LAA03622@beastie.mckusick.com>; from mckusick@mckusick.com on Thu, Dec 07, 2000 at 11:38:11AM -0800 Sender: bright@fw.wintelcom.net Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Kirk McKusick [001207 11:38] wrote: > For the third time in a week, I got the following message when I > tried to run ps on my 5.X system: > > proc size mismatch (39776 total, 1136 chunks) > > This message arises when the size of the proc structure changes. > With the current SMP development, the proc structure changes at > a very high rate of speed. The current kinfo_proc interface used > between the kernel and user processes is built from two pieces: > > struct kinfo_proc { > struct proc kp_proc; > struct eproc kp_eproc; > } > > Kinfo_proc contains a copy of the kernel's proc structure > followed by an `extended' proc structure which has lots > of bits and pieces that have moved out of the proc structure > or are otherwise needed. Any change to the kernel's version > of the proc structure changes the size of the kinfo_proc > structure and hence causes a mismatch when attempts are made > to copy it out. > > I propose to change the kinfo_proc structure. The new > kinfo_proc structure will contain only the stylized `extended' > proc structure which will be augmented with the twenty > fields that are actually referenced from the proc structure > by user processes. By taking this approach, changes to the > proc structure will not affect the format or size of the > kinfo_proc structure returned to user processes. The new > `extended' proc structure will have plenty of spare fields > added to its end so that when new fields are added to the > proc structure that user-level processes need/want to know > about, they can be added without changing the size of the > exported kinfo_proc structure and thus will not require > recompilation of the dozen or so programs that use the > exported interface. Note that even if 200 spare bytes are > added to the kinfo_proc structure, it will still be smaller > than the current one. I completely agree that should be done. My suggestion is to completely rip out and kernel structs being passed through this interface, the reason is that we will need mutexes in a lot of them and we don't want to export that to userland. I was looking at this the other week when trying to clean up the struct ucred issues and thought it was a good idea, but a bit more work than I had in mind at the time. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message