<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Dec 16, 2024 at 10:40 AM Douglas McIlroy <<a href="mailto:douglas.mcilroy@dartmouth.edu">douglas.mcilroy@dartmouth.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">>> Does anyone know whether there are implementations of mmap that<br>
>> do transparent file sharing? It seems to me that should be possible by<br>
>> making the buffer cache share pages with mmapping processes.<br>
<br>
> These days they all do. The POSIX rationale says:<br>
<br>
> ... When multiple processes map the same memory object, they <span style="background-color:rgb(255,255,0)">can</span><br>
> share access to the underlying data.<br>
<br>
Notice the weasel word "can". It is not guaranteed that they will do so<br>
automatically without delay. Apparently each process may have a physically<br>
distinct copy of the data, not shared access to a single location.<br></blockquote><div><font color="#0000ff"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hmmm — how did that make it through the IEEE editing process? However, that is not part of the standard if it's in the Rationale - just an explanation of the standard - which I want want look at more carefully to see what it says about what is required of mmap(2).</span></font></div><div><font color="#0000ff"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></span></font></div><div><font color="#0000ff"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">That said, as Heinz and the rest of us who worked on the original version of what would come to POSIX can tell you, the word "can" was always a no-no. The word "SHALL" is the the official IEEE word, and if you use "SHOULD," even in the rationale and it </span><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">was very much frowned upon. I'll have try dig up the troff sources to an early draft of the original and do a "grep -i should * | wc -l" through it. I bet the number is very small and "can" is zero.</span></font></div><div><font color="#0000ff"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></span></font></div><div><font color="#0000ff"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">That said, it has been a few years since I have read a current draft, but less the rationale section (which is not the standard itself).</span></font></div><div><font color="#0000ff"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">Clem</span></font></div><div><font color="#0000ff"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></span></font></div><div><font color="#0000ff"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">Clem</span></font></div></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img alt="" style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=aY2xlbWNAY2NjLmNvbQ%3D%3D&type=zerocontent&guid=2db5d6cb-0505-41c4-aae5-d83bd8fec9a2"><font color="#ffffff" size="1">ᐧ</font></div>