bind '#|'dir dir/data dir/data1
Write boundaries are preserved: each read terminates when the read buffer is full or after reading the last byte of a write, whichever comes first. In particular, a write of zero bytes will result in a zero-length read, which is usually interpreted by readers as end-of-file, but could be used to delimit the data stream for other purposes.
Written data is buffered by the kernel and stored on internal queues (see qio(10.2)). The maximum block size is 128k bytes; larger writes will be split across several blocks, which are queued separately. Each read will return data from at most one block. Concurrent writers are therefore guaranteed that their data will not be interleaved with data from other writers (ie, will be written atomically) only when each write is less than the maximum buffer size. Writers to pipe interfaces on remotely mounted portions of the namespace have their guarantee of atomicity lowered to Sys->ATOMICIO bytes by mnt(3).
The system mediates between producer and consumer. Writers will block when buffered data reaches a high-water mark, currently 32k bytes, until a reader has reduced it by half. The length returned by sys-stat(2) on each name gives the number of bytes waiting to be read on the corresponding end of the pipe.
When all file descriptors on one side of the pipe have been closed, and after any remaining data has been read, a reader on the other side sees end-of-file (count of zero) on a subsequent read. Once both ends are closed, the pipe can be reused.
A pipe persists until it is unmounted and no processes have either end open.
|PIPE(3 )||Rev: Thu Feb 15 14:43:36 GMT 2007|