]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/test/thirdparty/Fuzzer/FuzzerIO.h
1 //===- FuzzerIO.h - Internal header for IO utils ----------------*- C++ -* ===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_FUZZER_IO_H
13 #define LLVM_FUZZER_IO_H
15 #include "FuzzerDefs.h"
19 long GetEpoch(const std::string
&Path
);
21 Unit
FileToVector(const std::string
&Path
, size_t MaxSize
= 0,
22 bool ExitOnError
= true);
24 std::string
FileToString(const std::string
&Path
);
26 void CopyFileToErr(const std::string
&Path
);
28 void WriteToFile(const Unit
&U
, const std::string
&Path
);
30 void ReadDirToVectorOfUnits(const char *Path
, std::vector
<Unit
> *V
,
31 long *Epoch
, size_t MaxSize
, bool ExitOnError
);
33 // Returns "Dir/FileName" or equivalent for the current OS.
34 std::string
DirPlusFile(const std::string
&DirPath
,
35 const std::string
&FileName
);
37 // Returns the name of the dir, similar to the 'dirname' utility.
38 std::string
DirName(const std::string
&FileName
);
40 void DupAndCloseStderr();
44 void Printf(const char *Fmt
, ...);
46 // Platform specific functions:
47 bool IsFile(const std::string
&Path
);
49 void ListFilesInDirRecursive(const std::string
&Dir
, long *Epoch
,
50 std::vector
<std::string
> *V
, bool TopDir
);
54 FILE* OpenFile(int Fd
, const char *Mode
);
56 int CloseFile(int Fd
);
58 int DuplicateFile(int Fd
);
60 void RemoveFile(const std::string
&Path
);
64 #endif // LLVM_FUZZER_IO_H