14 #include <sys/mount.h>
15 #include <sys/param.h>
17 #include <sys/types.h>
19 #if defined(__NetBSD__)
20 #include <sys/statvfs.h>
28 #include "llvm/Support/Errno.h"
29 #include "llvm/Support/FileSystem.h"
34 const char *FileSystem::DEV_NULL =
"/dev/null";
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) {
75 FILE *FileSystem::Fopen(
const char *path,
const char *mode) {
76 return llvm::sys::RetryAfterSignal(
nullptr, ::fopen, path, mode);
79 int FileSystem::Open(
const char *path,
int flags,
int mode) {
80 return llvm::sys::RetryAfterSignal(-1, ::open, path, flags, mode);