Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 10 Jan 2002 15:07:29 +0100 From: Corinna Vinschen To: cygwin Subject: Re: ksh on cygwin Message-ID: <20020110150729.L12057@cygbert.vinschen.de> Mail-Followup-To: cygwin References: <200201101259 DOT g0ACxFN12728 AT dymwsm10 DOT mailwatch DOT com> <20020110144551 DOT J12057 AT cygbert DOT vinschen DOT de> <033d01c199de$4578ab10$0200a8c0 AT lifelesswks> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <033d01c199de$4578ab10$0200a8c0@lifelesswks> User-Agent: Mutt/1.3.22.1i On Fri, Jan 11, 2002 at 12:54:06AM +1100, Robert Collins wrote: > ----- Original Message ----- > From: "Corinna Vinschen" > > > - getpagesize() should return a value compatible with mmap(), that > is dwAllocGranularity (65536) instead of dwPageSize (1024). > > > > We discussed that months ago. I think we're not going to change that > > (it's 4096, not 1024, btw.). It will result in dubious problems > > when a process mmaps a file. For instance, the latest gcc expects to > > be able to read over the end of an mmaped file if the size is not a > > multiple of getpagesize(). Now think of a file which is > coincidentally > > exactly 1 page long... > > I'm not sure what you are implying. unless getpagesize returns 1, the > behaviour for gcc will be consistent for all larger sizes. If it's 4k, > then a file that is 4k will behave the same way as a 64K file if the > pagesize returned is 64k. > > You seem to be implying that something bad happens when the file size == > the returned page size. > > What is that bad thing? mmap (MapViewOfFile resp.) alwaus map whole pages. A page is 4096 bytes long. If a file is, say, 8190 bytes, then we have a two page map, size 8192. So we have two trailing 0 bytes. If getpagesize() returns 4096, gcc can count that correctly, if getpagesize returns 65536, gcc assumes 57346 trailing bytes. No problem, gcc only accesses exactly one trailing 0 byte. If the file is 8192 bytes long, mmap maps exactly 8192 bytes, no trailing bytes left. If getpagesize() returns 4096, gcc knows that, if getpagesize returns 65536, gcc assumes 57344 trailing bytes. Now it is a problem, since the one trailing 0 byte doesn't exist. Segmentation fault. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/