Luna/apps/src/init.c

39 lines
762 B
C
Raw Normal View History

#include <luna.h>
#include <stdio.h>
2022-10-02 17:25:56 +02:00
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <unistd.h>
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
}
printf("Welcome to Luna!\n");
2022-10-02 17:25:56 +02:00
printf("Running as tid %ld\n\n", gettid());
2022-10-02 17:25:56 +02:00
sleep(1);
2022-10-02 17:25:56 +02:00
char version[40];
syscall(SYS_getversion, version, sizeof(version));
printf("Your kernel version is %s\n\n", version);
2022-10-02 17:25:56 +02:00
sleep(2);
2022-10-02 17:25:56 +02:00
{
char* variable = malloc(200);
*variable = 3;
2022-10-08 18:11:41 +02:00
printf("Allocated variable at address %p\n", variable);
free(variable);
}
printf("Press any key to restart.\n");
2022-10-02 17:25:56 +02:00
return 0;
}