delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/23/10:45:12

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: Wed, 23 May 2001 16:32:41 +0200
From: Corinna Vinschen <cygwin AT cygwin DOT com>
To: cygwin <cygwin AT cygwin DOT com>
Subject: Re: Problems using mmap
Message-ID: <20010523163241.V10118@cygbert.vinschen.de>
Mail-Followup-To: cygwin <cygwin AT cygwin DOT com>
References: <3B0BAA95 DOT 8A8CC347 AT gmx DOT de>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <3B0BAA95.8A8CC347@gmx.de>; from ronald.hecht@gmx.de on Wed, May 23, 2001 at 02:18:29PM +0200

On Wed, May 23, 2001 at 02:18:29PM +0200, Ronald Hecht wrote:
> Hi,
> 
> I'm trying to compile the attached file, but getting problems with mmap.
> I've read about problems using mmap. Is there a workaround.
> 
> Using mmap.exe I#m getting
> 
> mkdep: mmap: No such device or address

Your code is way to big. Shrinking the code to a reasonable size
before sending it would ease reading. It would raise my attendance,
too.

> 	int fd = open(filename, O_RDONLY);
> 	struct stat st;
> 
> 	if (fd < 0) {
> 		perror("mkdep: open");
> 		return;
> 	}
> 	fstat(fd, &st);
> 	mapsize = st.st_size + 2*sizeof(unsigned long);
> 	mapsize = (mapsize+pagesizem1) & ~pagesizem1;
> 	map = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0);

When mmapping files, the requested mapsize must not exceed
the file size.

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