summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-03-20 23:55:20 +0000
committerZachary Turner <zturner@google.com>2017-03-20 23:55:20 +0000
commit5821a3bf366a5d401930c2632fdb7acfe39046b2 (patch)
treea3257244016e1680cd9360c641909b85a1a31edd /llvm/lib/Support
parent076a2599388d8a9efa90207291310c16b9322b1a (diff)
downloadbcm5719-llvm-5821a3bf366a5d401930c2632fdb7acfe39046b2.tar.gz
bcm5719-llvm-5821a3bf366a5d401930c2632fdb7acfe39046b2.zip
[Support] Fill the file_status struct with link count.
Differential Revision: https://reviews.llvm.org/D31110 llvm-svn: 298326
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Unix/Path.inc11
-rw-r--r--llvm/lib/Support/Windows/Path.inc7
2 files changed, 13 insertions, 5 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 80bb1a42a13..7a5816ba1dd 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -230,6 +230,10 @@ UniqueID file_status::getUniqueID() const {
return UniqueID(fs_st_dev, fs_st_ino);
}
+uint32_t file_status::getLinkCount() const {
+ return fs_st_nlinks;
+}
+
ErrorOr<space_info> disk_space(const Twine &Path) {
struct STATVFS Vfs;
if (::STATVFS(Path.str().c_str(), &Vfs))
@@ -549,10 +553,9 @@ static std::error_code fillStatus(int StatRet, const struct stat &Status,
Type = file_type::symlink_file;
perms Perms = static_cast<perms>(Status.st_mode) & all_perms;
- Result =
- file_status(Type, Perms, Status.st_dev, Status.st_ino, Status.st_atime,
- Status.st_mtime, Status.st_uid, Status.st_gid,
- Status.st_size);
+ Result = file_status(Type, Perms, Status.st_dev, Status.st_nlink,
+ Status.st_ino, Status.st_atime, Status.st_mtime,
+ Status.st_uid, Status.st_gid, Status.st_size);
return std::error_code();
}
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index 97682c11839..b00d3905f65 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -179,6 +179,10 @@ TimePoint<> file_status::getLastModificationTime() const {
return toTimePoint(Time);
}
+uint32_t file_status::getLinkCount() const {
+ return NumLinks;
+}
+
std::error_code current_path(SmallVectorImpl<char> &result) {
SmallVector<wchar_t, MAX_PATH> cur_path;
DWORD len = MAX_PATH;
@@ -534,7 +538,8 @@ static std::error_code getStatus(HANDLE FileHandle, file_status &Result) {
? (all_read | all_exe)
: all_all;
Result = file_status(
- Type, Permissions, Info.ftLastAccessTime.dwHighDateTime,
+ Type, Permissions, Info.nNumberOfLinks,
+ Info.ftLastAccessTime.dwHighDateTime,
Info.ftLastAccessTime.dwLowDateTime,
Info.ftLastWriteTime.dwHighDateTime, Info.ftLastWriteTime.dwLowDateTime,
Info.dwVolumeSerialNumber, Info.nFileSizeHigh, Info.nFileSizeLow,
OpenPOWER on IntegriCloud