[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:
@@ -97,7 +97,7 @@ main(int argc, const char **argv)
|
|||||||
if (result != j6_status_ok)
|
if (result != j6_status_ok)
|
||||||
break;
|
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);
|
com1.write(buffer, size);
|
||||||
}
|
}
|
||||||
if (result != j6_status_would_block)
|
if (result != j6_status_would_block)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <j6/errors.h>
|
#include <j6/errors.h>
|
||||||
#include <j6/flags.h>
|
#include <j6/flags.h>
|
||||||
#include <j6/syscalls.h>
|
#include <j6/syscalls.h>
|
||||||
|
#include <j6/syslog.hh>
|
||||||
#include <j6/types.h>
|
#include <j6/types.h>
|
||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
@@ -21,7 +22,7 @@ extern "C" {
|
|||||||
int
|
int
|
||||||
driver_main(unsigned argc, const char **argv, const char **env, const j6_init_args *init)
|
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::uefi_fb;
|
||||||
using bootproto::devices::video_mode;
|
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]);
|
const uefi_fb *fb = reinterpret_cast<const uefi_fb*>(init->args[0]);
|
||||||
|
|
||||||
if (!fb || !fb->framebuffer) {
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ driver_main(unsigned argc, const char **argv, const char **env, const j6_init_ar
|
|||||||
buffer_size = size;
|
buffer_size = size;
|
||||||
continue;
|
continue;
|
||||||
} else if (s != j6_status_ok) {
|
} 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;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ main(int argc, const char **argv)
|
|||||||
|
|
||||||
void *base = malloc(0x1000);
|
void *base = malloc(0x1000);
|
||||||
if (!base)
|
if (!base)
|
||||||
return 1;
|
return 1001;
|
||||||
|
|
||||||
uint64_t *vma_ptr = reinterpret_cast<uint64_t*>(base);
|
uint64_t *vma_ptr = reinterpret_cast<uint64_t*>(base);
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
@@ -107,7 +107,7 @@ main(int argc, const char **argv)
|
|||||||
|
|
||||||
j6::channel *chan = j6::channel::create(0x2000);
|
j6::channel *chan = j6::channel::create(0x2000);
|
||||||
if (!chan)
|
if (!chan)
|
||||||
return 2;
|
return 1002;
|
||||||
|
|
||||||
j6_log("main thread created channel");
|
j6_log("main thread created channel");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user