mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Remove the old file memory mapping functions.
llvm-svn: 183828
This commit is contained in:
parent
072d5a2178
commit
528e53f9f1
@ -495,29 +495,6 @@ namespace sys {
|
|||||||
bool eraseFromDisk(bool destroy_contents = false,
|
bool eraseFromDisk(bool destroy_contents = false,
|
||||||
std::string *Err = 0) const;
|
std::string *Err = 0) const;
|
||||||
|
|
||||||
|
|
||||||
/// MapInFilePages - This is a low level system API to map in the file
|
|
||||||
/// that is currently opened as FD into the current processes' address
|
|
||||||
/// space for read only access. This function may return null on failure
|
|
||||||
/// or if the system cannot provide the following constraints:
|
|
||||||
/// 1) The pages must be valid after the FD is closed, until
|
|
||||||
/// UnMapFilePages is called.
|
|
||||||
/// 2) Any padding after the end of the file must be zero filled, if
|
|
||||||
/// present.
|
|
||||||
/// 3) The pages must be contiguous.
|
|
||||||
///
|
|
||||||
/// This API is not intended for general use, clients should use
|
|
||||||
/// MemoryBuffer::getFile instead.
|
|
||||||
static const char *MapInFilePages(int FD, size_t FileSize,
|
|
||||||
off_t Offset);
|
|
||||||
|
|
||||||
/// UnMapFilePages - Free pages mapped into the current process by
|
|
||||||
/// MapInFilePages.
|
|
||||||
///
|
|
||||||
/// This API is not intended for general use, clients should use
|
|
||||||
/// MemoryBuffer::getFile instead.
|
|
||||||
static void UnMapFilePages(const char *Base, size_t FileSize);
|
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
/// @name Data
|
/// @name Data
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
// Simplistic definitinos of these macros to allow files to be read with
|
// Simplistic definitinos of these macros for use in getOpenFile.
|
||||||
// MapInFilePages.
|
|
||||||
#ifndef S_ISREG
|
#ifndef S_ISREG
|
||||||
#define S_ISREG(x) (1)
|
#define S_ISREG(x) (1)
|
||||||
#endif
|
#endif
|
||||||
|
@ -773,21 +773,4 @@ Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
|
|||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Path::MapInFilePages(int FD, size_t FileSize, off_t Offset) {
|
|
||||||
int Flags = MAP_PRIVATE;
|
|
||||||
#ifdef MAP_FILE
|
|
||||||
Flags |= MAP_FILE;
|
|
||||||
#endif
|
|
||||||
void *BasePtr = ::mmap(0, FileSize, PROT_READ, Flags, FD, Offset);
|
|
||||||
if (BasePtr == MAP_FAILED)
|
|
||||||
return 0;
|
|
||||||
return (const char*)BasePtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Path::UnMapFilePages(const char *BasePtr, size_t FileSize) {
|
|
||||||
const void *Addr = static_cast<const void *>(BasePtr);
|
|
||||||
::munmap(const_cast<void *>(Addr), FileSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end llvm namespace
|
} // end llvm namespace
|
||||||
|
@ -788,16 +788,5 @@ Path::createTemporaryFileOnDisk(bool reuse_current, std::string* ErrMsg) {
|
|||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// MapInFilePages - Not yet implemented on win32.
|
|
||||||
const char *Path::MapInFilePages(int FD, size_t FileSize, off_t Offset) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// MapInFilePages - Not yet implemented on win32.
|
|
||||||
void Path::UnMapFilePages(const char *Base, size_t FileSize) {
|
|
||||||
assert(0 && "NOT IMPLEMENTED");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user