Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jun 2003 11:07:20 -0400 (EDT)
From:      "Matthew Hagerty" <matthew@mundomateo.com>
To:        freebsd-hackers@freebsd.org
Subject:   Are write() calls guaranteed atomic?
Message-ID:  <1553.216.120.158.65.1054566440.squirrel@www.mundomateo.com>

next in thread | raw e-mail | index | archive | help
Greetings,

I'm writing a server that receives data via a named pipe (FIFO) and will
always have more than one other process sending data to it, and I'm
concerned with preventing data multiplexing.  The data coming in will be
lines of text delimited with a newline, but the processes writing the data
have no knowledge of the FIFO, they simply think they are writing to a
file.  This being the case, the processes writing the data give no regard
to PIPE_BUF and may send data in longer lengths (but probably never longer
than 2K to 4K.)

Will the kernel ensure that the data write() will be delivered to the FIFO
atomically even if the data is larger than PIPE_BUF, such that two or more
successive read() calls will retrieve the data in order?

If this is the case, is this specific to FreeBSD, or is this functionality
defined as a POSIX standard and generally portable?

Any insight would be greatly appreciated.

Thanks,
Matthew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1553.216.120.158.65.1054566440.squirrel>