Mail Archives: cygwin/2001/04/03/15:58:56
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
- Raw text -