Move the clock details over to the Time.h portability header
[folly.git] / folly / detail / FileUtilDetail.h
index 1cd77052c306994f4f43375b89acd7f3009fb8a2..11f06ae474e0b4010a84052ea36d8fd746919b9a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
 #include <cerrno>
 #include <unistd.h>
 
-#include <sys/uio.h>
+#include <folly/portability/SysUio.h>
 
 /**
  * Helper functions and templates for FileUtil.cpp.  Declared here so
@@ -38,7 +38,7 @@ ssize_t wrapNoInt(F f, Args... args) {
   return r;
 }
 
-inline void incr(ssize_t n) { }
+inline void incr(ssize_t /* n */) {}
 inline void incr(ssize_t n, off_t& offset) { offset += n; }
 
 // Wrap call to read/pread/write/pwrite(fd, buf, count, offset?) to retry on
@@ -76,7 +76,7 @@ ssize_t wrapvFull(F f, int fd, iovec* iov, int count, Offset... offset) {
   ssize_t totalBytes = 0;
   size_t r;
   do {
-    r = f(fd, iov, count, offset...);
+    r = f(fd, iov, std::min<int>(count, kIovMax), offset...);
     if (r == (size_t)-1) {
       if (errno == EINTR) {
         continue;