Speculatively fix windows build and unblock autoroller
TBR: fmayer
Change-Id: I3c58b6997ed0869db200fd5ea0980f1399919749
diff --git a/include/perfetto/base/file_utils.h b/include/perfetto/base/file_utils.h
index 3126b7c..b2cfbe2 100644
--- a/include/perfetto/base/file_utils.h
+++ b/include/perfetto/base/file_utils.h
@@ -19,16 +19,12 @@
#include <string>
-#include "perfetto/base/build_config.h"
-
namespace perfetto {
namespace base {
bool ReadFileDescriptor(int fd, std::string* out);
bool ReadFile(const std::string& path, std::string* out);
-#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
-
// Call write until all data is written or an error is detected.
//
// man 2 write:
@@ -38,8 +34,6 @@
// succeeds, and returns the number of bytes written.
ssize_t WriteAll(int fd, const void* buf, size_t count);
-#endif
-
} // namespace base
} // namespace perfetto
diff --git a/src/base/file_utils.cc b/src/base/file_utils.cc
index 89440b1..44b27f7 100644
--- a/src/base/file_utils.cc
+++ b/src/base/file_utils.cc
@@ -16,12 +16,15 @@
#include <sys/stat.h>
+#include "perfetto/base/build_config.h"
#include "perfetto/base/file_utils.h"
-
#include "perfetto/base/logging.h"
#include "perfetto/base/scoped_file.h"
+
#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
#include <unistd.h>
+#else
+#include <corecrt_io.h>
#endif
namespace perfetto {
@@ -63,8 +66,6 @@
return ReadFileDescriptor(*fd, out);
}
-#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
-
ssize_t WriteAll(int fd, const void* buf, size_t count) {
size_t written = 0;
while (written < count) {
@@ -79,7 +80,5 @@
return static_cast<ssize_t>(written);
}
-#endif
-
} // namespace base
} // namespace perfetto