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=wSIybKrqawxubc/y+OChQbSLCZeW8aoQCNfdkzWCfwM1SqQHdjHeb ktXF3cVSKaZZE3tN24DrVEHMgyTtfXVM6BvrW7FRJPnIHrl9KkN4GQtWBmXk/Ib7 xfwLHo4JkI8Rrxvf5DAhTnCKda8QUhhLKWHRUgRjcPX9dXtOs6VErA= 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=Alnm3pYGPSIAkIHai1SIg+LrutU=; b=vMKNctoL/uZi4bBKCrKvazudvcfy EsHV7ja4rXZkFTGYw98qFd3xm4nNKyj7piNJQvF1O9Exeg89xDwyNwa0T6AMJEic bXyqu/c9L4r5mWTQlmxADE3mPu/2UKgmJvY+s38O3SFJWQJ79TUAlvJNdmDZgbMx zn6ppTMk4v8xU0c= 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=-4.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: calimero.vinschen.de Date: Tue, 14 Apr 2015 09:39:37 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Shared memory handling for mixed C/FORTRAN program Message-ID: <20150414073937.GZ7343@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1999567694 DOT 2259208 DOT 1428493743005 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com> <1870355684 DOT 2072453 DOT 1428922807636 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EDT6MSV0B3GxyNyZ" Content-Disposition: inline In-Reply-To: <1870355684.2072453.1428922807636.JavaMail.yahoo@mail.yahoo.com> User-Agent: Mutt/1.5.23 (2014-03-12) --EDT6MSV0B3GxyNyZ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Apr 13 11:00, Christoph Weise wrote: >=20 >=20 > > The problem is the call to shmget: > >=20 > > #undef PAGESIZE > > #define PAGESIZE 512 > > shmid =3D shmget(key, PAGESIZE, IPC_ALLOC); > >=20 > > Since you're requesting only 512 bytes, the shared memory segment the > > following shmat call returns is only 4K. The shmget call should request > > as much memory as it needs so that the OS call is called with the right > > view size. > >=20 > > I re-read the POSIX man page for shmget, and it doesn't mention anything > > which would point out that Cygwin's behaviour here is wrong. If anybody > > has more information on this, please share them. >=20 > Yes, you're right. I tried a workaround that uses a second shm section to= pass between executables either the size or more simply the shm ID of the = main shm section. Either way this circumvented the problem. >=20 > However with this solution there is an odd change in the base address > of the shm section between calls from the routine that creates the > section to the executables that use it. You can't rely on getting the shm region allocated at the same memory address in different executables. > >On second thought, adjusting Cygwin's behaviour to Linux here is rather > >trivial. I applied a patch to the git repo and uploaded new developer > >snapshots (2015-04-12) to https://cygwin.com/snapshots/ > >You only have to replace the DLL itself, cygserver is not affected by > >this patch. Please give it a try. >=20 > That did the trick. With the new cygwin1 DLL I don't need to pass shm > section information between executables and the overall behavior is > consistent with that on Linux. >=20 > Thank you for your help! I am very happy this works now on cygwin. Thanks for the feedback. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --EDT6MSV0B3GxyNyZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVLMQ5AAoJEPU2Bp2uRE+g+2QP/igJWUdweZKxAHFjV1/Cq1rR VafPMuOb8mHl/yCVkRICgGL5zkYAcwCY4cl/E9BUtcFIJOPZd8ZdPGqmPft0Vpvt Gmir+EF1T6K3l8ITojSHORx3L6qtN7Sw/lSSaiT/70v6w96xtXXeNnV7ZKusJLy4 XfUoQaclUiCe/yVTsk1/siFLodV0YweJLkOlYgFbd52Xv+ZvJWXYFiohmcPr445q 3And7A00174eI7uGsoGWUWsu77+x1gZ3GWBv9kVm9o1n8F/IgzYHox9HCBpjTtlf TYvrZh3DwE4teoochq4EYR5mW9vX2XhLqEcaVdPn7xYDMyaExLRSwgM0U9pUwnwa 720fpC6R9AWTrKO5mttfEcEg+Ske4QZcaWxUR/jo3BfsBjl3yq+2U73JzetjCTed d6UJ2SnF7Lk1QcmVXmvYpoyfJxpOxCRaN5cG9a+zv6uS4Jp88v2fMuw0jl9RcEHV VYFFnr54yRMvivUVBG3vEt7Yl1vwaUBnjtRIAZ36XIgGrKvqU/4HdnGlVRw6tDgA gmk0SIXQQiZjyIFPOzV1Ix3KJV1mZTmTwDdAvzKLv4lcQLfayaYkRuhEu+eDGxSh BMn0iNyrQwTYzuct3owxhvHbNGIycH8B+ip3pZUa/uWKTikRiqnLLpi3hSPzTEk5 QbgEnFui8fbYOV/l1ZJX =BvtF -----END PGP SIGNATURE----- --EDT6MSV0B3GxyNyZ--