1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
namespace;
include rt;
int global_state = 16;
unchecked fn main() {
int fd = 0, state = 7; word heap = rt.new(1); heap[0] = 4;
let parent_process = rt.syscall(53, 0, 0, 0), parent_thread = rt.syscall(54, 0, 0, 0);
let callback = fn() {
global_state += 5; state += 9; heap[0] += 3;
int reply[5]; reply[0] = global_state; reply[1] = state; reply[2] = heap[0]; reply[3] = rt.syscall(53, 0, 0, 0); reply[4] = rt.syscall(54, 0, 0, 0);
rt.syscall(44, fd, reply, 5); return 0;
};
let context = rt.syscall(51, callback as word, &fd, 0);
int result[5]; rt.syscall(45, fd, result, 5); rt.syscall(52, context, 0, 0);
rt.put_n(result[0]); rt.put_c(' '); rt.put_n(result[1]); rt.put_c(' '); rt.put_n(result[2]); rt.put_c(' ');
rt.put_n(global_state); rt.put_c(' '); rt.put_n(state); rt.put_c(' '); rt.put_n(heap[0]); rt.put_c(' ');
rt.put_n(result[3] == parent_process); rt.put_c(' '); rt.put_n(result[4] != parent_thread); rt.put_c(10); return 0;
}
|