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]

Possible bug with mmap on XP?


I searched the mailing list archives and googled, but failed to find
anything specific to XP regarding this...

I am using the latest version (1.5.19-4) of Cygwin.

I had previously ported a unix prog that used mmap to Cygwin.  On win2k
it works fine.  When I copied the prog to a newly-installed win XP
professional system, I get:

  mmap failed (Permission denied)

when attempting to do a 

  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?

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.

PPS.  If this is a limitation for XP, is there a way for a Cygwin program
to tell if it's running on XP?

Thank you.

[
  My program generates x86 machine code and writes it to a file.
  The program then mmap's the file and executes the code.
  The problem is that I want the file prepended with '#!/bin/myprog\n"
  to be "executable", but I don't want a file with just the raw
  x86 code to be "executable" -- because it isn't without being
  run under control of my program that generated it.  This works
  entirely correctly on Linux, FreeBSD and Solaris.
]

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