summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/PathV2.inc
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-03 17:54:07 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-03 17:54:07 +0000
commitc20a0325f3cc44ad6dd3eb386604e65db7e42267 (patch)
tree2c70bf0ba76e4666f14677637ea6c64d3c95a902 /llvm/lib/Support/Unix/PathV2.inc
parent409f556a2fc8443aadf36616245358dc5c312bc0 (diff)
downloadbcm5719-llvm-c20a0325f3cc44ad6dd3eb386604e65db7e42267.tar.gz
bcm5719-llvm-c20a0325f3cc44ad6dd3eb386604e65db7e42267.zip
Support/FileSystem: Add resize_file implementation.
llvm-svn: 120819
Diffstat (limited to 'llvm/lib/Support/Unix/PathV2.inc')
-rw-r--r--llvm/lib/Support/Unix/PathV2.inc10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc
index 8ecf2a4222d..75cfce822a1 100644
--- a/llvm/lib/Support/Unix/PathV2.inc
+++ b/llvm/lib/Support/Unix/PathV2.inc
@@ -213,6 +213,16 @@ error_code rename(const Twine &from, const Twine &to) {
return make_error_code(errc::success);
}
+error_code resize_file(const Twine &path, uint64_t size) {
+ SmallString<128> path_storage;
+ StringRef p = path.toNullTerminatedStringRef(path_storage);
+
+ if (::truncate(p.begin(), size) == -1)
+ return error_code(errno, system_category());
+
+ return make_error_code(errc::success);
+}
+
error_code exists(const Twine &path, bool &result) {
SmallString<128> path_storage;
StringRef p = path.toNullTerminatedStringRef(path_storage);
OpenPOWER on IntegriCloud