Shared file descriptors

Doug Gwyn gwyn at smoke.BRL.MIL
Wed May 31 02:09:10 AEST 1989


In article <1770 at taux01.UUCP> gil%taux01 at nsc.COM (Gil Shwed) writes:
>		fork();
>		while((n = read(0, buf, 8192)) > 0)
>			write(1, buf, n);

This program has a race condition between the two processes,
even in the absence of kernel bugs.

>	The problem should be fixed by locking the inode before
>	taking the offset (This is the way SystemV does it).

Yeah, it's a problem, isn't it.  We begin to see why genuine
concurrent programming constructs are useful..



More information about the Comp.bugs.4bsd.ucb-fixes mailing list