]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re/util/include/cap
7f26c763ba9e8744583b91e523b63c435ae6343e
[l4.git] / l4 / pkg / l4re / util / include / cap
1 // -*- Mode: C++ -*-
2 // vim:ft=cpp
3 /**
4  * \file   cap
5  * \brief  Capability utility functions
6  */
7 /*
8  * (c) 2009 Technische Universität Dresden
9  * This file is part of TUD:OS and distributed under the terms of the
10  * GNU General Public License 2.
11  * Please see the COPYING-GPL-2 file for details.
12  *
13  * As a special exception, you may use this file as part of a free software
14  * library without restriction.  Specifically, if other files instantiate
15  * templates or use macros or inline functions from this file, or you compile
16  * this file and link it with other files to produce an executable, this
17  * file does not by itself cause the resulting executable to be covered by
18  * the GNU General Public License.  This exception does not however
19  * invalidate any other reasons why the executable file might be covered by
20  * the GNU General Public License.
21  */
22
23 #pragma once
24
25 #include <l4/sys/task>
26
27 namespace L4Re { namespace Util {
28
29 /**
30  * \brief Release a capability from a task (unmap).
31  * \ingroup api_l4re_util
32  *
33  * Note that the given capability does not need to be handled by the
34  * capability allocator in any way.
35  */
36 L4_CV static inline l4_msgtag_t cap_release(L4::Cap<void> cap)
37 {
38   return l4_task_unmap(L4_BASE_TASK_CAP,
39                        l4_obj_fpage(cap.cap(), 0, L4_FPAGE_RWX),
40                        L4_FP_ALL_SPACES);
41 }
42
43 }}