Path: utzoo!attcan!uunet!husc6!bloom-beacon!bu-cs!purdue!decwrl!labrea!denali!karish From: karish@denali.stanford.edu (Chuck Karish) Newsgroups: comp.unix.wizards Subject: Re: Is write(2) "atomic" ? Summary: Sometimes. Message-ID: <23051@labrea.Stanford.EDU> Date: 12 Jul 88 23:04:37 GMT References: <11410005@eecs.nwu.edu> <3247@phoenix.Princeton.EDU> Sender: news@labrea.Stanford.EDU Reply-To: karish@denali.stanford.edu (Chuck Karish) Organization: Mindcraft, Inc. Lines: 14 in article <11410005@eecs.nwu.edu> naim@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@denali.stanford.edu BITNET: karish%denali@forsythe.stanford.edu UUCP: {decvax,hplabs!hpda}!mindcrf!karish USPS: 1825 California St. #5 Mountain View, CA 94041