summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-03-31 08:21:58 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-04-01 08:04:19 +0200
commita340ca191a8fc33485afda123a9fba52f1f529ae (patch)
tree04496da8708025e37217e1d56f80dbb92fbd2ec0 /cpukit/libcsupport/src
parentnewlib01: Added tests for exit procedures (diff)
downloadrtems-a340ca191a8fc33485afda123a9fba52f1f529ae.tar.bz2
libcsupport: Use _fwalk_reent()
Use _fwalk_reent() instead of _fwalk(), since _fwalk() was removed from Newlib. Include <sys/reent.h> and remove local declarations.
Diffstat (limited to 'cpukit/libcsupport/src')
-rw-r--r--cpukit/libcsupport/src/sync.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/cpukit/libcsupport/src/sync.c b/cpukit/libcsupport/src/sync.c
index 265c6f07c9..b9d1dcdcc5 100644
--- a/cpukit/libcsupport/src/sync.c
+++ b/cpukit/libcsupport/src/sync.c
@@ -18,13 +18,7 @@
#include "config.h"
#endif
-/* Since we compile with strict ANSI we need to undef it to get
- * prototypes for extensions
- */
-#undef __STRICT_ANSI__
-int fdatasync(int); /* still not always prototyped */
-
-
+#include <sys/reent.h>
#include <unistd.h>
#include <stdio.h>
@@ -32,19 +26,22 @@ int fdatasync(int); /* still not always prototyped */
#include <rtems/score/thread.h>
#include <rtems/score/percpu.h>
-/* XXX check standards -- Linux version appears to be void */
-void _fwalk(struct _reent *, void *);
+/* In Newlib this function is declared in a private header file */
+int _fwalk_reent (struct _reent *, int (*)(struct _reent *, FILE *));
-
-static void sync_wrapper(FILE *f)
+static int sync_wrapper(struct _reent *reent, FILE *f)
{
int fn = fileno(f);
+ (void) reent;
+
/*
* There is no way to report errors here. So this is a best-effort approach.
*/
(void) fsync(fn);
(void) fdatasync(fn);
+
+ return 0;
}
/* iterate over all FILE *'s for this thread */
@@ -62,19 +59,13 @@ static bool sync_per_thread(Thread_Control *t, void *arg)
Thread_Control *executing = _Thread_Get_executing();
current_reent = executing->libc_reent;
executing->libc_reent = this_reent;
- _fwalk (t->libc_reent, sync_wrapper);
+ _fwalk_reent (this_reent, sync_wrapper);
executing->libc_reent = current_reent;
}
return false;
}
-/*
- * _global_impure_ptr is not prototyped in any .h files.
- * We have to extern it here.
- */
-extern struct _reent * const _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
-
/**
* This function operates by as follows:
* for all threads
@@ -88,7 +79,7 @@ void sync(void)
/*
* Walk the one used initially by RTEMS.
*/
- _fwalk(_global_impure_ptr, sync_wrapper);
+ _fwalk_reent(_GLOBAL_REENT, sync_wrapper);
/*
* XXX Do we walk the one used globally by newlib?