delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/16/16:36:02

X-Spam-Check-By: sourceware.org
Date: Wed, 16 Aug 2006 22:35:51 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.19 src/winsup/cygwin/mmap.cc msync() still calling getpagesize rather than getsystempagesize
Message-ID: <20060816203551.GB27256@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <59761B4D8BAF8248BB4F5BD53568EA1E311E21 AT MAGIC DOT trusteddata DOT local>
Mime-Version: 1.0
In-Reply-To: <59761B4D8BAF8248BB4F5BD53568EA1E311E21@MAGIC.trusteddata.local>
User-Agent: Mutt/1.4.2i
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

On Aug 16 11:43, Donna Jecha wrote:
> In the function msync in the file src/winsup/cygwin/mmap.cc, the declaration for pagesize goes out of its way to invoke either getsystempagesize -or- getpagesize():
> 
> 
> 1366    size_t pagesize = wincap.has_mmap_alignment_bug () ?
> 1367                      getsystempagesize () : getpagesize ();
> 
> 
> Later in this same function, however, only getpagesize() is called:
> 
> 
> 1393 for (DWORD i = getpagesize (); i < len; i += getpagesize ())
> 
> 
> Shouldn't the getpagesize invocation at line 1383 also be conditional as to which gets called as is done on line 1367???

Maybe, I have to have another look into that.  But that can't be the
reason for the ENOMEM problem since getpagesize is definitely correct
for NT systems as you're using.  getsystempagesize is only the right
choice for systems with the mmap alignment bug, which are 95/98/Me.
I'm not overly concerned by that since 9x support is phased out anyway.

> fsx is a file system exerciser program.  It has proven to be a good test case for finding corruption problems.  The fsx program works on cygwin 1.5.18, but not on cygwin 1.5.19.  On cygwin 1.5.19, msync always returns a status of -1 and sets errno to ENOMEM.  Here's the code snippet:
> 
> 673          pg_offset = offset & page_mask;
>  674          map_size  = pg_offset + size;
>  675
>  676          if ((p = (char *)mmap(0, map_size, PROT_READ | PROT_WRITE,
>  677                                MAP_FILE | MAP_SHARED, fd,
>  678                                (off_t)(offset - pg_offset))) == (char *)-1) {
>  679                  prterr("domapwrite: mmap");
>  680                  report_failure(202);
>  681          }
>  682          memcpy(p + pg_offset, good_buf + offset, size);  // status of memcpy is not checked ... yet
>  683          if (msync(p, map_size, 0) != 0) {
>  684                  prterr("domapwrite: msync");
>  685                  report_failure(203);
>  686          }
>  687
>  688          check_eofpage("Write", offset, p, size);
>  689
>  690          if (munmap(p, map_size) != 0) {
>  691                  prterr("domapwrite: munmap");
>  692                  report_failure(204);
>  693          }

Would you mind to create a self-contained, *minimal* testcase from that?
The snippet alone seems correct but I'm missing a few parameters like,
for instance the values of offset and page_mask, etc.  If you could
create a tiny testcase which builds out of the box and reproduces the
problem, that would be enourmeously helpful.


Thanks in advance,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019