2012-04-27

Linux C: page aligned buffer


I had to allocate a page-aligned buffer.



Alignment

char buf[1024] __attribute__ ((aligned (8)));

Unfortunately it is unusable for page alignment, because we haven't any PAGE_SIZE macro in user space.

Getting page size



Page align



References:
http://froebe.net/blog/2007/05/10/linux-o_directio-what-am-i-doing-wrong/

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Top WordPress Themes