Re: fixed memory bytes

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

 





On Tue, Jan 4, 2011 at 11:28 PM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
On Wed, Jan 5, 2011 at 00:40, mohit verma <mohit89mlnc@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



--
Rajesh S R
http://rajeshsr.co.cc/blogs/
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux