libk  testbin.exe.c at [5393623a84]

File kcore/testbin.exe.c artifact a4a4905883 part of check-in 5393623a84


#include <k/core.h>
#include <k/mem.h>
#include <k/io.h>
#include <k/magic.h>

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;
	}
	kmptr object = kmheapao(sizeof (struct object) * 16);
	if (object.kind == kmkind_fail) return kbad_mem;

	/* struct object* block = kmheapa(sizeof (struct object) * 4); */
	
	struct object* block = object.ref;
	block[5].a = 5;

	if (kmfree(object) != kmcond_ok) return kbad_mem;

	return kbad_ok;
}