]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commitdiff
feat: per-process errno + set_thread_area syscall stub for future TLS
authorTulio A M Mendes <[email protected]>
Wed, 11 Feb 2026 22:57:23 +0000 (19:57 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 02:20:50 +0000 (23:20 -0300)
- 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

include/syscall.h
src/kernel/syscall.c
user/errno.c

index c7cc0129870d19755808f53d0175744ba7d6dafd..2948163d20e1cd069b8b880ab8fbd28ef726efd4 100644 (file)
@@ -76,6 +76,8 @@ enum {
     SYSCALL_LINK     = 54,
     SYSCALL_SYMLINK  = 55,
     SYSCALL_READLINK = 56,
+
+    SYSCALL_SET_THREAD_AREA = 57,
 };
 
 #endif
index 0e0489a5449779bf15394807fb6f2d5334cb0387..999115e5bd2744a634512ba87d7933fa83c14056 100644 (file)
@@ -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;
 }
 
index 8330a8fd14710e8a84777b4d4ea1ded367312ab2..fbc6e36e21c0be164db5f7a7dca52f3f40080cce 100644 (file)
@@ -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;