Thread-safe version of loopKeepAlive()
[folly.git] / folly / FileUtil.cpp
index a1e15a0ac48f1609872effff38c2cee3ff6fc5e9..d31e8ff945f78b0883b841277e70243f5804ac6e 100644 (file)
 #include <folly/FileUtil.h>
 
 #include <cerrno>
-#ifdef __APPLE__
-#include <fcntl.h>
-#endif
-#include <sys/file.h>
-#include <sys/socket.h>
 
 #include <folly/detail/FileUtilDetail.h>
+#include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
+#include <folly/portability/SysFile.h>
 
 namespace folly {
 
@@ -85,7 +83,7 @@ int flockNoInt(int fd, int operation) {
 }
 
 int shutdownNoInt(int fd, int how) {
-  return wrapNoInt(shutdown, fd, how);
+  return wrapNoInt(portability::sockets::shutdown, fd, how);
 }
 
 ssize_t readNoInt(int fd, void* buf, size_t count) {
@@ -97,7 +95,7 @@ ssize_t preadNoInt(int fd, void* buf, size_t count, off_t offset) {
 }
 
 ssize_t readvNoInt(int fd, const iovec* iov, int count) {
-  return wrapNoInt(writev, fd, iov, count);
+  return wrapNoInt(readv, fd, iov, count);
 }
 
 ssize_t writeNoInt(int fd, const void* buf, size_t count) {
@@ -132,20 +130,16 @@ ssize_t readvFull(int fd, iovec* iov, int count) {
   return wrapvFull(readv, fd, iov, count);
 }
 
-#if FOLLY_HAVE_PREADV
 ssize_t preadvFull(int fd, iovec* iov, int count, off_t offset) {
   return wrapvFull(preadv, fd, iov, count, offset);
 }
-#endif
 
 ssize_t writevFull(int fd, iovec* iov, int count) {
   return wrapvFull(writev, fd, iov, count);
 }
 
-#if FOLLY_HAVE_PWRITEV
 ssize_t pwritevFull(int fd, iovec* iov, int count, off_t offset) {
   return wrapvFull(pwritev, fd, iov, count, offset);
 }
-#endif
 
 }  // namespaces