Luna/apps/src/init.c

40 lines
725 B
C
Raw Normal View History

#include <luna.h>
2022-10-02 17:25:56 +02:00
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <unistd.h>
static void print(const char* message)
{
syscall(SYS_write, message, strlen(message));
}
#define println(message) print(message "\n")
int main()
{
if (gettid() == 0) // why are we the idle task?
2022-10-02 17:25:56 +02:00
{
2022-10-02 18:16:27 +02:00
__luna_abort("SHENANIGANS! init is tid 0 (which is reserved for the idle task)\n");
2022-10-02 17:25:56 +02:00
}
println("Welcome to Luna from a C init!");
println("");
sleep(1);
2022-10-02 17:25:56 +02:00
print("Your kernel version is ");
char version[40];
syscall(SYS_getversion, version, sizeof(version));
print(version);
println("\n");
sleep(2);
2022-10-02 17:25:56 +02:00
println("Press any key to restart.");
return 0;
}