Luna/apps/src/init.c

39 lines
782 B
C

#include <luna.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <unistd.h>
int main()
{
if (gettid() == 0) // why are we the idle task?
{
__luna_abort("SHENANIGANS! init is tid 0 (which is reserved for the idle task)\n");
}
printf("Welcome to Luna!\n");
printf("Running as tid %ld\n\n", gettid());
sleep(1);
char version[40];
syscall(SYS_getversion, version, sizeof(version));
printf("Your kernel version is %s\n\n", version);
sleep(2);
{
char* variable = malloc(200);
*variable = 3;
printf("Allocated variable at address %lx\n", (unsigned long int)variable);
free(variable);
}
printf("Press any key to restart.\n");
return 0;
}