19#if defined(__NetBSD__)
20#include <sys/statvfs.h>
28#include "llvm/Support/Errno.h"
29#include "llvm/Support/FileSystem.h"
39 error.SetErrorToErrno();
46 ssize_t count = ::readlink(src.
GetPath().c_str(), buf,
sizeof(buf) - 1);
48 error.SetErrorToErrno();
51 dst.
SetFile(buf, FileSpec::Style::native);
58 if (!src.
GetPath(resolved_path,
sizeof(resolved_path))) {
59 return Status(
"Couldn't get the canonical path for %s",
64 if (realpath(resolved_path, real_path) ==
nullptr) {
76 return llvm::sys::RetryAfterSignal(
nullptr, ::fopen, path, mode);
82 auto lambda = [&]() { return ::open(path, flags, mode); };
83 return llvm::sys::RetryAfterSignal(-1, lambda);
static llvm::raw_ostream & error(Stream &strm)
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
static const char * DEV_NULL
Status Symlink(const FileSpec &src, const FileSpec &dst)
Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst)
int Open(const char *path, int flags, int mode=0600)
Wraps ::open in a platform-independent way.
Status Readlink(const FileSpec &src, FileSpec &dst)
FILE * Fopen(const char *path, const char *mode)
Wraps ::fopen in a platform-independent way.
void SetErrorToErrno()
Set the current error to errno.
A class that represents a running process on the host machine.