powerd++
0.4.4
|
This namespace contains safer c++ wrappers for the sysctl() interface. More...
Classes | |
struct | error |
The domain error type. More... | |
class | Once |
A read once representation of a Sysctl. More... | |
class | Sync |
This is a wrapper around Sysctl that allows semantically transparent use of a sysctl. More... | |
class | Sysctl |
Represents a sysctl MIB address. More... | |
class | Sysctl< 0 > |
This is a specialisation of Sysctl for sysctls using symbolic names. More... | |
Typedefs | |
typedef int | mib_t |
Management Information Base identifier type (see sysctl(3)). | |
template<typename T , size_t MibDepth = 0> | |
using | SysctlSync = Sync< T, Sysctl< MibDepth > > |
A convenience alias around Sync. More... | |
template<typename T , size_t MibDepth = 0> | |
using | SysctlOnce = Once< T, Sysctl< MibDepth > > |
A convenience alias around Once. More... | |
Functions | |
void | sysctl_raw (mib_t const *name, u_int const namelen, void *const oldp, size_t *const oldlenp, void const *const newp, size_t const newlen) |
A wrapper around the sysctl() function. More... | |
template<size_t MibDepth> | |
void | sysctl_get (mib_t const (&mib)[MibDepth], void *const oldp, size_t &oldlen) |
Returns a sysctl() value to a buffer. More... | |
template<size_t MibDepth> | |
void | sysctl_set (mib_t const (&mib)[MibDepth], void const *const newp, size_t const newlen) |
Sets a sysctl() value. More... | |
template<typename ... ArgTs> | |
Sysctl (mib_t const, ArgTs const ...) -> Sysctl<(1+sizeof...(ArgTs))> | |
Create a Sysctl from a set of predefined MIBs. More... | |
Sysctl (char const *const) -> Sysctl< 0 > | |
Create a Sysctl<0> by name. | |
Sysctl () -> Sysctl< 0 > | |
Default construct a Sysctl<0>. | |
This namespace contains safer c++ wrappers for the sysctl() interface.
The template class Sysctl represents a sysctl address and offers handles to retrieve or set the stored value.
The template class Sync represents a sysctl value that is read and written synchronously.
The template class Once represents a read once value.
struct sys::ctl::error |
The domain error type.
using sys::ctl::SysctlOnce = typedef Once<T, Sysctl<MibDepth> > |
A convenience alias around Once.
T | The type to represent the sysctl as |
MibDepth | The maximum allowed MIB depth |
using sys::ctl::SysctlSync = typedef Sync<T, Sysctl<MibDepth> > |
A convenience alias around Sync.
T | The type to represent the sysctl as |
MibDepth | The MIB depth, provide only for compile time initialisation |
sys::ctl::Sysctl | ( | mib_t const | , |
ArgTs | const ... | ||
) | -> Sysctl<(1+sizeof...(ArgTs))> |
Create a Sysctl from a set of predefined MIBs.
Args | List of argument types, should all be mib_t |
void sys::ctl::sysctl_get | ( | mib_t const (&) | mib[MibDepth], |
void *const | oldp, | ||
size_t & | oldlen | ||
) |
|
inline |
A wrapper around the sysctl() function.
All it does is throw an exception if sysctl() fails.
name,namelen | The MIB buffer and its length |
oldp,oldlenp | Pointers to the return buffer and its length |
newp,newlen | A pointer to the buffer with the new value and the buffer length |
sys::sc_error<error> | Throws if sysctl() fails for any reason |
void sys::ctl::sysctl_set | ( | mib_t const (&) | mib[MibDepth], |
void const *const | newp, | ||
size_t const | newlen | ||
) |