/*
- * 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.
#include <cerrno>
#include <unistd.h>
-#include <sys/uio.h>
+#include <folly/portability/SysUio.h>
/**
* Helper functions and templates for FileUtil.cpp. Declared here so
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
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;