Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-05-16 02:58:10 +0400
committerJeff Johnston <jjohnstn@redhat.com>2002-05-16 02:58:10 +0400
commitdc824ef7363e46b3602b458f7bf00303601c1102 (patch)
treee323a2db83cf227cf6ddd465d8657d9339d15369 /newlib/libc/include/sys/reent.h
parente355de817c95c1b5b3fa98c0e5e2863a1ecb7679 (diff)
2002-05-15 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/stdlib.h: Add on_exit prototype. * libc/include/sys/reent.h (struct _atexit): Add argument array and bits to track type of exit routine to support both on_exit and atexit. (_REENT_INIT_PTR): Add missing fields that won't be zeroed out by default and change the setting of the atexit structure. (_REENT_INIT)[!_REENT_SMALL]: Remove extraneous end brace. * libc/stdlib/on_exit.c: New file. * libc/stdlib/Makefile.am: Add support for on_exit. * libc/stdlib/Makefile.in: Regenerated. * libc/stdlib/atexit.c: Change to initialize types field. * libc/stdlib/exit.c: Change to look at types field for each exit routine and either call an atexit-style or an on_exit-style routine accordingly.
Diffstat (limited to 'newlib/libc/include/sys/reent.h')
-rw-r--r--newlib/libc/include/sys/reent.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 7a5305328..5303ed3dd 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -72,11 +72,15 @@ struct _atexit {
struct _atexit *_next; /* next in list */
int _ind; /* next index in this table */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
+ void *_fnargs[_ATEXIT_SIZE]; /* fn args for on_exit */
+ __uint32_t _fntypes; /* type of exit routine */
};
#else
struct _atexit {
int _ind; /* next index in this table */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
+ void *_fnargs[_ATEXIT_SIZE]; /* fn args for on_exit */
+ __uint32_t _fntypes; /* type of exit routine */
};
#endif
@@ -304,14 +308,15 @@ struct _reent
};
#define _REENT_INIT(var) \
- { &var.__sf_fake, &var.__sf_fake, &var.__sf_fake, 0, 0, _NULL, 0, 0, \
+ { (struct __sFILE *)&var.__sf_fake, (struct __sFILE *)&var.__sf_fake, \
+ (struct __sFILE *)&var.__sf_fake, 0, 0, _NULL, 0, 0, \
"C", _NULL, _NULL, 0, 0, _NULL, _NULL, _NULL, _NULL, _NULL, \
- { 0, _NULL }, { _NULL, 0, _NULL }, 0, _NULL }
+ { 0, _NULL, _NULL, 0 }, { _NULL, 0, _NULL }, _NULL, 0, _NULL }
#define _REENT_INIT_PTR(var) \
- { var->_stdin = &var->__sf_fake; \
- var->_stdout = &var->__sf_fake; \
- var->_stderr = &var->__sf_fake; \
+ { var->_stdin = (struct __sFILE *)&var->__sf_fake; \
+ var->_stdout = (struct __sFILE *)&var->__sf_fake; \
+ var->_stderr = (struct __sFILE *)&var->__sf_fake; \
var->_errno = 0; \
var->_inc = 0; \
var->_emergency = _NULL; \
@@ -328,12 +333,21 @@ struct _reent
var->_asctime_buf = _NULL; \
var->_sig_func = _NULL; \
var->_atexit._ind = 0; \
- var->_atexit._fns = _NULL}; \
+ var->_atexit._fns[0] = _NULL; \
+ var->_atexit._fnargs[0] = _NULL; \
+ var->_atexit._fntypes = 0; \
var->__sglue._next = _NULL; \
var->__sglue._niobs = 0; \
var->__sglue._iobs = _NULL; \
var->__sf = 0; \
var->_misc = _NULL; \
+ var->__sf_fake._p = _NULL; \
+ var->__sf_fake._r = 0; \
+ var->__sf_fake._w = 0; \
+ var->__sf_fake._flags = 0; \
+ var->__sf_fake._file = 0; \
+ var->__sf_fake._lbfsize = 0; \
+ var->__sf_fake._data = _NULL; \
}
/* signal info */
@@ -537,6 +551,15 @@ struct _reent
var->_new._reent._mbtowc_state = 0; \
var->_new._reent._wctomb_state = 0; \
var->_new._reent._l64a_buf[0] = '\0'; \
+ var->_atexit = _NULL; \
+ var->_atexit0._ind = 0; \
+ var->_atexit0._fns[0] = _NULL; \
+ var->_atexit0._fntypes = 0; \
+ var->_sig_func = _NULL; \
+ var->__sglue._next = _NULL; \
+ var->__sglue._niobs = 0; \
+ var->__sglue._iobs = _NULL; \
+ memset(var->__sf,0,sizeof(var->__sf)); \
}
#define _REENT_CHECK_RAND48(ptr) /* nothing */