From: Tudor Bosman Date: Wed, 15 May 2013 04:28:50 +0000 (-0700) Subject: add openNoInt, truncateNoInt, ftruncateNoInt X-Git-Tag: v0.22.0~961 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a896ed3944ade052af5ab68167cf21505b55286d;p=folly.git add openNoInt, truncateNoInt, ftruncateNoInt Test Plan: it compiles Reviewed By: soren@fb.com FB internal diff: D825286 --- diff --git a/folly/FileUtil.cpp b/folly/FileUtil.cpp index 690280b9..393f5408 100644 --- a/folly/FileUtil.cpp +++ b/folly/FileUtil.cpp @@ -24,6 +24,10 @@ namespace folly { using namespace fileutil_detail; +int openNoInt(const char* name, int flags, mode_t mode) { + return wrapNoInt(open, name, flags, mode); +} + int closeNoInt(int fd) { int r = close(fd); // Ignore EINTR. On Linux, close() may only return EINTR after the file @@ -49,6 +53,14 @@ int fdatasyncNoInt(int fd) { return wrapNoInt(fdatasync, fd); } +int ftruncateNoInt(int fd, off_t len) { + return wrapNoInt(ftruncate, fd, len); +} + +int truncateNoInt(const char* path, off_t len) { + return wrapNoInt(truncate, path, len); +} + 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 67e19213..81974871 100644 --- a/folly/FileUtil.h +++ b/folly/FileUtil.h @@ -19,7 +19,10 @@ #include "folly/Portability.h" +#include +#include #include +#include #include namespace folly { @@ -30,9 +33,12 @@ namespace folly { * until all data is written. Note that *Full wrappers weaken the thread * semantics of underlying system calls. */ +int openNoInt(const char* name, int flags, mode_t mode=0644); int closeNoInt(int fd); int fsyncNoInt(int fd); int fdatasyncNoInt(int fd); +int ftruncateNoInt(int fd, off_t len); +int truncateNoInt(const char* path, off_t len); ssize_t readNoInt(int fd, void* buf, size_t n); ssize_t preadNoInt(int fd, void* buf, size_t n, off_t offset);