| Filename | Latest commit message | Latest commit date |
|---|---|---|
A leaf's value area holds variable-length records end to end, so a record begins wherever the one before it finished -- a multiple of 8 only by luck. The code reads them by casting a pointer into the block, which tells the compiler they are aligned when they are not. That works on x86, which is why it has never shown as a bug, and it is undefined in C. A compiler entitled to assume 8-byte alignment may emit an instruction that requires it, and the failure would arrive at a different optimisation level or on a different architecture looking like filesystem corruption rather than like codegen. UndefinedBehaviorSanitizer reported 31 of them across obj.c, objw.c, attr.c and space.c. Seven types now carry SCHFS_PACKED: dirent_rec, extent, extref, index_rec, attr_rec, snap and inode. Two of those -- attr_rec and inode -- were never reported, because schfs_objtest does not reach an unaligned instance of either. They were latent rather than absent, and casting into a leaf is the same lie whether or not a test has caught it yet. NO ON-DISK LAYOUT CHANGED, and that was measured before the annotation was applied rather than assumed: every one of these already carries explicit `pad` fields and therefore has no implicit padding, so sizes and member offsets are identical with and without it. Seven _Static_asserts now pin the sizes, because a record that silently grows misreads every existing volume from that point on and looks like corruption rather than like a struct that changed. schfs_node_hdr, schfs_item, schfs_kptr and schfs_uberblock are deliberately left alone. The node header is exactly 32 bytes, so the items and key pointers after it are already 8-aligned, and annotating them would cost byte-wise access on the tree's hottest paths to fix a problem they do not have. Verified by reading an image written before the change: schfs_fsck --check passes on structure, checksums, key ordering, data blocks and derived free space, and the kernel mounts its own root unchanged. Also here: mkschfs passed a null pointer to qsort for an empty directory. Every implementation ignores it when the count is zero; the standard does not say they have to. make schfs-check now runs with no sanitizer output at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2 |
||
| .. | ||
| architecture | ||
| guides | ||
| history | ||
| plan | ||
| licensing.md | ||
| README.md | ||
SchOS documentation
Four kinds of document, kept in four directories, because they answer four different questions and go stale at four different rates.
| architecture/ | What SchOS is | Present tense. Describes what is built and working. |
| plan/ | What SchOS will be | Future tense. Everything here is unbuilt. |
| guides/ | How to work on it | Imperative. Build it, test it, add to it. |
| history/ | Why it is the way it is | Past tense. Bugs whose cause is not visible from the fix. |
Plus one rule that belongs to no category and applies to everything: licensing.md — read it before copying anyone else's code in.
The rule that keeps this from rotting
When something is finished, it moves from
plan/toarchitecture/and is rewritten as a description of the thing rather than a record of building it.
A completed item is not a ticked checkbox. A ticked checkbox says the work happened; it does not say what the work produced, and six months later the checkbox is the only thing left and it explains nothing.
So finishing a piece of work has three steps, and the third is not optional:
- The code works and is tested.
- The plan entry is deleted.
- A description exists in
architecture/written for somebody who was not there — what it does, what shape it has, what it costs, and what it still does not do.
This is not bookkeeping. The tree has already proved it necessary: the network stack was finished, verified end to end, and for a month afterwards the only description of it anywhere was a checkbox in a roadmap, four levels of indentation deep, written in the past tense of somebody arguing for the work rather than explaining the result.
The "what it does not do" section is the one that pays. Every description in
architecture/ ends with one. A document that only lists a subsystem's
strengths is marketing, and the reader who most needs the document is the one
about to trip over a limitation nobody wrote down.
Start here
New to the tree → architecture/README.md, the system layer by layer, then guides/layout.md for where the files are.
Trying to build it → guides/building.md.
Wondering what happens next → plan/1.0.md, which is the finish line, then plan/README.md for the order.
Something is broken and it feels familiar → history/. There is a good chance it is in there.
architecture/ — what SchOS is
| README | The system, layer by layer. Read first. |
| boot.md | Firmware to the first userspace process. |
| kernel.md | SchIFT: memory, processes, scheduling, traps, signals, SMP. |
| syscalls.md | The call table, and the Linux personality that lets real software run. |
| filesystem.md | The VFS, the buffer cache, procfs, mounts. |
| schfs.md | SchFS: the copy-on-write root filesystem. |
| devices.md | The device model, driver binding, the class vtables. |
| usb.md | xHCI, the USB core, and the class drivers. |
| graphics.md | Framebuffer, text rendering, console, and the crash screen. |
| networking.md | Drivers, lwIP, sockets — Unix and INET. |
| init.md | schinit, PID 1, and the job manifests. |
plan/ — what SchOS will be
| README | The three current decisions and the order they happen in. |
| 1.0.md | The finish line. What 1.0 contains, and what is explicitly deferred past it. |
| foundations.md | The kernel work everything else is blocked on. |
| init.md | PID 1 becomes a role rather than a process. |
| wayland.md | The GUI stack, and what gets deleted to make room. |
| hybrid.md | Moving drivers out of the kernel. |
| schapi.md | The long-term API layering, and the compatibility promise. |
| roadmap.md | Everything else still open. |
guides/ — how to work on it
| building.md | Prerequisites and the build, per host. |
| testing.md | The harnesses, and what each one actually proves. |
| layout.md | Repository map, and how to add a program or a port. |
| adding-a-driver.md | Writing one, binding it, publishing its class vtable. |
history/ — why it is the way it is
| README | What belongs in here and what does not. |
| kernel.md | Bugs whose cause was nowhere near their symptom. |
| moving-to-linux.md | The Windows-to-Fedora move, kept for the parts that recur. |
Writing one of these
Four conventions, all of them observable in the existing files:
State the cost. Every design choice gave something up. A document that does not say what is a document that will be argued with later by somebody who only sees the downside.
Prefer the measured number to the remembered one. "500 of 3565 files carry the advertising clause" is worth more than "some do", and it was worth the minute it took to count.
Write down the bug that shaped it. Half the non-obvious code in this tree is non-obvious because something failed once. If a design is strange, the strangeness is load-bearing and the reader deserves to know why before changing it.
No dates in headings. A date in a heading turns a description into a
changelog, and the description is the thing with a long life. Dates belong in
history/, where they mean something.