Is write(2) "atomic" ?

Chuck Karish karish at denali.stanford.edu
Wed Jul 13 09:04:37 AEST 1988


in article <11410005 at eecs.nwu.edu> naim at eecs.nwu.edu (Naim Abdullah) writes:
> Do UNIX semantics guarantee that write(2) calls will be "atomic" ?

	If the write() is to a pipe or to a FIFO, and the request is for
	[PIPE_BUF] bytes or fewer, the write() is guaranteed to be
	atomic by the SVID and by the POSIX 1003.1 draft standard.
	For other write()s, the behavior is undefined; you take your
	chances.  If you absolutely, positively need atomic write()s,
	cram your I/O through a pipe or set up your own locking scheme.

Chuck Karish	ARPA:	karish at denali.stanford.edu
		BITNET:	karish%denali at forsythe.stanford.edu
		UUCP:	{decvax,hplabs!hpda}!mindcrf!karish
		USPS:	1825 California St. #5   Mountain View, CA 94041



More information about the Comp.unix.wizards mailing list