mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
feat(kernel): Add RB-tree/kfifo/hashtable, wait queues, futex, tiny RCU, page cache and KTest harness
Expands the kernel-and-TTY core with the primitives the higher layers have
been missing, plus an in-kernel harness that proves they work.
Data structures (lib/):
- rbtree.c: Linux-compatible red-black tree with parent pointers, full
insert/erase rebalancing, in-order iteration and an invariant validator.
- kfifo.c: power-of-two byte ring with free-running indices, so the wrap
path costs one mask instead of a branch per byte.
- hashtable.c: separately-chained table with FNV-1a hashing, string or
u64 keys, and rehash-on-growth at a 3/4 load factor.
Kernel subsystems:
- kernel/wait.c: wait queues and one-shot completion barriers, backed by a
static sleeper pool so a blocking path never re-enters the allocator.
- kernel/futex.c: 32-bucket futex hash with value re-check, requeue, and an
fmutex_t sleeping mutex built on the uncontended-fastpath protocol.
- kernel/rcu.c: tiny RCU with reader nesting, deferred callbacks, kfree_rcu
and rcu_assign_pointer/rcu_dereference publish barriers.
- mm/page_cache.c: write-back block page cache, 4 KB pages indexed by
(device, page), CLOCK second-chance eviction and dirty write-back.
- kernel/ktest.c: KUnit-style harness with 6 built-in suites, 21 cases and
735 assertions covering every subsystem above (all passing under QEMU).
LazyBox userland:
- coreutils.c: sort, uniq, cut, tr, rev, tac, nl, seq, diff, xxd, du,
factor, sum and truncate, reading through the VFS and handling the
zero-length synthetic nodes that procfs and sysfs expose.
- ktest, rcuinfo, futexinfo, waitinfo and pagecache diagnostics applets.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L5yKJT4Wo2cV3rfPrwY5MP
This commit is contained in:
1 parent
492045b24d
commit
f9400f6ac4
22 files changed
+3631
-5
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#ifndef _USERLAND_COREUTILS_H
|
||||
#define _USERLAND_COREUTILS_H
|
||||
|
||||
// GNU-style text-processing applets for LazyBox. Each entry point matches
|
||||
// applet_fn_t so it can be placed directly in the LazyBox dispatch table.
|
||||
|
||||
int coreutils_sort(int argc, char** argv);
|
||||
int coreutils_uniq(int argc, char** argv);
|
||||
int coreutils_cut(int argc, char** argv);
|
||||
int coreutils_tr(int argc, char** argv);
|
||||
int coreutils_rev(int argc, char** argv);
|
||||
int coreutils_tac(int argc, char** argv);
|
||||
int coreutils_nl(int argc, char** argv);
|
||||
int coreutils_seq(int argc, char** argv);
|
||||
int coreutils_diff(int argc, char** argv);
|
||||
int coreutils_xxd(int argc, char** argv);
|
||||
int coreutils_du(int argc, char** argv);
|
||||
int coreutils_factor(int argc, char** argv);
|
||||
int coreutils_sum(int argc, char** argv);
|
||||
int coreutils_truncate(int argc, char** argv);
|
||||
|
||||
#endif // _USERLAND_COREUTILS_H
|
||||
Reference in new issue
Block a user