| git.druid.rocks | index | druid520 | kaboom | src/ | user/ | klogs.nsc |
src/user/klogs.nsc
include "syscalls.nsh";
/* dmesg-style: dumps the whole kernel log to stdout. no options, no
* follow mode -- minimalized, matching the rest of this kernel's
* coreutils. buf is sys_alloc'd, not a stack local -- see cat.nsc's
* own note on why any buffer of real size moved off the stack. */
global i32
main(i32 argc, ptr argv)
{
ptr buf;
u64 n;
buf = sys_alloc((u64)8192);
if(buf == (ptr)0)
{
sys_write(2, "klogs: out of memory\n", (u64)21);
return 1;
}
n = sys_klog_read(buf, (u64)8192);
sys_write(1, buf, n);
return 0;
}