summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c/src/exec/libcsupport/src/newlibc.c12
-rw-r--r--c/src/lib/libc/newlibc.c12
-rw-r--r--c/src/lib/libc/tcattr.c6
-rw-r--r--cpukit/libcsupport/src/newlibc.c12
4 files changed, 42 insertions, 0 deletions
diff --git a/c/src/exec/libcsupport/src/newlibc.c b/c/src/exec/libcsupport/src/newlibc.c
index 8fb1916d7e..089c7e7541 100644
--- a/c/src/exec/libcsupport/src/newlibc.c
+++ b/c/src/exec/libcsupport/src/newlibc.c
@@ -64,6 +64,8 @@ struct _reent libc_global_reent = _REENT_INIT(libc_global_reent);
extern void _wrapup_reent(struct _reent *);
extern void _reclaim_reent(struct _reent *);
+#include <stdio.h>
+
void
libc_wrapup(void)
{
@@ -86,6 +88,16 @@ libc_wrapup(void)
#endif
_REENT = &libc_global_reent;
}
+
+ /*
+ * Try to drain output buffers.
+ *
+ * Should this be changed to do *all* file streams?
+ * _fwalk (_REENT, fclose);
+ */
+ fclose (stdin);
+ fclose (stdout);
+ fclose (stderr);
}
diff --git a/c/src/lib/libc/newlibc.c b/c/src/lib/libc/newlibc.c
index 8fb1916d7e..089c7e7541 100644
--- a/c/src/lib/libc/newlibc.c
+++ b/c/src/lib/libc/newlibc.c
@@ -64,6 +64,8 @@ struct _reent libc_global_reent = _REENT_INIT(libc_global_reent);
extern void _wrapup_reent(struct _reent *);
extern void _reclaim_reent(struct _reent *);
+#include <stdio.h>
+
void
libc_wrapup(void)
{
@@ -86,6 +88,16 @@ libc_wrapup(void)
#endif
_REENT = &libc_global_reent;
}
+
+ /*
+ * Try to drain output buffers.
+ *
+ * Should this be changed to do *all* file streams?
+ * _fwalk (_REENT, fclose);
+ */
+ fclose (stdin);
+ fclose (stdout);
+ fclose (stderr);
}
diff --git a/c/src/lib/libc/tcattr.c b/c/src/lib/libc/tcattr.c
index aaa5ff6e6e..86c2569a94 100644
--- a/c/src/lib/libc/tcattr.c
+++ b/c/src/lib/libc/tcattr.c
@@ -37,4 +37,10 @@ tcsetattr(int fd, int opt, struct termios *tp)
return __rtems_ioctl(fd,RTEMS_IO_SET_ATTRIBUTES,tp);
}
+int
+tcdrain(int fd)
+{
+ return __rtems_ioctl(fd,RTEMS_IO_TCDRAIN,0);
+}
+
#endif
diff --git a/cpukit/libcsupport/src/newlibc.c b/cpukit/libcsupport/src/newlibc.c
index 8fb1916d7e..089c7e7541 100644
--- a/cpukit/libcsupport/src/newlibc.c
+++ b/cpukit/libcsupport/src/newlibc.c
@@ -64,6 +64,8 @@ struct _reent libc_global_reent = _REENT_INIT(libc_global_reent);
extern void _wrapup_reent(struct _reent *);
extern void _reclaim_reent(struct _reent *);
+#include <stdio.h>
+
void
libc_wrapup(void)
{
@@ -86,6 +88,16 @@ libc_wrapup(void)
#endif
_REENT = &libc_global_reent;
}
+
+ /*
+ * Try to drain output buffers.
+ *
+ * Should this be changed to do *all* file streams?
+ * _fwalk (_REENT, fclose);
+ */
+ fclose (stdin);
+ fclose (stdout);
+ fclose (stderr);
}