Hi,
WRT to Terry's email, I initialized the file by writing N nul ('\0')
bytes to it.

Alfred Perlstein wrote:
> Have you tried the mapping with PROT_READ as well?  I don't think
> most arches allow for access without PROT_READ along with PROT_WRITE.

Oops.. and I even read the thread a little while ago about PROT_WRITE
alone not working on x86, but working on alpha because write-only
pages are supported on that architecture.. silly me

anyhow, I changed it to use O_RDWR instead of O_WRONLY to open(2) and
then I used both PROT_READ and PROT_WRITE as the protection argument,
and then the file transfer worked like a charm.

Which brings us to the question, on x86 arch why do we even allow a
PROT_WRITE only map to be created? It is useless and a program which
gets a write-only map will think it actually has such a mmap'ed
region, but it will get a SIGBUS if it tries to write to it. It would
be better to return -1 and set errno to EFAULT than to have this brain
damage imho.

-- 
Farooq

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to