Add syncfs(2).

GMM calls this system call directly at the moment. That's silly.

Bug: http://b/36405699
Test: ran tests
Change-Id: I1e14c0e5ce0bc2aa888d884845ac30dc20f13cd5
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 9b811ed..cd51e1b 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -375,7 +375,7 @@
   EXPECT_EQ(0, unsetenv("test-variable"));
 }
 
-static void TestFsyncFunction(int (*fn)(int)) {
+static void TestSyncFunction(int (*fn)(int)) {
   int fd;
 
   // Can't sync an invalid fd.
@@ -401,10 +401,15 @@
   ASSERT_NE(-1, fd = open("/data/local/tmp", O_RDONLY));
   EXPECT_EQ(0, fn(fd));
   close(fd);
+}
 
-  // But some file systems may choose to be fussy...
+static void TestFsyncFunction(int (*fn)(int)) {
+  TestSyncFunction(fn);
+
+  // But some file systems are fussy about fsync/fdatasync...
   errno = 0;
-  ASSERT_NE(-1, fd = open("/proc/version", O_RDONLY));
+  int fd = open("/proc/version", O_RDONLY);
+  ASSERT_NE(-1, fd);
   EXPECT_EQ(-1, fn(fd));
   EXPECT_EQ(EINVAL, errno);
   close(fd);
@@ -418,6 +423,10 @@
   TestFsyncFunction(fsync);
 }
 
+TEST(UNISTD_TEST, syncfs) {
+  TestSyncFunction(syncfs);
+}
+
 static void AssertGetPidCorrect() {
   // The loop is just to make manual testing/debugging with strace easier.
   pid_t getpid_syscall_result = syscall(__NR_getpid);