From: Tulio A M Mendes Date: Sat, 14 Mar 2026 12:19:09 +0000 (-0300) Subject: docs: update FULL_POSIX_AUDIT.md sections 2B/2C/2D — mark 14 headers, 20+ functions... X-Git-Url: https://projects.tadryanom.me/sitemap.xml?a=commitdiff_plain;h=61c2d2b8c0a2b3f4b28d41008968dcc7c69d5118;p=AdrOS.git docs: update FULL_POSIX_AUDIT.md sections 2B/2C/2D — mark 14 headers, 20+ functions, 9 errno codes as implemented Many items listed as missing were already implemented since the original audit. - Section 2B: 14/27 headers now exist (setjmp, locale, pwd, grp, regex, fnmatch, getopt, libgen, select, resource, utsname, poll, wait, inttypes) - Section 2C: stdio (perror, popen, fdopen, fileno, getline, ungetc, clearerr), stdlib (strtoul, strtoll/strtoull, atexit, setenv, rand, abort), string (strerror, strtok_r, strpbrk, strspn/strcspn, strnlen), unistd (sleep, execvp/execlp/execl, pipe2, gethostname, ttyname, sysconf/pathconf), signal (sigset_t macros, signal()) - Section 2D: /etc/hosts, FIONREAD, setenv/putenv, process groups, permissions, free() - errno: 9/11 codes exist (ERANGE, ECONNREFUSED, ETIMEDOUT, EADDRINUSE, EOVERFLOW, ELOOP, ENAMETOOLONG, ESPIPE, EROFS) --- diff --git a/docs/FULL_POSIX_AUDIT.md b/docs/FULL_POSIX_AUDIT.md index 918bccc..8b8935f 100644 --- a/docs/FULL_POSIX_AUDIT.md +++ b/docs/FULL_POSIX_AUDIT.md @@ -45,122 +45,112 @@ lwIP is tracked as a git submodule (`.gitmodules` exists). DOOM is optional and | `mremap` | Linux ext | ❌ Not implemented (low priority) | | `execveat` | Linux ext | ❌ Not implemented (low priority) | | `umount2` | Required | ❌ Not implemented | -| `ioctl FIONREAD` | Required | ❌ Not implemented | +| `ioctl FIONREAD` | Required | ✅ **IMPLEMENTED** (ioctl 0x541B) | -**7 of 12 previously missing syscalls are now implemented.** The kernel now has **137 syscalls** total. +**8 of 12 previously missing syscalls are now implemented.** The kernel now has **137 syscalls** total. -### 2B. Missing ulibc Headers (completely absent) +### 2B. ulibc Headers — Status Update -These POSIX headers do NOT exist at all in `user/ulibc/include/`: +**Previously missing headers now IMPLEMENTED (14/27):** + +| Header | Status | +|---|---| +| `` | ✅ **IMPLEMENTED** | +| `` | ✅ **IMPLEMENTED** | +| `` | ✅ **IMPLEMENTED** | +| `` | ✅ **IMPLEMENTED** | +| `` | ✅ **IMPLEMENTED** (`regcomp`, `regexec`, `regfree`) | +| `` | ✅ **IMPLEMENTED** | +| `` | ✅ **IMPLEMENTED** (`getopt`, `getopt_long`) | +| `` | ✅ **IMPLEMENTED** (`dirname`, `basename`) | +| `` | ✅ **IMPLEMENTED** (`select`, `FD_SET`/`FD_CLR`/`FD_ISSET`/`FD_ZERO`) | +| `` | ✅ **IMPLEMENTED** (`getrlimit`, `setrlimit`, `getrusage`) | +| `` | ✅ **IMPLEMENTED** (`uname`) | +| `` | ✅ **IMPLEMENTED** (`poll`, `struct pollfd`) | +| `` | ✅ **IMPLEMENTED** | +| `` | ✅ **IMPLEMENTED** | + +**Still missing headers (13/27) — kernel syscalls exist, need ulibc wrappers:** | Header | Functions | Needed By | Priority | |---|---|---|---| -| `` | `setjmp`, `longjmp`, `sigsetjmp`, `siglongjmp` | **Bash, GCC, Busybox, any error recovery** | **Critical** | -| `` | `setlocale`, `localeconv` | GCC, Bash, Busybox, many programs | **Critical** | -| `` | `getpwnam`, `getpwuid`, `getpwent` | Bash, Busybox, login, id, ls -l | **Critical** | -| `` | `getgrnam`, `getgrgid`, `getgrent` | Bash, Busybox, id, ls -l | **Critical** | -| `` | `regcomp`, `regexec`, `regfree` | Bash, grep, sed, awk, Busybox | **Critical** | -| `` | `glob`, `globfree` | Bash (wildcard expansion) | **Critical** | -| `` | `fnmatch` | Bash (pattern matching), find | High | -| `` | `getopt`, `getopt_long` | Almost every Unix utility | **Critical** | -| `` | `dirname`, `basename` (POSIX versions) | Many programs | High | -| `` | `gethostbyname`, `getaddrinfo`, `freeaddrinfo` | Network programs | High | -| `` | `struct sockaddr_in`, `htons`, `ntohs` | Network programs | High | -| `` | `inet_aton`, `inet_ntoa`, `inet_pton` | Network programs | High | -| `` | `socket`, `bind`, `listen`, `accept`, `connect`, `send`, `recv` | Network programs | High | -| `` | `select`, `FD_SET`, `FD_CLR`, `FD_ISSET`, `FD_ZERO` | Bash, many programs | High | -| `` | `getrlimit`, `setrlimit`, `getrusage` | Bash, GCC | High | -| `` | `uname` | Bash, Busybox, autoconf | High | -| `` | `poll`, `struct pollfd` | Many programs | High | -| `` | `dlopen`, `dlsym`, `dlclose`, `dlerror` | GCC plugins, shared libs | Medium | -| `` | `posix_spawn` | Busybox, some programs | Medium | -| `` | `wordexp`, `wordfree` | Bash | Medium | -| `` | `shmget`, `shmat`, `shmdt`, `shmctl` | IPC programs | Medium | -| `` | `sem_open`, `sem_wait`, `sem_post` | Threaded programs | Medium | -| `` | `mq_open`, `mq_send`, `mq_receive` | IPC programs | Low | -| `` | `aio_read`, `aio_write` | Async I/O programs | Low | -| `` | `epoll_create`, `epoll_ctl`, `epoll_wait` | Event-driven servers | Medium | -| `` | `inotify_init`, `inotify_add_watch` | File watchers | Low | -| `` | `syslog`, `openlog`, `closelog` | Daemons, Busybox | Low | +| `` | `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) | -### 2C. Missing Functions in EXISTING ulibc Headers +### 2C. Functions in Existing ulibc Headers — Status Update -#### `` — Missing: -- `perror()` — error printing (used everywhere) -- `popen()` / `pclose()` — pipe to/from command -- `fdopen()` — FILE* from fd -- `fileno()` — fd from FILE* -- `getline()` / `getdelim()` — dynamic line reading +#### `` — 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 -- `ungetc()` — push back character -- `clearerr()` — clear error/EOF indicators -- `scanf()` / `fscanf()` — formatted input (only `sscanf` exists) -#### `` — Missing: -- `strtoul()` — unsigned long from string (**critical for Bash/Busybox**) +#### `` — Previously missing, now IMPLEMENTED: +- ✅ `strtoul()`, `strtoll()`/`strtoull()`, `atexit()`, `setenv()`/`putenv()`/`unsetenv()`, `rand()`/`srand()`, `abort()` + +**Still missing in ``:** - `strtod()` / `strtof()` — float from string -- `strtoll()` / `strtoull()` — 64-bit integers -- `atexit()` — exit handler registration - `mkstemp()` / `mkdtemp()` — secure temp files -- `setenv()` / `putenv()` / `unsetenv()` — environment modification - `bsearch()` — binary search - `div()` / `ldiv()` — division with remainder -- `rand()` / `srand()` — random number generation -- `abort()` — abnormal termination -#### `` — Missing: -- `strerror()` — error code to string (**critical**) +#### `` — Previously missing, now IMPLEMENTED: +- ✅ `strerror()`, `strtok_r()`, `strpbrk()`, `strspn()`/`strcspn()`, `strnlen()` + +**Still missing in ``:** - `strsignal()` — signal number to string -- `strtok_r()` — reentrant tokenizer -- `strpbrk()` — scan for character set -- `strspn()` / `strcspn()` — span character sets -- `strnlen()` — bounded strlen - -#### `` — Missing: -- `sleep()` / `usleep()` — wrappers over nanosleep (**critical**) -- `execvp()` / `execlp()` / `execl()` / `execle()` — exec family (**critical for Bash**) -- `getopt()` — option parsing (**critical**) -- `sbrk()` — heap growth (Newlib needs this) -- `pipe2()` — pipe with flags -- `gethostname()` / `sethostname()` -- `getlogin()` / `getlogin_r()` -- `ttyname()` / `ttyname_r()` -- `sysconf()` / `pathconf()` / `fpathconf()` — system configuration (**critical for autoconf**) -- `confstr()` + +#### `` — 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 -#### `` — Missing: -- `sigset_t` type (currently using raw `uint32_t`) -- `sigemptyset()` / `sigfillset()` / `sigaddset()` / `sigdelset()` / `sigismember()` -- `signal()` — simple signal handler (SIG_DFL, SIG_IGN, function) +#### `` — Previously missing, now IMPLEMENTED: +- ✅ `sigset_t` type, `sigemptyset()`/`sigfillset()`/`sigaddset()`/`sigdelset()`/`sigismember()`, `signal()` -#### `` — Missing: +#### `` — 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` +- `pthread_once`, `pthread_cancel`, `pthread_detach` -#### `` — Missing: +#### `` — Still missing: - `cfgetispeed()` / `cfgetospeed()` / `cfsetispeed()` / `cfsetospeed()` — baud rate - `cfmakeraw()` — convenience function - `tcdrain()` / `tcflush()` / `tcflow()` / `tcsendbreak()` -#### `` — Missing error codes: -- `ERANGE` (34) — result too large (**critical for strtol**) +#### `` — Previously missing, now IMPLEMENTED (9/11): +- ✅ `ERANGE`, `ECONNREFUSED`, `ETIMEDOUT`, `EADDRINUSE`, `EOVERFLOW`, `ELOOP`, `ENAMETOOLONG`, `ESPIPE`, `EROFS` + +**Still missing:** - `ENOTSOCK` (88) — not a socket -- `ECONNREFUSED` (111) — connection refused -- `ETIMEDOUT` (110) — connection timed out -- `EADDRINUSE` (98) — address in use - `ENETUNREACH` (101) — network unreachable -- `EOVERFLOW` (75) — value overflow -- `ELOOP` (40) — symlink loop -- `ENAMETOOLONG` (36) — filename too long -- `ESPIPE` (29) — invalid seek -- `EROFS` (30) — read-only filesystem ### 2D. Other POSIX/Unix Gaps @@ -173,10 +163,11 @@ These POSIX headers do NOT exist at all in `user/ulibc/include/`: | **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 | +| **`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 | | **`ssize_t` return types** | `read()`/`write()` return `int` | POSIX requires `ssize_t` | -| **Environment `setenv/putenv`** | Not implemented | Cannot modify environment at runtime | +| **Environment `setenv/putenv`** | ✅ **IMPLEMENTED** | ulibc provides `setenv()`/`unsetenv()`/`putenv()` | ---