From 1544491b3b1a854e2c8333ca75d6b20a5550e03f Mon Sep 17 00:00:00 2001
From: John Hodge <tpg@mutabah.net>
Date: Mon, 18 Jul 2011 21:39:38 +0800
Subject: [PATCH] Kernel - Added an errno macro (implemented with TLS)

---
 Kernel/include/acess.h | 5 ++++-
 Kernel/vfs/mmap.c      | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Kernel/include/acess.h b/Kernel/include/acess.h
index 707ad7f3..ad865784 100644
--- a/Kernel/include/acess.h
+++ b/Kernel/include/acess.h
@@ -39,7 +39,7 @@ typedef struct sShortSpinlock	tShortSpinlock;
  */
 
 /**
- * \name Per-Process Configuration Settings
+ * \name Per-Thread Configuration Settings
  * \{
  */
 enum eConfigTypes {
@@ -52,10 +52,13 @@ enum eConfigs {
 	CFG_VFS_CWD,
 	CFG_VFS_MAXFILES,
 	CFG_VFS_CHROOT,
+	CFG_ERRNO,
 	NUM_CFG_ENTRIES
 };
 #define CFGINT(id)	(*Threads_GetCfgPtr(id))
 #define CFGPTR(id)	(*(void**)Threads_GetCfgPtr(id))
+
+#define errno	(CFGINT(CFG_ERRNO))
 /**
  * \}
  */
diff --git a/Kernel/vfs/mmap.c b/Kernel/vfs/mmap.c
index 98137d44..7c3fdf4b 100644
--- a/Kernel/vfs/mmap.c
+++ b/Kernel/vfs/mmap.c
@@ -21,7 +21,7 @@ struct sVFS_MMapPageBlock
 };
 
 // === CODE ===
-void *VFS_MMap(int *ErrNo, void *DestHint, size_t Length, int Protection, int Flags, int FD, Uint64 Offset)
+void *VFS_MMap(void *DestHint, size_t Length, int Protection, int Flags, int FD, Uint64 Offset)
 {
 	tVFS_Handle	*h;
 	tVAddr	mapping_dest;
@@ -115,7 +115,7 @@ void *VFS_MMap(int *ErrNo, void *DestHint, size_t Length, int Protection, int Fl
 	return NULL;
 }
 
-int VFS_MUnmap(int *ErrNo, void *Addr, size_t Length)
+int VFS_MUnmap(void *Addr, size_t Length)
 {
 	return 0;
 }
-- 
GitLab