请教一个关于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.