libk  testbin.exe.c at [acb4a9944e]

File mod/kcore/testbin.exe.c artifact 2c9c964882 part of check-in acb4a9944e


#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;
	}

	kmres alloc = kmheapa(2048);
	if (alloc.cond != kmcond_ok) return kbad_mem;
	
	void* region = alloc.raw;
	kmzero(region,2048);

	if (kmheapf(region) >= kmcond_fail) return kbad_mem;

	return kbad_ok;
}