#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#define PIPE_MINOR 0
int pipe_fd;
int main(int argc, char *argv[])
{
        char devname[32], buf[16];
        
        sprintf(devname, "/dev/rtp%d", PIPE_MINOR);
        pipe_fd = open(devname, O_RDWR);
        if (pipe_fd < 0)
                fail();
        
        read(pipe_fd, buf, sizeof(buf));
        
        write(pipe_fd, "World", sizeof("World"));
        
}
void cleanup(void)
{
}
#define TASK_PRIO  0            
#define TASK_MODE  T_FPU|T_CPU(0)       
#define TASK_STKSZ 4096         
RT_TASK task_desc;
RT_PIPE pipe_desc;
void task_body(void)
{
        RT_PIPE_MSG *msgout, *msgin;
        int err, len, n;
        for (;;) {
                
                len = sizeof("Hello");
                
                if (!msgout)
                        fail();
                
                strcpy(RT_PIPE_MSGPTR(msgout), "Hello");
                
                if (n < 0) {
                        printf("receive error> errno=%d\n", n);
                        continue;
                }
                if (n == 0) {
                        if (msg == NULL) {
                                printf("pipe closed by peer while reading\n");
                                continue;
                        }
                        printf("empty message received\n");
                } else
                        printf("received msg> %s, size=%d\n", P_MSGPTR(msg),
                               P_MSGSIZE(msg));
                
                
        }
}
init init_module(void)
{
        int err;
        if (err)
                fail();
        
                             "MyTaskName", TASK_STKSZ, TASK_PRIO, TASK_MODE);
        if (!err)
        
}
void cleanup_module(void)
{
}