mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-02 10:42:27 +00:00
Fix MODE=tinylinux build
This commit is contained in:
parent
8c645fa1ee
commit
6be030cd7c
8 changed files with 77 additions and 98 deletions
|
@ -16,30 +16,29 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/stdio/internal.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/sysv/consts/fileno.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/thread/thread.h"
|
||||
|
||||
static FILE __stdin = {
|
||||
.fd = STDIN_FILENO,
|
||||
.iomode = O_RDONLY,
|
||||
.bufmode = _IOFBF,
|
||||
.buf = __stdin.mem,
|
||||
.size = sizeof(stdin->mem),
|
||||
.lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
|
||||
};
|
||||
|
||||
/**
|
||||
* Pointer to standard input stream.
|
||||
*/
|
||||
FILE *stdin;
|
||||
|
||||
static FILE __stdin;
|
||||
FILE *stdin = &__stdin;
|
||||
|
||||
__attribute__((__constructor__(60))) static textstartup void initin(void) {
|
||||
struct stat st;
|
||||
stdin = &__stdin;
|
||||
stdin->fd = STDIN_FILENO;
|
||||
stdin->iomode = O_RDONLY;
|
||||
stdin->buf = stdin->mem;
|
||||
stdin->size = sizeof(stdin->mem);
|
||||
stdin->lock._word = PTHREAD_MUTEX_RECURSIVE;
|
||||
if (fstat(STDIN_FILENO, &st) || !S_ISREG(st.st_mode))
|
||||
stdin->bufmode = _IONBF;
|
||||
__fflush_register(stdin);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue