www.delorie.com/archives/browse.cgi | search |
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:reply-to:from:to:references:in-reply-to | |
:subject:date:message-id:mime-version:content-type | |
:content-transfer-encoding; q=dns; s=default; b=o08ibwXLPMnKgI1q | |
qVkJbm+vBM/y4X72M0UEeFyLYLM9cFOLUas9ZCOQxjfUrAGG956YfxeQLRlaMM72 | |
gzku4Z53Sbvfdmu/Yx/dytZtK3TvR2kk+hwQMEOCXzJBwgFISIKIE9TDJrUQnXcf | |
3GhR8rjWa9ywgVyfVDEe6FLrfLg= | |
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:reply-to:from:to:references:in-reply-to | |
:subject:date:message-id:mime-version:content-type | |
:content-transfer-encoding; s=default; bh=J/jSu+ZYon6fCwnqMkYr9F | |
blrtM=; b=MGRmTB/WKaCFbgwR3K9MOgaZdCWzc1sRRqvnx2vIjIF5Mx1lSAGKhD | |
MuG/Y/YkD4/lVoOV/tlagFAUGKrzqRIDoM6ACWQWmK7nu8bkCFeaLoxhBnMm/8cm | |
7QFx8jaaUfhO4KEgPPyyxWTQQ60+rVOrO4CQ4c9AUNDQegISPKwyM= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.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 |
Authentication-Results: | sourceware.org; auth=none |
X-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=0.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 |
X-HELO: | p3plsmtpa06-07.prod.phx3.secureserver.net |
Reply-To: | <sbardwell AT lbmsys DOT com> |
From: | "Steven Bardwell" <SBardwell AT lbmsys DOT com> |
To: | <cygwin AT cygwin DOT com> |
References: | <01a801cf1cfa$77957900$66c06b00$@lbmsys.com> <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> |
In-Reply-To: | <20140130124558.GA2821@calimero.vinschen.de> |
Subject: | RE: second call to mmap() results in error |
Date: | Thu, 30 Jan 2014 08:19:54 -0500 |
Message-ID: | <003801cf1dbd$fc3ffc70$f4bff550$@lbmsys.com> |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id s0UDKE4P031776 |
> On Jan 30 07:25, Steven Bardwell wrote: > > > > On 29/01/2014 19:12, Corinna Vinschen wrote: > > > > >On Jan 29 09:00, Steven Bardwell wrote: > > > > >>My application needs several areas of shared memory, and I am > getting > > > an > > > > >>error ("No such device") on the second call to mmap(). The first call > > > works > > > > >>fine. > > > > > > Sorry guys, but it still works fine for me. I tried your testcase on W7 > > > 32, W7 64 in 32 and 64 bit, and on Windows 8.1 64 in 32 and 64 bit. I > > > tried it with Cygwin 1.7.27 and with the latest snapshot. I'm always > > > getting the output "Shared memory initialized" and no error at all. > > > > > > > > > Any chance one of you guys could debug this further, by stepping > through > > > the Cygwin mmap64 function, preferredly using the latest snapshot or, > > > a self-built Cygwin DLL from? > > > > > > > > > Corinna > > > > I reinstalled Cygwin, rebooted and the error persisted. Running 'gdb' and > > stepping through the program showed that the call to mmap() fails for > /block1 > > also -- it is returning an invalid address. This simplification of the program > > shows that error on my machine ('Bus error (core dumped)' ) occurs > > when it tries to do the memcpy() to the mapped address. > The reason is that ftruncate is defined with the second argument being > off_t, which is 8 byte. 524304 is an int (4 byte) only, though. Since > ftruncate is declared in unistd.h, but you didn't include unistd.h, the > 2nd parameter to ftruncate is auto-propagated to int, which results in > an invalid new file length, and which makes ftruncate fail. Since you > missed to check ftruncate's return value... you get the idea. > > > Corinna Thanks so much for wasting your time debugging my program. Adding the <unistd.h> fixes the problem in all its iterations -- the original mmap() test works (without the call to ftruncate()), as well as the second one. You all run a great technical support operation. Steve -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |