summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-03-11 18:57:22 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2013-03-11 18:57:22 +0100
commit25f04a68a168a948783618910e115316eb0ed3fc (patch)
treeb3cb88e49ef21b5855569918634937bdbf78b19e /sys/include
parent34ec2056041a193a471701dd50e2032dc300fb0e (diff)
ape: threadsafe errno
store errno on the private process stack so its always per process and not just per memory space. errno itself becomes a macro dereferencing int *_errnoloc; which is initialized from main9.s pointing to the private stack location. various fixes in programs that just imported errno variable with "extern int errno;" instead of including <errno.h>.
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/ape/errno.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/include/ape/errno.h b/sys/include/ape/errno.h
index 6e821c28d..01fab5c36 100644
--- a/sys/include/ape/errno.h
+++ b/sys/include/ape/errno.h
@@ -2,7 +2,8 @@
#define __ERRNO
#pragma lib "/$M/lib/ape/libap.a"
-extern int errno;
+extern int *_errnoloc;
+#define errno (*_errnoloc)
#define EDOM 1000
#define ERANGE 1001