Fixed stdin/stdout/stderr declarations

This commit is contained in:
g1n 2021-12-30 22:09:36 +02:00
parent 887bd0b242
commit 8acc7de89c
Signed by: g1n
GPG Key ID: 8D352193D65D4E2C
2 changed files with 18 additions and 4 deletions

View File

@ -2,6 +2,6 @@
int main() { int main() {
char hellostr[] = "Hello, World!\n"; char hellostr[] = "Hello, World!\n";
sys_write(0, hellostr, sizeof(hellostr)); sys_write(stdout->fd, hellostr, sizeof(hellostr));
return 0; return 0;
} }

View File

@ -1,9 +1,23 @@
#include <liblinux.h> #include <liblinux.h>
#include <liblinux/syscall.h> #include <liblinux/syscall.h>
FILE *stdin = {0}; // FIXME FILE __stdin_FILE = {
FILE *stdout = {1}; .fd = 0
FILE *stderr = {2}; };
FILE *stdin = &__stdin_FILE;
FILE __stdout_FILE = {
.fd = 1
};
FILE *stdout = &__stdout_FILE;
FILE __stderr_FILE = {
.fd = 2
};
FILE *stderr = &__stderr_FILE;
_Noreturn void sys_exit(int status) { _Noreturn void sys_exit(int status) {
syscall(__NR_exit, status); syscall(__NR_exit, status);