libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
syscall_wrapper.hpp File Reference
Include dependency graph for syscall_wrapper.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_code< ssize_t >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_code< int >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_code< void * >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_code< sighandler_t >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_code< void >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_detection< ssize_t >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_detection< int >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_detection< void * >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_detection< sighandler_t >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_detection< void >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::unroller< N, CaseStatements >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::unroller< 0, CaseStatements >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::a_case_statement< RetCode, Stmnt >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::case_statements_t< CaseLabels >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::failure_traits< ReturnType, FailureCode, FailureDetection >
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::traits_base< FailureTraits, Args >
 The base of any trait in this file. This trait calls handle_error() if it detects a failure, otherwise returns the result of the wrapped function. More...
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::simple_report_traits< FailureTraits, Args >
 This is the default trait. More...
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::switch_traits< CaseStatements, FailureTraits, Args >
 If different operations need to be performed on different return-codes, then this trait may be used. More...
 
struct  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::switch_wrapper_t< CaseStatements >
 

Namespaces

namespace  jmmcg
 Link with -lrt to include these functions.
 
namespace  jmmcg::LIBJMMCG_VER_NAMESPACE
 
namespace  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall
 A wrapper for glibc or syscalls, etc. This function captures the return-code and if it is the specified failure-code, then according to the traits may capture any error information and throw it as an exception.
 
namespace  jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_
 

Macros

#define JMMCG_SYSCALL_WRAPPER(ErrMsg, RevInfo, Fn, ...)
 Use this nasty macro to wrap calling the C-style function for which the return code is basically a "single" failure-code and a range of successful ones. More...
 
#define JMMCG_SYSCALL_WRAPPER_FC(FailureCode, ErrMsg, RevInfo, Fn, ...)
 
#define JMMCG_SYSCALL_WRAPPER_SWITCH(CaseLabels, ErrMsg, RevInfo, Fn, ...)
 Use this nasty macro to wrap calling the C-style function for which there may be many failure codes that need different handling for each. More...
 

Typedefs

using jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::exception_t = crt_exception< ppd::platform_api, ppd::heavyweight_threading >
 

Functions

template<template< class, class ... > class Traits, template< class, template< class > class, template< class > class > class FailureTraits, template< class > class FailureCode, template< class > class FailureDetection, class FnReturnType , class ... FnArgs, class ... PassedInArgs>
FnReturnType jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::process (char const *const file_name, unsigned line_num, char const *const fn_name, tchar const *const rev_info, tchar const *const err_msg, FnReturnType(*fn)(FnArgs...), PassedInArgs ...args) noexcept(std::is_same< FnReturnType, void >::value)
 The function that wraps calling the C-style function. More...
 

Macro Definition Documentation

◆ JMMCG_SYSCALL_WRAPPER

#define JMMCG_SYSCALL_WRAPPER (   ErrMsg,
  RevInfo,
  Fn,
  ... 
)
Value:
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::simple_report_traits, \
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::failure_traits, \
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_code, \
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_detection \
>(__FILE__, __LINE__, LIBJMMCG_ENQUOTE(Fn), _T(LIBJMMCG_VERSION_NUMBER), ErrMsg, Fn, __VA_ARGS__)
#define LIBJMMCG_ENQUOTE(x)
#define LIBJMMCG_VERSION_NUMBER
Definition: config.h:28
FnReturnType process(char const *const file_name, unsigned line_num, char const *const fn_name, tchar const *const rev_info, tchar const *const err_msg, FnReturnType(*fn)(FnArgs...), PassedInArgs ...args) noexcept(std::is_same< FnReturnType, void >::value)
The function that wraps calling the C-style function.
#define _T(str)
Definition: ttypes.hpp:63

Use this nasty macro to wrap calling the C-style function for which the return code is basically a "single" failure-code and a range of successful ones.

Todo:
This define could be removed in C++20 with the use of std::source_location, does not work with g++ v9.2.

Definition at line 239 of file syscall_wrapper.hpp.

◆ JMMCG_SYSCALL_WRAPPER_FC

#define JMMCG_SYSCALL_WRAPPER_FC (   FailureCode,
  ErrMsg,
  RevInfo,
  Fn,
  ... 
)
Value:
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::simple_report_traits, \
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::failure_traits, \
FailureCode, \
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_detection \
>(__FILE__, __LINE__, LIBJMMCG_ENQUOTE(Fn), RevInfo, ErrMsg, Fn, __VA_ARGS__)

Definition at line 247 of file syscall_wrapper.hpp.

◆ JMMCG_SYSCALL_WRAPPER_SWITCH

#define JMMCG_SYSCALL_WRAPPER_SWITCH (   CaseLabels,
  ErrMsg,
  RevInfo,
  Fn,
  ... 
)
Value:
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::switch_wrapper_t< \
CaseLabels \
>::type, \
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::failure_traits, \
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_code, \
jmmcg::LIBJMMCG_VER_NAMESPACE::syscall::private_::failure_detection \
>(__FILE__, __LINE__, LIBJMMCG_ENQUOTE(Fn), RevInfo, ErrMsg, Fn, __VA_ARGS__)
const MsgType_t type() const noexcept(true)
Definition: messages.hpp:23

Use this nasty macro to wrap calling the C-style function for which there may be many failure codes that need different handling for each.

Todo:
This define could be removed in C++20 with the use of std::source_location, does not work with g++ v9.2.

Definition at line 259 of file syscall_wrapper.hpp.