From the POSIX section (IEEE Std 1003.1-2008) to mmap:
mmap
Fildes file descriptors must be open with read permissions regardless of the specified security options.
Why? It seems that a handle open O_WRONLYand mapped to PROT_WRITE, rather than PROT_READ, should not be problematic with respect to permissions, right?
O_WRONLY
PROT_WRITE
PROT_READ
But the next line says that:
If PROT_WRITE is specified, the application shall ensure that it has opened the file descriptor fildes with write permission unless MAP_PRIVATE is specified in the flags parameter as described below.
, , , , atleast . , .
, READ ONLY mmap.
fd= open(file_name,O_RDONLY); mappedData = mmap(0,fdstat.st_size,PROT_READ|PROT_WRITE, MAP_SHARED,fd,0);
, , :
mmap:
EDIT: , .
, - , - : RAM mmaped-. . ( , O_WRONLY , PROT_WRITE) , , , .
, , , msync() munmap(). , , "" , momory.
msync()
munmap()
, 4KB - , .
Source: https://habr.com/ru/post/1568637/More articles:What is equivalent to QVariant in C ++? - c ++Microsoft Visual Studio 2012 C ++ Circular Reference - c ++How to check page resources in Firefox? - fileWriting DMA buffers to memory mapped file - linuxThe difference is how LINQ to Entities and LINQ to Objects handle clicks - c #Open a webpage without using webview - xamarinhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1568639/python-selenium-explicitly-wait-for-one-of-two-elements-to-be-loaded&usg=ALkJrhiPxjDTnHj_Kfwqqofgfnc-7w6DRwto quietly check if the database is present on the remote host - mysqlIndex order in a numpy multidimensional array - pythonHow to send a string with many lines from the command line - javaAll Articles