20 #include <system_error>
22 #if !defined(_MSC_VER) && !defined(__MINGW32__)
31 FileOutputBuffer::FileOutputBuffer(std::unique_ptr<mapped_file_region> R,
32 StringRef Path, StringRef TmpPath,
34 :
Region(std::move(R)), FinalPath(Path), TempPath(TmpPath),
35 IsRegular(IsRegular) {}
49 bool IsRegular =
true;
50 switch (Stat.
type()) {
107 auto MappedFile = llvm::make_unique<mapped_file_region>(
108 FD, mapped_file_region::readwrite, Size, 0, EC);
113 return std::error_code(errno, std::generic_category());
116 std::move(MappedFile), FilePath, TempFilePath, IsRegular));
117 return std::move(Buf);
Represents either an error or a value T.
std::error_code createUniqueFile(const Twine &Model, int &ResultFD, SmallVectorImpl< char > &ResultPath, unsigned Mode=all_read|all_write)
Create a uniquely named file.
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
This class represents a memory mapped file.
file_status - Represents the result of a call to stat and friends.
~FileOutputBuffer()
If this object was previously committed, the destructor just deletes this object. ...
struct fuzzer::@269 Flags
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
FileOutputBuffer - This interface provides simple way to create an in-memory buffer which will be wri...
std::error_code commit()
Flushes the content of the buffer to its file and deallocates the buffer.
std::error_code copy_file(const Twine &From, const Twine &To)
Copy the contents of From to To.
StringRef filename(StringRef path)
Get filename.
std::error_code resize_file(int FD, uint64_t Size)
Resize path to size.
void DontRemoveFileOnSignal(StringRef Filename)
This function removes a file from the list of files to be removed on signal delivery.
static ErrorOr< std::unique_ptr< FileOutputBuffer > > create(StringRef FilePath, size_t Size, unsigned Flags=0)
Factory method to create an OutputBuffer object which manages a read/write buffer of the specified si...
std::error_code rename(const Twine &from, const Twine &to)
Rename from to to.
bool RemoveFileOnSignal(StringRef Filename, std::string *ErrMsg=nullptr)
This function registers signal handlers to ensure that if a signal gets delivered that the named file...
std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix, int &ResultFD, SmallVectorImpl< char > &ResultPath)
Create a file in the system temporary directory.
StringRef - Represent a constant reference to a string, i.e.
std::error_code status(const Twine &path, file_status &result)
Get file status as if by POSIX stat().