]>
Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: POSIX Phases 2-6 — syscalls, ulibc functions, headers, malloc, Newlib prep
Phase 2 — Critical Kernel Syscalls:
- SYSCALL_GETRLIMIT (129) / SYSCALL_SETRLIMIT (130): per-process resource
limits (RLIMIT_NOFILE, RLIMIT_STACK, RLIMIT_CORE, etc.) stored in process
struct, inherited on fork, enforced by setrlimit with root privilege check
- SYSCALL_SETSOCKOPT (131) / SYSCALL_GETSOCKOPT (132): SO_REUSEADDR,
SO_KEEPALIVE, SO_RCVBUF/SNDBUF, SO_ERROR, SO_TYPE via lwIP
- SYSCALL_SHUTDOWN (133): TCP half-close via tcp_shutdown
- SYSCALL_GETPEERNAME (134) / SYSCALL_GETSOCKNAME (135): socket address query
- Added missing errno codes: ENOPROTOOPT, EOVERFLOW, ELOOP
Phase 3 — Critical ulibc Functions (12 new source files):
- setjmp/longjmp/_setjmp/_longjmp/sigsetjmp/siglongjmp (i386 assembly)
- sleep()/usleep() wrappers over nanosleep
- execvp()/execlp()/execl() with PATH search
- getopt()/getopt_long() full POSIX implementation
- strerror()/perror() with 35-entry error string table
- strtoul()/strtoll()/strtoull() with base auto-detection
- setenv()/unsetenv()/putenv() with owned environ array
- signal() wrapper over sigaction (SA_RESTART)
- abort() sends SIGABRT, atexit() with 32-handler registry
- exit() now calls atexit handlers in reverse order
- rand()/srand() LCG PRNG (RAND_MAX=0x7FFF)
- strtok_r(), strnlen(), strspn(), strcspn(), strpbrk()
Phase 4 — Critical Headers (9 new headers):
- setjmp.h: jmp_buf, sigjmp_buf for i386
- locale.h: LC_* constants, struct lconv, setlocale/localeconv stubs
- pwd.h/grp.h: struct passwd/group, getpwnam/getpwuid/getpwent stubs
- getopt.h: struct option, getopt_long declarations
- fnmatch.h + fnmatch(): glob-style pattern matching with FNM_PATHNAME
- sys/select.h: fd_set, FD_SET/CLR/ISSET/ZERO macros, select()
- sys/resource.h: struct rlimit, RLIMIT_* constants, getrlimit/setrlimit
Phase 5 — Proper malloc with free():
- Replaced bump allocator with address-ordered free-list allocator
- 8-byte aligned blocks with 8-byte header (size | used_bit, next_free)
- First-fit allocation with block splitting
- free() with address-ordered insertion and bidirectional coalescing
- realloc() now preserves old data size from block header
Phase 6 — Newlib Port (from previous commit):
- libgloss stubs already complete, syscall numbers updated
97/97 smoke tests pass, cppcheck clean.
37 files changed: