boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

commit c506d1cf9a1cfb2cffd0944f4a216b878d5c7940
parent e10111ba5d4dd010e5035144d054f587cad507b7
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Wed, 29 Apr 2026 12:12:16 -0700

mes-libc: define __std{in,out,err}

Diffstat:
Mvendor/mes-libc/lispcc-syscall.c | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/vendor/mes-libc/lispcc-syscall.c b/vendor/mes-libc/lispcc-syscall.c @@ -41,6 +41,18 @@ FILE *stdin = (FILE *) 0; FILE *stdout = (FILE *) 1; FILE *stderr = (FILE *) 2; +/* `__stdout` and friends (the int-typed fd globals oputs / fdputs read) + * are file-scope initialized in mes/mes_open.c — but that initializer + * is gated behind `#if SYSTEM_LIBC`, which we don't define. Without + * SYSTEM_LIBC we'd be left with only mes/globals.c's tentative + * `int __stdout;`, which zero-inits — meaning oputs("ok") writes to + * fd 0 (read-only stdin) and silently no-ops. unified-libc.c includes + * lispcc-syscall.c before globals.c, so cc.scm's redecl-merge sees + * the proper definition first and absorbs the later tentative. */ +int __stdin = 0; +int __stdout = 1; +int __stderr = 2; + extern long sys_read (long fd, long buf, long n); extern long sys_write (long fd, long buf, long n); extern long sys_open (long path, long flags, long mode);