示例#1
0
文件: newlibc.c 项目: comex/libogc
void __libc_init(int reentrant)
{
	libc_globl_reent = (struct _reent)_REENT_INIT((libc_globl_reent));
	_REENT = &libc_globl_reent;

	if(reentrant) {
		__lwp_thread_setlibcreent((void*)&_REENT);
		libc_reentrant = reentrant;
	}
}
示例#2
0
 * impure data (_exception_impure_data) are initialized. Afterwards,
 * the current value _current_impure_ptr is set to _impure_ptr.
 *
 * At runtime __getreent is called to return the current reentrancy pointer,
 * which is stored in _current_impure_ptr.
 *
 * In the or1k_exception_handler the _current_impure_ptr is set to point to
 * _exception_impure_ptr. After the exception handler returned, it is set back
 * to _impure_ptr.
 */

/* Link in the external impure_data structure */
extern struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr;

/* Create exception impure data structure */
static struct _reent _exception_impure_data = _REENT_INIT (_exception_impure_data);

/* Link to the exception impure data structure */
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _exception_impure_ptr = &_exception_impure_data;

/* Link to the currently used data structure. */
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _current_impure_ptr;

void
__impure_init (void)
{
    // Initialize both impure data structures
    _REENT_INIT_PTR (_impure_ptr);
    _REENT_INIT_PTR (_exception_impure_ptr);

    // Set current to standard impure pointer
示例#3
0
#include <reent.h>

/* Note that there is a copy of this in sys/reent.h.  */
#ifndef __ATTRIBUTE_IMPURE_PTR__
#define __ATTRIBUTE_IMPURE_PTR__
#endif

#ifndef __ATTRIBUTE_IMPURE_DATA__
#define __ATTRIBUTE_IMPURE_DATA__
#endif

/* Redeclare these symbols locally as weak so that the file containing
   their definitions (along with a lot of other stuff) isn't sucked in
   unless they are actually used by other compilation units.  This is
   important to reduce image size for targets with very small amounts
   of memory.  */
#ifdef _REENT_SMALL
extern const struct __sFILE __sf_fake_stdin _ATTRIBUTE ((weak));
extern const struct __sFILE __sf_fake_stdout _ATTRIBUTE ((weak));
extern const struct __sFILE __sf_fake_stderr _ATTRIBUTE ((weak));
#endif

static struct _reent __ATTRIBUTE_IMPURE_DATA__ impure_data = _REENT_INIT (impure_data);
#ifdef __CYGWIN__
extern struct _reent reent_data __attribute__ ((alias("impure_data")));
#endif
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &impure_data;
struct _reent *_CONST __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &impure_data;
示例#4
0
 &__pthread_handles[0].h_lock, /* struct _pthread_fastlock * p_lock */
 0,                          /* int p_signal */
 NULL,                       /* sigjmp_buf * p_signal_buf */
 NULL,                       /* sigjmp_buf * p_cancel_buf */
 0,                          /* char p_terminated */
 0,                          /* char p_detached */
 0,                          /* char p_exited */
 NULL,                       /* void * p_retval */
 0,                          /* int p_retval */
 NULL,                       /* pthread_descr p_joining */
 NULL,                       /* struct _pthread_cleanup_buffer * p_cleanup */
 0,                          /* char p_cancelstate */
 0,                          /* char p_canceltype */
 0,                          /* char p_canceled */
 &__pthread_initial_thread.p_reent, /* struct _reent *p_reentp */
 _REENT_INIT(__pthread_initial_thread.p_reent),  /* struct _reent p_reent */
 NULL,                       /* int *p_h_errnop */
 0,                          /* int p_h_errno */
 NULL,                       /* char * p_in_sighandler */
 0,                          /* char p_sigwaiting */
 PTHREAD_START_ARGS_INITIALIZER(NULL),
                             /* struct pthread_start_args p_start_args */
 {NULL},                     /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */
 {NULL},                     /* void * p_libc_specific[_LIBC_TSD_KEY_N] */
 1,                          /* int p_userstack */
 NULL,                       /* void * p_guardaddr */
 0,                          /* size_t p_guardsize */
 0,                          /* Always index 0 */
 0,                          /* int p_report_events */
 {{{0, }}, 0, NULL},         /* td_eventbuf_t p_eventbuf */
 __ATOMIC_INITIALIZER,       /* struct pthread_atomic p_resume_count */