[llvm-commits] CVS: llvm/lib/System/Unix/MappedFile.inc Signals.inc Unix.h
Reid Spencer
reid at x10sys.com
Fri Aug 25 14:37:34 PDT 2006
Changes in directory llvm/lib/System/Unix:
MappedFile.inc updated: 1.17 -> 1.18
Signals.inc updated: 1.14 -> 1.15
Unix.h updated: 1.18 -> 1.19
---
Log message:
For PR797: http://llvm.org/PR797 :
Make the Win32 code exception free (untested/uncompiled) which forced some
interface changes which had ripple effect. This should be the last of 797.
---
Diffs of the changes: (+16 -9)
MappedFile.inc | 10 ++++++----
Signals.inc | 13 +++++++++----
Unix.h | 2 +-
3 files changed, 16 insertions(+), 9 deletions(-)
Index: llvm/lib/System/Unix/MappedFile.inc
diff -u llvm/lib/System/Unix/MappedFile.inc:1.17 llvm/lib/System/Unix/MappedFile.inc:1.18
--- llvm/lib/System/Unix/MappedFile.inc:1.17 Tue Aug 22 11:04:22 2006
+++ llvm/lib/System/Unix/MappedFile.inc Fri Aug 25 16:37:17 2006
@@ -122,7 +122,7 @@
return info_->Size;
}
-void MappedFile::size(size_t new_size) {
+bool MappedFile::size(size_t new_size, std::string* ErrMsg) {
assert(info_ && "MappedFile not initialized");
// Take the mapping out of memory
@@ -140,12 +140,14 @@
if (new_size > cur_size) {
// Ensure we can allocate at least the idodes necessary to handle the
// file size requested.
- ::lseek(info_->FD, new_size, SEEK_SET);
- ::write(info_->FD, "\0", 1);
+ if ((off_t)-1 == ::lseek(info_->FD, new_size, SEEK_SET))
+ return MakeErrMsg(ErrMsg, "Can't lseek: ");
+ if (-1 == ::write(info_->FD, "\0", 1))
+ return MakeErrMsg(ErrMsg, "Can't write: ");
}
// Put the mapping back into memory.
- this->map(0);
+ return this->map(ErrMsg);
}
}
Index: llvm/lib/System/Unix/Signals.inc
diff -u llvm/lib/System/Unix/Signals.inc:1.14 llvm/lib/System/Unix/Signals.inc:1.15
--- llvm/lib/System/Unix/Signals.inc:1.14 Mon Aug 7 00:36:24 2006
+++ llvm/lib/System/Unix/Signals.inc Fri Aug 25 16:37:17 2006
@@ -154,7 +154,7 @@
}
// RemoveFileOnSignal - The public API
-void sys::RemoveFileOnSignal(const sys::Path &Filename) {
+bool sys::RemoveFileOnSignal(const sys::Path &Filename, std::string* ErrMsg) {
if (FilesToRemove == 0)
FilesToRemove = new std::vector<sys::Path>;
@@ -162,14 +162,18 @@
std::for_each(IntSigs, IntSigsEnd, RegisterHandler);
std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
+ return false;
}
// RemoveDirectoryOnSignal - The public API
-void sys::RemoveDirectoryOnSignal(const sys::Path& path) {
+bool sys::RemoveDirectoryOnSignal(const sys::Path& path, std::string* ErrMsg) {
// Not a directory?
sys::FileStatus Status;
- if (path.getFileStatus(Status) || !Status.isDir)
- return;
+ if (path.getFileStatus(Status) || !Status.isDir) {
+ if (ErrMsg)
+ *ErrMsg = path.toString() + " is not a directory";
+ return true;
+ }
if (DirectoriesToRemove == 0)
DirectoriesToRemove = new std::vector<sys::Path>;
@@ -178,6 +182,7 @@
std::for_each(IntSigs, IntSigsEnd, RegisterHandler);
std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
+ return false;
}
/// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or
Index: llvm/lib/System/Unix/Unix.h
diff -u llvm/lib/System/Unix/Unix.h:1.18 llvm/lib/System/Unix/Unix.h:1.19
--- llvm/lib/System/Unix/Unix.h:1.18 Wed Aug 23 15:34:57 2006
+++ llvm/lib/System/Unix/Unix.h Fri Aug 25 16:37:17 2006
@@ -94,7 +94,7 @@
// but, oh well, just use a generic message
sprintf(buffer, "Error #%d", errnum);
#endif
- *ErrMsg = buffer;
+ *ErrMsg = prefix + buffer;
return true;
}
More information about the llvm-commits
mailing list