Removed Common

Change-Id: I01ea8f07220375c2ad9bc0092281d4f27c642303
diff --git a/aos/util/file.cc b/aos/util/file.cc
new file mode 100644
index 0000000..dc31ddd
--- /dev/null
+++ b/aos/util/file.cc
@@ -0,0 +1,28 @@
+#include "aos/util/file.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "aos/scoped/scoped_fd.h"
+
+namespace aos {
+namespace util {
+
+::std::string ReadFileToStringOrDie(const ::std::string &filename) {
+  ::std::string r;
+  ScopedFD fd(PCHECK(open(filename.c_str(), O_RDONLY)));
+  while (true) {
+    char buffer[1024];
+    const ssize_t result = read(fd.get(), buffer, sizeof(buffer));
+    if (result < 0) {
+      PLOG(FATAL, "reading from %s", filename.c_str());
+    } else if (result == 0) {
+      break;
+    }
+    r.append(buffer, result);
+  }
+  return r;
+}
+
+}  // namespace util
+}  // namespace aos