apio
810c4bc257
This commit adds open and close syscalls to the kernel, and adds matching wrappers to libc. No read/write support, so file descriptors are kind of useless for now.
29 lines
413 B
C
29 lines
413 B
C
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
|
|
void bye()
|
|
{
|
|
printf("byeee!\n");
|
|
}
|
|
|
|
int main()
|
|
{
|
|
atexit(bye);
|
|
printf("Welcome to %s from userspace!\n", "Luna");
|
|
|
|
int fd = open("/etc/motd", 0);
|
|
if (fd < 0)
|
|
{
|
|
perror("open");
|
|
return 1;
|
|
}
|
|
|
|
close(fd);
|
|
|
|
time_t now = time(NULL);
|
|
printf("date: %s", ctime(&now));
|
|
}
|