tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: Questions regarding 'struct modstat'



> >> 3. If I wanted to add another address field (ms_modaddr for the address
> >>    of the module's 'struct module'), would it be better to
> >>
> >> 	a) insert a new uint64_t in the middle of this structure,
> >> 	   after the current ms_addr field,
> >>
> >> 	b) insert a new uint64_t in the middle of this structure,
> >> 	   immediately before the ms_reserved[] array,
> >>
> >> 	c) append a new uint64_t at the end of this structure, or
> >>
> >> 	d) replace some number of the ms_reserved[] array with a
> >> 	   new uint64_t structure (and how many to replace?)
> >
> > You need to replace 2 u_ints (each u_int has 4 bytes and you need
> > 8 bytes for a uint64_t).
> 
> Thanks for the quick responses.
> 
> Since the real reason I was contemplating this was to get access to
> the mod_flags member of struct module, I decided it was more correct
> to directly expose that value, rather than providing a kernel address
> of the structure (and then having to use gdb/crash to examine it).

ah, good, i was going to ask why you wanted to do this.

in general, have a look at how struct kproc_info2 is handled.
it's been extended over the years several times and was designed
for this in mind.


.mrg.


Home | Main Index | Thread Index | Old Index