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!
38 lines
546 B
C
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;
|
|
} |