This is an archive of the discontinued LLVM Phabricator instance.

[Support] Add support for the OF_Delete open flag on posix platforms
AbandonedPublic

Authored by zturner on Jun 6 2018, 7:57 PM.

Details

Reviewers
rnk
echristo
Summary
Previously this was documented as only making a difference on
Windows.  However, we can support this on all platform for
symmetry.  Although the semantics differ slightly, the important
part (i.e. the file should no longer exist after the descriptor
is closed) is supportable everywhere.  On Windows we do this
with FILE_FLAG_DELETE_ON_CLOSE, as we always have.  On Unixy
platforms, we do this by simply unlinking the file after it
has been opened.

Diff Detail

Event Timeline

zturner created this revision.Jun 6 2018, 7:57 PM
rnk accepted this revision.Jun 7 2018, 1:18 PM

lgtm

This revision is now accepted and ready to land.Jun 7 2018, 1:18 PM
echristo accepted this revision.Jun 7 2018, 1:53 PM

LGTM.

zturner abandoned this revision.Jun 7 2018, 2:01 PM

FWIW turns out this doesn't work as nicely as I thought it did. So I'm going to bench this one for now. createUniqueFile uses this flag, and there are several places in the codebase that assume they can refer to the path afterwords, which breaks here as this effectively makes an open unliked file on posix platforms. I'll think about the best way to handle this in the future, but it's not high priority right now.