Skip to content
Snippets Groups Projects
Commit 36dc1d06 authored by Avi Kivity's avatar Avi Kivity
Browse files

file: don't overide FILE

Unlike most glibc data types, FILE is not opaque - it is defined as _IO_FILE
in libio.h and some glibc inlines actually use it.  So we must use the same
structure.  Do this by subclassing _IO_FILE.

Unbreaks mode=release build.
parent b9d0bb0b
No related branches found
No related tags found
No related merge requests found
#define __FILE_defined
class FILE;
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
......@@ -9,12 +6,10 @@ class FILE;
#include "libc.hh"
#include "fs/fs.hh"
class FILE {
class std_file : public _IO_FILE {
public:
explicit FILE(int fd);
~FILE();
private:
int _fd;
explicit std_file(int fd);
~std_file();
};
class __dirstream {
......@@ -26,9 +21,9 @@ private:
fileref _file;
};
FILE::FILE(int fd)
: _fd(fd)
std_file::std_file(int fd)
{
_fileno = fd;
}
__dirstream::__dirstream(fileref file)
......@@ -63,7 +58,7 @@ FILE* fopen(const char* fname, const char* fmode)
if (fd == -1) {
return nullptr;
}
return new FILE(fd);
return new std_file(fd);
}
DIR* opendir(const char* fname)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment