L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
kobject
1// vi:set ft=cpp: -*- Mode: C++ -*-
2/* \file
3 * Kobject C++ interface.
4 */
5/*
6 * Copyright (C) 2015-2017, 2019, 2021 Kernkonzept GmbH.
7 * Author(s): Alexander Warg <alexander.warg@kernkonzept.com>
8 *
9 * This file is distributed under the terms of the GNU General Public
10 * License, version 2. Please see the COPYING-GPL-2 file for details.
11 *
12 * As a special exception, you may use this file as part of a free software
13 * library without restriction. Specifically, if other files instantiate
14 * templates or use macros or inline functions from this file, or you compile
15 * this file and link it with other files to produce an executable, this
16 * file does not by itself cause the resulting executable to be covered by
17 * the GNU General Public License. This exception does not however
18 * invalidate any other reasons why the executable file might be covered by
19 * the GNU General Public License.
20 */
21#pragma once
22
23#include "kernel_object.h"
24#include "types.h"
25#include "__typeinfo.h"
26
27namespace L4 {
28
47{
48private:
49 Kobject();
50 Kobject(Kobject const &);
51 Kobject &operator = (Kobject const &);
52
53 template<typename T> friend struct Kobject_typeid;
54
55protected:
56 typedef Typeid::Iface<L4_PROTO_META, Kobject> __Iface;
57 typedef Typeid::Iface_list<__Iface> __Iface_list;
58
65 struct __Kobject_typeid
66 {
67 typedef Type_info::Demand_t<> Demand;
68 static Type_info const _m;
69 };
70
79 l4_cap_idx_t cap() const noexcept { return _c(); }
80
81private:
82
87 l4_cap_idx_t _c() const noexcept
88 { return reinterpret_cast<l4_cap_idx_t>(this) & L4_CAP_MASK; }
89
90public:
111 { return l4_kobject_dec_refcnt_u(cap(), diff, utcb); }
112};
113
114template<typename Derived, long PROTO = L4::PROTO_ANY,
115 typename S_DEMAND = Type_info::Demand_t<> >
116struct Kobject_0t : Kobject_t<Derived, L4::Kobject, PROTO, S_DEMAND> {};
117
118}
119
Type information handling.
Base class for all kinds of kernel objects and remote objects, referenced by capabilities.
Definition kobject:47
l4_cap_idx_t cap() const noexcept
Return capability selector.
Definition kobject:79
l4_msgtag_t dec_refcnt(l4_mword_t diff, l4_utcb_t *utcb=l4_utcb())
Decrement the in kernel reference counter for the object.
Definition kobject:110
signed long l4_mword_t
Signed machine word.
Definition l4int.h:48
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:359
@ L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition consts.h:166
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:67
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:340
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:231
Kernel object system calls.
Common L4 ABI Data Types.
L4 low-level kernel interface.
Definition io_regblock.h:19
@ PROTO_ANY
Default protocol used by Kobject_t and Kobject_x.
Definition __typeinfo.h:58
Meta object for handling access to type information of Kobjects.
Definition __typeinfo.h:622
Template type statically describing demand of receive buffers.
Definition __typeinfo.h:565
Dynamic Type Information for L4Re Interfaces.
Definition __typeinfo.h:511
Message tag data structure.
Definition types.h:164