X-Spam-Check-By: sourceware.org Date: Wed, 16 Aug 2006 22:35:51 +0200 From: Corinna Vinschen 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 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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/