]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/xray/xray_utils.h
Merge ^/head r327165 through r327168.
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / xray / xray_utils.h
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.
24 void printToStdErr(const char *Buffer);
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
39 } // namespace __xray
40
41 #endif // XRAY_UTILS_H