diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2005-02-08 19:38:47 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2005-02-08 19:38:47 +0000 |
commit | 1d7dd82d694755b854c500b1563287390149afc7 (patch) | |
tree | 05e3cd99b8311e5cc5d055357d32fdf9e61ae21d /libgloss/arm | |
parent | 01d9b1612c8658d4ebe4243462edea09dffc03e9 (diff) | |
download | cygnal-1d7dd82d694755b854c500b1563287390149afc7.tar.gz cygnal-1d7dd82d694755b854c500b1563287390149afc7.tar.bz2 cygnal-1d7dd82d694755b854c500b1563287390149afc7.zip |
2005-02-08 Antony King <antony.king@st.com>
* arm/syscalls.c: Change CHECK_INIT to pass reentrant struct
instead of file pointer.
Diffstat (limited to 'libgloss/arm')
-rw-r--r-- | libgloss/arm/syscalls.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c index 42e69b7b0..e89022806 100644 --- a/libgloss/arm/syscalls.c +++ b/libgloss/arm/syscalls.c @@ -55,20 +55,17 @@ register char * stack_ptr asm ("sp"); /* following is copied from libc/stdio/local.h to check std streams */ extern void _EXFUN(__sinit,(struct _reent *)); -#define CHECK_INIT(fp) \ - do \ - { \ - if ((fp)->_data == 0) \ - (fp)->_data = _REENT; \ - if (!(fp)->_data->__sdidinit) \ - __sinit ((fp)->_data); \ - } \ +#define CHECK_INIT(ptr) \ + do \ + { \ + if ((ptr) && !(ptr)->__sdidinit) \ + __sinit (ptr); \ + } \ while (0) /* Adjust our internal handles to stay away from std* handles. */ #define FILE_HANDLE_OFFSET (0x20) -static int std_files_checked; static int monitor_stdin; static int monitor_stdout; static int monitor_stderr; @@ -119,13 +116,8 @@ do_AngelSWI (int reason, void * arg) static int remap_handle (int fh) { - if (!std_files_checked) - { - CHECK_INIT(stdin); - CHECK_INIT(stdout); - CHECK_INIT(stderr); - std_files_checked = 1; - } + CHECK_INIT(_REENT); + if (fh == STDIN_FILENO) return monitor_stdin; if (fh == STDOUT_FILENO) |