]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/jdb/jdb_ipc_gate.cpp
update
[l4.git] / kernel / fiasco / src / jdb / jdb_ipc_gate.cpp
1 IMPLEMENTATION:
2
3 #include <climits>
4 #include <cstring>
5 #include <cstdio>
6
7 #include "jdb.h"
8 #include "jdb_core.h"
9 #include "jdb_module.h"
10 #include "jdb_screen.h"
11 #include "jdb_kobject.h"
12 #include "simpleio.h"
13 #include "static_init.h"
14 #include "ipc_gate.h"
15
16 class Jdb_ipc_gate : public Jdb_kobject_handler
17 {
18 public:
19   Jdb_ipc_gate() FIASCO_INIT;
20 };
21
22 IMPLEMENT
23 Jdb_ipc_gate::Jdb_ipc_gate()
24   : Jdb_kobject_handler(Ipc_gate_obj::static_kobj_type)
25 {
26   Jdb_kobject::module()->register_handler(this);
27 }
28
29 PUBLIC
30 Kobject *
31 Jdb_ipc_gate::follow_link(Kobject *o)
32 {
33   Ipc_gate_obj *g = Kobject::dcast<Ipc_gate_obj *>(o);
34   return g->thread() ? g->thread()->kobject() : o;
35 }
36
37 PUBLIC
38 bool
39 Jdb_ipc_gate::show_kobject(Kobject *, int)
40 { return true; }
41
42 PUBLIC
43 int
44 Jdb_ipc_gate::show_kobject_short(char *buf, int max, Kobject *o)
45 {
46   Ipc_gate_obj *g = Kobject::dcast<Ipc_gate_obj*>(o);
47   if (!g)
48     return 0;
49
50   return snprintf(buf, max, " L=%s%08lx\033[0m D=%lx",
51                   (g->id() & 3) ? JDB_ANSI_COLOR(lightcyan) : "",
52                   g->id(), g->thread() ? g->thread()->dbg_info()->dbg_id() : 0);
53 }
54
55 PUBLIC
56 char const *
57 Jdb_ipc_gate::kobject_type() const
58 {
59   return JDB_ANSI_COLOR(magenta) "Gate" JDB_ANSI_COLOR(default);
60 }
61
62 static Jdb_ipc_gate jdb_space INIT_PRIORITY(JDB_MODULE_INIT_PRIO);
63