[英]what does it mean by __attribute__((__aligned__(PAGE_SIZE)))?
I am dealing with a Linux device driver project, in that i encountered with this: 我正在处理一个Linux设备驱动程序项目,因为我遇到了这个问题:
__attribute__((aligned(PAGE_SIZE)))
I Think the above one is a specific use of __attribute__
. 我认为以上是
__attribute__
的特定用法。
I couldn't find satisfactory answers. 我找不到满意的答案。 I need to know, What does
__attribute__
means, and the use of the same 我需要知道
__attribute__
是什么意思,以及它的用法
It is used to specify that a variable or a struct
should have a specific alignment in memory. 它用于指定变量或
struct
在内存中应具有特定的对齐方式。 Read about it here . 在这里阅读。
Basically in your example it forces whatever has that attribute to be aligned to a memory page ( PAGE_SIZE
is just a numeric constant). 基本上在您的示例中,它强制将具有该属性的任何内容与内存页对齐(
PAGE_SIZE
只是一个数字常量)。 The __attribute__
keyword is used to specify certain special things, aligned
is just one of many. __attribute__
关键字用于指定某些特殊内容, aligned
仅是其中之一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.