summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorHubert Tong <hubert.reinterpretcast@gmail.com>2019-04-04 00:40:34 +0000
committerHubert Tong <hubert.reinterpretcast@gmail.com>2019-04-04 00:40:34 +0000
commit7f8b3bf2475624c4bd1140a4b48c83b738ddd0ec (patch)
tree826df99822531fa2a53e2840cf6fb7549e81bfd6 /llvm/lib/Support/Unix
parent844a02e509a4cc03f76ef5dd1c358c57ee164b71 (diff)
downloadbcm5719-llvm-7f8b3bf2475624c4bd1140a4b48c83b738ddd0ec.tar.gz
bcm5719-llvm-7f8b3bf2475624c4bd1140a4b48c83b738ddd0ec.zip
[Support] On AIX, Check ENOTSUP on posix_fallocate instead of EOPNOTSUPP
Summary: `posix_fallocate` can fail if the underlying filesystem does not support it; and, on AIX, such a failure is reported by a return value of `ENOTSUP`. The existing code checks only for `EOPNOTSUPP`, which may share the same value as `ENOTSUP`, but is not required to. Reviewers: xingxue, sfertile, jasonliu Reviewed By: xingxue Subscribers: kristina, jsji, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60175 llvm-svn: 357662
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Path.inc7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index a02585c3bdc..05ccc6cc5e4 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -492,7 +492,12 @@ std::error_code resize_file(int FD, uint64_t Size) {
// If we have posix_fallocate use it. Unlike ftruncate it always allocates
// space, so we get an error if the disk is full.
if (int Err = ::posix_fallocate(FD, 0, Size)) {
- if (Err != EINVAL && Err != EOPNOTSUPP)
+#ifdef _AIX
+ constexpr int NotSupportedError = ENOTSUP;
+#else
+ constexpr int NotSupportedError = EOPNOTSUPP;
+#endif
+ if (Err != EINVAL && Err != NotSupportedError)
return std::error_code(Err, std::generic_category());
}
#endif
OpenPOWER on IntegriCloud