blob: 1ecc74a2dce87bda72668b277f65390a9a69ca8e [file] [log] [blame]
Dean Michael Berrise7dbebf2017-01-25 03:50:46 +00001//===-- 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
21namespace __xray {
22
23// Default implementation of the reporting interface for sanitizer errors.
Dean Michael Berrisea9042c2017-02-07 23:35:34 +000024void printToStdErr(const char *Buffer);
Dean Michael Berrise7dbebf2017-01-25 03:50:46 +000025
26// EINTR-safe write routine, provided a file descriptor and a character range.
27void retryingWriteAll(int Fd, char *Begin, char *End);
28
29// Reads a long long value from a provided file.
30bool readValueFromFile(const char *Filename, long long *Value);
31
32// EINTR-safe read routine, providing a file descriptor and a character range.
33std::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.
37int getLogFD();
38
Dean Michael Berrise7dbebf2017-01-25 03:50:46 +000039} // namespace __xray
40
41#endif // XRAY_UTILS_H