This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mmap() on 64K aligned address fails


Corinna Vinschen wrote:
[snip]
>>mmap(0x470000, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)
>>somehow an invalid invocation.
> 
> 
> I didn't inspect the testcase all too closely since it's annoyingly long
> for such a simple test.  But what exactly do you expect when trying to
> mmap an arbitrary memory address in the virtual address space which you
> know nothing about?

It's not an arbitrary memory address, the 0x470000 is the result of aligning a
pagesize space into 17xpagesize malloced memory.

> The code is making invalid assumptions about the
> usage of the underlying memory layout.
> 
> Don't use MAP_FIXED unless you know what you're doing.

I'm not an expert but I think the example did comply with all the Windows
"granularity" requirements and unless I'm really missing something else it
should have worked without the invalid argument error.

Thanks for your reply.
-- 
René Berber


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]