Files | |
file | pipe.c |
This file is part of the RTAI project. | |
Functions | |
int | rt_pipe_open (RT_PIPE *pipe, int minor) |
Open a pipe. | |
int | rt_pipe_close (RT_PIPE *pipe) |
Close a pipe. | |
ssize_t | rt_pipe_read (RT_PIPE *pipe, RT_PIPE_MSG **msgp, RTIME timeout) |
Read a message from a pipe. | |
ssize_t | rt_pipe_write (RT_PIPE *pipe, RT_PIPE_MSG *msg, size_t size, int flags) |
Write a message to a pipe. | |
ssize_t | rt_pipe_stream (RT_PIPE *pipe, const void *buf, size_t size) |
Stream bytes to a pipe. | |
ssize_t | rt_pipe_flush (RT_PIPE *pipe) |
Flush the pipe. | |
RT_PIPE_MSG * | rt_pipe_alloc (size_t size) |
Allocate a message buffer. | |
int | rt_pipe_free (RT_PIPE_MSG *msg) |
Free a message buffer. |
|
Allocate a message buffer. This service allocates a message buffer from the system heap which can be subsequently filled then passed to rt_pipe_write() for sending. The beginning of the available data area of size contiguous bytes is accessible from RT_PIPE_MSGPTR(msg).
|
|
Close a pipe. This service closes a pipe previously opened by rt_pipe_open(). Data pending for transmission to user-space are lost.
Context: This routine can be called on behalf of a task or from the initialization code. |
|
Flush the pipe. This service flushes any pending data buffered by rt_pipe_stream(). The data will be immediately sent to the user-space side of the pipe.
Context: This routine can be called on behalf of a task, interrupt context or from the initialization code. |
|
Free a message buffer. This service releases a message buffer returned by rt_pipe_read() to the system heap.
|
|
Open a pipe. This service opens a bi-directional communication channel allowing data exchange between real-time tasks and regular user-space processes. Pipes natively preserve message boundaries, but can also be used in byte stream mode from kernel to user space.
Context: This routine can be called on behalf of a task or from the initialization code. |
|
Read a message from a pipe. This service retrieves the next message sent from the user-space side of the pipe. rt_pipe_read() always preserves message boundaries, which means that all data sent through the same write(2) operation on the user-space side will be gathered in a single message by this service. Unless otherwise specified, the caller is blocked for a given amount of time if no data is immediately available on entry.
Side-effect: This routine calls the rescheduling procedure if no data is available on entry and timeout is different from RT_TIME_NONBLOCK. Context: This routine can be called on behalf of a task. It can also be called on behalf of an interrupt context or from the initialization code provided timeout is equal to RT_TIME_NONBLOCK.
|
|
Stream bytes to a pipe. This service writes a sequence of bytes to be received by the user-space side of the pipe. Unlike rt_pipe_write(), this service does not preserve message boundaries. Instead, an internal buffer is filled on the fly with the data. The actual sending may be delayed until the internal buffer is full, or the Linux kernel is re-entered after the real-time kernel enters a quiescent state. Data buffers sent by the rt_pipe_stream() service are always transmitted in FIFO order (i.e. RT_PIPE_NORMAL mode).
Context: This routine can be called on behalf of a task, interrupt context or from the initialization code. |
|
Write a message to a pipe. This service writes a complete message to be received by the user-space side of the pipe. rt_pipe_write() always preserves message boundaries, which means that all data sent through a single call of this service will be gathered in a single read(2) operation on the user-space side.
Side-effect: rt_pipe_write() causes any data buffered by rt_pipe_stream() to be flushed prior to sending the message. For this reason, rt_pipe_write() can return a non-zero byte count to the caller if some pending data has been flushed, even if size was zero on entry. Context: This routine can be called on behalf of a task, interrupt context or from the initialization code. |