summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Walsh <benjamin.walsh@windriver.com>2015-12-04 15:15:44 -0500
committerAnas Nashif <anas.nashif@intel.com>2016-02-05 20:24:58 -0500
commitfc1c0c33458668489f1660f386c19a3d0b1433d0 (patch)
treeeb2b61da157b51c1986bd25b09c4060a4cbb66aa /lib
parent3181df6db4cdb7c7366c3c7c35d8969952a36b79 (diff)
libc/minimal: use per-thread errno implementation
Provides proper access to the per-thread errno variable, by using the _get_errno() call. Users can now do: errno = EINVAL; printk("errno: %d\n", errno); Change-Id: I0ef365199656d002623b39b7f45f14f561501375 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/minimal/include/errno.h4
-rw-r--r--lib/libc/minimal/source/string/Makefile2
-rw-r--r--lib/libc/minimal/source/string/errno.c20
3 files changed, 3 insertions, 23 deletions
diff --git a/lib/libc/minimal/include/errno.h b/lib/libc/minimal/include/errno.h
index d5e6fd9c2..f999bd13f 100644
--- a/lib/libc/minimal/include/errno.h
+++ b/lib/libc/minimal/include/errno.h
@@ -32,8 +32,8 @@ extern "C" {
#endif
-/* Stub: this should be implemented as a thread local variable */
-extern int errno;
+extern int *_get_errno(void);
+#define errno (*_get_errno())
/*
* POSIX Error codes
diff --git a/lib/libc/minimal/source/string/Makefile b/lib/libc/minimal/source/string/Makefile
index 07e44f3d8..c64286d68 100644
--- a/lib/libc/minimal/source/string/Makefile
+++ b/lib/libc/minimal/source/string/Makefile
@@ -1,2 +1,2 @@
obj-y := string.o
-obj-$(CONFIG_MINIMAL_LIBC_EXTENDED) += errno.o strncasecmp.o
+obj-$(CONFIG_MINIMAL_LIBC_EXTENDED) += strncasecmp.o
diff --git a/lib/libc/minimal/source/string/errno.c b/lib/libc/minimal/source/string/errno.c
deleted file mode 100644
index 7082ff488..000000000
--- a/lib/libc/minimal/source/string/errno.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2015 Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/* Stub: this should be implemented as a thread local variable */
-int errno;
-