summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include/sys/reent.h
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2004-09-09 19:46:54 +0000
committerJeff Johnston <jjohnstn@redhat.com>2004-09-09 19:46:54 +0000
commit0c8593cf11a16ca75c72977a6f5e3983896940c4 (patch)
tree8133764892ae91831d48980ef216fc4935e45b5f /newlib/libc/include/sys/reent.h
parent582dde69f31fb0dbe4beca5461b2b08924ae4e20 (diff)
downloadcygnal-0c8593cf11a16ca75c72977a6f5e3983896940c4.tar.gz
cygnal-0c8593cf11a16ca75c72977a6f5e3983896940c4.tar.bz2
cygnal-0c8593cf11a16ca75c72977a6f5e3983896940c4.zip
2004-09-09 Paul Brook <paul@codesourcery.com>
* libc/include/sys/reent.h (struct _on_exit_args): Add _dso_handle and _is_cxa. (struct _atexit): Add _next when _REENT_SMALL. (struct _reent): Add _atexit0 when _REENT_SMALL. (_REENT_INIT_PTR): Adjust. * libc/stdlib/Makefile.am (GENERAL_SOURCES): Add __atexit.c and __call_exit.c. (EXTENDED_SOURCES): Add cxa_atexit.c and cxa_finalize.c. * libc/stdlib/Makefile.in: Regenerate. * libc/stdlib/__atexit.c: New file. * libc/stdlib/__call_atexit.c: New file. * libc/stdlib/atexit.h: Remove old definitions. Add new. * libc/stdlib/atexit.c (atexit): Use __register_exitproc. * libc/stdlib/cxa_atexit.c: New file. * libc/stdlib/cxa_finalize.c: New file. * libc/stdlib/exit.c (exit): Use __call_exitprocs. * libc/stdlib/on_exit.c (on_exit): Use __register_exitproc. 2004-09-09 Jeff Johnston <jjohnstn@redhat.com> * libc/reent/reent.c [_REENT_SMALL]: Fix reference to _on_exit_args_ptr.
Diffstat (limited to 'newlib/libc/include/sys/reent.h')
-rw-r--r--newlib/libc/include/sys/reent.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index a216c2434..54f5d8efe 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -59,19 +59,24 @@ struct __tm
};
/*
- * atexit() support. For _REENT_SMALL, we limit to 32 max.
+ * atexit() support.
*/
#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
struct _on_exit_args {
- void * _fnargs[_ATEXIT_SIZE]; /* fn args for on_exit */
+ void * _fnargs[_ATEXIT_SIZE]; /* user fn args */
+ void * _dso_handle[_ATEXIT_SIZE];
+ /* Bitmask is set if user function takes arguments. */
__ULong _fntypes; /* type of exit routine -
- Must have at least _ATEXIT_SIZE bits */
+ Must have at least _ATEXIT_SIZE bits */
+ /* Bitmask is set if function was registered via __cxa_atexit. */
+ __ULong _is_cxa;
};
#ifdef _REENT_SMALL
struct _atexit {
+ struct _atexit *_next; /* next in list */
int _ind; /* next index in this table */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args * _on_exit_args_ptr;
@@ -80,6 +85,7 @@ struct _atexit {
struct _atexit {
struct _atexit *_next; /* next in list */
int _ind; /* next index in this table */
+ /* Some entries may already have been called, and will be NULL. */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args _on_exit_args;
};
@@ -371,7 +377,8 @@ struct _reent
void (**(_sig_func))(int);
/* atexit stuff */
- struct _atexit _atexit;
+ struct _atexit *_atexit;
+ struct _atexit _atexit0;
struct _glue __sglue; /* root of glue chain */
__FILE *__sf; /* file descriptors */
@@ -399,7 +406,8 @@ struct _reent
_NULL, \
_NULL, \
_NULL, \
- {0, {_NULL}, _NULL}, \
+ _NULL, \
+ {_NULL, 0, {_NULL}, _NULL}, \
{_NULL, 0, _NULL}, \
_NULL, \
{_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL}, \
@@ -426,9 +434,11 @@ struct _reent
var->_localtime_buf = _NULL; \
var->_asctime_buf = _NULL; \
var->_sig_func = _NULL; \
- var->_atexit._ind = 0; \
- var->_atexit._fns[0] = _NULL; \
- var->_atexit._on_exit_args = _NULL; \
+ var->_atexit = _NULL; \
+ var->_atexit0._next = _NULL; \
+ var->_atexit0._ind = 0; \
+ var->_atexit0._fns[0] = _NULL; \
+ var->_atexit0._on_exit_args_ptr = _NULL; \
var->__sglue._next = _NULL; \
var->__sglue._niobs = 0; \
var->__sglue._iobs = _NULL; \
@@ -673,7 +683,7 @@ struct _reent
} \
}, \
_NULL, \
- {_NULL, 0, {_NULL}, {{_NULL}, 0}}, \
+ {_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}, \
_NULL, \
{_NULL, 0, _NULL} \
}