Add various functions to wrapNoInt
authorTudor Bosman <tudorb@fb.com>
Wed, 18 Sep 2013 23:16:22 +0000 (16:16 -0700)
committerJordan DeLong <jdelong@fb.com>
Sun, 22 Sep 2013 23:40:31 +0000 (16:40 -0700)
Test Plan: used them

Reviewed By: soren@fb.com

FB internal diff: D976393

folly/FileUtil.cpp
folly/FileUtil.h

index 45c313fff59b82ef23497c4f01d9ada2f82b0bc3..0c719a875358254d0136707c432c30aa4356ce0a 100644 (file)
@@ -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);
 }
index a542e1c98d7146a5065a7a62766275f12d1a7d45..93b843bf5646844e7b3805b194cd1992c27907eb 100644 (file)
@@ -35,11 +35,14 @@ namespace folly {
  */
 int openNoInt(const char* name, int flags, mode_t mode=0644);
 int closeNoInt(int fd);
+int dupNoInt(int fd);
+int dup2NoInt(int oldfd, int newfd);
 int fsyncNoInt(int fd);
 int fdatasyncNoInt(int fd);
 int ftruncateNoInt(int fd, off_t len);
 int truncateNoInt(const char* path, off_t len);
 int flockNoInt(int fd, int operation);
+int shutdownNoInt(int fd, int how);
 
 ssize_t readNoInt(int fd, void* buf, size_t n);
 ssize_t preadNoInt(int fd, void* buf, size_t n, off_t offset);