From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16222 invoked by alias); 30 Jan 2014 19:30:33 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 16140 invoked by uid 89); 30 Jan 2014 19:30:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: vms173025pub.verizon.net Received: from vms173025pub.verizon.net (HELO vms173025pub.verizon.net) (206.46.173.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Jan 2014 19:30:31 +0000 Received: from [192.168.1.231] ([unknown] [74.104.179.122]) by vms173025.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0N0800I7SBIC40J0@vms173025.mailsrvcs.net> for cygwin@cygwin.com; Thu, 30 Jan 2014 13:30:22 -0600 (CST) Message-id: <52EAA848.7070808@cygwin.com> Date: Thu, 30 Jan 2014 19:30:00 -0000 From: "Larry Hall (Cygwin)" Reply-to: cygwin@cygwin.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-version: 1.0 To: cygwin@cygwin.com Subject: Re: second call to mmap() results in error References: <20140129181250.GW2821@calimero.vinschen.de> <52E95786.8050606@gmail.com> <20140130095822.GY2821@calimero.vinschen.de> <001801cf1db6$66c47c40$344d74c0$@lbmsys.com> <20140130124558.GA2821@calimero.vinschen.de> <003801cf1dbd$fc3ffc70$f4bff550$@lbmsys.com> <20140130170142.GD2821@calimero.vinschen.de> <5F8AAC04F9616747BC4CC0E803D5907D0C4763CC@MLBXv04.nih.gov> <52EA9A53.2050203@cygwin.com> <5F8AAC04F9616747BC4CC0E803D5907D0C4764C5@MLBXv04.nih.gov> <20140130183956.GA3573@ednor.casa.cgf.cx> <5F8AAC04F9616747BC4CC0E803D5907D0C4764ED@MLBXv04.nih.gov> <52EA9EA2.5030202@cygwin.com> <5F8AAC04F9616747BC4CC0E803D5907D0C476528@MLBXv04.nih.gov> <52EAA171.406@cygwin.com> <5F8AAC04F9616747BC4CC0E803D5907D0C4765D8@MLBXv04.nih.gov> In-reply-to: <5F8AAC04F9616747BC4CC0E803D5907D0C4765D8@MLBXv04.nih.gov> Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-SW-Source: 2014-01/txt/msg00539.txt.bz2 On 1/30/2014 2:04 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: >> Forget mmap(). > > Why? The response was: > >> Adding the fixes the problem in all its iterations -- the original mmap() >> test works (without the call to ftruncate()), as well as the second one. > > Note *the original*. . Note here Corinna says: Your testcase is missing an ftruncate or two., btw. So if the question is why do you need to include ftruncate() in the code, take a look here: . In particular: Note that references beyond the end of the object do not extend the object as the new end cannot be determined precisely by most virtual memory hardware. Instead, the size can be directly manipulated by ftruncate(). So the code as written requires ftruncate() to work in a defined manner. But if you don't include unistd.h, you don't get the prototype and you end up with ftruncate() failing, which causes mmap() to fail. -- Larry _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple