libc: #define STDOUT_FILENO and STDERR_FILENO

Still missing stdin >.<
This commit is contained in:
apio 2022-10-14 21:24:18 +02:00
parent eb67ab113e
commit d5bc87099f
2 changed files with 5 additions and 2 deletions

View File

@ -5,6 +5,9 @@
#include <bits/seek.h>
#include <sys/types.h>
#define STDOUT_FILENO 0
#define STDERR_FILENO 1
#ifdef __cplusplus
extern "C"
{

View File

@ -25,7 +25,7 @@ static void check_for_file(int fd, FILE** target_stream, const char* path, const
extern "C" void initialize_libc()
{
check_for_file(0, &stdout, "/dev/console", "rw");
check_for_file(1, &stderr, "/dev/console", "rw");
check_for_file(STDOUT_FILENO, &stdout, "/dev/console", "rw");
check_for_file(STDERR_FILENO, &stderr, "/dev/console", "rw");
atexit(terminate_libc);
}