19#include <l4/cxx/type_traits>
46 virtual
void take(
L4::Cap<
void> cap) noexcept = 0;
52 template< typename T >
54 {
return L4::cap_cast<T>(
alloc()); }
73template<
typename ALLOC>
76 template<
typename ...ARGS>
77 Cap_alloc_t(ARGS &&...args) : ALLOC(cxx::forward<ARGS>(args)...) {}
79 L4::Cap<void> alloc() noexcept
override {
return ALLOC::alloc(); }
80 void take(
L4::Cap<void> cap)
noexcept override { ALLOC::take(cap); }
85 return L4::cap_cast<T>(alloc());
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 >
138template<
unsigned long Unmap_flags = L4_FP_ALL_SPACES >
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.
Helper for Unique_cap and Unique_del_cap.
Helper for Ref_cap and Ref_del_cap.
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.
Common task related definitions.