Pipe manager (QNX Neutrino)
|You must be root to start this manager.|
pipe [-1] [-a atomic_write_size] [-P] [-s pipe_buffer_size] &
|All these options were added in the QNX Neutrino Core OS 6.3.2.|
The pipe manager implements the subset of file I/O known as pipes (or anonymous FIFOs). A simple form of interprocess communication, pipes are mostly used to connect the output of one process to the input of another to form a series of filters.
|This version of pipe is backward compatible. When you invoke pipe with no arguments, the behavior you get is identical to that of the earlier versions of pipe.|
The atomic_write_size is the size for which it's guaranteed that a write() of data won't be interleaved with data from any other process; in other words the amount of data that will be written atomically. This is required when there are multiple writers sending data to a single reader. The POSIX maximum is referred to as PIPE_BUF, and can be queried at runtime using fpathconf(_PC_PIPE_BUF). It isn't recommended to lower this value from the default 5120 bytes in case application code is using the PIPE_BUF manifest from <limits.h> rather than a runtime fpathconf() determination.
The pipe_buffer_size is the total buffer size of the pipe (and must be at least the atomic write size). Effectively the pipe utility can hold this many (unread) bytes before write() clients start to block or fail with EAGAIN (based on their O_NONBLOCK orientation).
There is no simple mechanism (such as fpathconf()) to query the pipe-buffering capacity, but it can be determined by writing one byte at a time to an empty O_NONBLOCK pipe and counting how many are consumed until an EAGAIN error (full-pipe indication) is returned. Increasing this value could make pipelines more elastic, in terms of decoupling the writer from the reader processes, at the expense of using extra system memory for each pipe. Across a sample of OSs, pipe-buffering capacity is in the 4–16 KB range.
Strict POSIX conformance requires that the atime and mtime attributes of a FIFO be updated for every read() and write() operation. As FIFOs operate by redirecting access of the FIFO from the host filesystem to the pipe server, maintaining these attributes requires additional synchronization messages from the pipe server back to the host filesystem. In most cases, this level of synchronization isn't required, and by default is performed only at the last close() of the FIFO. For strict POSIX conformance, specify the -P option.
The -1 option sets the behavior for select() write notification of the pipe utility. The original behavior was to satisfy or unblock select() clients even if 1 byte of buffer space was available. POSIX specifies a different behavior. Since the atomic write size and the total buffer size are both equal to 5120 bytes, select() would be satisfied only on an empty pipe, which may impact performance or establish a lock-step timing between the writing and reading processes. If this option is enabled, consider also increasing the -s to be larger than PIPE_BUF so that the pipe doesn't have to completely drain before a select() for write is satisfied.
The pipe utility terminates only if an error occurs during startup. If pipe fails during startup, it prints a diagnostic message to the standard output stream and then exits with a nonzero status.
Controlling How Neutrino Starts in the Neutrino User's Guide