X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:reply-to:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=V7dJsFJmB531mFcf a1CJjT9+VBHI508MUeSsq5iCCVsnbnZOtULYTKR90r9ufAYgSywoz7CTmn03JfzY yFAPKoeofnrY76wCkc5CCytyN42F8eUzeSFJ8rkBP79VXADrYIWvnxkDhmYBQUBq VTsoth+nf9OhtjIwntiS3TcqMWo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:reply-to:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=ga7n7CK3bKX9ukbuIA6baz MZXMs=; b=JrP4hOgfKOq8YOvVWN4SR0CSuo3ck/Wbo1QvVvOuv0qxu+9s844j1h nOOATGLQNz+pHM81XaIZyxv8Z0B+tMe3h2dweuEadF+oCRpTNnwq3NzJNjAEgEn2 4XAEVU6uYM2nNw3gtqYZxJDN+xo2+FuZMQ15sE8a05FXrNji/Kmxc= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 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 Message-id: <52EAA848.7070808@cygwin.com> Date: Thu, 30 Jan 2014 14:30:16 -0500 From: "Larry Hall (Cygwin)" Reply-to: cygwin AT cygwin DOT 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 AT cygwin DOT com Subject: Re: second call to mmap() results in error References: <20140129181250 DOT GW2821 AT calimero DOT vinschen DOT de> <52E95786 DOT 8050606 AT gmail DOT com> <20140130095822 DOT GY2821 AT calimero DOT vinschen DOT de> <001801cf1db6$66c47c40$344d74c0$@lbmsys.com> <20140130124558 DOT GA2821 AT calimero DOT vinschen DOT de> <003801cf1dbd$fc3ffc70$f4bff550$@lbmsys.com> <20140130170142 DOT GD2821 AT calimero DOT vinschen DOT de> <5F8AAC04F9616747BC4CC0E803D5907D0C4763CC AT MLBXv04 DOT nih DOT gov> <52EA9A53 DOT 2050203 AT cygwin DOT com> <5F8AAC04F9616747BC4CC0E803D5907D0C4764C5 AT MLBXv04 DOT nih DOT gov> <20140130183956 DOT GA3573 AT ednor DOT casa DOT cgf DOT cx> <5F8AAC04F9616747BC4CC0E803D5907D0C4764ED AT MLBXv04 DOT nih DOT gov> <52EA9EA2 DOT 5030202 AT cygwin DOT com> <5F8AAC04F9616747BC4CC0E803D5907D0C476528 AT MLBXv04 DOT nih DOT gov> <52EAA171 DOT 406 AT cygwin DOT com> <5F8AAC04F9616747BC4CC0E803D5907D0C4765D8 AT MLBXv04 DOT nih DOT gov> In-reply-to: <5F8AAC04F9616747BC4CC0E803D5907D0C4765D8@MLBXv04.nih.gov> Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit 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