27 #include <system_error> 29 #include <glog/logging.h> 36 CHECK_GE(
fd, -1) <<
"fd must be -1 or non-negative";
37 CHECK(
fd != -1 || !ownsFd) <<
"cannot own -1";
41 :
fd_(::open(name, flags, mode)),
ownsFd_(false) {
44 folly::format(
"open(\"{}\", {:#o}, 0{:#o}) failed", name, flags, mode)
51 :
File(name.c_str(), flags, mode) {}
54 :
File(name.str(), flags, mode) {}
69 DCHECK_NE(errno, EBADF)
70 <<
"closing fd " <<
fd <<
", it may already " 71 <<
"have been closed. Another time, this might close the wrong FD.";
77 FILE* tmpFile = tmpfile();
83 int fd =
::dup(fileno(tmpFile));
86 return File(fd,
true);
111 return File(fd,
true);
149 if (r == -1 && errno == EWOULDBLOCK) {
File & operator=(File &&)
—— Concurrent Priority Queue Implementation ——
requires E e noexcept(noexcept(s.error(std::move(e))))
void swap(File &a, File &b) noexcept
folly::Optional< PskKeyExchangeMode > mode
void swap(File &other) noexcept
void checkFopenError(FILE *fp, Args &&...args)
int flockNoInt(int fd, int operation)
void checkUnixError(ssize_t ret, Args &&...args)
Formatter< false, Args... > format(StringPiece fmt, Args &&...args)
void throwSystemError(Args &&...args)
GMockOutputTest ExpectedCall FILE