forked from Imagelibrary/rtems
Updates from Tony Bennett.
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
* @(#)libio.h 1.1 - 95/06/02
|
||||
*
|
||||
*
|
||||
* General purpose communication channel for RTEMS to allow UNIX/POSIX
|
||||
* system call behavior on top of RTEMS IO devices.
|
||||
*
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
* @(#)libio.c 1.1 - 95/06/02
|
||||
*
|
||||
*
|
||||
* Provide UNIX/POSIX-like io system calls for RTEMS using the
|
||||
* RTEMS IO manager
|
||||
*
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h> /* sbrk(2) */
|
||||
|
||||
rtems_id RTEMS_Malloc_Heap;
|
||||
size_t RTEMS_Malloc_Sbrk_amount;
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
#define MALLOC_STATS
|
||||
#define MALLOC_DIRTY
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
@@ -203,6 +205,10 @@ void *malloc(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_DIRTY
|
||||
(void) memset(return_this, 0xCF, size);
|
||||
#endif
|
||||
|
||||
return return_this;
|
||||
}
|
||||
|
||||
@@ -221,6 +227,8 @@ void *calloc(
|
||||
if ( cptr )
|
||||
memset( cptr, '\0', length );
|
||||
|
||||
MSBUMP(malloc_calls, -1); /* subtract off the malloc */
|
||||
|
||||
return cptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* @(#)newlibc.c 1.9 - 95/05/16
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
|
||||
/*
|
||||
* File: newlibc.c,v
|
||||
* Project: PixelFlow
|
||||
* Created: 94/12/7
|
||||
* Revision: 1.2
|
||||
* Last Mod: 1995/05/09 20:24:37
|
||||
*
|
||||
* COPYRIGHT (c) 1994 by Division Incorporated
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
@@ -47,8 +36,25 @@
|
||||
|
||||
#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */
|
||||
|
||||
#ifdef RTEMS_UNIX
|
||||
#include <stdio.h> /* for setvbuf() */
|
||||
/*
|
||||
* 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.
|
||||
* NOTE:
|
||||
* There is some problem with doing this on the hpux version
|
||||
* of the UNIX simulator (symptom is printf core dumps), so
|
||||
* we just don't for now.
|
||||
* Not sure if this is a problem with hpux, newlib, or something else.
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_UNIX) && !defined(hpux)
|
||||
#define NEED_SETVBUF
|
||||
#endif
|
||||
|
||||
#ifdef NEED_SETVBUF
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "internal.h"
|
||||
@@ -196,18 +202,19 @@ libc_delete_hook(rtems_tcb *current_task,
|
||||
|
||||
if (current_task == deleted_task)
|
||||
{
|
||||
ptr = _REENT;
|
||||
ptr = _REENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
|
||||
ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
|
||||
}
|
||||
|
||||
/* if (ptr) */
|
||||
if (ptr && ptr != &libc_global_reent)
|
||||
{
|
||||
_wrapup_reent(ptr);
|
||||
_reclaim_reent(ptr);
|
||||
_wrapup_reent(ptr);
|
||||
_reclaim_reent(ptr);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
MY_task_set_note(deleted_task, LIBC_NOTEPAD, 0);
|
||||
@@ -218,7 +225,7 @@ libc_delete_hook(rtems_tcb *current_task,
|
||||
|
||||
if (current_task == deleted_task)
|
||||
{
|
||||
_REENT = 0;
|
||||
_REENT = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
* @(#)libio.h 1.1 - 95/06/02
|
||||
*
|
||||
*
|
||||
* General purpose communication channel for RTEMS to allow UNIX/POSIX
|
||||
* system call behavior on top of RTEMS IO devices.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
/*
|
||||
* @(#)bspstart.c 1.7 - 95/04/07
|
||||
*
|
||||
*/
|
||||
|
||||
/* bsp_start()
|
||||
*
|
||||
* This routine starts the application. It includes application,
|
||||
@@ -55,7 +50,6 @@ rtems_unsigned32 bsp_isr_level;
|
||||
rtems_unsigned32 Heap_size;
|
||||
int rtems_argc;
|
||||
char **rtems_argv;
|
||||
char **rtems_envp;
|
||||
|
||||
/*
|
||||
* May be overridden by RTEMS_WORKSPACE_SIZE and RTEMS_HEAPSPACE_SIZE
|
||||
@@ -167,6 +161,13 @@ bsp_pretasking_hook(void)
|
||||
#ifdef RTEMS_DEBUG
|
||||
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dump malloc stats on exit...
|
||||
*/
|
||||
#if defined(RTEMS_DEBUG)
|
||||
atexit(malloc_dump);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -198,11 +199,6 @@ bsp_postdriver_hook(void)
|
||||
if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
|
||||
rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
|
||||
#endif
|
||||
|
||||
#if defined(MALLOC_STATS)
|
||||
atexit(malloc_dump);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
//
|
||||
// @(#)rtems-ctor.cc 1.6 - 95/04/25
|
||||
//
|
||||
|
||||
/*
|
||||
* rtems-ctor.cc
|
||||
*
|
||||
@@ -90,7 +86,6 @@ extern "C" {
|
||||
{
|
||||
rtems_argc = argc;
|
||||
rtems_argv = argv;
|
||||
rtems_envp = environp;
|
||||
|
||||
if ((argc > 0) && argv && argv[0])
|
||||
rtems_progname = argv[0];
|
||||
|
||||
@@ -31,7 +31,7 @@ set_vector( /* returns old vector */
|
||||
int type /* RTEMS or RAW intr */
|
||||
)
|
||||
{
|
||||
rtems_isr_entry rtems_isr_ptr;
|
||||
rtems_isr_entry rtems_isr_ptr = 0;
|
||||
proc_ptr raw_isr_ptr;
|
||||
|
||||
if ( type ) {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
* @(#)libio.c 1.1 - 95/06/02
|
||||
*
|
||||
*
|
||||
* Provide UNIX/POSIX-like io system calls for RTEMS using the
|
||||
* RTEMS IO manager
|
||||
*
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
* @(#)libio.h 1.1 - 95/06/02
|
||||
*
|
||||
*
|
||||
* General purpose communication channel for RTEMS to allow UNIX/POSIX
|
||||
* system call behavior on top of RTEMS IO devices.
|
||||
*
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h> /* sbrk(2) */
|
||||
|
||||
rtems_id RTEMS_Malloc_Heap;
|
||||
size_t RTEMS_Malloc_Sbrk_amount;
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
#define MALLOC_STATS
|
||||
#define MALLOC_DIRTY
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
@@ -203,6 +205,10 @@ void *malloc(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_DIRTY
|
||||
(void) memset(return_this, 0xCF, size);
|
||||
#endif
|
||||
|
||||
return return_this;
|
||||
}
|
||||
|
||||
@@ -221,6 +227,8 @@ void *calloc(
|
||||
if ( cptr )
|
||||
memset( cptr, '\0', length );
|
||||
|
||||
MSBUMP(malloc_calls, -1); /* subtract off the malloc */
|
||||
|
||||
return cptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* @(#)newlibc.c 1.9 - 95/05/16
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
|
||||
/*
|
||||
* File: newlibc.c,v
|
||||
* Project: PixelFlow
|
||||
* Created: 94/12/7
|
||||
* Revision: 1.2
|
||||
* Last Mod: 1995/05/09 20:24:37
|
||||
*
|
||||
* COPYRIGHT (c) 1994 by Division Incorporated
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
@@ -47,8 +36,25 @@
|
||||
|
||||
#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */
|
||||
|
||||
#ifdef RTEMS_UNIX
|
||||
#include <stdio.h> /* for setvbuf() */
|
||||
/*
|
||||
* 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.
|
||||
* NOTE:
|
||||
* There is some problem with doing this on the hpux version
|
||||
* of the UNIX simulator (symptom is printf core dumps), so
|
||||
* we just don't for now.
|
||||
* Not sure if this is a problem with hpux, newlib, or something else.
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_UNIX) && !defined(hpux)
|
||||
#define NEED_SETVBUF
|
||||
#endif
|
||||
|
||||
#ifdef NEED_SETVBUF
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "internal.h"
|
||||
@@ -196,18 +202,19 @@ libc_delete_hook(rtems_tcb *current_task,
|
||||
|
||||
if (current_task == deleted_task)
|
||||
{
|
||||
ptr = _REENT;
|
||||
ptr = _REENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
|
||||
ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
|
||||
}
|
||||
|
||||
/* if (ptr) */
|
||||
if (ptr && ptr != &libc_global_reent)
|
||||
{
|
||||
_wrapup_reent(ptr);
|
||||
_reclaim_reent(ptr);
|
||||
_wrapup_reent(ptr);
|
||||
_reclaim_reent(ptr);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
MY_task_set_note(deleted_task, LIBC_NOTEPAD, 0);
|
||||
@@ -218,7 +225,7 @@ libc_delete_hook(rtems_tcb *current_task,
|
||||
|
||||
if (current_task == deleted_task)
|
||||
{
|
||||
_REENT = 0;
|
||||
_REENT = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
* @(#)libio.h 1.1 - 95/06/02
|
||||
*
|
||||
*
|
||||
* General purpose communication channel for RTEMS to allow UNIX/POSIX
|
||||
* system call behavior on top of RTEMS IO devices.
|
||||
*
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
* @(#)libio.c 1.1 - 95/06/02
|
||||
*
|
||||
*
|
||||
* Provide UNIX/POSIX-like io system calls for RTEMS using the
|
||||
* RTEMS IO manager
|
||||
*
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h> /* sbrk(2) */
|
||||
|
||||
rtems_id RTEMS_Malloc_Heap;
|
||||
size_t RTEMS_Malloc_Sbrk_amount;
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
#define MALLOC_STATS
|
||||
#define MALLOC_DIRTY
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
@@ -203,6 +205,10 @@ void *malloc(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_DIRTY
|
||||
(void) memset(return_this, 0xCF, size);
|
||||
#endif
|
||||
|
||||
return return_this;
|
||||
}
|
||||
|
||||
@@ -221,6 +227,8 @@ void *calloc(
|
||||
if ( cptr )
|
||||
memset( cptr, '\0', length );
|
||||
|
||||
MSBUMP(malloc_calls, -1); /* subtract off the malloc */
|
||||
|
||||
return cptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* @(#)newlibc.c 1.9 - 95/05/16
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
|
||||
/*
|
||||
* File: newlibc.c,v
|
||||
* Project: PixelFlow
|
||||
* Created: 94/12/7
|
||||
* Revision: 1.2
|
||||
* Last Mod: 1995/05/09 20:24:37
|
||||
*
|
||||
* COPYRIGHT (c) 1994 by Division Incorporated
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
@@ -47,8 +36,25 @@
|
||||
|
||||
#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */
|
||||
|
||||
#ifdef RTEMS_UNIX
|
||||
#include <stdio.h> /* for setvbuf() */
|
||||
/*
|
||||
* 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.
|
||||
* NOTE:
|
||||
* There is some problem with doing this on the hpux version
|
||||
* of the UNIX simulator (symptom is printf core dumps), so
|
||||
* we just don't for now.
|
||||
* Not sure if this is a problem with hpux, newlib, or something else.
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_UNIX) && !defined(hpux)
|
||||
#define NEED_SETVBUF
|
||||
#endif
|
||||
|
||||
#ifdef NEED_SETVBUF
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "internal.h"
|
||||
@@ -196,18 +202,19 @@ libc_delete_hook(rtems_tcb *current_task,
|
||||
|
||||
if (current_task == deleted_task)
|
||||
{
|
||||
ptr = _REENT;
|
||||
ptr = _REENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
|
||||
ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
|
||||
}
|
||||
|
||||
/* if (ptr) */
|
||||
if (ptr && ptr != &libc_global_reent)
|
||||
{
|
||||
_wrapup_reent(ptr);
|
||||
_reclaim_reent(ptr);
|
||||
_wrapup_reent(ptr);
|
||||
_reclaim_reent(ptr);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
MY_task_set_note(deleted_task, LIBC_NOTEPAD, 0);
|
||||
@@ -218,7 +225,7 @@ libc_delete_hook(rtems_tcb *current_task,
|
||||
|
||||
if (current_task == deleted_task)
|
||||
{
|
||||
_REENT = 0;
|
||||
_REENT = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user