19#include <l4/cxx/type_traits>
33 void operator = (Cap_alloc
const &);
36 Cap_alloc(Cap_alloc
const &) {}
46 virtual
void take(
L4::Cap<
void> cap) noexcept = 0;
52 template< typename T >
73template<
typename ALLOC>
76 template<
typename ...ARGS>
77 Cap_alloc_t(ARGS &&...args) : ALLOC(cxx::forward<ARGS>(args)...) {}
80 void take(L4::Cap<void> cap)
noexcept override { ALLOC::take(cap); }
83 L4::Cap<T>
alloc() noexcept
90 { ALLOC::free(cap, task, unmap_flags); }
93 unsigned unmap_flags)
noexcept override
94 {
return ALLOC::release(cap, task, unmap_flags); }
96 void operator delete(
void *) {}
109template<
unsigned long Unmap_flags = L4_FP_ALL_SPACES >
116 Smart_cap_auto() : _ca(0) {}
117 Smart_cap_auto(
Cap_alloc *ca) : _ca(ca) {}
138template<
unsigned long Unmap_flags = L4_FP_ALL_SPACES >
145 Smart_count_cap() : _ca(
nullptr) {}
146 Smart_count_cap(
Cap_alloc *ca) : _ca(ca) {}
155 if (_ca && _ca->release(
L4::Cap<void>(c.cap()), This_task, Unmap_flags))
Capability allocator interface.
virtual L4::Cap< void > alloc() noexcept=0
Allocate a capability.
virtual void free(L4::Cap< void > cap, l4_cap_idx_t task=L4_INVALID_CAP, unsigned unmap_flags=L4_FP_ALL_SPACES) noexcept=0
Free a capability.
L4::Cap_base copy(L4::Cap_base const &src)
Copy operation for L4::Smart_cap (increment ref count).
void free(L4::Cap_base &c) noexcept
Free operation for L4::Smart_cap (decrement ref count and delete if 0).
static void invalidate(L4::Cap_base &c) noexcept
Invalidate operation for L4::Smart_cap.
Base class for all kinds of capabilities.
void invalidate() noexcept
Set this capability to invalid (L4_INVALID_CAP).
l4_cap_idx_t cap() const noexcept
Return capability selector.
bool is_valid() const noexcept
Test whether the capability is a valid capability index (i.e., not L4_INVALID_CAP).
C++ interface for capabilities.
unsigned long l4_cap_idx_t
Capability selector type.
@ L4_INVALID_CAP
Invalid capability selector.
@ L4_FP_ALL_SPACES
Flag to tell the unmap operation to revoke permissions from all child mappings including the mapping ...
virtual ~Cap_alloc()=0
Destructor.
L4 low-level kernel interface.
Cap< T > cap_cast(Cap< F > const &c) noexcept
static_cast for capabilities.
Common task related definitions.