Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Subject: Re: cygserver shmat From: bertrand marquis To: cygwin In-Reply-To: <20040812104409.GA28756@cygbert.vinschen.de> References: <1092302630 DOT 4368 DOT 3 DOT camel AT bma DOT sysgo DOT com> <20040812093246 DOT GB24822 AT cygbert DOT vinschen DOT de> <1092305627 DOT 4368 DOT 10 DOT camel AT bma DOT sysgo DOT com> <20040812104409 DOT GA28756 AT cygbert DOT vinschen DOT de> Content-Type: multipart/mixed; boundary="=-SEf6iT+Q4o7jBrHekyab" Organization: SYSGO AG Message-Id: <1092312195.4368.14.camel@bma.sysgo.com> Mime-Version: 1.0 Date: 12 Aug 2004 14:03:15 +0200 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on donald.sysgo.com X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=no version=2.63 X-AntiVirus: checked by AntiVir MailGate (version: 2.0.1.16; AVE: 6.27.0.4; VDF: 6.27.0.7; host: mailgate.sysgo.de) --=-SEf6iT+Q4o7jBrHekyab Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Le jeu 12/08/2004 =C3=A0 12:44, Corinna Vinschen a =C3=A9crit : > On Aug 12 12:13, bertrand marquis wrote: > > In fact i wasn't using the SHM_RNd flag. > >=20 > > In details here is what i do: > >=20 > > - get a shared segment of with size=3D SIZE (SIZE multiple of SHMLBA) > > - attach the segment without specifying address and storing the result > > in beginaddress > > - attach the segment again specifying the address: endposition=3D > > beginaddress + SIZE > >=20 > > without SHM_RND in the second shmat i've got the error : invalid > > argument > >=20 > > now that i specifie SHM_RND in the flag i have the error: value to large > > for defined type .... > >=20 > > any idea ? >=20 > Nope. Not without knowing the actual values. An strace output of > the affected calls would be good. Even better, create a simple testcase > which allows to reproduce the behaviour. Just the minimum of necessary > code. >=20 >=20 > Corinna Ok, i have made a minimum program showing the problem. You can try specifying or not SHM_RND in the second shmat, without i have INvalid argument error and with i have value too large for defined data type. thanks bertrand --=-SEf6iT+Q4o7jBrHekyab Content-Disposition: attachment; filename=testshm.c Content-Type: text/x-c; name=testshm.c; charset=UTF-8 Content-Transfer-Encoding: 7bit #include #include #include #include #define SHM_R 0400 #define SHM_W 0200 main() { int sh_key,sz; unsigned int size=1000000; unsigned char *begin,*end,*tmp; sz = getpagesize(); size= (size / sz)*sz; sh_key = shmget (IPC_PRIVATE, size, IPC_CREAT | IPC_EXCL | SHM_R | SHM_W); if (sh_key != -1) { printf("sh_key=%i\n",sh_key); begin = (unsigned char *)shmat (sh_key, NULL, 0); if ( begin != -1) { tmp = begin + size; printf("begin=%d, tmp=%d\n",(int)begin,(int)tmp); end = (unsigned char *) shmat(sh_key,tmp,SHM_RND); if (tmp == end ) { printf("end=%i\n",(int)end); shmdt(end); } else { printf("error in shmat : %s\n",strerror(errno)); } shmdt(begin); } else { printf("error in shmat : %s\n",strerror(errno)); } shmctl (sh_key, IPC_RMID, NULL); } else { printf("error in shmget : %s\n",strerror(errno)); } } --=-SEf6iT+Q4o7jBrHekyab Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --=-SEf6iT+Q4o7jBrHekyab--