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
|
struct object {
u8 a;
s16 b;
bool c;
};
kbad entry(kenv e) {
const char msg[] = "hello from libk\n";
ksraw ptr = { Kmsz(msg), msg };
bool maybe = true;
maybe = no;
if (kiosend(e.std, ptr, null) == kiocond_ok) {
/* great, continue */
} else {
return kbad_io;
}
struct object* block = kmheapa(sizeof (struct object) * 4);
if (block == null) return kbad_mem; else return kbad_ok;
block[1].a = 5;
return kbad_ok;
}
|
|
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
|
struct object {
u8 a;
s16 b;
bool c;
};
stat_long entry(kenv e) {
const char msg[] = "hello from libk\n";
ksraw ptr = { Kmsz(msg), msg };
bool maybe = true;
maybe = no;
if (kiosend(e.std, ptr, null) == kiocond_ok) {
/* great, continue */
} else {
return kbad_io;
}
struct object* block = kmheapa(sizeof (struct object) * 4);
if (block == null) return kbad_mem;
block[1].a = 5;
if (kmheapf(block) != kmcond_ok) return kbad_mem;
return kbad_ok;
}
|