summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-08-04 17:43:49 +0000
committerReid Kleckner <rnk@google.com>2017-08-04 17:43:49 +0000
commitaf3e93ac932b89f224db44ff64d64589f0508645 (patch)
treed658396367ac32fc33394e381acfc38abdff2880 /llvm/lib/Support/Unix
parent96d6008145e41095c3f027868f4edea9074561e0 (diff)
downloadbcm5719-llvm-af3e93ac932b89f224db44ff64d64589f0508645.tar.gz
bcm5719-llvm-af3e93ac932b89f224db44ff64d64589f0508645.zip
[Support] Remove getPathFromOpenFD, it was unused
Summary: It was added to support clang warnings about includes with case mismatches, but it ended up not being necessary. Reviewers: twoh, rafael Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D36328 llvm-svn: 310078
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Path.inc47
1 files changed, 0 insertions, 47 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 250a15dc5a7..3099c270944 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -807,53 +807,6 @@ std::error_code openFileForWrite(const Twine &Name, int &ResultFD,
return std::error_code();
}
-std::error_code getPathFromOpenFD(int FD, SmallVectorImpl<char> &ResultPath) {
- if (FD < 0)
- return make_error_code(errc::bad_file_descriptor);
-
-#if defined(F_GETPATH)
- // When F_GETPATH is availble, it is the quickest way to get
- // the path from a file descriptor.
- ResultPath.reserve(MAXPATHLEN);
- if (::fcntl(FD, F_GETPATH, ResultPath.begin()) == -1)
- return std::error_code(errno, std::generic_category());
-
- ResultPath.set_size(strlen(ResultPath.begin()));
-#else
- // If we have a /proc filesystem mounted, we can quickly establish the
- // real name of the file with readlink. Otherwise, we don't know how to
- // get the filename from a file descriptor. Give up.
- if (!fs::hasProcSelfFD())
- return make_error_code(errc::function_not_supported);
-
- ResultPath.reserve(PATH_MAX);
- char ProcPath[64];
- snprintf(ProcPath, sizeof(ProcPath), "/proc/self/fd/%d", FD);
- ssize_t CharCount = ::readlink(ProcPath, ResultPath.begin(), ResultPath.capacity());
- if (CharCount < 0)
- return std::error_code(errno, std::generic_category());
-
- // Was the filename truncated?
- if (static_cast<size_t>(CharCount) == ResultPath.capacity()) {
- // Use lstat to get the size of the filename
- struct stat sb;
- if (::lstat(ProcPath, &sb) < 0)
- return std::error_code(errno, std::generic_category());
-
- ResultPath.reserve(sb.st_size + 1);
- CharCount = ::readlink(ProcPath, ResultPath.begin(), ResultPath.capacity());
- if (CharCount < 0)
- return std::error_code(errno, std::generic_category());
-
- // Test for race condition: did the link size change?
- if (CharCount > sb.st_size)
- return std::error_code(ENAMETOOLONG, std::generic_category());
- }
- ResultPath.set_size(static_cast<size_t>(CharCount));
-#endif
- return std::error_code();
-}
-
template <typename T>
static std::error_code remove_directories_impl(const T &Entry,
bool IgnoreErrors) {
OpenPOWER on IntegriCloud