On Wed, Mar 01, 2023 at 05:48:08PM +0300, Valeriy E. Ushakov wrote: > On Wed, Mar 01, 2023 at 15:29:27 +0100, Thomas Klausner wrote: > > > It seems the problem is that mmap() in the mremap(2) man page example > > (which was used to implement the asmjit version) is not using > > MAP_SHARED. > > > > - I'd like to add MAP_SHARED in the mmap() call in the mremap(2) man > > page example. Is that fine? > > Not really. There are no other processes involved in the example, so > MAP_SHARED makes no sense. > > > > - Reading mmap(2) it seems that one of MAP_SHARED or MAP_PRIVATE is > > required, but there is no error if none is provided. Should we change > > mmap() to return an error in that case? > > sys/kern/vfs_vnops.c: > > /* > * Old programs may not select a specific sharing type, so > * default to an appropriate one. > */
So this looks like it would default to MAP_PRIVATE. > > - Why does MAP_PRIVATE (instead of MAP_SHARED) not work? > > Are there multiple processes involved in the erlang case? I don't think so - it's a VM running a program. Multiple threads perhaps. I'll ask. Thomas