diff options
| author | user <user@clank> | 2026-07-16 08:25:35 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-16 08:25:35 +0200 |
| commit | 6c64d97e70984c77be3cd8d4e03e9adf717e02fb (patch) | |
| tree | fd55f0ef943fef12a833ab526ebfe6bc5740f728 /c/gbos.h | |
| parent | filesystem: a RAM FS (WRAMX) + ls/cat/save/rm; wc/head read files (diff) | |
| download | gbos-6c64d97e70984c77be3cd8d4e03e9adf717e02fb.tar.gz gbos-6c64d97e70984c77be3cd8d4e03e9adf717e02fb.tar.xz gbos-6c64d97e70984c77be3cd8d4e03e9adf717e02fb.zip | |
shell: I/O redirection (>/<) and pipes (|); rewrite shell in C
- kernel I/O routing: PCB gains PROC_STDIN/PROC_STDOUT (default console $FF),
inherited across fork. KGetc/KPutc route read/write/putc to the console or a
file fd. New syscalls: putc(16), setin(17), setout(18), lookup(19).
read/write now go through the routing; putc/puts/nl use SYS_PUTC.
- sys_lookup + NameTable move command-name resolution into the kernel.
- shell rewritten in C (c/sh.c): tokenizes a line, parses > / < / |, and drives
fork+setin/setout+exec+wait. Pipes run as 'a > __pipe ; b < __pipe' (temp
file). asm shell + cmdtab removed; StrEqual/SkipName kept for sys_lookup.
- libc: fork/exec/wait/setin/setout/lookup wrappers.
- verified: echo>file, cat file, wc<file, cat readme|wc -l, echo ...|wc.
Diffstat (limited to '')
| -rw-r--r-- | c/gbos.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -30,4 +30,12 @@ void fremove(const char *name); #define O_READ 0 #define O_WRITE 1 #define NOFD 0xFF + +/* process control (c/libc.s) */ +unsigned char fork(void); +void exec(unsigned char id); /* replace image; never returns */ +unsigned char wait(void); +void setin(unsigned char fd); /* redirect stdin ($FF=console) */ +void setout(unsigned char fd); /* redirect stdout ($FF=console) */ +unsigned char lookup(const char *name); /* command name -> program id */ #endif |
