Subject: Re: Possible bug with mmap on XP?
From: Dave Bodenstab <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Fri, 3 Feb 2006 00:36:42 -0600 (CST)

Thanks for the reply.

On Thu, 02 Feb 2006 21:47:55 -0700 Eric Blake <[email-masked]> wrote:

> According to Dave Bodenstab on 2/2/2006 5:16 PM:
> >   mmap(0,1500,PROT_EXEC|PROT_READ|PROT_WRITE,MAP_PRIVATE,<the fd>,0)
> > 
> > I've found that changing the permissions (chmod +x) on the file being
> > mmap'ed makes the problem go away.
> > 
> > Is this the way things are supposed to work on XP?
>
> Cygwin's behavior sounds reasonable to me - POSIX permits an
> implementation to fail with EACCESS if the prot parameter requests writes
> but filedes was not opened for writing, and permits failure with ENOTSUP
> if a combination of prot flags is not supported.  But I see nothing in
> POSIX that requires PROT_EXEC to either fail or succeed based on whether
> filedes is tied to a file that has execute privileges, so you are treading
> in unspecified waters.
>
> > PS.  I have a test program that demonstrates this problem, but I wanted
> > to ask if this is a known problem before I start posting test programs.
>
> A test program would be very helpful.

It can be found at http://www.bodenstab.org/files/mmaptest.c

> > PPS.  If this is a limitation for XP, is there a way for a Cygwin program
> > to tell if it's running on XP?
>
> Yes, uname(2) can be used to give you an idea of what version of Windows
> you are running on.

Is there a reference for what is returned for each windows release?  On my
only windows (I only have these for a couple of games and the digital cameras)
systems I get:

 Win98SE   sysname="CYGWIN_98-4.10"
 WinXP     sysname="CYGWIN_NT-5.1"

I would have expected "XP" rather than "NT"... I thought I read somewhere
that NT is obsolete or at least unsupported now?  Does the 4.10 or 5.1
mean anything important?

--
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/