2020-06-15 07:18:57 -07:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_STDIO_INTERNAL_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_STDIO_INTERNAL_H_
|
|
|
|
#include "libc/stdio/stdio.h"
|
2023-08-13 20:31:27 -07:00
|
|
|
#include "libc/thread/thread.h"
|
2021-03-26 22:31:41 -07:00
|
|
|
|
|
|
|
#define PUSHBACK 12
|
|
|
|
|
2020-06-15 07:18:57 -07:00
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
2023-08-13 20:31:27 -07:00
|
|
|
struct FILE {
|
2023-09-11 21:34:53 -07:00
|
|
|
uint8_t bufmode; /* _IOFBF, etc. (ignored if fd=-1) */
|
|
|
|
char noclose; /* for fake dup() todo delete! */
|
|
|
|
char dynamic; /* did malloc() create this object? */
|
|
|
|
uint32_t iomode; /* O_RDONLY, etc. (ignored if fd=-1) */
|
|
|
|
int32_t state; /* 0=OK, -1=EOF, >0=errno */
|
|
|
|
int fd; /* ≥0=fd, -1=closed|buffer */
|
|
|
|
uint32_t beg;
|
|
|
|
uint32_t end;
|
|
|
|
char *buf;
|
|
|
|
uint32_t size;
|
|
|
|
uint32_t nofree;
|
|
|
|
int pid;
|
|
|
|
char *getln;
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
struct FILE *next;
|
|
|
|
char mem[BUFSIZ];
|
2023-08-13 20:31:27 -07:00
|
|
|
};
|
|
|
|
|
2023-07-24 08:31:54 -07:00
|
|
|
extern uint64_t g_rando;
|
2022-08-11 12:26:30 -07:00
|
|
|
|
2023-07-24 08:31:54 -07:00
|
|
|
int __fflush_impl(FILE *);
|
|
|
|
int __fflush_register(FILE *);
|
|
|
|
void __fflush_unregister(FILE *);
|
|
|
|
bool __stdio_isok(FILE *);
|
|
|
|
FILE *__stdio_alloc(void);
|
|
|
|
void __stdio_free(FILE *);
|
2020-06-15 07:18:57 -07:00
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_STDIO_INTERNAL_H_ */
|