现在的位置: 首页 > 综合 > 正文

Cygwin中的系统调用(2):get_page_size

2013年09月13日 ⁄ 综合 ⁄ 共 580字 ⁄ 字号 评论关闭

快乐虾

http://blog.csdn.net/lights_joy/

lights@hb165.com

 

本文适用于

Windows xp with sp3

vs2008

cygwin checkout-20080928 (仅指cygwin.dll)

 

欢迎转载,但请保留作者信息

 

这个系统调用用于取得内核页面的大小。Cygwin对此的实现为:

extern "C" size_t

getpagesize ()

{

     if (!system_info.dwAllocationGranularity)

         GetSystemInfo (&system_info);

     return (size_t) system_info.dwAllocationGranularity;

}

在这里system_info是一个全局变量:

SYSTEM_INFO system_info;

dwAllocationGranularity这个成员的作用为:

The granularity for the starting address at which virtual memory can be allocated. For more information, see VirtualAlloc.

xp sp3中,这个值为0x10000,即65536

 

 

1       参考资料

Cygwin中的系统调用(1):前言(2009-3-10)

 

 

 

抱歉!评论已关闭.