ewmscp  ..
outputHandlerPosixFile.cpp
Go to the documentation of this file.
1 #include <OptionsChrono.h>
3 #include "block.h"
4 #include "copyRequestTypes.h"
5 #include "ewmscp.h"
6 #include "timer.h"
7 #include "throwcall.h"
8 #include "errMsgQueue.h"
9 #include <fcntl.h>
10 #include <libgen.h>
11 #include <sys/stat.h>
12 #include <sys/types.h>
13 #include <sys/statvfs.h>
14 #include <unistd.h>
15 #include <vector>
16 
17 
18 namespace outputHandler {
19  decltype(posixFile::factory) posixFile::factory("posixFile");
20  std::unique_ptr<base::writer> posixFile::newWriter(const std::string& path,
21  bool mightAppend,
22  size_t sourceSize,
23  size_t readBlockSize,
25  bool noWrite,
26  std::unique_ptr<ioHandle::attrDataType> attrData,
27  std::unique_ptr<acl::list> aclData) {
28  return std::unique_ptr<base::writer>(new writerPosixFile(path, mightAppend,
29  sourceSize, readBlockSize,
30  state, noWrite,
31  std::move(attrData),
32  std::move(aclData)));
33  }
34 
35  std::unique_ptr<base::writer> posixFile::newTmpWriter(std::string& path,
36  size_t /*sourceSize*/,
37  bool noWrite,
38  std::unique_ptr<ioHandle::attrDataType> attrData,
39  std::unique_ptr<acl::list> aclData) {
40  return std::unique_ptr<base::writer>(new writerPosixFile(path,
41  noWrite,
42  std::move(attrData),
43  std::move(aclData),
44  *this));
45  }
46 
47  static options::single<unsigned long> requiredFsid('\0', "requiredFsid",
48  "required fsid of output file system", 0);
49  static options::single<unsigned long> fsidMask('\0', "fsidMask",
50  "bit mask for required fsid of output file system", 0);
51  static options::single<timer::clock_type::duration> slownessThreshold('\0',"posixSlownessThreshold",
52  "duration after which file operations are considered slow",
53  std::chrono::seconds(1));
54 
55  void posixFile::ensureParentDirs(const std::string& path,
56  const std::string& srcPath,
57  inputHandler::base* InputHandler) {
58  std::vector<std::remove_reference<decltype(path)>::type::value_type> disposable_buffer(path.c_str(), path.c_str() + path.size() + 1);
59  std::string dir(dirname(disposable_buffer.data()));
60  struct stat statbuf;
61 
62  if (stat(dir.c_str(), &statbuf)) {
63  if (errno == ENOENT || errno == ENOTDIR) {
64  ensureParentDirs(dir, srcPath, InputHandler);
65  static timer::anchor A("mkdir");
67  auto result = mkdir(dir.c_str(), 0777u);
68  I.stop(slownessThreshold, dir);
69 
70  if (result != 0 && errno == EEXIST) {
71  return; // we lost a race with another copy process...
72  }
73 
74  throwcall::good0(result, "can't create directory ", dir);
75 
76  if (gid != -1 || uid != -1) {
77  timerInst(chown);
78  throwcall::good0(chown(dir.c_str(), uid, gid), "can't set owner/group (", uid, ",", gid, ") on ", dir);
79  }
80  }
81  } else if (! S_ISDIR(statbuf.st_mode)) {
83  dir, "ensure parents",
84  "is not a directory (st_mode is ", statbuf.st_mode, ") but should be");
85  }
86  if (requiredFsid != 0) {
87  struct statvfs fsstat;
88  timerInst(statvfs);
89  throwcall::good0(statvfs(dir.c_str(), &fsstat), "can't statvfs ", dir);
90  if ((fsstat.f_fsid & fsidMask) != requiredFsid) {
91  throw fatalException("wrong fs id 0x", std::hex, fsstat.f_fsid, " instead of ", requiredFsid);
92  }
93  }
94  }
95 
96 
97  void posixFile::remove(const std::string& path, copyRequest::stateType& state) {
98  struct stat dsttat;
99  {
100  timerInst(lstat);
101  auto retval = lstat(path.c_str(), &dsttat);
102 
103  if (retval && errno == ENOENT) {
105  return;
106  }
107  }
108  if (S_ISDIR(dsttat.st_mode)) {
109  timerInst(rmdir);
110  auto retval = rmdir(path.c_str());
111  if (retval) {
112  switch (errno) {
113  case ENOENT:
115  return;
116  case ENOTEMPTY:
117  case EEXIST: // POSIX.1 allows this also
119  path, "remove", "directory not empty but should be removed");
121  return;
122  }
123  throwcall::good0(retval, "can't remove directory ", path);
124  } else {
126  return;
127  }
128  } else {
129  timerInst(unlink);
130  auto retval = unlink(path.c_str());
131 
132  if (retval && errno == ENOENT) {
134  } else {
135  throwcall::good0(retval, "can't unlink ", path);
136  }
138  }
139  }
140 
141  bool posixFile::renameSimple(const std::string& fromPath,
142  const std::string& toPath) {
144  auto retval = std::rename(fromPath.c_str(), toPath.c_str());
145  if (retval && (errno == ENOENT || errno == ENOTDIR)) {
146  return false;
147  }
148  throwcall::good0(retval, "can't rename '", fromPath, "' to '", toPath, "'");
149  return true;
150  }
151 
152 
153  base::renameRetvalType posixFile::rename(const std::string& fromPath,
154  const std::unique_ptr<const genericStat>& readInitialStat,
155  const std::string& toPath,
156  copyRequest::stateType& state) {
157  struct stat fromPathStatBuf;
158  static timer::anchor A("stat");
160  auto statRetVal = stat(fromPath.c_str(), &fromPathStatBuf);
161  I.stop();
162  if (statRetVal && (errno == ENOENT || errno == ENOTDIR)) {
163  if (readInitialStat && readInitialStat->isDir()) { // no need to act, dirs are created on the fly
167  }
169  } else if (statRetVal) { // curious error
170  throwcall::good0(statRetVal, "can't stat '", fromPath, "'");
171  return base::renameRetvalType::cantHappen; // never reached
172  }
173  genericStat fromPathStat(fromPathStatBuf, std::chrono::nanoseconds(1));
174  if (!readInitialStat || (! readInitialStat->isDir() &&
175  (fromPathStat.size != readInitialStat->size
176  || !fromPathStat.isSameMtimeAs(*readInitialStat)))) {
177  // the copy on fromPath is not up to date, create a new copy
178  if (readInitialStat) {
179  std::string initialTime;
180  std::string finalTime;
181  readInitialStat->getMtime(initialTime);
182  fromPathStat.getMtime(finalTime);
184  fromPath, "move"
185  "file (", toPath, ") changed unexpectedly ("
186  , initialTime, " -> ", finalTime, ", "
187  , readInitialStat->size, " -> ", fromPathStat.size
188  , ", doing fresh copy");
189  } else {
191  fromPath, "move",
192  "file (", toPath, ") has no initial stat, doing fresh copy");
193  }
195  } else { // try to move the existing copy
196  timerInst(rename);
197  auto retval = std::rename(fromPath.c_str(), toPath.c_str());
198 
199  if (retval && (errno == ENOENT || errno == ENOTDIR)) {
200  if (readInitialStat->isDir()) { // no need to act, dirs are created on the fly
203  }
205  fromPath, "move",
206  "vanished unexpectedly, doing fresh copy");
207  // file was probably not copied yet, try to copy it from the move target
209  } else {
210  throwcall::good0(retval, "can't rename '", fromPath, "' to '", toPath, "'");
213  }
214  }
215  }
216 
217  void posixFile::createSymlink(const std::vector<char>& target,
218  const std::string& path,
219  uid_t uid, gid_t gid) {
220  timerInst(symlink);
221  auto retval = symlink(target.data(), path.c_str());
222  if (retval != 0 && errno != EEXIST) {
223  throwcall::good0(retval, "can't create link at ", path);
224  }
225  if (static_cast<std::make_signed<decltype(gid)>::type>(gid) != -1
226  || static_cast<std::make_signed<decltype(uid)>::type>(uid) != -1) {
227  throwcall::good0(lchown(path.c_str(), uid, gid), "can't set owner/group (", uid, ",", gid, ") on ", path);
228  }
229  }
230 
232  bool mightAppend,
233  size_t sourceSize,
234  size_t readBlockSize,
235  copyRequest::stateType &state,
236  bool noWrite, std::unique_ptr<ioHandle::attrDataType> aAttrData,
237  std::unique_ptr<acl::list> aAclData):
238  posixFileIoCommon(aPath),
239  attrData(std::move(aAttrData)),
240  aclData(std::move(aAclData)) {
241  bool haveWriteStat = false;
242  if (noWrite) {
243  fd = -1;
244  blockSize = 4096;
245  } else {
246  auto openMode = O_CREAT | O_TRUNC | O_WRONLY;
247  state.clear(copyRequest::stateBitType::append); // clear any old append bits, may be left over from former attempts
248  if (mightAppend) {
249  auto retval = stat(path.c_str(), &writeInitialStat);
250  if (retval) {
251  if (errno != ENOENT) {
252  throwcall::good0(retval, "can't stat destination file ", path);
253  }
254  } else {
255  haveWriteStat = true;
256  if (static_cast<size_t>(writeInitialStat.st_size) < sourceSize &&
257  sourceSize > readBlockSize) {
259  openMode = O_WRONLY;
260  }
261  }
262  }
264  fd = throwcall::badval(open(path.c_str(), openMode, S_IWUSR),
265  -1, "can't open ", path, " for writing");
266  if (!haveWriteStat) {
267  throwcall::good0(fstat(fd, &writeInitialStat), "can't stat destination file ", path);
268  }
269  blockSize = writeInitialStat.st_blksize;
270  throwcall::good0(posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL),
271  "can't advise ", path, " as sequential");
272  throwcall::good0(posix_fadvise(fd, 0, 0, POSIX_FADV_NOREUSE),
273  "can't advise ", path, " as use only once");
274  }
275  };
277  bool noWrite,
278  std::unique_ptr<ioHandle::attrDataType> aAttrData,
279  std::unique_ptr<acl::list> aAclData,
280  base& handler):
281  posixFileIoCommon(aPath),
282  attrData(std::move(aAttrData)),
283  aclData(std::move(aAclData)) {
284  if (noWrite) {
285  fd = -1;
286  blockSize = 4096;
287  } else {
288  static const std::string pattern("XXXXXX.tmp");
289  std::vector<char> tmpName;
290  tmpName.reserve(path.size() + pattern.size() + 1);
291  tmpName.insert(tmpName.end(), path.cbegin(), path.cend());
292  handler.shortenNameToMax(path,tmpName,pattern);
293  tmpName.insert(tmpName.end(), pattern.cbegin(), pattern.cend());
294  tmpName.push_back('\0');
295  timerInstTO(mkstemps,slownessThreshold,tmpName);
296  fd = throwcall::badval(mkstemps(tmpName.data(), 4),
297  -1, "can't open ", tmpName.data(), " for writing");
298  aPath.replace(0, path.size(), tmpName.data(), tmpName.size());
299  throwcall::good0(fstat(fd, &writeInitialStat), "can't stat destination file ", path);
300  blockSize = writeInitialStat.st_blksize;
301  throwcall::good0(posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL),
302  "can't advise ", path, " as sequential");
303  throwcall::good0(posix_fadvise(fd, 0, 0, POSIX_FADV_NOREUSE),
304  "can't advise ", path, " as use only once");
305  }
306  };
308  if (close(fd) != 0) {
310  path, "close during unwind ",
311  std::system_category().default_error_condition(errno).message());
312  }
314  path, "unlink failed copy", "due to exception");
315  auto retval = unlink(path.c_str());
316  if (retval && errno != ENOENT) {
318  path, "can't remove bad copy ",
319  std::system_category().default_error_condition(errno).message());
320  }
321  }
322 
324  if (fd != -1) {
325  if (isUnwinding()) {
326  closeAndRemoveBadCopy();
327  return;
328  } else {
329  if (attrData) {
330  try {
331  attrData->set(this);
332  } catch (const std::exception& e) {
334  path, "set attr at close ",
335  e.what());
336  closeAndRemoveBadCopy();
337  throw;
338  }
339  }
340  timerInstTO(close,slownessThreshold,path);
341  throwcall::good0(close(fd), "can't close ", path);
342  }
343  }
344  };
345 
346  void posixFile::writerPosixFile::seek(size_t position) {
347  timerInst(lseek);
348  throwcall::badval(lseek(fd, position, SEEK_SET),
349  -1, "can't seek ", path, " to ", position);
350  }
352  return writeInitialStat.st_size == 0;
353  }
355  return writeInitialStat.st_size;
356  }
357 
359  if (b.isHole()) { // just write a hole...
360  static timer::anchor a("lseek");
362  auto currentPosition = throwcall::badval(lseek(fd, 0, SEEK_CUR), -1, "lseek to determine position on", path);
363  i.stop();
364  auto holeEnd = currentPosition + b.size();
365  {
366  timerInst(ftruncate);
367  throwcall::good0(ftruncate(fd, holeEnd),
368  "fruncate ", path, " to ", holeEnd);
369  }
370  timerInst(lseek);
371  throwcall::badval(lseek(fd, holeEnd, SEEK_SET), -1,
372  "can't seek to hole end (", holeEnd, ") in ", path);
373  return;
374  }
375 
376  size_t bytes_writen_so_far = 0;
377 
378  while (bytes_writen_so_far < b.size()) {
379  auto count = b.size() - bytes_writen_so_far;
380 
381  if (count > blockSize) {
382  count = blockSize;
383  }
385  timerInst(write);
386  auto bytes_writen = throwcall::badval(write(fd, b.bufferAt(bytes_writen_so_far), count),
387  -1, "write failed on ", path);
388  writeRateLimit.update(bytes_writen);
389  bytes_writen_so_far += bytes_writen;
390  }
391  }
392 
393 
395  size_t bytes_writen_so_far = 0;
396 
397  while (bytes_writen_so_far < b.size()) {
398  auto count = b.size() - bytes_writen_so_far;
399 
400  if (count > blockSize) {
401  count = blockSize;
402  }
403  timerInst(pwrite);
404  auto bytes_writen = throwcall::badval(pwrite(fd, b.bufferAt(bytes_writen_so_far), count, b.offset() + bytes_writen_so_far),
405  -1, "write failed on ", path);
406  bytes_writen_so_far += bytes_writen;
407  }
408  }
409 
411  if (preserve.timestamps) {
412  struct timespec times[2];
413  readInitialStat.getAtime(times[0]);
414  readInitialStat.getMtime(times[1]);
415  timerInst(futimens);
416  throwcall::good0(futimens(fd, times), "can't set time stamp of ", path);
417  }
418 
419  if (preserve.mode) {
420  timerInst(fchmod);
421  throwcall::good0(fchmod(fd, readInitialStat.mode), "can't set mode of ", path);
422  } else {
423  auto oldmask = umask(0);
424  timerInst(fchmod);
425  throwcall::good0(fchmod(fd, modeBits & ~oldmask), "can't set mode of ", path);
426  umask(oldmask);
427  }
428 
429  if (gid != -1 || uid != -1) {
430  timerInst(fchown);
431  throwcall::good0(fchown(fd, uid, gid), "can't set owner/group (", uid, ",", gid, ") of ", path);
432  } else if (preserve.ownership) {
433  timerInst(fchown);
434  throwcall::good0(fchown(fd, readInitialStat.ownerUid, readInitialStat.ownerGid),
435  "can't set owner/group (", readInitialStat.ownerUid, ",", readInitialStat.ownerGid, ") of ",
436  path);
437  }
438  }
439 
440  void posixFile::doAttributePreservations(const std::string& path,
441  const genericStat& stat) {
442  if (preserve.timestamps) {
443  struct timespec times[2];
444  times[0].tv_nsec = UTIME_OMIT; // leave atime unchanged
445  stat.getMtime(times[1]);
446  timerInst(utimensat);
447  throwcall::good0(utimensat(0, path.c_str(), times, 0), "can't set mtime on ", path);
448  }
449  if (preserve.mode) {
450  timerInst(chmod);
451  throwcall::good0(chmod(path.c_str(), stat.mode), "can't set mode of ", path);
452  } else {
453  auto oldmask = umask(0);
454  timerInst(chmod);
455  throwcall::good0(chmod(path.c_str(), modeBits & ~oldmask), "can't set mode of ", path);
456  umask(oldmask);
457  }
458 
459  if (gid != -1 || uid != -1) {
460  timerInst(chown);
461  throwcall::good0(chown(path.c_str(), uid, gid), "can't set owner/group (", uid, ",", gid, ") of ", path);
462  } else if (preserve.ownership) {
463  timerInst(chown);
464  throwcall::good0(chown(path.c_str(), stat.ownerUid, stat.ownerGid),
465  "can't set owner/group (", stat.ownerUid, ",", stat.ownerGid, ") of ",
466  path);
467  }
468  }
469 
470  size_t posixFile::getMaxNameLength(const std::string& dirPath) {
471  errno = 0;
472  timerInst(pathconf);
473  return throwcall::badval(pathconf(dirPath.c_str(), _PC_NAME_MAX), -1,"can't get max name lenght on", dirPath);
474  }
475 
476 
478  timerInst(fsync);
479  throwcall::good0(fsync(fd), "can't sync ", path);
480  }
481 
482 }; // end namespace outputHandler
genericStat::ownerGid
gid_t ownerGid
Definition: genericStat.h:24
outputHandler::posixFile::writerPosixFile::writeInitialStat
struct stat writeInitialStat
Definition: outputHandlerPosixFile.h:15
outputHandler::requiredFsid
static options::single< unsigned long > requiredFsid('\0', "requiredFsid", "required fsid of output file system", 0)
block.h
genericStat::mode
mode_t mode
Definition: genericStat.h:22
options::single< unsigned long >
outputHandler::fsidMask
static options::single< unsigned long > fsidMask('\0', "fsidMask", "bit mask for required fsid of output file system", 0)
errMsgQueue.h
outputHandler::posixFile::writerPosixFile
Definition: outputHandlerPosixFile.h:13
outputHandler::posixFile::renameSimple
bool renameSimple(const std::string &fromPath, const std::string &toPath) override
Definition: outputHandlerPosixFile.cpp:141
block::offset
size_t offset() const
Definition: block.h:25
errMsg::location
class for defining the location of a error message in the source code.
Definition: errMsgQueue.h:14
genericStat::getAtime
void getAtime(struct timespec &spec) const
Definition: genericStat.cpp:62
outputHandler::posixFile::writerPosixFile::writeBlockP
void writeBlockP(const block &b) override
Definition: outputHandlerPosixFile.cpp:394
throwcall::badval
T badval(T call, t badvalue, const Args &... args)
template function to wrap system calls that return a special bad value on failure
Definition: throwcall.h:54
genericStat
generic stat abstraction class Used to abstract the variants of the stat structure.
Definition: genericStat.h:12
copyRequestTypes.h
fatalException
class for exceptions that should result in program termination
Definition: copyRequestTypes.h:11
copyRequest::stateBitType::ignore
@ ignore
errMsg::level::info
@ info
outputHandler::posixFile::newTmpWriter
std::unique_ptr< writer > newTmpWriter(std::string &path, size_t sourceSize, bool noWrite, std::unique_ptr< ioHandle::attrDataType > attrData, std::unique_ptr< acl::list > aclData) override
Definition: outputHandlerPosixFile.cpp:35
outputHandler::slownessThreshold
static options::single< timer::clock_type::duration > slownessThreshold('\0',"daosFsSlownessThreshold", "duration after which file operations are considered slow", std::chrono::milliseconds(10))
outputHandler::base::renameRetvalType::cantHappen
@ cantHappen
copyRequest::stateBitType::done
@ done
outputHandler::base::renameRetvalType::fileChanged
@ fileChanged
copyRequest::stateBitType::failed
@ failed
posixFileIoCommon::fd
int fd
Definition: posixFileCommon.h:21
outputHandler
Definition: ioHandle.h:9
genericStat::getMtime
void getMtime(struct timespec &spec) const
Definition: genericStat.cpp:65
gid
options::single< int > gid
copyRequest::stateBitType::vanished
@ vanished
outputHandler::posixFile::writerPosixFile::doAttributePreservations
void doAttributePreservations(const genericStat &readInitialStat) override
Definition: outputHandlerPosixFile.cpp:410
copyRequest::stateType
Definition: copyRequestTypes.h:66
outputHandler::posixFile::ensureParentDirs
void ensureParentDirs(const std::string &path, const std::string &srcPath, inputHandler::base *InputHandler) override
Definition: outputHandlerPosixFile.cpp:55
outputHandler::posixFile::writerPosixFile::~writerPosixFile
~writerPosixFile() noexcept(false) override
Definition: outputHandlerPosixFile.cpp:323
outputHandlerPosixFile.h
block::isHole
bool isHole() const
Definition: block.h:36
genericStat::isSameMtimeAs
bool isSameMtimeAs(const genericStat &that) const
Definition: genericStat.cpp:87
outputHandler::posixFile::getMaxNameLength
size_t getMaxNameLength(const std::string &dirPath) override
Definition: outputHandlerPosixFile.cpp:470
errMsg::level::debug
@ debug
genericStat::isDir
bool isDir() const
Definition: genericStat.cpp:92
outputHandler::posixFile::writerPosixFile::writerPosixFile
writerPosixFile(const std::string &aPath, bool mightAppend, size_t sourceSize, size_t readBlockSize, copyRequest::stateType &state, bool noWrite, std::unique_ptr< ioHandle::attrDataType > aAttrData, std::unique_ptr< acl::list > aAclData)
Definition: outputHandlerPosixFile.cpp:231
outputHandler::posixFile::remove
void remove(const std::string &path, copyRequest::stateType &state) override
Definition: outputHandlerPosixFile.cpp:97
ioHandle::blockSize
size_t blockSize
in bytes, block size to be used when reading or writing
Definition: ioHandle.h:17
outputHandler::posixFile::writerPosixFile::writeBlock
void writeBlock(const block &b) override
Definition: outputHandlerPosixFile.cpp:358
genericStat::size
size_t size
Definition: genericStat.h:16
outputHandler::base::renameRetvalType::fileVanished
@ fileVanished
timer::instanceUnscoped::stop
void stop()
Definition: timer.h:107
outputHandler::posixFile::writerPosixFile::seek
void seek(size_t position) override
Definition: outputHandlerPosixFile.cpp:346
OptionsChrono.h
outputHandler::base
Definition: outputHandler.h:17
block::bufferAt
void * bufferAt(size_t offset)
only way to access the data in the block
Definition: block.cpp:28
outputHandler::base::renameRetvalType::ok
@ ok
timer.h
outputHandler::posixFile::writerPosixFile::parallelizable
bool parallelizable() const override
tell if this handler is capable of parallel IO. Unsually not the case
Definition: outputHandlerPosixFile.cpp:351
outputHandler::base::renameRetvalType
renameRetvalType
Definition: outputHandler.h:106
throwcall.h
block
data block, used to hold the data that are being copied (or checksummed).
Definition: block.h:7
timer::instanceUnscoped
Definition: timer.h:95
outputHandler::posixFile::newWriter
std::unique_ptr< writer > newWriter(const std::string &path, bool mightAppend, size_t sourceSize, size_t readBlockSize, copyRequest::stateType &state, bool noWrite, std::unique_ptr< ioHandle::attrDataType > attrData, std::unique_ptr< acl::list > aclData) override
Definition: outputHandlerPosixFile.cpp:20
outputHandler::posixFile::writerPosixFile::sync
void sync() override
Definition: outputHandlerPosixFile.cpp:477
timer::anchor
Definition: timer.h:22
outputHandler::posixFile::writerPosixFile::getSize
size_t getSize() const override
Definition: outputHandlerPosixFile.cpp:354
preserve
decltype(preserve) preserve
set of properties to preserve in the copy
Definition: ewmscp.cpp:111
uid
options::single< int > uid
inputHandler::base
class for handling input This is the (abstract) base class for handling input, both reading a file vi...
Definition: inputHandler.h:35
errMsg::level::err
@ err
throttle::watch::wait
void wait()
Definition: throttle.h:50
outputHandler::posixFile::writerPosixFile::closeAndRemoveBadCopy
void closeAndRemoveBadCopy() override
Definition: outputHandlerPosixFile.cpp:307
errMsg::emit
void emit(level aLogLevel, const location &loc, const std::string &aObject, const std::string &aAction, const Args &... args)
function to create and enqueue a message, this is the only way that messages should be created!
Definition: errMsgQueue.h:148
timerInst
#define timerInst(subfunc)
Definition: timer.h:157
outputHandler::posixFile::createSymlink
void createSymlink(const std::vector< char > &target, const std::string &path, uid_t uid, gid_t gid) override
Definition: outputHandlerPosixFile.cpp:217
block::size
size_t size() const
Definition: block.h:16
posixFileIoCommon
base class for posixFile reader and writer class with the common stuff like fd, path and xattr handli...
Definition: posixFileCommon.h:17
writeRateLimit
throttle::watch writeRateLimit
outputHandler::base::shortenNameToMax
void shortenNameToMax(const std::string &path, C &pathBuf, const std::string &suffix)
Definition: outputHandler.h:122
outputHandler::posixFile::doAttributePreservations
void doAttributePreservations(const std::string &path, const genericStat &stat) override
Definition: outputHandlerPosixFile.cpp:440
timerInstTO
#define timerInstTO(subfunc, timeout, object)
Definition: timer.h:158
throwcall::good0
void good0(T call, const Args &... args)
template function to wrap system calls that return 0 on success
Definition: throwcall.h:40
outputHandler::posixFile::factory
static factoryTemplate< posixFile > factory
Definition: outputHandlerPosixFile.h:11
enumAsBitmask::clear
void clear(const T aBits)
Definition: enumAsBitmask.h:31
throttle::watch::update
void update(double units=1.0)
Definition: throttle.h:35
posixFileIoCommon::path
const std::string & path
Definition: posixFileCommon.h:20
ewmscp.h
copyRequest::stateBitType::append
@ append
genericStat::ownerUid
uid_t ownerUid
Definition: genericStat.h:23
outputHandler::posixFile::rename
base::renameRetvalType rename(const std::string &fromPath, const std::unique_ptr< const genericStat > &readInitialStat, const std::string &toPath, copyRequest::stateType &state) override
Definition: outputHandlerPosixFile.cpp:153
modeBits
options::single< modeBitType > modeBits