diff options
author | Chris Lattner <sabre@nondot.org> | 2004-05-28 00:23:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-05-28 00:23:48 +0000 |
commit | eb082995180756068af35bb826a9017975d87a51 (patch) | |
tree | bb625254fd242c104f0c0698c8302f90b2573ee4 /include | |
parent | 4e6620c9e0745ed19a8fe9844c43415afbb14ad8 (diff) | |
download | external_llvm-eb082995180756068af35bb826a9017975d87a51.zip external_llvm-eb082995180756068af35bb826a9017975d87a51.tar.gz external_llvm-eb082995180756068af35bb826a9017975d87a51.tar.bz2 |
Add a pair of functions to hide system specific details of mapping a file in for reading.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13863 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/Support/FileUtilities.h | 12 | ||||
-rw-r--r-- | include/llvm/Support/FileUtilities.h | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/include/Support/FileUtilities.h b/include/Support/FileUtilities.h index 0543d76..d5db63f 100644 --- a/include/Support/FileUtilities.h +++ b/include/Support/FileUtilities.h @@ -42,7 +42,7 @@ bool IsSharedObject(const std::string &FN); /// FileOpenable - Returns true IFF Filename names an existing regular file /// which we can successfully open. /// -bool FileOpenable (const std::string &Filename); +bool FileOpenable(const std::string &Filename); /// DiffFiles - Compare the two files specified, returning true if they are /// different or if there is a file error. If you specify a string to fill in @@ -93,6 +93,16 @@ long long getFileSize(const std::string &Filename); /// not exist or there is an error getting the time-stamp, zero is returned. unsigned long long getFileTimestamp(const std::string &Filename); +/// ReadFileIntoAddressSpace - Attempt to map the specific file into the +/// address space of the current process for reading. If this succeeds, +/// return the address of the buffer and the length of the file mapped. On +/// failure, return null. +void *ReadFileIntoAddressSpace(const std::string &Filename, unsigned &Length); + +/// UnmapFileFromAddressSpace - Remove the specified file from the current +/// address space. +void UnmapFileFromAddressSpace(void *Buffer, unsigned Length); + /// FDHandle - Simple handle class to make sure a file descriptor gets closed /// when the object is destroyed. This handle acts similarly to an diff --git a/include/llvm/Support/FileUtilities.h b/include/llvm/Support/FileUtilities.h index 0543d76..d5db63f 100644 --- a/include/llvm/Support/FileUtilities.h +++ b/include/llvm/Support/FileUtilities.h @@ -42,7 +42,7 @@ bool IsSharedObject(const std::string &FN); /// FileOpenable - Returns true IFF Filename names an existing regular file /// which we can successfully open. /// -bool FileOpenable (const std::string &Filename); +bool FileOpenable(const std::string &Filename); /// DiffFiles - Compare the two files specified, returning true if they are /// different or if there is a file error. If you specify a string to fill in @@ -93,6 +93,16 @@ long long getFileSize(const std::string &Filename); /// not exist or there is an error getting the time-stamp, zero is returned. unsigned long long getFileTimestamp(const std::string &Filename); +/// ReadFileIntoAddressSpace - Attempt to map the specific file into the +/// address space of the current process for reading. If this succeeds, +/// return the address of the buffer and the length of the file mapped. On +/// failure, return null. +void *ReadFileIntoAddressSpace(const std::string &Filename, unsigned &Length); + +/// UnmapFileFromAddressSpace - Remove the specified file from the current +/// address space. +void UnmapFileFromAddressSpace(void *Buffer, unsigned Length); + /// FDHandle - Simple handle class to make sure a file descriptor gets closed /// when the object is destroyed. This handle acts similarly to an |