I do not understand how the opensolaris mailing lists and fora
interact... does every post on the forum get send to the mailing list
and vice versa?


I sent my original question, yesterday after the reply of Frank
Hoffman. However, based on your replies, I seem to conclude that you
didn't receive that one, is that correct?

To be sure, I paste the original question here again:

----------
I need to read fields in kernel structures directly from memory (from
within a simulator). Using mdb I can extract the necessary offset
values for the different fields in different structures (like proc,
kthread_t, ...).

My question is: how fixed are these offsets? Will they always be the
same within a same kernel version? Does it depend on the structure
instance as well? I noticed there are unions inside the structure I am
interested in, does this make a difference? (How is union memory
allocated?)

Is there a way to verify that the numbers mdb will give are correct?
Can I for example calculate the actual offset of a field by counting
the sizeof()s of the preceding fields from the source?
----------

So your replies indicate that they are indeed fixed if the structure
doesn't change.

About alignment: is it possible that the order of fields is changed so
the gaps aren't too big?
Suppose for example there is an int - char - int - char and that an
int is 4 bytes and char is 1 byte. With a 32-bit memory, one could
keep the order and align on 4-byte boundaries. This would mean that in
total 16 bytes will be used. If however, order is changed, both char's
can be put together, and then only 12 bytes will be used.

Is it correct that for a union, the allocated memory is as big as the
largest member of the union?

Thanks, Thomas

On 4/12/07, Dan Mick <[EMAIL PROTECTED]> wrote:
Thomas De Schampheleire wrote:
> It's been a while since I posted this, without any reply. Is there someone 
who can comment on this question?

This is the complete record I have of your question.

Oh, how I hate web fora.

_______________________________________________
opensolaris-code mailing list
[EMAIL PROTECTED]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to