This is an archive of the discontinued LLVM Phabricator instance.

Remove FileSystem::GetFilePermissions and FileSystem::SetFilePermissions
ClosedPublic

Authored by zturner on Mar 17 2017, 10:48 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner created this revision.Mar 17 2017, 10:48 AM
labath added inline comments.
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
813 ↗(On Diff #92167)

This doesn't seem right. At the very least I would expect to see a matching change in the client code (I assume llvm constants don't match whatever we have used here (?)).

We don't care much about protocol compatibility, but the apple guys might. If that is the case then we will need some encode/decode functions here.

zturner added inline comments.Mar 17 2017, 12:47 PM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
813 ↗(On Diff #92167)

AFAICT both LLVM's enumeration and LLDB's enumeration map directly to the unix file permissions bits.

zturner added inline comments.Mar 17 2017, 12:52 PM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
813 ↗(On Diff #92167)

Here is the implementation of setPermissions in LLVM:

std::error_code setPermissions(const Twine &Path, perms Permissions) {
  SmallString<128> PathStorage;
  StringRef P = Path.toNullTerminatedStringRef(PathStorage);

  if (::chmod(P.begin(), Permissions))
    return std::error_code(errno, std::generic_category());
  return std::error_code();
}

So it's literally the same as LLDB's implementation which I've deleted, which was:

Error FileSystem::SetFilePermissions(const FileSpec &file_spec,
                                     uint32_t file_permissions) {
  Error error;
  if (::chmod(file_spec.GetCString(), file_permissions) != 0)
    error.SetErrorToErrno();
  return error;
}
labath accepted this revision.Mar 17 2017, 12:57 PM

Cool. Nevermind me then.

This revision is now accepted and ready to land.Mar 17 2017, 12:57 PM
This revision was automatically updated to reflect the committed changes.