<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gbos.git/usr/stat.h, branch master</title>
<subtitle>gbos - a tiny Unix-flavored OS for the Game Boy Color (kernel, shell, coreutils in C, RAM filesystem)</subtitle>
<id>https://git.sl0p.foo/gbos.git/atom/usr/stat.h?h=master</id>
<link rel='self' href='https://git.sl0p.foo/gbos.git/atom/usr/stat.h?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/'/>
<updated>2026-09-24T10:48:37Z</updated>
<entry>
<title>kernel: stat/fsstat/isatty syscalls, and O_APPEND</title>
<updated>2026-09-24T10:48:37Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-09-24T10:48:37Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=dc9dffb9069e32a1a0cf14883176544b234fc3e5'/>
<id>urn:sha1:dc9dffb9069e32a1a0cf14883176544b234fc3e5</id>
<content type='text'>
Four things userland had no way to ask for:

- SYS_STAT: type, link count, size and inode for a path. The trap needs HL
  for its dispatch table, so a call taking both a path and an output buffer
  passes a request block - the shape SYS_NET already established. usr/stat.h
  wraps it, header-only like sock.h, because the block must live in the
  caller's RAM.
- SYS_FSSTAT: blocks/inodes, total and free. The bitmaps are already cached
  write-through in fs_bmbuf, so this is the popcount boot_fs already prints.
- SYS_ISATTY: is this process's stdin the console? The shell needs it to tell
  an interactive session from a script.
- O_APPEND: open a file positioned at EOF. There is no seek syscall, so this
  is the only way to add to a file - without it nothing running ON the Game
  Boy can build a multi-line file, shell scripts included.

Together these back ls -l, df, and `&gt;&gt;`.
</content>
</entry>
</feed>
