Skip to contentSkip to conversation

native pipe can not write

Xenomai-help Henk Geraads 1 participant 1 message Dec 3, 2007

lore
Share & tools
lore
#0 lore raw

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=rt_pipe_write(&dti_pipe_wr, data->dti_rcvbuf, 20, P_NORMAL)

we got error = -ENOMEM?

Is this the same error?

Quoted 25 lines

-- Gilles Chanteperdrix wrote :

Quoted 23 lines · wrote:

Hi,
I try to use the message pipe in native API, but I can not write to 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

#include <stdio.h>
#include <errno.h>
#include <native/task.h>
#include <sys/mman.h>

RT_PIPE pipe_desc;
RT_TASK task;

void op_pipe(void *arg)

{
        int  err, pipe_fd, wre, rre;
        char buf[16] = {'a', 'b', 'c'};
        char rd;
Quoted 11 lines
Quoted 5 lines
        err = rt_pipe_create(&pipe_desc, "my_testpipe2", 3, 128);
        char tmp[] = {"test pipe"};

        wre = rt_pipe_write(&pipe_desc, buf, 2, P_NORMAL);
        rre = rt_pipe_read(&pipe_desc, &rd, 2, 100);

I do not know if this is related with your issue, but the receive buff is too small: you want write 2 bytes in a 1 byte buffer.

Signature · 1 line
        Gilles Chanteperdrix.

If we create the pipe on the heap, that means at creation time with size '0' the pipe seems at first to works, but the memory of other processes (not related) is corrupted and those processes crashes!

Henk Geraads