Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix Subject: Re: file system query Message-ID: <2165@sun.uucp> Date: Thu, 9-May-85 03:22:12 EDT Article-I.D.: sun.2165 Posted: Thu May 9 03:22:12 1985 Date-Received: Sat, 11-May-85 02:00:02 EDT References: <10195@brl-tgr.ARPA> <220@ki4pv.UUCP> Organization: Sun Microsystems, Inc. Lines: 33 > Opening for append using [see] fopen(3) does not cause anything > of great magic to happen to the op system. The basic procedure > involved is: > (1) open file > (2) seek to end > (3) fill buffer and write to file in current position Not in System V. In System V, opening for append using "fopen" *does* turn on the "forced append" bit for the underlying file descriptor. This solves the problem you mention of two processes appending to the same file. (For System III or 4.NBSD for N >= 2, which have the same forced append bit but don't use it in the standard I/O library, #include int fdflags; if ((fdflags = fcntl(fileno(stream), F_GETFD, 0) < 0) { perror("Hell just froze over"); exit(69); } if (fcntl(fileno(stream), F_SETFD, fdflags|O_APPEND) < 0) { perror("The Mets just won the World Series"); /* * No statement is being made here about the relative * probability of the two "fcntl" calls failing :-) */ exit(17); } should do the trick. Guy Harris