options/ansi: Implement stdio functions for gcc

This commit is contained in:
Alexander van der Grinten 2019-02-14 19:54:05 +01:00
parent 2581f29c52
commit 02550f623e
3 changed files with 8 additions and 7 deletions

View file

@ -394,11 +394,15 @@ FILE *stderr = &stderrFile;
FILE *stdin = &stdinFile;
FILE *stdout = &stdoutFile;
int fileno(FILE *file_base) {
int fileno_unlocked(FILE *file_base) {
auto file = static_cast<mlibc::fd_file *>(file_base);
return file->fd();
}
int fileno(FILE *file_base) {
return fileno_unlocked(file_base);
}
FILE *fopen(const char *path, const char *mode) {
// Consume the first char; this must be 'r', 'w' or 'a'.
int flags;

View file

@ -510,10 +510,6 @@ int ferror_unlocked(FILE *file_base) {
return file_base->__status_bits & __MLIBC_ERROR_BIT;
}
int fileno_unlocked(FILE *) {
__ensure(!"Not implemented");
__builtin_unreachable();
}
int fgetc_unlocked(FILE *) {
__ensure(!"Not implemented");
__builtin_unreachable();

View file

@ -1,6 +1,7 @@
#include <stdio_ext.h>
#include <bits/ensure.h>
#include <mlibc/debug.hpp>
size_t __fbufsize(FILE *) {
__ensure(!"Not implemented");
@ -32,8 +33,8 @@ int __fwriting(FILE *file_base) {
}
int __fsetlocking(FILE *, int) {
__ensure(!"Not implemented");
__builtin_unreachable();
mlibc::infoLogger() << "mlibc: __fsetlocking() is a no-op" << frg::endlog;
return FSETLOCKING_INTERNAL;
}
void _flushlbf(void) {