summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-02-28 23:56:44 +0000
committerJens Arnold <amiconn@rockbox.org>2006-02-28 23:56:44 +0000
commitb4ada860b3f9b5811de9b4bb1de78c042e7a349e (patch)
tree3bc7f11e47f3ec36f439453fca1bf044afb9b225
parentef4e43822fcbdfeb9ede918eb7936d0c945f66ac (diff)
downloadrockbox-b4ada860b3f9b5811de9b4bb1de78c042e7a349e.tar.gz
rockbox-b4ada860b3f9b5811de9b4bb1de78c042e7a349e.zip
Allow building simulators on systems where errno is thread-local by using the system's implementation of errno.h for simulator builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8871 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagdb/parser.c3
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/include/errno.h7
-rw-r--r--uisimulator/sdl/kernel.c5
-rw-r--r--uisimulator/win32/kernel.c5
5 files changed, 10 insertions, 12 deletions
diff --git a/apps/tagdb/parser.c b/apps/tagdb/parser.c
index 1d251dcbe3..6eec3bad1c 100644
--- a/apps/tagdb/parser.c
+++ b/apps/tagdb/parser.c
@@ -1,11 +1,10 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
+#include <errno.h>
#include "config.h"
-int errno;
-
int read_failure(FILE *fd) {
fprintf(stderr, "Could not read from file: errno: %u ", errno);
if( feof(fd) ) fprintf(stderr, "EOF");
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 23c3a6dddc..7ebfba38e1 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -14,7 +14,9 @@ common/file.c
common/dircache.c
#endif
common/disk.c
+#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__)
common/errno.c
+#endif
common/memcmp.c
common/memchr.c
common/qsort.c
diff --git a/firmware/include/errno.h b/firmware/include/errno.h
index 4162f6a9ed..1843b56f1d 100644
--- a/firmware/include/errno.h
+++ b/firmware/include/errno.h
@@ -1,6 +1,12 @@
/* errno is not a global variable, because that would make using it
non-reentrant. Instead, its address is returned by the function
__errno. */
+
+#if defined(SIMULATOR) && !defined(__MINGW32__) && !defined(__CYGWIN__)
+
+#include "/usr/include/errno.h" /* use the host system implementation */
+
+#else /* use our own implementation */
#ifndef _SYS_ERRNO_H_
@@ -132,3 +138,4 @@ extern int errno;
#define __ELASTERROR 2000 /* Users can add values starting here */
#endif /* _SYS_ERRNO_H */
+#endif /* !SIMULATOR */
diff --git a/uisimulator/sdl/kernel.c b/uisimulator/sdl/kernel.c
index 2621ecebdd..0db7546860 100644
--- a/uisimulator/sdl/kernel.c
+++ b/uisimulator/sdl/kernel.c
@@ -24,11 +24,6 @@
#include "thread.h"
#include "debug.h"
-/* (Daniel 2002-10-31) Mingw32 requires this errno variable to be present.
- I'm not quite sure why and I don't know if this breaks the MSVC compile.
- If it does, we should put this within #ifdef __MINGW32__ */
-int errno;
-
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
int set_irq_level (int level)
diff --git a/uisimulator/win32/kernel.c b/uisimulator/win32/kernel.c
index 08b3114f08..34100a234e 100644
--- a/uisimulator/win32/kernel.c
+++ b/uisimulator/win32/kernel.c
@@ -24,11 +24,6 @@
#include "thread.h"
#include "debug.h"
-/* (Daniel 2002-10-31) Mingw32 requires this errno variable to be present.
- I'm not quite sure why and I don't know if this breaks the MSVC compile.
- If it does, we should put this within #ifdef __MINGW32__ */
-int errno;
-
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
int set_irq_level (int level)