[user] Update logging and return in user apps

Update some userspace apps to return more distinct error messages and
make better use of j6::syslog.
This commit is contained in:
Justin C. Miller
2023-07-10 01:41:55 -07:00
parent 4bf03266a9
commit a449a88395
3 changed files with 8 additions and 7 deletions

View File

@@ -97,7 +97,7 @@ main(int argc, const char **argv)
if (result != j6_status_ok)
break;
j6::syslog("uart driver: got %d bytes from channel", size);
//j6::syslog("uart driver: got %d bytes from channel", size);
com1.write(buffer, size);
}
if (result != j6_status_would_block)

View File

@@ -8,6 +8,7 @@
#include <j6/errors.h>
#include <j6/flags.h>
#include <j6/syscalls.h>
#include <j6/syslog.hh>
#include <j6/types.h>
#include "font.h"
@@ -21,7 +22,7 @@ extern "C" {
int
driver_main(unsigned argc, const char **argv, const char **env, const j6_init_args *init)
{
j6_log("fb driver starting");
j6::syslog("fb driver starting");
using bootproto::devices::uefi_fb;
using bootproto::devices::video_mode;
@@ -30,7 +31,7 @@ driver_main(unsigned argc, const char **argv, const char **env, const j6_init_ar
const uefi_fb *fb = reinterpret_cast<const uefi_fb*>(init->args[0]);
if (!fb || !fb->framebuffer) {
j6_log("fb driver didn't find a framebuffer, exiting");
j6::syslog("fb driver didn't find a framebuffer, exiting");
return 1;
}
@@ -102,7 +103,7 @@ driver_main(unsigned argc, const char **argv, const char **env, const j6_init_ar
buffer_size = size;
continue;
} else if (s != j6_status_ok) {
j6_log("fb driver got error from get_log, quitting");
j6::syslog("fb driver got error from get_log, quitting");
return s;
}
@@ -128,6 +129,6 @@ driver_main(unsigned argc, const char **argv, const char **env, const j6_init_ar
}
}
j6_log("fb driver done, exiting");
j6::syslog("fb driver done, exiting");
return 0;
}

View File

@@ -97,7 +97,7 @@ main(int argc, const char **argv)
void *base = malloc(0x1000);
if (!base)
return 1;
return 1001;
uint64_t *vma_ptr = reinterpret_cast<uint64_t*>(base);
for (int i = 0; i < 3; ++i)
@@ -107,7 +107,7 @@ main(int argc, const char **argv)
j6::channel *chan = j6::channel::create(0x2000);
if (!chan)
return 2;
return 1002;
j6_log("main thread created channel");