Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
john-tornblom committed Feb 11, 2024
1 parent bbbfb6c commit 1c5109b
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions main.c
Expand Up @@ -229,13 +229,31 @@ serve_file(const char *path, uint16_t port) {
}


/**
*
**/
static void
init_stdio(void) {
int fd = open("/dev/console", O_WRONLY);

close(STDERR_FILENO);
close(STDOUT_FILENO);

dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);

close(fd);
}



int
main() {
uint16_t port = 3232;

init_stdio();
syscall(SYS_setsid);
syscall(SYS_thr_set_name, -1, "klogsrv.elf");
dup2(open("/dev/console", O_WRONLY), STDOUT_FILENO);
dup2(open("/dev/console", O_WRONLY), STDERR_FILENO);

while(1) {
serve_file("/dev/klog", port);
Expand Down

0 comments on commit 1c5109b

Please sign in to comment.