读书人

请问一个关于mmap的有关问题

发布时间: 2012-03-28 15:40:03 作者: rapoo

请教一个关于mmap的问题
各位同仁好,在mmap中,有一个函数的参数是你打开的文件的文件描述符,如果这个参数是-1会事什么效果!往赐教

[解决办法]

MAP_ANON
Synonym for MAP_ANONYMOUS. Deprecated.

MAP_ANONYMOUS
The mapping is not backed by any file; its contents are initialized to zero. The fd and offset arguments are ignored; however, some imple
mentations require fd to be -1 if MAP_ANONYMOUS (or MAP_ANON) is specified, and portable applications should ensure this. The use of
MAP_ANONYMOUS in conjunction with MAP_SHARED is only supported on Linux since kernel 2.4.

读书人网 >C语言

热点推荐