[llvm] r297661 - Bring back r297624.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 10:44:25 PDT 2017


On 30 March 2017 at 13:38, Yaron Keren <yaron.keren at gmail.com> wrote:
> stdout is special since getFD (pre-commit) always returns the same file
> descriptor, STDOUT_FILENO (1) whereas for regular files openFileForWrite
> will return new (unique) file descriptor and then there is no problem of
> closing one of them.

With the current code we also get an unique file descriptor for each
call to get a stream to stdout.

I think that if we are going to disallow multiple streams pointing to
a singe file, we should do that for all files, not just stdout.

> What will happen when you open the same file with two file descriptors and
> write there? probably intermixed output, depending on file exclusivity flags
> and buffers? dono. With stdout it works intermixed which is actually ok for
> many cases, as long you don't depend on order.

Other than having a different buffer management I think the results
are the same (intermixed output).

Cheers,
Rafael


More information about the llvm-commits mailing list