Adding support for signed integers
[folly.git] / folly / FileUtil.cpp
index 45c313fff59b82ef23497c4f01d9ada2f82b0bc3..6b153fd13b89e8f320e7cbc5f917a0fd68603d06 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
 #include <fcntl.h>
 #endif
 #include <sys/file.h>
+#include <sys/socket.h>
 
 #include "folly/detail/FileUtilDetail.h"
 
@@ -53,6 +54,14 @@ int fsyncNoInt(int fd) {
   return wrapNoInt(fsync, fd);
 }
 
+int dupNoInt(int fd) {
+  return wrapNoInt(dup, fd);
+}
+
+int dup2NoInt(int oldfd, int newfd) {
+  return wrapNoInt(dup2, oldfd, newfd);
+}
+
 int fdatasyncNoInt(int fd) {
 #if defined(__APPLE__)
   return wrapNoInt(fcntl, fd, F_FULLFSYNC);
@@ -75,6 +84,10 @@ int flockNoInt(int fd, int operation) {
   return wrapNoInt(flock, fd, operation);
 }
 
+int shutdownNoInt(int fd, int how) {
+  return wrapNoInt(shutdown, fd, how);
+}
+
 ssize_t readNoInt(int fd, void* buf, size_t count) {
   return wrapNoInt(read, fd, buf, count);
 }
@@ -119,7 +132,7 @@ ssize_t readvFull(int fd, iovec* iov, int count) {
   return wrapvFull(readv, fd, iov, count);
 }
 
-#ifdef FOLLY_HAVE_PREADV
+#if FOLLY_HAVE_PREADV
 ssize_t preadvFull(int fd, iovec* iov, int count, off_t offset) {
   return wrapvFull(preadv, fd, iov, count, offset);
 }
@@ -129,7 +142,7 @@ ssize_t writevFull(int fd, iovec* iov, int count) {
   return wrapvFull(writev, fd, iov, count);
 }
 
-#ifdef FOLLY_HAVE_PWRITEV
+#if FOLLY_HAVE_PWRITEV
 ssize_t pwritevFull(int fd, iovec* iov, int count, off_t offset) {
   return wrapvFull(pwritev, fd, iov, count, offset);
 }