From: Tulio A M Mendes Date: Wed, 11 Feb 2026 22:57:23 +0000 (-0300) Subject: feat: per-process errno + set_thread_area syscall stub for future TLS X-Git-Url: https://projects.tadryanom.me/docs/static/gitweb.css?a=commitdiff_plain;h=65dad3bea6f039ff578e9f9bf04db929c2c42adb;p=AdrOS.git feat: per-process errno + set_thread_area syscall stub for future TLS - user/errno.c: documented per-process errno isolation via fork - include/syscall.h: added SYSCALL_SET_THREAD_AREA(57) for future TLS - src/kernel/syscall.c: set_thread_area dispatch stub (-ENOSYS) - True TLS deferred until clone/threads (task #14) is implemented - cppcheck clean, 19/19 smoke tests pass --- diff --git a/include/syscall.h b/include/syscall.h index c7cc012..2948163 100644 --- a/include/syscall.h +++ b/include/syscall.h @@ -76,6 +76,8 @@ enum { SYSCALL_LINK = 54, SYSCALL_SYMLINK = 55, SYSCALL_READLINK = 56, + + SYSCALL_SET_THREAD_AREA = 57, }; #endif diff --git a/src/kernel/syscall.c b/src/kernel/syscall.c index 0e0489a..999115e 100644 --- a/src/kernel/syscall.c +++ b/src/kernel/syscall.c @@ -2148,6 +2148,12 @@ void syscall_handler(struct registers* regs) { return; } + if (syscall_no == SYSCALL_SET_THREAD_AREA) { + /* Stub: will be implemented when clone/threads are added */ + regs->eax = (uint32_t)-ENOSYS; + return; + } + regs->eax = (uint32_t)-ENOSYS; } diff --git a/user/errno.c b/user/errno.c index 8330a8f..fbc6e36 100644 --- a/user/errno.c +++ b/user/errno.c @@ -1 +1,4 @@ +/* Per-process errno: each fork()ed process gets its own copy in its + address space. When true threads (clone) are added, this must become + __thread int errno or use a TLS segment (GS/FS). */ int errno = 0;