Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 To: cygwin Subject: Re: problem with mmap and cygwin 1.1.8 Message-ID: <20010403192133.N956@cygbert.vinschen.de> Mail-Followup-To: cygwin References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; 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 { > 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