summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_common.h
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-06-07 05:38:26 +0000
committerAlexey Samsonov <samsonov@google.com>2012-06-07 05:38:26 +0000
commitcffe2f5c30c27234260d004b54152916ff0c45c6 (patch)
tree09bf8f5a83e24ec4d598d9d7bc0468aa2aa3887b /lib/sanitizer_common/sanitizer_common.h
parent16071602d364db4a8e99575acd098d7462ef318d (diff)
downloadcompiler-rt-cffe2f5c30c27234260d004b54152916ff0c45c6.tar.gz
[Sanitizer] Move ReadFileToBuffer to sanitizer_common.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_common.h')
-rw-r--r--lib/sanitizer_common/sanitizer_common.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_common.h b/lib/sanitizer_common/sanitizer_common.h
index 566c38196..2f13814bc 100644
--- a/lib/sanitizer_common/sanitizer_common.h
+++ b/lib/sanitizer_common/sanitizer_common.h
@@ -37,6 +37,13 @@ void Printf(const char *format, ...);
int SNPrintf(char *buffer, uptr length, const char *format, ...);
void Report(const char *format, ...);
+// Opens the file 'file_name" and reads up to 'max_len' bytes.
+// The resulting buffer is mmaped and stored in '*buff'.
+// The size of the mmaped region is stored in '*buff_size',
+// Returns the number of read bytes or 0 if file can not be opened.
+uptr ReadFileToBuffer(const char *file_name, char **buff,
+ uptr *buff_size, uptr max_len);
+
// Bit twiddling.
inline bool IsPowerOfTwo(uptr x) {
return (x & (x - 1)) == 0;