ewmscp  ..
Namespaces | Functions
throwcall Namespace Reference

Namespaces

 dcap
 
 sftp
 
 ssh
 

Functions

template<typename T >
void conCatString (std::ostringstream &msg, const T &begin)
 
template<typename T , typename ... Args>
void conCatString (std::ostringstream &msg, const T &begin, const Args &... args)
 
template<typename T , typename ... Args>
void good0 (T call, const Args &... args)
 template function to wrap system calls that return 0 on success More...
 
template<typename T , typename t , typename ... Args>
badval (T call, t badvalue, const Args &... args)
 template function to wrap system calls that return a special bad value on failure More...
 

Function Documentation

◆ badval()

template<typename T , typename t , typename ... Args>
T throwcall::badval ( call,
badvalue,
const Args &...  args 
)
inline

template function to wrap system calls that return a special bad value on failure

Parameters
[in]callthe call, e.g. open(name,O_RDONLY)
[in]badvaluethe special value returned on failure
[in]argsget written to the what field of the exception
Returns
returns whatever the system call returns on success badvalue has a type different from T to allow nullptr badvalues, which would fail inference with more specific pointer return types

Definition at line 54 of file throwcall.h.

54  {
55  if (__builtin_expect(call == badvalue, false)) {
56  std::ostringstream msg;
57  conCatString(msg, args...);
58  throw std::system_error(errno, std::system_category(), msg.str());
59  }
60  return call;
61  };

References conCatString().

Referenced by block::block(), createFile(), scoped::Dir::Dir(), baseTest::ensuredRead(), baseTest::ensuredWrite(), baseTest::Execute(), tmpFile::execute(), vimWrite::execute(), keepOpen::execute(), appendBlocks::execute(), simpleWrite::execute(), cpWrite::execute(), directWrite::execute(), mmapWrite::execute(), sparseWrite::execute(), sparseWrite2::execute(), findMinHoleSize::execute(), appendHole::execute(), createUnlinkCreate::execute(), closeMvUpdate::execute(), createUnlinkClose::execute(), simpleRead::execute(), mmapRead::execute(), truncateToSize::execute(), uglyNames::execute(), uglyPaths::execute(), outputHandler::posixFile::getMaxNameLength(), outputHandler::daosFs::getMaxNameLength(), posixFileCommon::getXattr(), posixFileIoCommon::getXattr(), daosFsCommon::getXattr(), daosFsIoCommon::getXattr(), handleDir(), main(), block::nullBuffer(), libsshCommon::openSessions(), aclBuffer::operator void *(), copyRequest::perThreadData::perThreadData(), inputHandler::posixFile::PosixDirectory::PosixDirectory(), runnerType::process(), readAndDeleteFile(), inputHandler::posixFile::readerPosixFile::readBlock(), inputHandler::posixFile::readerPosixFile::readBlockP(), inputHandler::posixFile::readerPosixFile::readerPosixFile(), inputHandler::daosFs::readLinkTarget(), inputHandler::posixFile::readLinkTarget(), outputHandler::Gpfs::rename(), outputHandler::posixFile::writerPosixFile::seek(), outputHandler::daosFs::writerDaosFs::seek(), inputHandler::posixFile::readerPosixFile::seek(), inputHandler::posixFile::readerPosixFile::setupSparseRegions(), watchedDirType::watchedDirType(), outputHandler::posixFile::writerPosixFile::writeBlock(), outputHandler::daosFs::writerDaosFs::writeBlock(), outputHandler::posixFile::writerPosixFile::writeBlockP(), outputHandler::daosFs::writerDaosFs::writeBlockP(), outputHandler::daosFs::writerDaosFs::writerDaosFs(), outputHandler::posixFile::writerPosixFile::writerPosixFile(), and outputHandler::libssh::writerLibssh::~writerLibssh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ conCatString() [1/2]

template<typename T >
void throwcall::conCatString ( std::ostringstream &  msg,
const T &  begin 
)

Definition at line 26 of file throwcall.h.

26  {
27  msg << begin;
28  }

Referenced by fatalException::argsToString(), throwcall::dcap::badval(), badval(), throwcall::sftp::badval(), throwcall::ssh::badval(), conCatString(), throwcall::dcap::good0(), good0(), throwcall::sftp::good0(), throwcall::ssh::good0(), and throwcall::ssh::goodval().

Here is the caller graph for this function:

◆ conCatString() [2/2]

template<typename T , typename ... Args>
void throwcall::conCatString ( std::ostringstream &  msg,
const T &  begin,
const Args &...  args 
)
inline

Definition at line 29 of file throwcall.h.

31  {
32  msg << begin;
33  if (sizeof...(args)) {
34  conCatString(msg, args...);
35  }
36  }

References conCatString().

Here is the call graph for this function:

◆ good0()

template<typename T , typename ... Args>
void throwcall::good0 ( call,
const Args &...  args 
)
inline

template function to wrap system calls that return 0 on success

Parameters
[in]callthe call, e.g. close(fd)
[in]argsget written to the what field of the exception

Definition at line 40 of file throwcall.h.

40  {
41  if (__builtin_expect(call, 0)) {
42  std::ostringstream msg;
43  conCatString(msg, args...);
44  throw std::system_error(errno, std::system_category(), msg.str());
45  }
46  };

References conCatString().

Referenced by gpfs_fcntl_handler::call(), inputHandler::daosFs::readerDaosFs::checkUnchangedness(), inputHandler::posixFile::readerPosixFile::checkUnchangedness(), createFile(), outputHandler::posixFile::createSymlink(), outputHandler::daosFs::createSymlink(), daosFsCommon::daosFsCommon(), inputHandler::daosFs::DaosFsDirectory::DaosFsDirectory(), outputHandler::posixFile::writerPosixFile::doAttributePreservations(), outputHandler::daosFs::writerDaosFs::doAttributePreservations(), outputHandler::dcap::doAttributePreservations(), outputHandler::posixFile::doAttributePreservations(), outputHandler::daosFs::doAttributePreservations(), outputHandler::Gpfs::writerGpfs::doSpecialFdHandling(), outputHandler::posixFile::ensureParentDirs(), outputHandler::daosFs::ensureParentDirs(), baseTest::Execute(), tmpFile::execute(), vimWrite::execute(), keepOpen::execute(), appendBlocks::execute(), simpleWrite::execute(), cpWrite::execute(), directWrite::execute(), mmapWrite::execute(), sparseWrite::execute(), sparseWrite2::execute(), findMinHoleSize::execute(), appendHole::execute(), createUnlinkCreate::execute(), closeMvUpdate::execute(), createUnlinkClose::execute(), simpleRead::execute(), mmapRead::execute(), truncateToSize::execute(), uglyNames::execute(), uglyPaths::execute(), daosFsIoCommon::attrDataType::fill(), gpfs_acl_handler::get(), gpfsIoCommon::getAttrData(), daosFsCommon::getDirObj(), inputHandler::daosFs::DaosFsDirectory::getNextEntry(), inputHandler::posixFile::PosixDirectory::getNextEntry(), davixCommon::getPassword(), posixFileCommon::getStat(), posixFileIoCommon::getStat(), daosFsCommon::getStat(), daosFsIoCommon::getStat(), daosFsCommon::getXattr(), handleDir(), main(), libsshCommon::openSessions(), aclBuffer::operator void *(), posixFileCommon::pathExists(), daosFsCommon::pathExists(), pidFileRemover(), readAndDeleteFile(), inputHandler::daosFs::readerDaosFs::readBlock(), inputHandler::daosFs::readerDaosFs::readBlockP(), inputHandler::daosFs::readerDaosFs::readerDaosFs(), inputHandler::posixFile::readerPosixFile::readerPosixFile(), outputHandler::posixFile::remove(), outputHandler::daosFs::remove(), posixFileIoCommon::removeXattr(), daosFsIoCommon::removeXattr(), outputHandler::Gpfs::rename(), outputHandler::libssh::rename(), outputHandler::posixFile::rename(), outputHandler::daosFs::rename(), outputHandler::posixFile::renameSimple(), outputHandler::daosFs::renameSimple(), gpfsIoCommon::attrDataType::set(), gpfs_acl_handler::set(), inputHandler::posixFile::readerPosixFile::setupSparseRegions(), posixFileIoCommon::setXattr(), daosFsIoCommon::setXattr(), outputHandler::posixFile::writerPosixFile::sync(), outputHandler::daosFs::writerDaosFs::sync(), watchDirectory(), outputHandler::posixFile::writerPosixFile::writeBlock(), outputHandler::daosFs::writerDaosFs::writeBlock(), outputHandler::daosFs::writerDaosFs::writerDaosFs(), outputHandler::posixFile::writerPosixFile::writerPosixFile(), block::~block(), daosFsCommon::~daosFsCommon(), inputHandler::daosFs::DaosFsDirectory::~DaosFsDirectory(), scoped::Dir::~Dir(), scoped::Fd::~Fd(), inputHandler::posixFile::PosixDirectory::~PosixDirectory(), inputHandler::daosFs::readerDaosFs::~readerDaosFs(), inputHandler::posixFile::readerPosixFile::~readerPosixFile(), watchedDirType::~watchedDirType(), outputHandler::daosFs::writerDaosFs::~writerDaosFs(), and outputHandler::posixFile::writerPosixFile::~writerPosixFile().

Here is the call graph for this function:
Here is the caller graph for this function:
throwcall::conCatString
void conCatString(std::ostringstream &msg, const T &begin, const Args &... args)
Definition: throwcall.h:29