From: Tudor Bosman Date: Wed, 18 Sep 2013 23:16:22 +0000 (-0700) Subject: Add various functions to wrapNoInt X-Git-Tag: v0.22.0~871 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5675ef276356038f2b74dcd23e7dea455dfc2aff;p=folly.git Add various functions to wrapNoInt Test Plan: used them Reviewed By: soren@fb.com FB internal diff: D976393 --- diff --git a/folly/FileUtil.cpp b/folly/FileUtil.cpp index 45c313ff..0c719a87 100644 --- a/folly/FileUtil.cpp +++ b/folly/FileUtil.cpp @@ -21,6 +21,7 @@ #include #endif #include +#include #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); } diff --git a/folly/FileUtil.h b/folly/FileUtil.h index a542e1c9..93b843bf 100644 --- a/folly/FileUtil.h +++ b/folly/FileUtil.h @@ -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);