delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/03/16:25:28

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
Message-ID: <D5C80F97BFC2D311A6AB0060977DA05AD9681A@hamsxafrl1.plh.af.mil>
From: Turnbull Wallace Capt AFRL/VSBXR <Wallace DOT Turnbull AT hanscom DOT af DOT mil>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: RE: problem with mmap and cygwin 1.1.8
Date: Tue, 3 Apr 2001 14:41:44 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

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

Thanks for taking the time to point out my mistake.  I'm not very familiar
with mmap and didn't catch the problem since it worked (or at least appeared
to) under 1.1.7.  I fixed the code in question and it now works fine with
Cygwin 1.1.8.  

>But your example shows that the error code returned by mmap is
>not correct. It should be EOVERFLOW.

At least the bug in my program wasn't a complete waste of time! ;-)

Thanks again,

Rhet


>  -----Original Message-----
[Turnbull Wallace Capt AFRL/VSBXR]  Re: problem with mmap and cygwin 1.1.8
*	To: cygwin <cygwin at cygwin dot com> 
*	Subject: Re: problem with mmap and cygwin 1.1.8 
*	From: Corinna Vinschen <cygwin at cygwin dot com> 
*	Date: Tue, 3 Apr 2001 19:21:33 +0200 
*	References:
<D5C80F97BFC2D311A6AB0060977DA05AD96818 AT hamsxafrl1 DOT plh DOT af DOT mil
<msg00168.html>> 

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 <http://cygwin.com/ml/>
>  

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