Mmap

Can someone tell me what part of mmap is implemented in QNX RTP? I get the
errno 48 back when I try to use it? All the examples don’t use a file
descriptor - does this mean the mmapping files aint implemented?

DAN

Daniel G. Waddington <dwaddington@lucent.com> wrote:

Can someone tell me what part of mmap is implemented in QNX RTP? I get the
errno 48 back when I try to use it? All the examples don’t use a file
descriptor - does this mean the mmapping files aint implemented?

If you’re trying to map in a file you must pass MAP_NOSYNCFILE to the
flags.


cburgess@qnx.com

Colin Burgess wrote:

Daniel G. Waddington <> dwaddington@lucent.com> > wrote:
Can someone tell me what part of mmap is implemented in QNX RTP? I get the
errno 48 back when I try to use it? All the examples don’t use a file
descriptor - does this mean the mmapping files aint implemented?

If you’re trying to map in a file you must pass MAP_NOSYNCFILE to the
flags.

The not-implemented part is syncronization between memory access and I/O
and that won’t be fixed any time soon, because of limitations of VM
design. So, make sure you don’t mix up memory and I/O access, or you’ll
be screwed. Also, unless this has been fixed, mmap() used to require
MAP_ELF along with MAP_NOSYNCFILE.

  • igor

So if I should use MAP_NOSYNCFILE, how do I get the file to synchronise with
memory?

DAN


“Igor Kovalenko” <kovalenko@home.com> wrote in message
news:3A021480.A8A24D25@home.com

Colin Burgess wrote:

Daniel G. Waddington <> dwaddington@lucent.com> > wrote:
Can someone tell me what part of mmap is implemented in QNX RTP? I
get the
errno 48 back when I try to use it? All the examples don’t use a file
descriptor - does this mean the mmapping files aint implemented?

If you’re trying to map in a file you must pass MAP_NOSYNCFILE to the
flags.


The not-implemented part is syncronization between memory access and I/O
and that won’t be fixed any time soon, because of limitations of VM
design. So, make sure you don’t mix up memory and I/O access, or you’ll
be screwed. Also, unless this has been fixed, mmap() used to require
MAP_ELF along with MAP_NOSYNCFILE.

  • igor

Daniel G. Waddington <dwaddington@lucent.com> wrote:

So if I should use MAP_NOSYNCFILE, how do I get the file to synchronise with
memory?

As Igor pointed out, we don’t have support for that.

DAN



“Igor Kovalenko” <> kovalenko@home.com> > wrote in message
news:> 3A021480.A8A24D25@home.com> …
Colin Burgess wrote:

Daniel G. Waddington <> dwaddington@lucent.com> > wrote:
Can someone tell me what part of mmap is implemented in QNX RTP? I
get the
errno 48 back when I try to use it? All the examples don’t use a file
descriptor - does this mean the mmapping files aint implemented?

If you’re trying to map in a file you must pass MAP_NOSYNCFILE to the
flags.


The not-implemented part is syncronization between memory access and I/O
and that won’t be fixed any time soon, because of limitations of VM
design. So, make sure you don’t mix up memory and I/O access, or you’ll
be screwed. Also, unless this has been fixed, mmap() used to require
MAP_ELF along with MAP_NOSYNCFILE.

  • igor


cburgess@qnx.com

Colin Burgess wrote:

Daniel G. Waddington <> dwaddington@lucent.com> > wrote:
So if I should use MAP_NOSYNCFILE, how do I get the file to synchronise with
memory?

As Igor pointed out, we don’t have support for that.

One can do read/write to syncronize, but that pretty much defeats
purpose of mmap(), unless one knows the application very well and can
place ‘syncronization points’ scarcely and carefully.

If support for that was in the kernel, then it could be ‘scarce-nized’
automatically because when page and FS buffer cache are unified, there
wouldn’t be any difference in terms of pages being modified when doing
memcpy(mmap(fd),b,n) and write(fd,b,n), except that write() would be
slower because it is syscall. Then if you do read(fd,c,n) after doing
memcpy(mmap(fd),b,n), you would get up-to-date data again because VM
page cache is unified with FS cache. The mmap() just tells VM that you
will access those pages a lot so map them all to my address space thus I
can do it without asking kernel for help every time and you VM please
feel free to sync them to disk as scarcely as reasonable…

Unfortunately, traditional market of QNX did not provide much demand for
that kind of functionality. And since its implementation tends to be
rather complicated, QNX did not want to bloat their kernel with feature
that no customer needed. Note that not even all Unixes do that and among
those which do, not all of them do it right what might to confuse the
hell out of programs relying on this. I actually discussed this with QNX
kernel people when I visited them last week. They appear to be willing
to do it, but such undertaking is really huge. Given the amount of more
‘visible’ problems which need to be addressed first, it is unlikely to
happen until couple of years later, unless of course we will start
screaming bloody murder all at once AND some big OEM customer will want
it too :wink:

  • igor

DAN

“Igor Kovalenko” <> kovalenko@home.com> > wrote in message
news:> 3A021480.A8A24D25@home.com> …
Colin Burgess wrote:

Daniel G. Waddington <> dwaddington@lucent.com> > wrote:
Can someone tell me what part of mmap is implemented in QNX RTP? I
get the
errno 48 back when I try to use it? All the examples don’t use a file
descriptor - does this mean the mmapping files aint implemented?

If you’re trying to map in a file you must pass MAP_NOSYNCFILE to the
flags.


The not-implemented part is syncronization between memory access and I/O
and that won’t be fixed any time soon, because of limitations of VM
design. So, make sure you don’t mix up memory and I/O access, or you’ll
be screwed. Also, unless this has been fixed, mmap() used to require
MAP_ELF along with MAP_NOSYNCFILE.

  • igor


cburgess@qnx.com