summaryrefslogtreecommitdiff
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 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdint.h> 2#include <stdint.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <errno.h>
4 5
5#include "config.h" 6#include "config.h"
6 7
7int errno;
8
9int read_failure(FILE *fd) { 8int read_failure(FILE *fd) {
10 fprintf(stderr, "Could not read from file: errno: %u ", errno); 9 fprintf(stderr, "Could not read from file: errno: %u ", errno);
11 if( feof(fd) ) fprintf(stderr, "EOF"); 10 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
14common/dircache.c 14common/dircache.c
15#endif 15#endif
16common/disk.c 16common/disk.c
17#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__)
17common/errno.c 18common/errno.c
19#endif
18common/memcmp.c 20common/memcmp.c
19common/memchr.c 21common/memchr.c
20common/qsort.c 22common/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 @@
1/* errno is not a global variable, because that would make using it 1/* errno is not a global variable, because that would make using it
2 non-reentrant. Instead, its address is returned by the function 2 non-reentrant. Instead, its address is returned by the function
3 __errno. */ 3 __errno. */
4
5#if defined(SIMULATOR) && !defined(__MINGW32__) && !defined(__CYGWIN__)
6
7#include "/usr/include/errno.h" /* use the host system implementation */
8
9#else /* use our own implementation */
4 10
5#ifndef _SYS_ERRNO_H_ 11#ifndef _SYS_ERRNO_H_
6 12
@@ -132,3 +138,4 @@ extern int errno;
132#define __ELASTERROR 2000 /* Users can add values starting here */ 138#define __ELASTERROR 2000 /* Users can add values starting here */
133 139
134#endif /* _SYS_ERRNO_H */ 140#endif /* _SYS_ERRNO_H */
141#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 @@
24#include "thread.h" 24#include "thread.h"
25#include "debug.h" 25#include "debug.h"
26 26
27/* (Daniel 2002-10-31) Mingw32 requires this errno variable to be present.
28 I'm not quite sure why and I don't know if this breaks the MSVC compile.
29 If it does, we should put this within #ifdef __MINGW32__ */
30int errno;
31
32static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); 27static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
33 28
34int set_irq_level (int level) 29int 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 @@
24#include "thread.h" 24#include "thread.h"
25#include "debug.h" 25#include "debug.h"
26 26
27/* (Daniel 2002-10-31) Mingw32 requires this errno variable to be present.
28 I'm not quite sure why and I don't know if this breaks the MSVC compile.
29 If it does, we should put this within #ifdef __MINGW32__ */
30int errno;
31
32static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); 27static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
33 28
34int set_irq_level (int level) 29int set_irq_level (int level)