fixed memory bytes

Rajesh S R srrajesh1989 at gmail.com
Tue Jan 4 13:07:15 EST 2011


On Tue, Jan 4, 2011 at 11:28 PM, Mulyadi Santosa
<mulyadi.santosa at gmail.com>wrote:

> On Wed, Jan 5, 2011 at 00:40, mohit verma <mohit89mlnc at gmail.com> wrote:
> >
> > hi all,
> > i have seen many places in  kernel where the variables specially the
> > structures should be of  fixed size independent of the architecture. i
> went
> > through the  definitions of them  but dint  get  clearly (or frankly  say
> > ...dint get them even a bit) .
>
> Your question isn't specific enough, so I'll just guess. Let's say
> "int". In 32 bit, AFAIK it's  4 byte, but in 64 bit (like IA 64, not
> sure if it's x64) it's 8 byte. So, if you just say "int", you will
> likely getting screwed up.
>
> By using types like u_int or something like that, you pretty much say
> "I mean 4 byte kind of integer" etc
>

Still there can be padding issues due to byte alignment, which may vary
across architecture. Am not sure if that is controllable (probably some
pragma to gcc?). Probably, OP is asking about it?

>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Rajesh S R
http://rajeshsr.co.cc/blogs/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110104/2050762f/attachment.html 


More information about the Kernelnewbies mailing list