[PATCH] D38570: Support: Rewrite Windows implementation of sys::fs::rename to be more POSIXy.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 11:33:24 PDT 2017


On Thu, Oct 5, 2017 at 11:21 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Peter Collingbourne via Phabricator via llvm-commits
> <llvm-commits at lists.llvm.org> writes:
>
>
> > +  while (1) {
> > +    auto EC = rename_internal(FromHandle, To, true);
> > +    if (!EC || EC != errc::permission_denied)
> > +      return EC;
> ...
> > +    // The destination file probably exists and is currently open in
> another
> > +    // process. Rename it to move it out of the way of the source file.
> Use
> > +    // FILE_FLAG_DELETE_ON_CLOSE to arrange for the destination file to
> be
> > +    // deleted when the other process closes it.
>
> This only happens if the file is open without FILE_SHARE_DELETE mode, no?
>

I observed that it could also happen if the destination file is memory
mapped (i.e. another process has a MemoryBuffer open on the file). In that
case we cannot delete it directly, we have to rename it.

When do we expect to hit that? If only when a virus scanner is running,
> shouldn't we just sleep and wait for it to close it?
>
> Cheers,
> Rafael
>



-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171005/0f51da6f/attachment.html>


More information about the llvm-commits mailing list