Unix™ Systems Programming [Electronic resources] : Communication, Concurrency, and Threads

Prentice Hall

نسخه متنی -صفحه : 276/ 168
نمايش فراداده

15.8 Exercise: Implementing Pipes with Message Queues

Formulate a specification of a software pipe implementation in terms of message queues. Implement the following functions.

pipe_t *pipe_open(void);
int pipe_read(pipe_t *p, char *buf, int chars);
int pipe_write(pipe_t *p, char *buf, int chars);
int pipe_close(pipe_t *p);

Design a pipe_t structure to fit the implementation. Test the implementation as described in Section 15.7.