delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/01/30/12:02:07

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=CrREvli3fusN4SqUBpUgYm3F4amJzdmF0hSpnqnAyOoIJnQqLGjxY
AuhbBTC+eZk+MBJvsGSEW+PTNuELeR7VE55e72g14b/1p/Zw74W6f/h3KQXz9ygV
4mdOVTdOr1Qznnrc3r6Ixav1ypgX+lWuTkI8oSulhF4HWFZ64MiP2M=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=hAWom6pxK1kLE5N70XSymPmUuL4=; b=ZNrY/43UkQH43TT92787U9YoRD4z
JrSJM4tUtWa9KRNu0sL2s7CG9Vg+3Hj/2AyjHNAQVL2vxdXC8UkZfTTg5N4omStD
jVe5x+U8viCJ50QrWdHJTGbYfcF/R1TdPoBOea6KjEhSIKV6lp2ex86Gozo5UCK5
XA0g0hI3KjxeXec=
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=-6.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Thu, 30 Jan 2014 18:01:42 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: second call to mmap() results in error
Message-ID: <20140130170142.GD2821@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-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> <003801cf1dbd$fc3ffc70$f4bff550$@lbmsys.com>
MIME-Version: 1.0
In-Reply-To: <003801cf1dbd$fc3ffc70$f4bff550$@lbmsys.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--wAI/bQb0EMvlZCHl
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jan 30 08:19, Steven Bardwell wrote:
> > 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 firs=
t 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 alwa=
ys
> > > > 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 o=
r,
> > > > 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 th=
e 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.
> >=20
> >=20
> > Corinna
>=20
> Thanks so much for wasting your time debugging my program.=20
>=20
> Adding the <unistd.h> fixes the problem in all its iterations -- the orig=
inal mmap()=20
> test works (without the call to ftruncate()), as well as the second one.=
=20

I'm glad to read that.

> You all run a great technical support operation.

I'm glad you think that.


:)
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--wAI/bQb0EMvlZCHl
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJS6oV2AAoJEPU2Bp2uRE+govsP/3Me04IgobneUNv9pnkO2Swp
v/Z0CiRQROBa0X1Mbuf/V7uMXSvAgUeUXOCKzh8jFHFP20uCZ3UpmHVC6+TPngd3
F7Ns2Pbl4zyouMs86hMYSXJFOG6M4lKs8RvHQhepa9v602VD/9AbG97wxkFmk49M
+lJquHcmakhlk6I/u/LxxndPX1Q3vpOl6enmL1pscnZRcqcjGDA7HWPIbqEuwMPK
Mdu378aQ8BSVcFKjKvCSFcHUlRPRI4uTyII/N2CbRohdWD1IM+n6SrOeXrx0ofuE
8SqRNzxvyzekiwXtiUilpRPu7U7yR0uh3Et9HoEikVD0z06eZeGFuZdNfAzSVOO0
zIlUP92tYQFJ5dJgGFD/TizdpWem/fYo47FI1CLbq4LBu4s3q57QYKQdwgT/GeGf
BVYIDzry5h/PHLfv31pVVRBkJWzMlU+zEK4T4wmFEpdX4sNhJj7EBl7Rg8FwRe+a
Dx8ew0TZVDgZrHGC5jN7E/6N2YKKIKen/ac+3b9p4MNnTaF8o/77IUP8KJ9XvXXc
OCO00K7H38cRv/n7YKvekcviNLjD3BWeSNl1L4Nl2Z7Z6I4+mV/aHrfbjdvjlu+7
+dW4Ixa73/BuqNHGNm26tQFXs2GylX7+N5d2oJZjFMH5zrnso4YJhrFb+y6kq/Em
uiC2k+om4rNYYUwfaGjg
=P3tt
-----END PGP SIGNATURE-----

--wAI/bQb0EMvlZCHl--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019