delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/03/15:58:56

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Tue, 3 Apr 2001 19:21:33 +0200
From: Corinna Vinschen <cygwin AT cygwin DOT com>
To: cygwin <cygwin AT cygwin DOT com>
Subject: Re: problem with mmap and cygwin 1.1.8
Message-ID: <20010403192133.N956@cygbert.vinschen.de>
Mail-Followup-To: cygwin <cygwin AT cygwin DOT com>
References: <D5C80F97BFC2D311A6AB0060977DA05AD96818 AT hamsxafrl1 DOT plh DOT af DOT mil>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <D5C80F97BFC2D311A6AB0060977DA05AD96818@hamsxafrl1.plh.af.mil>; from Wallace.Turnbull@hanscom.af.mil on Tue, Apr 03, 2001 at 10:02:09AM -0400

On Tue, Apr 03, 2001 at 10:02:09AM -0400, Turnbull Wallace Capt AFRL/VSBXR wrote:
> Hello all.  I've recently updated my system to cygwin 1.1.8 and gcc
> 2.95-3.2. I had been running cygwin 1.1.7 and gcc 2.95.2-6.  The following
> code (which calls mmap) worked fine under 1.1.7 but now mmap fails with
> errno = 13, "Permission denied."  (Actually, the strace shows:
> "geterrno_from_win_error: unknown windows error 1006, setting errno to 13") 
> 
> I rolled back to the previous setup just to double check and the call to
> mmap worked fine.  Attached is the broken code, some cygcheck output, and
> strace output.  I'm running Windows 2000 Pro, SP1.  I did a diff on the
> cygwin sources and noticed significant changes to mmap.cc between 1.1.7 and
> 1.1.8 but didn't I didn't delve very deep.  Any ideas?  

Your source isn't correct.

> int create_files()
> {
>    int i;
>    int fd;
>    char *p;
>    char fname[1024];
>    long size;
>    int perms;
>   
>    size = get_file_size();

At this point you get a size, probably > 0.

>    perms = 0666;
>    
>    for (i=0;i<NUMALTBINS;i++)
>    {
>       memset(fname,'\0',1024);
>       sprintf(fname,"%s/csealt%02d.map",FILEPATH,i);
>       printf("creating file %s with perms %03o\n",fname,perms);
>       
>       //create and open the file
>       if ((fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, perms)) < 0)

Now you create(!) an empty(!) file.

>       {
>          fprintf(stderr,"error creating file\n");     
> 
>          return -1;      
>       }
>               
>       if ((p = mmap(0,(size_t) size, 
>               PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0)) ==
> (caddr_t) -1)

And at this point you're trying to mmap a file with size 0 by
giving a filesize > 0.

But your example shows that the error code returned by mmap is
not correct. It should be EOVERFLOW. I will change that for the
next version.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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