Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 2001 17:56:24 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        "Pierre Y. Dampure" <pierre.dampure@westmarsh.com>
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Poul-Henning Kamp <phk@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/sys user.h
Message-ID:  <XFMail.010219175624.jhb@FreeBSD.org>
In-Reply-To: <3A90DF0A.236698A9@westmarsh.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <jhb@FreeBSD.org> -- 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010219175624.jhb>