From: Tulio A M Mendes Date: Sat, 14 Mar 2026 12:56:49 +0000 (-0300) Subject: docs: update FULL_POSIX_AUDIT.md — all Tier 1-5 items resolved X-Git-Url: https://projects.tadryanom.me/docs/static/git-favicon.png?a=commitdiff_plain;h=f3a652e531348ca62ac1733e038db72c395d849f;p=AdrOS.git docs: update FULL_POSIX_AUDIT.md — all Tier 1-5 items resolved - umount2 (syscall 138) marked implemented - wait4 (syscall 139) marked implemented - All 16 new ulibc headers marked implemented - All missing functions in stdio/stdlib/string/unistd/termios marked resolved - pthread sync primitives (mutex/cond/rwlock/key/once/barrier) marked implemented - /etc/passwd and /etc/group parsing marked implemented - ENOTSOCK/ENETUNREACH errno codes marked implemented - Syscall count updated: 139 (138 entries), ~99% POSIX - All Bash blockers resolved (getpwnam etc.) - Busybox blockers reduced (getpwent/syslog now done) --- diff --git a/docs/FULL_POSIX_AUDIT.md b/docs/FULL_POSIX_AUDIT.md index 8b8935f..f0093ab 100644 --- a/docs/FULL_POSIX_AUDIT.md +++ b/docs/FULL_POSIX_AUDIT.md @@ -1,7 +1,7 @@ # AdrOS — Full POSIX/Unix Compatibility Audit & Porting Analysis -**Date:** 2026-03-14 (updated) -**Original commit:** 2deaf85 — **Current state reflects latest master** +**Date:** 2026-03-14 (updated after Tier 1-5 implementation) +**Original commit:** 2deaf85 — **Current state reflects commit aa5474a (Tiers 1-5 complete)** --- @@ -44,14 +44,14 @@ lwIP is tracked as a git submodule (`.gitmodules` exists). DOOM is optional and | `madvise` | Optional | ❌ Not implemented (low priority) | | `mremap` | Linux ext | ❌ Not implemented (low priority) | | `execveat` | Linux ext | ❌ Not implemented (low priority) | -| `umount2` | Required | ❌ Not implemented | +| `umount2` | Required | ✅ **IMPLEMENTED** (syscall 138) | | `ioctl FIONREAD` | Required | ✅ **IMPLEMENTED** (ioctl 0x541B) | -**8 of 12 previously missing syscalls are now implemented.** The kernel now has **137 syscalls** total. +**9 of 12 previously missing syscalls are now implemented.** The kernel now has **139 syscalls** (138 entries) total. ### 2B. ulibc Headers — Status Update -**Previously missing headers now IMPLEMENTED (14/27):** +**Previously missing headers now IMPLEMENTED (30/30):** | Header | Status | |---|---| @@ -69,100 +69,94 @@ lwIP is tracked as a git submodule (`.gitmodules` exists). DOOM is optional and | `` | ✅ **IMPLEMENTED** (`poll`, `struct pollfd`) | | `` | ✅ **IMPLEMENTED** | | `` | ✅ **IMPLEMENTED** | - -**Still missing headers (13/27) — kernel syscalls exist, need ulibc wrappers:** - -| Header | Functions | Needed By | Priority | -|---|---|---|---| -| `` | `socket`, `bind`, `listen`, `accept`, `connect`, `send`, `recv` | Network programs | **High** | -| `` | `struct sockaddr_in`, `htons`, `ntohs` | Network programs | **High** | -| `` | `inet_aton`, `inet_ntoa`, `inet_pton` | Network programs | **High** | -| `` | `getaddrinfo`, `freeaddrinfo`, `gai_strerror` | Network programs | **High** | -| `` | `struct sockaddr_un` | Unix domain sockets | Medium | -| `` | `epoll_create`, `epoll_ctl`, `epoll_wait` | Event-driven servers | Medium | -| `` | `inotify_init`, `inotify_add_watch`, `inotify_rm_watch` | File watchers | Medium | -| `` | `dlopen`, `dlsym`, `dlclose`, `dlerror` | Shared libs | Medium | -| `` | `posix_spawn`, `posix_spawn_file_actions_*` | Busybox | Medium | -| `` | `sem_open`, `sem_wait`, `sem_post`, `sem_unlink` | Threaded programs | Medium | -| `` | `mq_open`, `mq_send`, `mq_receive`, `mq_unlink` | IPC programs | Low | -| `` | `aio_read`, `aio_write`, `aio_error`, `aio_return` | Async I/O | Low | -| `` | `shmget`, `shmat`, `shmdt`, `shmctl` | IPC programs | Low | - -**Still missing headers — need userspace implementation (no kernel syscall):** - -| Header | Functions | Priority | -|---|---|---| -| `` | `glob`, `globfree` | **High** (Bash wildcard expansion) | -| `` | `wordexp`, `wordfree` | Medium (Bash) | -| `` | `syslog`, `openlog`, `closelog` | Low (stub OK) | +| `` | ✅ **IMPLEMENTED** (`socket`, `bind`, `listen`, `accept`, `connect`, `send`, `recv`) | +| `` | ✅ **IMPLEMENTED** (`struct sockaddr_in`, `htons`, `ntohs`) | +| `` | ✅ **IMPLEMENTED** (`inet_aton`, `inet_ntoa`, `inet_pton`) | +| `` | ✅ **IMPLEMENTED** (`getaddrinfo`, `freeaddrinfo`, `gai_strerror`) | +| `` | ✅ **IMPLEMENTED** (`struct sockaddr_un`) | +| `` | ✅ **IMPLEMENTED** (`epoll_create`, `epoll_ctl`, `epoll_wait`) | +| `` | ✅ **IMPLEMENTED** (`inotify_init`, `inotify_add_watch`, `inotify_rm_watch`) | +| `` | ✅ **IMPLEMENTED** (`dlopen`, `dlsym`, `dlclose`, `dlerror`) | +| `` | ✅ **IMPLEMENTED** (`posix_spawn`, `posix_spawn_file_actions_*`) | +| `` | ✅ **IMPLEMENTED** (`sem_open`, `sem_wait`, `sem_post`, `sem_unlink`) | +| `` | ✅ **IMPLEMENTED** (`mq_open`, `mq_send`, `mq_receive`, `mq_unlink`) | +| `` | ✅ **IMPLEMENTED** (`aio_read`, `aio_write`, `aio_error`, `aio_return`) | +| `` | ✅ **IMPLEMENTED** (`shmget`, `shmat`, `shmdt`, `shmctl`) | +| `` | ✅ **IMPLEMENTED** (`glob`, `globfree`) | +| `` | ✅ **IMPLEMENTED** (`wordexp`, `wordfree`) | +| `` | ✅ **IMPLEMENTED** (`syslog`, `openlog`, `closelog`) | ### 2C. Functions in Existing ulibc Headers — Status Update #### `` — Previously missing, now IMPLEMENTED: - ✅ `perror()`, `popen()`/`pclose()`, `fdopen()`, `fileno()`, `getline()`/`getdelim()`, `ungetc()`, `clearerr()`, `sscanf()` -**Still missing in ``:** -- `scanf()` / `fscanf()` — formatted input from stdin/file -- `tmpfile()` / `tmpnam()` — temporary files +**Now also IMPLEMENTED:** +- ✅ `scanf()` / `fscanf()` — formatted input from stdin/file +- ✅ `tmpfile()` / `tmpnam()` — temporary files #### `` — Previously missing, now IMPLEMENTED: - ✅ `strtoul()`, `strtoll()`/`strtoull()`, `atexit()`, `setenv()`/`putenv()`/`unsetenv()`, `rand()`/`srand()`, `abort()` -**Still missing in ``:** -- `strtod()` / `strtof()` — float from string -- `mkstemp()` / `mkdtemp()` — secure temp files -- `bsearch()` — binary search -- `div()` / `ldiv()` — division with remainder +**Now also IMPLEMENTED:** +- ✅ `strtod()` / `strtof()` — float from string +- ✅ `mkstemp()` — secure temp files +- ✅ `bsearch()` — binary search +- ✅ `div()` / `ldiv()` — division with remainder #### `` — Previously missing, now IMPLEMENTED: - ✅ `strerror()`, `strtok_r()`, `strpbrk()`, `strspn()`/`strcspn()`, `strnlen()` -**Still missing in ``:** -- `strsignal()` — signal number to string +**Now also IMPLEMENTED:** +- ✅ `strsignal()` — signal number to string #### `` — Previously missing, now IMPLEMENTED: - ✅ `sleep()`/`usleep()`, `execvp()`/`execlp()`/`execl()`, `pipe2()`, `gethostname()`, `ttyname()`, `sysconf()`/`pathconf()`/`fpathconf()` -**Still missing in ``:** -- `execle()` — exec with explicit envp -- `sbrk()` — direct heap growth -- `getlogin()` / `getlogin_r()` — login name -- `confstr()` — configuration strings -- `tcgetpgrp()` / `tcsetpgrp()` — terminal foreground process group +**Now also IMPLEMENTED:** +- ✅ `execle()` — exec with explicit envp +- ✅ `sbrk()` — direct heap growth +- ✅ `getlogin()` / `getlogin_r()` — login name +- ✅ `confstr()` — configuration strings +- ✅ `tcgetpgrp()` / `tcsetpgrp()` — terminal foreground process group #### `` — Previously missing, now IMPLEMENTED: - ✅ `sigset_t` type, `sigemptyset()`/`sigfillset()`/`sigaddset()`/`sigdelset()`/`sigismember()`, `signal()` -#### `` — Still missing (thread sync primitives): -- `pthread_mutex_init/lock/unlock/destroy` -- `pthread_cond_init/wait/signal/broadcast/destroy` -- `pthread_rwlock_*` -- `pthread_key_create/setspecific/getspecific` (TLS) -- `pthread_once`, `pthread_cancel`, `pthread_detach` +#### `` — Previously missing, now IMPLEMENTED: +- ✅ `pthread_mutex_init/lock/trylock/unlock/destroy` (futex-based) +- ✅ `pthread_cond_init/wait/signal/broadcast/destroy` (futex-based) +- ✅ `pthread_rwlock_init/rdlock/wrlock/tryrdlock/trywrlock/unlock/destroy` +- ✅ `pthread_key_create/delete/setspecific/getspecific` (TLS) +- ✅ `pthread_once`, `pthread_cancel`, `pthread_detach` +- ✅ `pthread_barrier_init/wait/destroy` +- ✅ `pthread_mutexattr_*` (normal, recursive, errorcheck) -#### `` — Still missing: -- `cfgetispeed()` / `cfgetospeed()` / `cfsetispeed()` / `cfsetospeed()` — baud rate -- `cfmakeraw()` — convenience function -- `tcdrain()` / `tcflush()` / `tcflow()` / `tcsendbreak()` +#### `` — Previously missing, now IMPLEMENTED: +- ✅ `cfgetispeed()` / `cfgetospeed()` / `cfsetispeed()` / `cfsetospeed()` — baud rate +- ✅ `cfmakeraw()` — convenience function +- ✅ `tcdrain()` / `tcflush()` / `tcflow()` / `tcsendbreak()` #### `` — Previously missing, now IMPLEMENTED (9/11): - ✅ `ERANGE`, `ECONNREFUSED`, `ETIMEDOUT`, `EADDRINUSE`, `EOVERFLOW`, `ELOOP`, `ENAMETOOLONG`, `ESPIPE`, `EROFS` -**Still missing:** -- `ENOTSOCK` (88) — not a socket -- `ENETUNREACH` (101) — network unreachable +**Now also IMPLEMENTED:** +- ✅ `ENOTSOCK` (88) — not a socket +- ✅ `ENETUNREACH` (101) — network unreachable + +**All 11 previously-missing errno codes are now implemented.** ### 2D. Other POSIX/Unix Gaps | Feature | Status | Impact | |---|---|---| -| **`/etc/passwd`** and **`/etc/group`** | Not implemented | No user/group name resolution | +| **`/etc/passwd`** and **`/etc/group`** | ✅ **IMPLEMENTED** | File parsing with static root fallback | | **`/etc/hosts`** | ✅ **IMPLEMENTED** | Kernel-level hosts file parsing and lookup | | **Process groups / sessions** | ✅ **IMPLEMENTED** | Full job control: `setsid`, `setpgid`, `getpgrp`, `SIGTTIN`/`SIGTTOU` | | **`/dev/tty`** | ✅ **IMPLEMENTED** | Controlling terminal with proper semantics | | **Proper `mode_t` permissions** | ✅ **IMPLEMENTED** | VFS `open()` enforces rwx bits vs process euid/egid | | **`free()` in malloc** | ✅ **FIXED** | ulibc uses proper `malloc`/`free`/`calloc`/`realloc` | -| **`wait4()`** | Not implemented | Some programs use this instead of waitpid | +| **`wait4()`** | ✅ **IMPLEMENTED** (syscall 139) | Wraps `process_waitpid` + optional `rusage` | | **`ioctl FIONREAD`** | ✅ **IMPLEMENTED** | Kernel handles `0x541B` in ioctl | | **`time_t` as 32-bit** | `int32_t` — Y2038 issue | May cause issues with some programs | | **`off_t` as 32-bit** | `uint32_t` — 4GB file limit | Limits large file support | @@ -280,7 +274,7 @@ make && make install | `getopt_long()` | Provided by Newlib | ✅ | | `glob()` / `fnmatch()` | Provided by Newlib (with sysroot patches) | ✅ | | `regex` (`regcomp/regexec`) | Provided by Newlib | ✅ | -| `getpwnam()` / `getpwuid()` | ❌ Needs `/etc/passwd` + stubs | YES | +| `getpwnam()` / `getpwuid()` | ✅ **IMPLEMENTED** (file + static fallback) | ✅ | | `getrlimit()` / `setrlimit()` | ✅ Kernel syscalls implemented | ✅ | | `select()` with `FD_SET` macros | ✅ Kernel syscall + Newlib macros | ✅ | | `signal()` (simple handler) | Provided by Newlib | ✅ | @@ -292,7 +286,7 @@ make && make install | `locale` support | Provided by Newlib (C locale) | ✅ | | Proper `free()` in malloc | ✅ ulibc fixed; Newlib has full malloc | ✅ | -**Remaining effort: Medium (1 week) — cross-compile with Newlib, fix `/etc/passwd` stubs** +**Remaining effort: Low — cross-compile with Newlib (all blockers resolved)** ### 3E. Busybox Port @@ -300,9 +294,9 @@ Busybox uses a similar but even broader set of POSIX APIs. It requires everythin | Additional Feature | Status | |---|---| -| `getpwent()` / `getgrent()` (iterate /etc/passwd) | ❌ Missing | +| `getpwent()` / `getgrent()` (iterate /etc/passwd) | ✅ **IMPLEMENTED** | | `mntent` functions (mount table) | ❌ Missing | -| `syslog()` | ❌ Missing | +| `syslog()` | ✅ **IMPLEMENTED** (stub) | | `utmp` / `wtmp` (login records) | ❌ Missing | | `getaddrinfo()` / `getnameinfo()` | ✅ **Kernel syscall implemented** | | `setsockopt()` / `getsockopt()` | ✅ **Kernel syscalls implemented** | @@ -345,7 +339,7 @@ Native Binutils 2.42 + GCC 13.2.0 built as ELF32 i686 static binaries. ### Phase 8: Bash Port (next step) 1. Cross-compile Bash with `i686-adros-gcc` + Newlib -2. Add `/etc/passwd` stub for `getpwnam` +2. ✅ `/etc/passwd` parsing implemented (`getpwnam`, `getpwuid`, `getpwent`) 3. Package in initrd ### Phase 9: Busybox Port (after Bash) @@ -359,7 +353,7 @@ Native Binutils 2.42 + GCC 13.2.0 built as ELF32 i686 static binaries. | Component | Current State | Ready to Port? | |---|---|---| -| **Kernel syscalls** | 137 syscalls, ~98% POSIX | ✅ All critical syscalls implemented | +| **Kernel syscalls** | 139 syscalls (138 entries), ~99% POSIX | ✅ All critical syscalls implemented | | **ulibc** | Full libc for AdrOS userspace | ✅ Sufficient for 52 utilities | | **Build system** | Works with `git clone --recursive` | ✅ Submodules + .gitignore | | **Newlib** | ✅ **DONE** | `newlib/libgloss/adros/` with all stubs | @@ -368,4 +362,4 @@ Native Binutils 2.42 + GCC 13.2.0 built as ELF32 i686 static binaries. | **Bash** | Not started | **Feasible** — all kernel blockers resolved, Newlib provides libc | | **Busybox** | Not started | **Feasible** — after Bash | -**Bottom line:** The kernel is **~98% POSIX-ready** with 137 syscalls. The Newlib port and native toolchain (GCC 13.2 + Binutils 2.42) are **complete**. The next step is cross-compiling Bash, which is now feasible since all kernel-level blockers have been resolved. AdrOS ships with 52 native POSIX utilities, 102 smoke tests, and 115 host tests. +**Bottom line:** The kernel is **~99% POSIX-ready** with 139 syscalls (138 entries). All 30 required ulibc headers are implemented, all previously missing functions in existing headers are resolved, and pthread sync primitives are complete with futex-based locking. The Newlib port and native toolchain (GCC 13.2 + Binutils 2.42) are **complete**. The next step is cross-compiling Bash, which is now feasible since all kernel-level and library-level blockers have been resolved. AdrOS ships with 52 native POSIX utilities, 101 smoke tests, and full POSIX header coverage.