# $Id: README,v 2.1 2007/12/03 17:13:43 ksb Exp $ Flock applies or removes an advisory lock on the named file or file descriptor. Advisory locks allow cooperating processes to perform consistent operations on files see flock(2). This program is *very* useful on a Sequent machine; almost as useful on fast uniprocessors. Here is a case where flock(1) is very useful: on a Sequent Balance series machine parallel make can be used to compile many files at the same time. This doesn't work for programs that use xstr(1) because competing processes using xstrings fails. In the Makefile for vi one might use a flock on the Makefile to force (only) the xstr to be run sequentially: .c.o: ${CC} -E ${CFLAGS} $*.c | \ flock Makefile sh -c "${XSTR} -c -; mv x.c $*.p.x"; \ sed '/rcsid\[\]/d' < $*.p.x > $*.p.c; \ ${CC} ${CFLAGS} -c $*.p.c; \ mv $*.p.o $*.o; \ rm $*.p.x $*.p.c Which will start a few cpps in parallel and run only one xstr at a time, as soon as it can it will run the sed/cc/mv/rm allowing another process to begin using xstr. (I flock the Makefile by convention, because I know I always have one. If more then one command set needs to work from the same Makefile I flock `complie.lock', and `yacc.lock' or some such, not using Makefile for either. The clean target in the Makefile removes these files.) As a wrapper, flock makes xapply(1) even more spiffy. Also flock(1) works well with xclate's file descriptor passing (-E, -I, -D) and escrow. -- kayessbee (Kevin S Braunsdorf), Dec 2007 flock-spam@ksb.npcguild.org s,-span,,p