[llvm-dev] Experiment on how to improve our temporary file handing.

Rafael Avila de Espindola via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 10 13:34:06 PST 2017


Mark Kettenis <mark.kettenis at xs4all.nl> writes:

>> The same would happen if there was a fatal error between the
>> FileOutputBuffer creation and commit. I don't think that is a code path
>> where that is possible right now, but it would be an easy thing to miss
>> in a code review.
>> 
>> I was hopping the OS could help us manage the temporary file so that
>> there was no way to accidentally leave it behind.
>> 
>> On linux there is O_TMPFILE, which allows us to create a file with no
>> name in the file system.
>
> For the LLVM use case creatinmg the file and immediately unlinking it
> would probably be good enough.  Howver...

One is not normally allowed to create a link once the count goes down to
zero. O_TMPFILE is a special case.

Cheers,
Rafael


More information about the llvm-dev mailing list