diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-01-19 22:20:40 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-01-19 22:20:40 +0000 |
commit | eaa442fc4640ea079e9d4af806e87f0819184240 (patch) | |
tree | 9c0597038e0f4faf26583564978cdc00f21e5045 /cpukit/libcsupport | |
parent | updated (diff) | |
download | rtems-eaa442fc4640ea079e9d4af806e87f0819184240.tar.bz2 |
added a task begin extension for unix simulator configurations. This extension
insures that stdout is line buffered (see setvbuf).
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/src/newlibc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/newlibc.c b/cpukit/libcsupport/src/newlibc.c index db959d6156..735f104f44 100644 --- a/cpukit/libcsupport/src/newlibc.c +++ b/cpukit/libcsupport/src/newlibc.c @@ -46,6 +46,10 @@ #include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */ +#ifdef RTEMS_UNIX +#include <stdio.h> /* for setvbuf() */ +#endif + #include "internal.h" #define LIBC_NOTEPAD RTEMS_NOTEPAD_LAST @@ -110,6 +114,24 @@ libc_start_hook(rtems_tcb *current_task, MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr); } +/* + * Called for all user TASKS (system tasks are SYSI and IDLE) + * + * NOTE: When using RTEMS fake stat, fstat, and isatty, all output + * is line buffered so this setvbuf is not necessary. This + * setvbuf insures that we can redirect the output of a test + * on the UNIX simulator and it is in the same order as for a + * real target. + */ + +#ifdef RTEMS_UNIX +rtems_extension +libc_begin_hook(rtems_tcb *current_task) +{ + setvbuf( stdout, NULL, _IOLBF, BUFSIZ ); +} +#endif + rtems_extension libc_switch_hook(rtems_tcb *current_task, rtems_tcb *heir_task) @@ -244,6 +266,9 @@ libc_init(int reentrant) libc_extension.thread_create = libc_create_hook; libc_extension.thread_start = libc_start_hook; +#ifdef RTEMS_UNIX + libc_extension.thread_begin = libc_begin_hook; +#endif libc_extension.thread_switch = libc_switch_hook; libc_extension.thread_delete = libc_delete_hook; |