From: "Henk Geraads" Date: Mon, 3 Dec 2007 13:58:35 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_005E_01C835B4.99105930" Subject: Re: [Xenomai-help] native pipe can not write Reply-To: linux@domain.hid List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org This is a multi-part message in MIME format. ------=_NextPart_000_005E_01C835B4.99105930 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, we are currently using a PXA270 board with kernel 2.6.15 with xenomai = 2.2.2. We are having the same problem. We create a pipe like; rt_pipe_create(&dti_pipe_wr, "DTI_FROM_UART", FIFO_WR, 1000); i=3Drt_pipe_write(&dti_pipe_wr, data->dti_rcvbuf, 20, P_NORMAL) we got error =3D -ENOMEM? Is this the same error? > -- Gilles Chanteperdrix wrote :=20 > wrote: > > Hi, > > I try to use the message pipe in native API, but I can not write t= o the > > pipe. Can anyone help me to find what is wrong? > > And in Linux side it says:"write failed: Cannot allocate memory" > > Thank you! > > Following is the program and return message. > > #./test_pipe > > create return: 0, write return: -12, read return: -110 > >=20 > > #include > > #include > > #include > > #include > >=20 > > RT_PIPE pipe_desc; > > RT_TASK task; > >=20 > > void op_pipe(void *arg) > > { > > int err, pipe_fd, wre, rre; > > char buf[16] =3D {'a', 'b', 'c'}; > > char rd; > >=20 > > err =3D rt_pipe_create(&pipe_desc, "my_testpipe2", 3, 128); > > char tmp[] =3D {"test pipe"}; > >=20 > > wre =3D rt_pipe_write(&pipe_desc, buf, 2, P_NORMAL); > > rre =3D rt_pipe_read(&pipe_desc, &rd, 2, 100); > I do not know if this is related with your issue, but the receive bu= ff > is too small: you want write 2 bytes in a 1 byte buffer. > > --=20 > Gilles Chanteperdrix. If we create the pipe on the heap, that means at creation time with si= ze '0' the pipe seems at first to works, but the memory of other proce= sses (not related) is corrupted and those processes crashes! Henk Geraads=20 ------=_NextPart_000_005E_01C835B4.99105930 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable =EF=BB=BF
Hi,
 
we are currently using a PXA270 board with = kernel=20 2.6.15 with xenomai 2.2.2. We are having the same problem. We create a= pipe=20 like;
rt_pipe_create(&dti_pipe_wr, "DTI_FROM_UART", FIFO_WR,=20 1000);
 
i=3Drt_pipe_write(&dti_pipe_wr,=20 data->dti_rcvbuf, 20, P_NORMAL)
 
we got error =3D -ENOMEM?
 
Is this the same error?
 
> --=20 Gilles Chanteperdrix wrote : 
>
 wrote:
> > Hi,
> > I try to use the message= pipe in=20 native API, but I can not write to the
> > pipe. Can anyone help me= to find=20 what is wrong?
> > = And in=20 Linux side it says:"write failed: Cannot allocate memory"
> > Thank you!
> > Following is the program= and=20 return message.
> >= =20 #./test_pipe
> > cr= eate=20 return: 0, write return: -12, read return: -110
> > 
> > #include <stdio.h>=
> > #include <errno.h>=
> > #include=20 <native/task.h>
>&nbs= p;>=20 #include <sys/mman.h>
> > 
> > RT_PIPE pipe_desc;
> > RT_TASK task;
> > 
> > void op_pipe(void *arg)<= BR>> > {
> >    &= nbsp;   =20 int  err, pipe_fd, wre, rre;
> >    &= nbsp;   =20 char buf[16] =3D {'a', 'b', 'c'};
> >    &= nbsp;   =20 char rd;
> > <= BR>> >    &= nbsp;   =20 err =3D rt_pipe_create(&pipe_desc, "my_testpipe2", 3, 128);
> >    &= nbsp;   =20 char tmp[] =3D {"test pipe"};
> > 
>=20 >         wre =3D=20 rt_pipe_write(&pipe_desc, buf, 2, P_NORMAL);
> >    &= nbsp;   =20 rre =3D rt_pipe_read(&pipe_desc, &rd, 2, 100);
 
> I=20 do not know if this is related with your issue, but the receive buff> is too small: you want write 2 byt= es in a 1=20 byte buffer.
>
> --
>      = ;  =20 Gilles Chanteperdrix.
 
If we create the pipe on the heap, that mea= ns at=20 creation time with size '0' the pipe seems at first to works, but the = memory of=20 other processes (not related) is corrupted and those processes=20 crashes!
 
Henk Geraads
 
------=_NextPart_000_005E_01C835B4.99105930--