delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/03/12:40:42

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
Message-ID: <D5C80F97BFC2D311A6AB0060977DA05AD96818@hamsxafrl1.plh.af.mil>
From: Turnbull Wallace Capt AFRL/VSBXR <Wallace DOT Turnbull AT hanscom DOT af DOT mil>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: problem with mmap and cygwin 1.1.8
Date: Tue, 3 Apr 2001 10:02:09 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

Hello all. I tried posting this to the list yesterday and it showed up in
the cygwin list web archive but I received an email saying the message
bounced so I don't know if it really went to the list or not so I'm
reposting.  I apologize if you got two copies of this.

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?  

--Rhet

int create_files()
{
   int i;
   int fd;
   char *p;
   char fname[1024];
   long size;
   int perms;
  
   size = get_file_size();
   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)
      {
         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)
      {
         fprintf(stderr,"mmap returned error\n");
         #ifdef DEBUG
                 fprintf(stderr,"errno is %d, error is
%s\n",errno,strerror(errno));
         #endif
         return -1;
      }
     
      init_file(p);
      
      //unmap and close
      munmap(p,(size_t)size);
      
      close(fd);
   }
   return 0;
}
Here's my DLL info from cygcheck:
Cygwin DLL version info:
    dll major: 1001
    dll minor: 8
    dll epoch: 19
    dll bad signal mask: 19005
    dll old termios: 5
    dll malloc env: 28
    api major: 0
    api minor: 34
    shared data: 3
    dll identifier: cygwin1
    mount registry: 2
    cygnus registry name: Cygnus Solutions
    cygwin registry name: Cygwin
    program options name: Program Options
    cygwin mount registry name: mounts v2
    cygdrive flags: cygdrive flags
    cygdrive prefix: cygdrive prefix
    cygdrive default prefix:
    build date: Wed Jan 31 10:08:38 EST 2001
    shared id: cygwin1S3

Here's some strace output:

 100   49056 [main] cse_bin 1220 _open: open
(/home/rhet/csebin/test/csealt00.map, 0x602)
  113   49169 [main] cse_bin 1220 dtable::build_fhandler: some disk file -
cb 56, fd 3, fh 0x1A0205B0
  101   49270 [main] cse_bin 1220 fhandler_disk_file::open:
(/home/rhet/csebin/test/csealt00.map, 0x602)
  105   49375 [main] cse_bin 1220 mount_info::conv_to_win32_path:
conv_to_win32_path (/home/rhet/csebin/test/csealt00.map)
  104   49479 [main] cse_bin 1220 normalize_posix_path: src
/home/rhet/csebin/test/csealt00.map
  100   49579 [main] cse_bin 1220 normalize_posix_path:
/home/rhet/csebin/test/csealt00.map = normalize_posix_path
(/home/rhet/csebin/test/csealt00.map)
  106   49685 [main] cse_bin 1220 mount_info::conv_to_win32_path:
c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map(rel),
c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map(abs) 0xA(flags) =
conv_to_win32_path (/home/rhet/csebin/test/csealt00.map)
  275   49960 [main] cse_bin 1220 symlink_info::check: GetFileAttributesA
(c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map) failed
  126   50086 [main] cse_bin 1220 geterrno_from_win_error: windows error 2
== errno 2
  101   50187 [main] cse_bin 1220 symlink_info::check: 0 = symlink.check
(c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map, 0x244F319) (0xA)
  225   50412 [main] cse_bin 1220 symlink_info::check: not a symlink
  119   50531 [main] cse_bin 1220 symlink_info::check: 0 = symlink.check
(c:\Turnbull\cyghome\rhet\csebin\test, 0x244F319) (0x0)
  287   50818 [main] cse_bin 1220 path_conv::check:
GetVolumeInformation(c:\) = OK,
full_path(c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map),
set_has_acls(0)
  142   50960 [main] cse_bin 1220 fhandler_base::open:
(c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map, 0x602)
  286   51246 [main] cse_bin 1220 fhandler_base::open: 176 = CreateFileA
(c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map, 0xC0000000, 0x7,
0x6108517C, 0x2, 0x80, 0)
  159   51405 [main] cse_bin 1220 fhandler_base::open: filemode set to
binary
  110   51515 [main] cse_bin 1220 fhandler_base::open: 1 =
fhandler_base::open (c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map,
0x602)
  133   51648 [main] cse_bin 1220 fhandler_disk_file::open: 1 =
fhandler_disk_file::open (c:\Turnbull\cyghome\rhet\csebin\test\csealt00.map,
0x602)
  110   51758 [main] cse_bin 1220 _open: 3 = open
(/home/rhet/csebin/test/csealt00.map, 0x602)
  114   51872 [main] cse_bin 1220 mmap: addr 0, len 414489600, prot 3, flags
1, fd 3, off 0
  333   52205 [main] cse_bin 1220 seterrno_from_win_error:
/cygnus/netrel/src/cygwin-1.1.8-2/winsup/cygwin/mmap.cc:690 errno 1006
  110   52315 [main] cse_bin 1220 geterrno_from_win_error: unknown windows
error 1006, setting errno to 13
  102   52417 [main] cse_bin 1220 fhandler_disk_file::mmap: -1 = mmap():
CreateFileMapping failed with Win32 error 1006





--
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