L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
reply_cap_hooks
1// vi:set ft=cpp: -*- Mode: C++ -*-
2
3#pragma once
4
5#include <l4/cxx/result>
7
8namespace L4Re { namespace Util {
9
10template<typename HOOKS>
11class Reply_cap_hooks : public HOOKS
12{
13public:
14 // Implement L4::Ipc_svr::Server_iface
15 cxx::Result<L4::Reply_cap> take_reply_cap() noexcept override
16 {
17 auto next = reply_cap_alloc.alloc();
18 if (!next)
19 return cxx::Error(-L4_ENOMEM);
20
21 auto ret = cxx::move(_reply_cap);
22 _reply_cap = cxx::move(next);
23 return ret;
24 }
25
26protected:
27 // Required interface for L4::Ipc_svr::Server
28 L4::Reply_cap_idx setup_reply_cap() const noexcept
29 { return _reply_cap.get(); }
30
31private:
32 L4::Reply_cap _reply_cap{reply_cap_alloc.alloc()};
33};
34
35}}
@ L4_ENOMEM
No memory.
Definition err.h:40
Def_reply_cap_alloc reply_cap_alloc
Reply capability allocator.
Documentation of the L4 Runtime Environment utility functionality in C++.
Definition l4re.dox:21
L4Re C++ Interfaces.
Definition cmd_control:14
Capability allocator.