mmap() of files

Hi:
I am trying to mmap() a file, but get an error “Not Supported”. mmap()ing
physical addresses works fine.
Is this a QNX limitation of mmap()?

I tried the same code on a Linux box, and that worked fine.

Help will be appreciated.

-Rommel

Rommel Dongre <rdongre@pillardata.com> wrote:

Hi:
I am trying to mmap() a file, but get an error “Not Supported”. mmap()ing
physical addresses works fine.
Is this a QNX limitation of mmap()?

I tried the same code on a Linux box, and that worked fine.

You need to specify MAP_NOSYNCFILE at mapping time. (QNX will
NOT synchronise mmap and read/write access for such files,
and this flags says that is ok.)

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

That worked.
But now I have another problem; dont know if thata a side-effect of
O_NOSYNCFILE.
I am not able to write to the mmapped file, even though the file permissions
and the prot flags are correct. Specifically, any memcpy into that region
cores.

Any ideas?

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:b5t3uv$ojr$2@nntp.qnx.com

Rommel Dongre <> rdongre@pillardata.com> > wrote:
Hi:
I am trying to mmap() a file, but get an error “Not Supported”.
mmap()ing
physical addresses works fine.
Is this a QNX limitation of mmap()?

I tried the same code on a Linux box, and that worked fine.

You need to specify MAP_NOSYNCFILE at mapping time. (QNX will
NOT synchronise mmap and read/write access for such files,
and this flags says that is ok.)

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Sorry, what I meant to say was:
Anything written to that mmapped area looks good when viewed as memory, but
the corresponing file has junk.
I tried an munmap(), assuming that at that point it would SYNY the file with
memory; but that’s not happening either.

Any idea how I can make the file reflect true memory?


“Rommel Dongre” <rdongre@pillardata.com> wrote in message
news:b5vq63$ibj$1@nntp.qnx.com

That worked.
But now I have another problem; dont know if thata a side-effect of
O_NOSYNCFILE.
I am not able to write to the mmapped file, even though the file
permissions
and the prot flags are correct. Specifically, any memcpy into that region
cores.

Any ideas?

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:b5t3uv$ojr$> 2@nntp.qnx.com> …
Rommel Dongre <> rdongre@pillardata.com> > wrote:
Hi:
I am trying to mmap() a file, but get an error “Not Supported”.
mmap()ing
physical addresses works fine.
Is this a QNX limitation of mmap()?

I tried the same code on a Linux box, and that worked fine.

You need to specify MAP_NOSYNCFILE at mapping time. (QNX will
NOT synchronise mmap and read/write access for such files,
and this flags says that is ok.)

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Rommel Dongre <rdongre@pillardata.com> wrote:

Sorry, what I meant to say was:
Anything written to that mmapped area looks good when viewed as memory, but
the corresponing file has junk.
I tried an munmap(), assuming that at that point it would SYNY the file with
memory; but that’s not happening either.

Any idea how I can make the file reflect true memory?

You would have to manually write it to a file.

chris

\

Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/