This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problems using mmap


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@cygwin.com
Red Hat, Inc.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]