Mark Hackett wrote:
Is that actually true? It may be guaranteed on Intel x86 compatibles and Linux (because of the string operations available in the x86 instruction set), but I don't thing anything other than an IPC message has a "you can write a string atomically" guarantee. And I may be misremembering that.
It seems to be a POSIX requirement: PIPE_BUF POSIX.1-2001 says that write(2)s of less than PIPE_BUF bytes must be atomic: the output data is written to the pipe as a contiguous sequence. (From http://dell9.ma.utexas.edu/cgi-bin/man-cgi?pipe+7) There's no corresponding guarantee for reading, though. The process on the other end can't be sure of getting the data from one write() call in a single read() call. In other words, the write does *not* establish a record boundary. -- Greg