delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/02/02/19:16:51

X-Spam-Check-By: sourceware.org
Date: Thu, 2 Feb 2006 18:16:34 -0600 (CST)
From: Dave Bodenstab <dave AT bodenstab DOT org>
Message-Id: <200602030016.k130GYOk002533@base686.home.org>
To: cygwin AT cygwin DOT com
Subject: Possible bug with mmap on XP?
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019