| Dean Michael Berris | e7dbebf | 2017-01-25 03:50:46 +0000 | [diff] [blame] | 1 | //===-- xray_utils.h --------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file is a part of XRay, a dynamic runtime instrumentation system. |
| 11 | // |
| 12 | // Some shared utilities for the XRay runtime implementation. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | #ifndef XRAY_UTILS_H |
| 16 | #define XRAY_UTILS_H |
| 17 | |
| 18 | #include <sys/types.h> |
| 19 | #include <utility> |
| 20 | |
| 21 | namespace __xray { |
| 22 | |
| 23 | // Default implementation of the reporting interface for sanitizer errors. |
| Dean Michael Berris | ea9042c | 2017-02-07 23:35:34 +0000 | [diff] [blame] | 24 | void printToStdErr(const char *Buffer); |
| Dean Michael Berris | e7dbebf | 2017-01-25 03:50:46 +0000 | [diff] [blame] | 25 | |
| 26 | // EINTR-safe write routine, provided a file descriptor and a character range. |
| 27 | void retryingWriteAll(int Fd, char *Begin, char *End); |
| 28 | |
| 29 | // Reads a long long value from a provided file. |
| 30 | bool readValueFromFile(const char *Filename, long long *Value); |
| 31 | |
| 32 | // EINTR-safe read routine, providing a file descriptor and a character range. |
| 33 | std::pair<ssize_t, bool> retryingReadSome(int Fd, char *Begin, char *End); |
| 34 | |
| 35 | // EINTR-safe open routine, uses flag-provided values for initialising a log |
| 36 | // file. |
| 37 | int getLogFD(); |
| 38 | |
| Dean Michael Berris | e7dbebf | 2017-01-25 03:50:46 +0000 | [diff] [blame] | 39 | } // namespace __xray |
| 40 | |
| 41 | #endif // XRAY_UTILS_H |