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: Wed, 23 May 2001 16:32:41 +0200 From: Corinna Vinschen To: cygwin Subject: Re: Problems using mmap Message-ID: <20010523163241.V10118@cygbert.vinschen.de> Mail-Followup-To: cygwin References: <3B0BAA95 DOT 8A8CC347 AT gmx DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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