service_machine.anubis
2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
An example of a service machine for 'http_server.anubis'.
read tools/basis.anubis
public define One
print
(
AllocatorInfo i
) =
if i is alloc_info(id,c,sms,nms,nfs,tms,tfs,nas, tss, tfss) then
print(id+" "+(if c then " corrupted ! " else "")+
" sms:"+sms+
" nms:"+nms+
" nfs:"+nfs+
" tms:"+tms+
" tfs:"+tfs+
" nas:"+nas).
public define One
print
(
AllocatorInfo i
) =
if i is alloc_info(id,c,sms,nms,nfs,tms,tfs,nas, tss, tfss) then
print(" nfs:"+nfs+
" nas:"+nas).
public define One
print
(
VirtualMachineState s
) =
if s is
{
not_used then should_not_happen(unique),
running then print("r"),
waiting_for_event then print("e"),
waiting_for_condition then print("c"),
waiting_for_completion then print("x"),
finished then print("f"),
need_bigger_stack then print("s"),
need_bigger_locked_files_stack then print("l"),
need_more_memory then print("m"),
invalid_instruction then print("i"),
invalid_IP then print("j")
}.
define One
print
(
VirtualMachineWorkSort ws
) =
print(
if ws is
{
computing then "c",
deleting then "d",
equaling then "e",
serializing then "s",
unserializing then "u"
}).
define One
print
(
List(VirtualMachineInfo) l
) =
if l is
{
[ ] then unique,
[h . t] then
if h is vm_info(mid,state,ws,sip,ip,ss,sp,l1,l5,l15) then
print(to_decimal(mid)); print(state); print(ws);
print(to_decimal(ip));
//(if state is running then print(to_decimal(ip)) else unique);
print(" ");
print(t)
}.
public define One
print
(
SystemInfo s
) =
if s is sys_info(max_machine,vm_infos) then
print(vm_infos);
print(" ");
print(allocator_info);
print(" \r").
public define One
show_system_info
(
One u
) =
print(system_info).
public define One
service_machine
=
sleep(1000);
show_system_info(unique);
service_machine.
public define One
service_machine
(
Var(Bool) shutdown_required
) =
if *shutdown_required then unique else
sleep(1000);
show_system_info(unique);
service_machine(shutdown_required).