]> 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 14233ff89bd40f8fead2202f1efb6704fff5ace1..77a5a88dc66c94fa36c4ad86ee20e0f5b6ece6a5 100644 (file)
@@ -85,6 +85,8 @@ enum {
     SYSCALL_LINK     = 54,
     SYSCALL_SYMLINK  = 55,
     SYSCALL_READLINK = 56,
+
+    SYSCALL_SET_THREAD_AREA = 57,
 };
 
 #endif
index 6617c10bc3225ed3d6c89aad93bc83adbb0aca9e..44a733ec89febe5e317a5c5999a6dec33c402ff9 100644 (file)
@@ -2157,6 +2157,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 74d9f803ec9854b2a9d2daa35065ed9fa33bba58..dd029b741c016a84013e6e5f81b4d9af82ccce34 100644 (file)
@@ -7,4 +7,7 @@
  * Source: https://github.com/tadryanom/AdrOS
  */
 
+/* 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;