Subject: Re: Possible solution to toolchain/16963 - NBUILDJOBS/METALOG conflict
From: David Laight <firstname.lastname@example.org>
Date: 06/06/2002 13:20:03
> >2) Have an append(1) command as the last item in the pipe when writing to
> >METALOG. This command would take its stdin and dump it to a target file
> >given on its command line, but (and here's the critical bit!) would set
> >and obey exclusive advisory locks while doing so.
> >Possible problem:
> > *) flock(2) doesn't necessarily exist everywhere.
Also you doing a rather global lock. IIRC the header file (or was it
timezone) parts of the build add lots of records using find. Your
'append' program will lock the METALOG file for the duration of the find
- stopping the parallel build in its tracks.
> libnbcompat emulates flock(2) using POSIX fcntl() locks, whose existence I
> think it's reasonably to rely on.
Would it be more reasonable to just rely on O_APPEND - and do a
single write() call for each entry?
I don't think I'd rely on setlinebuf() guaranteeing that only
writes of lines are done - I know one system whose libc would
do multiple write for a single line....
install would hae to have a 'large enough' buffer.
OTOH the append() program could use fgets() fputs()....
David Laight: email@example.com