cvs commit: src/sys/sys user.h

Bruce Evans brde at optusnet.com.au
Thu May 1 03:01:57 UTC 2008


On Wed, 30 Apr 2008, David O'Brien wrote:

> On Tue, Apr 29, 2008 at 05:41:18PM +0400, Yar Tikhiy wrote:
>> On Tue, Apr 29, 2008 at 3:17 PM, Oleksandr Tymoshenko <gonzo at freebsd.org> wrote:
>>> gonzo       2008-04-29 11:17:45 UTC
>>>   Modified files:
>>>     sys/sys              user.h
>>>   Log:
>>>     Define KINFO_PROC_SIZE for mips.
> ..
>> Perhaps it's time to introduce MD .h files for that instead of adding
>> MD #ifdefs to the MI .h file, isn't it? I.e., <sys/user.h> can include
>> <machine/_user.h>, which can define KINFO_PROC_SIZE and its possible
>> friends.
>
> I would like to see us go in that direction also.

KINFO_PROC_SIZE is special.  It can only be determined by looking at the
MI struct declared in <sys.user.h>, and the looking must not be automated
since the reason for existence of this macro is to prevent automated
changes to the size of the struct.

I would have used a definition like

     KI_NVOIDSTAR * sizeof(void *) + KI_NINTMAX_T * sizeof(intmax_t) + ...

where KI_N* are MI.  This requires the struct to not have any padding
or for the padding to be countable by and actually counted by an
expression like the above.  Unfortunately, the struct is not laid out
very carefully, (it has nested structs which it cannot control the
layout of) so it might have MD padding which would make some of the
KI_N*'s MD.  All padding is MD in theory, but in practice padding can
be made almost MI by a careful layout.

Bruce


More information about the cvs-all mailing list