8#include <mxl/version.h>
16# include <linux/magic.h>
17#elif defined(__APPLE__)
19# include <sys/mount.h>
20# include <sys/param.h>
29 if (out_version !=
nullptr)
31 out_version->
major = MXL_VERSION_MAJOR;
32 out_version->
minor = MXL_VERSION_MINOR;
33 out_version->
bugfix = MXL_VERSION_PATCH;
34 out_version->
build = MXL_VERSION_BUILD;
47 if (in_mxlDomain ==
nullptr)
49 MXL_ERROR(
"Failed to create instance : the domain is NULL");
55 auto const opts = (in_options !=
nullptr) ? in_options :
"";
56 auto domainWatcher = std::make_shared<mxl::lib::DomainWatcher>(in_mxlDomain);
57 auto flowIoFactory = std::make_unique<mxl::lib::PosixFlowIoFactory>(domainWatcher);
60 catch (std::exception& e)
62 MXL_ERROR(
"Failed to create instance : {}", e.what());
75 if ((in_path ==
nullptr) || (out_isTmpFs ==
nullptr))
81 using statfs_t =
struct statfs;
82 auto buf = statfs_t{};
83 if (::statfs(in_path, &buf) != 0)
87 *out_isTmpFs = (buf.f_type == TMPFS_MAGIC) || (buf.f_type == RAMFS_MAGIC);
89#elif defined(__APPLE__)
90 using statfs_t =
struct statfs;
91 auto buf = statfs_t{};
92 if (::statfs(in_path, &buf) != 0)
96 *out_isTmpFs = std::strcmp(buf.f_fstypename,
"tmpfs") == 0;
127 MXL_DEBUG(
"Starting garbage collection of flows");
129 auto count = instance->garbageCollect();
130 MXL_DEBUG(
"Garbage collected {} flows", count);
MXL_EXPORT mxlStatus mxlDestroyInstance(mxlInstance in_instance)
MXL_EXPORT mxlStatus mxlGetVersion(mxlVersionType *out_version)
MXL_EXPORT mxlInstance mxlCreateInstance(char const *in_mxlDomain, char const *in_options)
MXL_EXPORT mxlStatus mxlIsTmpFs(char const *in_path, bool *out_isTmpFs)
MXL_EXPORT mxlStatus mxlGarbageCollectFlows(mxlInstance in_instance)
static char const g_mxl_version_string[]
mxlStatus
MXL SDK Status codes.
struct mxlInstance_t * mxlInstance
Instance * to_Instance(mxlInstance instance) noexcept
Utility function to convert from a C mxlInstance handle to a C++ Instance class.
MXL SDK Semantic versionning structure.