1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:27:42 +00:00

Add some simple write buffering to LibC's stdio.

Plumb it all the way to the VirtualConsole. Also fix /bin/cat to write()
the whole chunks we get from read() directly to stdout.
This commit is contained in:
Andreas Kling 2018-11-08 01:23:23 +01:00
parent e287f8ef3a
commit da3857b0c2
10 changed files with 42 additions and 22 deletions

View file

@ -4,8 +4,7 @@
#include <sys/types.h>
__BEGIN_DECLS
#ifndef EOF
#ifndef EOF
#define EOF (-1)
#endif
@ -13,10 +12,16 @@ __BEGIN_DECLS
#define SEEK_CUR 1
#define SEEK_END 2
#define __STDIO_FILE_BUFFER_SIZE 128
struct __STDIO_FILE {
int fd;
int eof;
int error;
char read_buffer[__STDIO_FILE_BUFFER_SIZE];
size_t read_buffer_index;
char write_buffer[__STDIO_FILE_BUFFER_SIZE];
size_t write_buffer_index;
};
typedef struct __STDIO_FILE FILE;