forked from Imagelibrary/rtems
2004-03-05 Joel Sherrill <joel@OARcorp.com>
* libcsupport/src/newlibc.c, libcsupport/src/sync.c: Eliminate warnings. Explicitly defeat __STRICT_ANSI__ since both legitimately use routines beyond ANSI.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2004-03-05 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
|
* libcsupport/src/newlibc.c, libcsupport/src/sync.c: Eliminate
|
||||||
|
warnings. Explicitly defeat __STRICT_ANSI__ since both
|
||||||
|
legitimately use routines beyond ANSI.
|
||||||
|
|
||||||
2004-03-05 Joel Sherrill <joel@OARcorp.com>
|
2004-03-05 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* cpukit/libblock/src/bdbuf.c: Initialize pointer to avoid warning.
|
* cpukit/libblock/src/bdbuf.c: Initialize pointer to avoid warning.
|
||||||
|
|||||||
@@ -22,6 +22,12 @@
|
|||||||
|
|
||||||
#if defined(RTEMS_NEWLIB)
|
#if defined(RTEMS_NEWLIB)
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
|
|
||||||
|
/* Since we compile with strict ANSI we need to undef it to get
|
||||||
|
* prototypes for extensions
|
||||||
|
*/
|
||||||
|
#undef __STRICT_ANSI__
|
||||||
|
|
||||||
#include <stdlib.h> /* for free() */
|
#include <stdlib.h> /* for free() */
|
||||||
#include <string.h> /* for memset() */
|
#include <string.h> /* for memset() */
|
||||||
|
|
||||||
@@ -126,26 +132,26 @@ rtems_boolean libc_create_hook(
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
/* GCC extension: structure constants */
|
/* GCC extension: structure constants */
|
||||||
_REENT_INIT_PTR((ptr));
|
_REENT_INIT_PTR((ptr));
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
* WARNING: THIS IS VERY DEPENDENT ON NEWLIB!!!
|
* WARNING: THIS IS VERY DEPENDENT ON NEWLIB!!!
|
||||||
* Last visual check was against newlib 1.8.2 but last known
|
* Last visual check was against newlib 1.8.2 but last known
|
||||||
* use was against 1.7.0. This is basically an exansion of
|
* use was against 1.7.0. This is basically an exansion of
|
||||||
* REENT_INIT() in <sys/reent.h>.
|
* REENT_INIT() in <sys/reent.h>.
|
||||||
*/
|
*/
|
||||||
memset(ptr, 0, sizeof(*ptr));
|
memset(ptr, 0, sizeof(*ptr));
|
||||||
ptr->_stdin = &ptr->__sf[0];
|
ptr->_stdin = &ptr->__sf[0];
|
||||||
ptr->_stdout = &ptr->__sf[1];
|
ptr->_stdout = &ptr->__sf[1];
|
||||||
ptr->_stderr = &ptr->__sf[2];
|
ptr->_stderr = &ptr->__sf[2];
|
||||||
ptr->_current_locale = "C";
|
ptr->_current_locale = "C";
|
||||||
ptr->_new._reent._rand_next = 1;
|
ptr->_new._reent._rand_next = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
creating_task->libc_reent = ptr;
|
creating_task->libc_reent = ptr;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -235,7 +241,6 @@ rtems_extension libc_delete_hook(
|
|||||||
ptr = deleted_task->libc_reent;
|
ptr = deleted_task->libc_reent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (ptr) */
|
|
||||||
if (ptr && ptr != &libc_global_reent) {
|
if (ptr && ptr != &libc_global_reent) {
|
||||||
/*
|
/*
|
||||||
_wrapup_reent(ptr);
|
_wrapup_reent(ptr);
|
||||||
@@ -248,7 +253,7 @@ rtems_extension libc_delete_hook(
|
|||||||
#if REENT_MALLOCED
|
#if REENT_MALLOCED
|
||||||
free(ptr);
|
free(ptr);
|
||||||
#else
|
#else
|
||||||
_Workspace_Free(ptr);
|
_Workspace_Free(ptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,13 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#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 <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -35,6 +42,7 @@
|
|||||||
/* XXX check standards -- Linux version appears to be void */
|
/* XXX check standards -- Linux version appears to be void */
|
||||||
void _fwalk(struct _reent *, void *);
|
void _fwalk(struct _reent *, void *);
|
||||||
|
|
||||||
|
|
||||||
static void sync_wrapper(FILE *f)
|
static void sync_wrapper(FILE *f)
|
||||||
{
|
{
|
||||||
int fn = fileno(f);
|
int fn = fileno(f);
|
||||||
@@ -60,6 +68,22 @@ static void sync_per_thread(Thread_Control *t)
|
|||||||
|
|
||||||
int sync(void)
|
int sync(void)
|
||||||
{
|
{
|
||||||
|
extern struct _reent libc_global_reent;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Walk the one used initially by RTEMS.
|
||||||
|
*/
|
||||||
|
_fwalk(&libc_global_reent, sync_wrapper);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX Do we walk the one used globally by newlib?
|
||||||
|
* XXX Do we need the RTEMS global one?
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now walk all the per-thread reentrancy structures.
|
||||||
|
*/
|
||||||
rtems_iterate_over_all_threads(sync_per_thread);
|
rtems_iterate_over_all_threads(sync_per_thread);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user