Changeset 5e9a594 in rtems


Ignore:
Timestamp:
09/18/96 20:53:35 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
0c35efe
Parents:
1f2d5df
Message:

modified to support non-GNU compilers and to use calloc rather than
malloc for per-thread reentrancy structure allocation.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/src/newlibc.c

    r1f2d5df r5e9a594  
    6565
    6666int              libc_reentrant;        /* do we think we are reentrant? */
    67 struct _reent    libc_global_reent = _REENT_INIT(libc_global_reent);;
     67struct _reent    libc_global_reent = _REENT_INIT(libc_global_reent);
    6868
    6969/*
     
    115115     */
    116116
    117     ptr = (struct _reent *) malloc(sizeof(struct _reent));
    118 
     117    ptr = (struct _reent *) calloc(1, sizeof(struct _reent));
     118
     119    if (!ptr)
     120       rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
     121 
     122#ifdef __GNUC__
    119123    /* GCC extension: structure constants */
    120124    *ptr = (struct _reent) _REENT_INIT((*ptr));
     125#else
     126    /*
     127     *  Warning: THIS IS VERY DEPENDENT ON NEWLIB!!! WRITTEN FOR 1.7.0
     128     */
     129    ptr->_errno=0;
     130    ptr->_stdin=&ptr->__sf[0];
     131    ptr->_stdout=&ptr->__sf[1];
     132    ptr->_stderr=&ptr->__sf[2];
     133    ptr->_scanpoint=0;
     134    ptr->_asctime[0]=0;
     135    ptr->_next=1;
     136    ptr->__sdidinit=0;
     137#endif
    121138
    122139    MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr);
     
    330347 */
    331348
    332 #if !defined(RTEMS_UNIX) && !defined(__GO32__)
     349#if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K)
    333350void _exit(int status)
    334351{
  • c/src/lib/libc/newlibc.c

    r1f2d5df r5e9a594  
    6565
    6666int              libc_reentrant;        /* do we think we are reentrant? */
    67 struct _reent    libc_global_reent = _REENT_INIT(libc_global_reent);;
     67struct _reent    libc_global_reent = _REENT_INIT(libc_global_reent);
    6868
    6969/*
     
    115115     */
    116116
    117     ptr = (struct _reent *) malloc(sizeof(struct _reent));
    118 
     117    ptr = (struct _reent *) calloc(1, sizeof(struct _reent));
     118
     119    if (!ptr)
     120       rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
     121 
     122#ifdef __GNUC__
    119123    /* GCC extension: structure constants */
    120124    *ptr = (struct _reent) _REENT_INIT((*ptr));
     125#else
     126    /*
     127     *  Warning: THIS IS VERY DEPENDENT ON NEWLIB!!! WRITTEN FOR 1.7.0
     128     */
     129    ptr->_errno=0;
     130    ptr->_stdin=&ptr->__sf[0];
     131    ptr->_stdout=&ptr->__sf[1];
     132    ptr->_stderr=&ptr->__sf[2];
     133    ptr->_scanpoint=0;
     134    ptr->_asctime[0]=0;
     135    ptr->_next=1;
     136    ptr->__sdidinit=0;
     137#endif
    121138
    122139    MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr);
     
    330347 */
    331348
    332 #if !defined(RTEMS_UNIX) && !defined(__GO32__)
     349#if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K)
    333350void _exit(int status)
    334351{
  • cpukit/libcsupport/src/newlibc.c

    r1f2d5df r5e9a594  
    6565
    6666int              libc_reentrant;        /* do we think we are reentrant? */
    67 struct _reent    libc_global_reent = _REENT_INIT(libc_global_reent);;
     67struct _reent    libc_global_reent = _REENT_INIT(libc_global_reent);
    6868
    6969/*
     
    115115     */
    116116
    117     ptr = (struct _reent *) malloc(sizeof(struct _reent));
    118 
     117    ptr = (struct _reent *) calloc(1, sizeof(struct _reent));
     118
     119    if (!ptr)
     120       rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
     121 
     122#ifdef __GNUC__
    119123    /* GCC extension: structure constants */
    120124    *ptr = (struct _reent) _REENT_INIT((*ptr));
     125#else
     126    /*
     127     *  Warning: THIS IS VERY DEPENDENT ON NEWLIB!!! WRITTEN FOR 1.7.0
     128     */
     129    ptr->_errno=0;
     130    ptr->_stdin=&ptr->__sf[0];
     131    ptr->_stdout=&ptr->__sf[1];
     132    ptr->_stderr=&ptr->__sf[2];
     133    ptr->_scanpoint=0;
     134    ptr->_asctime[0]=0;
     135    ptr->_next=1;
     136    ptr->__sdidinit=0;
     137#endif
    121138
    122139    MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr);
     
    330347 */
    331348
    332 #if !defined(RTEMS_UNIX) && !defined(__GO32__)
     349#if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K)
    333350void _exit(int status)
    334351{
Note: See TracChangeset for help on using the changeset viewer.