Luna/apps/src/sym.c
apio 26211bd49f It (almost) works now
The only thing doing weird stuff is exec(), so that's commented out and throws ENOSYS right now.

But we have two user tasks running in parallel, isolated from each other!
2022-10-14 16:46:00 +02:00

38 lines
546 B
C

#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main()
{
sleep(6);
FILE* syms = fopen("/sys/moon.sym", "r");
if (!syms)
{
perror("fopen");
return 1;
}
char buf[1025];
if (fseek(syms, 8000, SEEK_SET) < 0)
{
perror("fseek");
return 1;
}
size_t nread = fread(buf, 1024, 1, syms);
if (ferror(syms))
{
perror("fread");
return 1;
}
buf[nread] = 0;
printf("%s\n", strchr(buf, '\n') + 1);
fclose(syms);
return 0;
}